Skip to content

Card 1: Research desk

One lead agent. Its tools are a pipeline of agents and the agents themselves.

You ask a question. The lead (Claude Code, Opus) runs a deterministic research pipeline: two researchers search the web in parallel, one for and one against, then a reviewer audits them and a writer, a token-based API model, produces a cited brief. If a gap still matters, the lead calls a specialist directly to dig deeper.

Research desk A question enters research_desk, a Claude Code Opus lead agent, and a cited answer comes out. Its tools are research_brief, deep_research and fact_check. research_brief is a deterministic Plan: support uses deep_research and challenge uses fact_check in parallel; review reads both through from_parallel_all; summary, on the DeepSeek API, uses from_step to write a cited brief from support, challenge and review. The same two specialists can also be called directly by the lead. Research desk Plain Python Question research_desk Claude Code · Opus Cited answer tools Choose a tool research_brief Deterministic · Agent(engine=Plan(...)) parallel=True support deep_research Claude Code · Sonnet web · for challenge fact_check Codex · Terra web · against from_parallel_all review Codex · Terra · reads both from_step summary DeepSeek API · tokens Writes a cited brief Uses support + challenge + review Same specialists, also called directly deep_research Claude Code · Sonnet web · dig deeper fact_check Codex · Terra web · check claims an agent, or a whole pipeline, is just a tool Claude Code Codex API model

How it is built

  1. Prompts first. Every instruction an LLM sees is a constant at the top.
  2. Two specialists. deep_research and fact_check are agents on two different engines, read-only, with web search.
  3. A pipeline that is itself an agent. Agent(engine=Plan(...)) runs the same two specialists as steps: support and challenge in parallel (parallel=True), then review reads both (from_parallel_all), then summary reads the research and the review (from_step). The summary is written by DeepSeek over its API: subscription engines and token-based models are peers in the same pipeline.
  4. Stack them as tools. The lead gets tools=[research_brief, sonnet, terra]. No glue code: an agent, or a whole pipeline, is just a tool.

The code

"""Card 1: a research desk in plain Python.

A lead agent (Claude Code, Opus) has three tools:
  - research_brief: a deterministic pipeline, two web researchers in parallel,
    then a review, then a summary written by DeepSeek over its API;
  - deep_research (Claude Code, Sonnet) and fact_check (Codex, Terra), the
    same specialists, callable directly to dig deeper.

    python research_desk.py "Should a small team start with SQLite or Postgres?"
"""

import sys

from lazybridge import (
    Agent,
    ClaudeCodeEngine,
    CodexEngine,
    CodingAgentConfig,
    LLMEngine,
    Plan,
    Step,
    from_parallel_all,
    from_start,
    from_step,
)

# Prompts
SUPPORT = "Find the strongest evidence FOR the answer you would give. Cite URLs."
CHALLENGE = "Find the strongest evidence AGAINST it and its limits. Cite URLs."
REVIEW = "Audit both research notes. Flag unsupported, weak or outdated claims."
SUMMARY = "Write a balanced brief under 200 words: verdict, reasons, caveats, URLs."
LEAD = (
    "Call research_brief once. Use deep_research or fact_check only to close "
    "a gap that changes the answer. Reply concisely, with sources."
)

# Specialists: read-only, with web search
web = CodingAgentConfig.reviewer(web=True)
sonnet = Agent(
    name="deep_research",
    description="Researches one narrow question on the web.",
    engine=ClaudeCodeEngine(model="sonnet", config=web),
)
terra = Agent(
    name="fact_check",
    description="Checks claims, dates and sources on the web.",
    engine=CodexEngine(model="terra", config=web),
)

# Writer: a token-based API model, a peer of the two coding agents
writer = Agent(name="writer", engine=LLMEngine("deepseek-flash"))

# Pipeline: research in parallel, review, summarise
research_brief = Agent(
    name="research_brief",
    description="Two-angle web research, reviewed and summarised.",
    engine=Plan(
        Step(sonnet, name="support", task=from_start, context=SUPPORT, parallel=True),
        Step(terra, name="challenge", task=from_start, context=CHALLENGE, parallel=True),
        Step(terra, name="review", task=from_start, context=[REVIEW, from_parallel_all("support")]),
        Step(
            writer,
            name="summary",
            task=from_start,
            context=[SUMMARY, from_parallel_all("support"), from_step("review")],
        ),
    ),
)

# Lead: the pipeline and the specialists are all tools
desk = Agent(
    name="research_desk",
    description="Answers a research question with a reviewed, cited brief.",
    engine=ClaudeCodeEngine(model="opus", system=LEAD, web=False),
    tools=[research_brief, sonnet, terra],
)

if __name__ == "__main__":
    question = " ".join(sys.argv[1:]) or "Should a small team start with SQLite or Postgres?"
    result = desk(question)
    print(result.text() if result.ok else f"failed: {result.error.message}")

Run it

python research_desk.py "Should a small team start with SQLite or Postgres?"

Install everything with one command. You must sign in to Claude Code and Codex once before the first run; with a subscription login they use your plan's quota.