← CookbookView source on GitHub ↗

LangChain deepagents + Nebius Token Factory

Two starter examples of a LangChain Deep Agent powered by an LLM served by Nebius Token Factory.

Deep agents extend a regular tool-calling agent with:

The two agents

File Description Tools
research_agent_1.py Bare deep agent — planning, virtual FS, and a default general-purpose sub-agent. No external tools. none
tavily_agent.py Same deep-agent loop, but with real web search via Tavily. tavily_search, think_tool

Both use the moonshotai/Kimi-K2.5 model on Nebius; swap it for any tool-calling capable Nebius model in the source.

Setup

This project uses uv for dependency management.

cd agents/langchain/deep-agent-example-1
uv sync

Create a .env file from the template and fill in your API keys:

cp env.example .env

Edit .env:

# https://tokenfactory.nebius.com/
NEBIUS_API_KEY=your-nebius-api-key

# https://tavily.com/  (only needed for tavily_agent.py)
TAVILY_API_KEY=your-tavily-api-key   

Run

Bare deep agent (no external tools):

uv run python research_agent_1.py

Deep agent with Tavily web search:

(Make sure you have TAVILY_API_KEY defined in .env)

uv run python tavily_agent.py

Each script prints the full message trace (including planning steps, sub-agent calls, and the final report) as JSON.

Files

References