← CookbookView source on GitHub ↗

Competitive Intelligence Agent

A LangChain Deep Agent that produces decision-grade competitive briefs, powered by an LLM served by Nebius Token Factory, and real-time web research via Tavily.

You give it a single company name. It picks the top competitors itself, researches each across pricing, recent activity, and sentiment, and synthesizes a strategic brief.

Why deep agents

A regular tool-calling agent gets shallow on a task like this — it does one search, hallucinates the rest. Deep Agents add three primitives that make multi-step research actually work:

All sub-agents share two tools: tavily_search (LLM-optimized web search) and tavily_extract (clean-markdown page fetch). Everything else — planning, files, delegation — is provided by Deep Agents out of the box.

Setup

This project uses uv.

cd agents/langchain/competitive-intelligence-agent
uv sync
cp env.example .env

Then edit .env:

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

# https://tavily.com/
TAVILY_API_KEY=your-tavily-api-key

Run

CLI

uv run cli.py "Netflix"

Streamlit (web UI)

uv run streamlit run streamlit_app.py

Opens a browser with a branded activity feed: enter a company in the sidebar, click Generate Brief, and watch the agent plan, dispatch sub-agents, and stream results live. The final brief renders as markdown with a download button.

That's it. The agent will:

  1. Identify Netflix's top direct competitors.
  2. Lay out a TODO plan covering all dimensions.
  3. Dispatch sub-agents in parallel for each company.
  4. Synthesize the results into brief.md and save it to disk (./brief-netflix.md by default).

You'll see every step rendered live in the terminal: plan updates, tool calls, sub-agent dispatches, and the final brief.

Options

uv run cli.py "Linear" \
  --model "moonshotai/Kimi-K2.5" \
  --output ./linear-brief.md
Flag Default Notes
--model, -m moonshotai/Kimi-K2.5 Any tool-calling capable Nebius TF model.
--output, -o ./brief-<company>.md Where to save the final markdown brief.
--recursion-limit 150 Bump if the agent runs out of LangGraph steps.

What the output looks like

The brief is structured for action, not entertainment:

Files

agent.py         # Lead agent + 3 sub-agent specs + the brief-schema prompt
cli.py           # Typer entry point + Rich live renderer + output handling
streamlit_app.py # Streamlit web UI with live activity feed + brief viewer

Two files. The Deep Agents SDK does the heavy lifting — we just compose model, two tools, three sub-agent prompts, and a brief structure.

References