All articles
November 1, 2025 5 min read

create_agent: LangChain's prebuilt agent in one call

create_agent hands you the agent loop prebuilt — a model, tools, and a prompt in one function — and returns a compiled LangGraph graph, batteries included: memory, structured output, middleware, and MCP.

Written forEngineering
LangChainAgentsTooling

The langchain-core post showed the agent loop written by hand. create_agent is the layer that writes it for you: give it a model, tools, and a system prompt, and the loop arrives prebuilt in one function call — much like the OpenAI Agents SDK. It's the fast path from the ecosystem-layers ladder.

GoalLLM — reason + decideTool call?yesRun toolresultdoneAnswer
create_agent gives you this loop prebuilt — you supply the model, tools, and prompt; it runs reason → act → observe until there's a final answer.

One call, the loop prebuilt

The whole agent
from langchain.agents import create_agent

agent = create_agent(
    model='openai:gpt-4o',
    tools=[get_weather],
    system_prompt='You are a concise, helpful assistant.',
)
result = agent.invoke({'messages': [{'role': 'user', 'content': 'weather in Paris?'}]})
# await agent.ainvoke(...) for async — nothing else changes

It's a LangGraph graph underneath

The important detail: create_agent returns the same compiled LangGraph graph you'd have wired by hand a layer down. So you inherit LangGraph's durability — checkpointing, resumable runs, streaming — for free, and you can drop into the graph when you need more control. You climbed a layer; you didn't leave the ecosystem.

Batteries included

  • Tools — your @tool functions from langchain-core; the loop runs itself.
  • Memory — a checkpointer and a thread_id, exactly like LangGraph, so conversations persist and resume.
  • Structured output — response_format returns your Pydantic object instead of text.
  • Middleware — your own hooks inside the loop, to observe or modify each step.
  • MCP — connect MCP server tools so the agent can drive real systems (see the MCP posts).

When to use it

Reach for create_agent when you want a production-ready agent quickly without wiring the loop yourself — the same trade as the OpenAI Agents SDK's one-call agent. Drop down to langgraph or langchain-core when you need bespoke control over the flow, and up to deep agents when the task needs planning and sub-agents.

create_agent is the loop you'd write by hand, minus the writing — and because it's a LangGraph graph underneath, dropping to a lower layer is always one step away.
Building something with LLMs?
I help teams ship GenAI that’s reliable and cost-efficient.
Let’s talk