from deepagents import create_deep_agent class _DirectModel: """Thin wrapper: single LLM call, no tools, same ainvoke interface as a graph.""" def __init__(self, model): self._model = model async def ainvoke(self, input_dict: dict) -> dict: messages = input_dict["messages"] response = await self._model.ainvoke(messages) return {"messages": list(messages) + [response]} def build_medium_agent(model, agent_tools: list, system_prompt: str): """Medium agent: single LLM call, no tools — fast ~3s response.""" return _DirectModel(model) def build_complex_agent(model, agent_tools: list, system_prompt: str): """Complex agent: direct agentic loop — calls web_search/fetch_url itself, no subagent indirection.""" return create_deep_agent( model=model, tools=agent_tools, system_prompt=system_prompt, )