create_agent parameters
create_agent in langchain 1.5.0 takes a model, tools, and 13 keyword parameters, and returns a compiled LangGraph graph with a recursion limit of 9999.
The tables give each parameter, its type and default at the pin, and what the code does with it. Each row names the line of libs/langchain_v1/langchain/agents/factory.py at langchain==1.5.0 in its citation. Section 4.1 explains the graph, and the last column links the section that runs each parameter.
The signature
Import it with from langchain.agents import create_agent. The function starts at line 895, after three typed overloads at lines 827, 849, and 873. The first two parameters are positional. The others are keyword only.
| Parameter | Type | Default | What the code does | Section |
|---|---|---|---|---|
model | str or BaseChatModel | required | A string goes through init_chat_model once, when the agent is built. | 3.2 |
tools | a sequence of BaseTool, callables, and dicts | None | A dict is a provider tool. It is bound to the model and never runs in the tools node. | 3.4 |
system_prompt | str or SystemMessage | None | A string becomes a SystemMessage. It goes first in every model request and is not stored in the state. | 3.5 |
middleware | a sequence of AgentMiddleware | () | Two instances with one name raise AssertionError. Their tools join your tools. | 4.5 |
response_format | ToolStrategy, ProviderStrategy, AutoStrategy, a type, or a dict | None | A plain schema becomes AutoStrategy, which picks a strategy on each model call. | 4.2 |
state_schema | a subclass of AgentState | None | Middleware schemas merge first and this schema merges last, so its fields win. | 4.1 |
context_schema | a type | None | Types the context argument of a run. Without it, a context dict gives a pydantic warning in our runs. | 5.4 |
checkpointer | a Checkpointer | None | Passed to compile. Without one, a run keeps no state between calls. | 5.2 |
store | a BaseStore | None | Passed to compile, and given to tools as runtime.store. | 5.4 |
interrupt_before | a list of node names | None | Static breakpoints before the named nodes, passed to compile. | 6.4 |
interrupt_after | a list of node names | None | Static breakpoints after the named nodes, passed to compile. | 6.4 |
debug | bool | False | Passed to compile. | 4.1 |
name | str | None | Sets the graph name, the name of each model reply, and lc_agent_name in the run metadata. | 6.7 |
cache | a LangGraph BaseCache | None | A node cache, passed to compile. It is not the model cache of set_llm_cache. | 4.7 |
transformers | a sequence of stream transformer factories | None | Added after ToolCallTransformer, SubagentTransformer, and the transformers of each middleware. | 5.1 |
The docstring says that response_format takes a ToolStrategy, a ProviderStrategy, or a Pydantic class. The signature also takes AutoStrategy, a dataclass, a TypedDict, and a JSON schema dict, and capture 07-structured-output.txt runs each one.
The graph it returns
The return type is CompiledStateGraph. The code compiles the graph and then applies one run config to it.
| Property | Value at the pin | Where it comes from |
|---|---|---|
| model node | model | graph.add_node("model", ...) |
| tool node | tools, a ToolNode, present only with client tools or a wrap_tool_call middleware | |
| middleware nodes | <name>.before_agent, <name>.before_model, <name>.after_model, <name>.after_agent | capture 09-middleware-order.txt |
recursion_limit | 9999 | |
| run metadata | {"ls_integration": "langchain_create_agent"} | |
default stream_mode | updates | StateGraph.compile |
| parallel tool calls | one Send("tools", [tool_call]) for each pending call, in one step | |
| loop exit | no tool calls, or a new structured_response |
The tools node uses the default error handler of ToolNode. It returns a message for bad arguments and raises every other exception. Section 3.4 shows both cases.
The state
AgentState is a TypedDict with three keys.
| Key | Type | Notes |
|---|---|---|
messages | a list of messages with the add_messages reducer | required |
jump_to | "tools", "model", or "end" | private and ephemeral. A node hook sets it to route the run |
structured_response | your schema | left out of the input schema |
InputAgentState holds only messages. OutputAgentState holds messages and structured_response.
Arguments of a run
The run methods belong to the compiled graph from langgraph 1.2.22. invoke and stream take the same keywords, and stream also takes subgraphs.
| Argument | Default | Notes | Section |
|---|---|---|---|
input | required | A dict with messages, None to go on from a checkpoint, or a Command to resume. | 6.4 |
config | None | Holds recursion_limit, max_concurrency, callbacks, and configurable, with thread_id inside configurable. | 5.2 |
context | None | Static data for the run, read as runtime.context. | 5.4 |
stream_mode | values for invoke, the graph default for stream | The stream reference lists each mode. | 5.1 |
durability | async | sync, async, or exit. | 5.3 |
interrupt_before, interrupt_after | None | Breakpoints for this run only. | 6.4 |
subgraphs | False | stream only. Each chunk then carries the namespace of its subgraph. | 6.7 |
version | v1 | v2 yields StreamPart dicts, and invoke returns a GraphOutput. | 5.1 |
LangChain (Python): langchain, langchain-core, langgraph, deepagents, langsmith 1.5.0 · c2f4036 · 2026-11-11 · Edition 2026.11