create_deep_agent¶
create_deep_agent
¶
create_deep_agent(
model: str | BaseChatModel | None = None,
tools: Sequence[BaseTool | Callable | dict[str, Any]] | None = None,
*,
system_prompt: str | SystemMessage | None = None,
middleware: Sequence[AgentMiddleware] = (),
subagents: list[SubAgent | CompiledSubAgent] | None = None,
skills: list[str] | None = None,
memory: list[str] | None = None,
response_format: ResponseFormat | None = None,
context_schema: type[Any] | None = None,
checkpointer: Checkpointer | None = None,
store: BaseStore | None = None,
backend: BackendProtocol | BackendFactory | None = None,
interrupt_on: dict[str, bool | InterruptOnConfig] | None = None,
debug: bool = False,
name: str | None = None,
cache: BaseCache | None = None,
) -> CompiledStateGraph
Create a deep agent.
Deep agents require a LLM that supports tool calling!
By default, this agent has access to the following tools:
write_todos: manage a todo listls,read_file,write_file,edit_file,glob,grep: file operationsexecute: run shell commandstask: call subagents
The execute tool allows running shell commands if the backend implements SandboxBackendProtocol.
For non-sandbox backends, the execute tool will return an error message.
| PARAMETER | DESCRIPTION |
|---|---|
model
|
The model to use. Defaults to Use the
TYPE:
|
tools
|
The tools the agent should have access to. In addition to custom tools you provide, deep agents include built-in tools for planning, file management, and subagent spawning.
TYPE:
|
system_prompt
|
Custom system instructions to prepend before the base deep agent prompt. If a string, it's concatenated with the base prompt.
TYPE:
|
middleware
|
Additional middleware to apply after the standard middleware stack
(
TYPE:
|
subagents
|
The subagents to use. Each subagent should be a
TYPE:
|
skills
|
Optional list of skill source paths (e.g., Paths must be specified using POSIX conventions (forward slashes) and are relative
to the backend's root. When using |
memory
|
Optional list of memory file paths ( Display names are automatically derived from paths. Memory is loaded at agent startup and added into the system prompt. |
response_format
|
A structured output response format to use for the agent.
TYPE:
|
context_schema
|
The schema of the deep agent. |
checkpointer
|
Optional
TYPE:
|
store
|
Optional store for persistent storage (required if backend uses
TYPE:
|
backend
|
Optional backend for file storage and execution. Pass either a
TYPE:
|
interrupt_on
|
Mapping of tool names to interrupt configs. Pass to pause agent execution at specified tool calls for human approval or modification. Example:
TYPE:
|
debug
|
Whether to enable debug mode. Passed through to
TYPE:
|
name
|
The name of the agent. Passed through to
TYPE:
|
cache
|
The cache to use for the agent. Passed through to
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
CompiledStateGraph
|
A configured deep agent. |