from deepagents import create_deep_agent, SubAgent def build_medium_agent(model, agent_tools: list, system_prompt: str): """Medium agent: create_deep_agent with TodoList planning, no subagents.""" return create_deep_agent( model=model, tools=agent_tools, system_prompt=system_prompt, ) def build_complex_agent(model, agent_tools: list, system_prompt: str): """Complex agent: create_deep_agent with TodoList planning + research/memory subagents.""" web_tools = [t for t in agent_tools if getattr(t, "name", "") == "web_search"] memory_tools = [ t for t in agent_tools if getattr(t, "name", "") in ("search_memory", "get_all_memories") ] research_sub: SubAgent = { "name": "research", "description": ( "Runs multiple web searches in parallel and synthesizes findings. " "Use for thorough research tasks requiring several queries." ), "system_prompt": ( "You are a research specialist. Search the web thoroughly using multiple queries. " "Cite sources and synthesize information into a clear summary." ), "tools": web_tools, "model": model, } memory_sub: SubAgent = { "name": "memory", "description": ( "Searches and retrieves all relevant memories about the user comprehensively. " "Use to gather full context from past conversations." ), "system_prompt": ( "You are a memory specialist. Search broadly using multiple queries. " "Return all relevant facts and context you find." ), "tools": memory_tools, "model": model, } return create_deep_agent( model=model, tools=agent_tools, system_prompt=system_prompt, subagents=[research_sub, memory_sub], )