← 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 scripts use tool-calling capable Nebius models via langchain-nebius and are currently configured with MiniMaxAI/MiniMax-M3. Swap either 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

Run Agent

Bare deep agent (no external tools):

uv run python research_agent_1.py

The report is written to output.md, and a short summary is printed to stdout. You can view a sample output here.

Add Tavily API key to .env file

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

Deep agent with Tavily web search:

uv run python tavily_agent.py

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

Files

References