A research agent that searches the web and hands long sources to a cheaper summarising subagent.

agent

Pick a model and how hard it works, then what its system prompt starts from.

Model family
Effort
Thinking

Families, not dated model IDs: the SDK picks the current model. Leave effort on default unless you have a reason. Adaptive thinking lets recent models decide how much to think; a fixed budget is mainly for older models.

Base prompt

Your text replaces the system prompt completely.

this step writes2 of 36 lines
options = ClaudeAgentOptions(    model="sonnet",    system_prompt="You track developments in our field. Cite every source you use.",)

generated code

import anyiofrom claude_agent_sdk import ClaudeAgentOptions, query, AgentDefinitionfrom claude_agent_sdk import AssistantMessage, ResultMessage, TextBlock, ToolUseBlockoptions = ClaudeAgentOptions(    model="sonnet",    system_prompt="You track developments in our field. Cite every source you use.",    allowed_tools=["WebSearch", "WebFetch", "Read", "Agent"],    agents={        "summariser": AgentDefinition(            description="Condenses one long source into five bullet points.",            prompt="Summarise the source you are given in five bullet points. Keep every number and date exact.",            tools=["Read"],            model="haiku",        ),    },    max_turns=12,    max_budget_usd=1,)def show(message):    if isinstance(message, AssistantMessage):        for block in message.content:            if isinstance(block, TextBlock):                print(block.text)            elif isinstance(block, ToolUseBlock):                print("->", block.name, block.input)    elif isinstance(message, ResultMessage):        cost = message.total_cost_usd or 0        print(f"\n[{message.subtype}: {message.num_turns} turns, ${cost:.4f}]")async def main():    async for message in query(prompt="What changed in our field this week?", options=options):        show(message)anyio.run(main)

The file targets the claude-agent-sdk Python package. Options change between releases, so check the SDK's own documentation before you ship it.