create_cli_agent(
model: str | BaseChatModel,
assistant_id: str,| Name | Type | Description |
|---|---|---|
model* | str | BaseChatModel | LLM model to use (e.g., |
assistant_id* | str | Agent identifier for memory/state storage |
tools | Sequence[BaseTool | Callable | dict[str, Any]] | None | Default: None |
sandbox | SandboxBackendProtocol | None | Default: None |
sandbox_type | str | None | Default: None |
system_prompt | str | None | Default: None |
interactive | bool | Default: True |
auto_approve | bool | Default: False |
interrupt_shell_only | bool | Default: False |
shell_allow_list | list[str] | None | Default: None |
enable_ask_user | bool | Default: True |
enable_memory | bool | Default: True |
enable_skills | bool | Default: True |
enable_shell | bool | Default: True |
checkpointer | BaseCheckpointSaver | None | Default: None |
mcp_server_info | list[MCPServerInfo] | None | Default: None |
cwd | str | Path | None | Default: None |
project_context | ProjectContext | None | Default: None |
async_subagents | list[AsyncSubAgent] | None | Default: None |
Create a CLI-configured agent with flexible options.
This is the main entry point for creating a Deep Agents Code agent, usable both internally and from external code (e.g., benchmarking frameworks).
Additional tools to provide to agent
Optional sandbox backend for remote execution
(e.g., ModalSandbox).
If None, uses local filesystem + shell.
Type of sandbox provider
('agentcore', 'daytona', 'langsmith', 'modal', 'runloop').
Used for system prompt generation.
Override the default system prompt.
If None, generates one based on sandbox_type, assistant_id,
and interactive.
When False, the auto-generated system prompt is
tailored for headless non-interactive execution. Ignored when
system_prompt is provided explicitly.
If True, no tools trigger human-in-the-loop
interrupts — all calls (shell execution, file writes/edits,
web search, URL fetch) run automatically.
If False, tools pause for user confirmation via the approval menu.
See _add_interrupt_on for the full list of gated tools.
If True, all HITL interrupts are disabled;
shell commands are validated inline by ShellAllowListMiddleware
against the configured allow-list instead.
Used in non-interactive mode with a restrictive shell allow-list to avoid splitting traces into multiple LangSmith runs.
Has no effect when auto_approve is True (interrupts are already
disabled) or when shell_allow_list is SHELL_ALLOW_ALL.
Explicit restrictive shell allow-list forwarded from
the CLI process. When provided (and interrupt_shell_only is
True), used directly instead of reading settings.shell_allow_list
(which may not be set in the server subprocess environment).
Enable AskUserMiddleware so the agent can ask
clarifying questions.
Disabled in non-interactive mode.
Enable MemoryMiddleware for persistent memory
Enable SkillsMiddleware for custom agent skills
Enable shell execution via LocalShellBackend
(only in local mode). When enabled, the execute tool is available.
Optional checkpointer for session persistence.
When None, the graph is compiled without a checkpointer.
MCP server metadata to surface in the system prompt.
Override the working directory for the agent's filesystem backend and system prompt.
Explicit project path context for project-sensitive
behavior such as project AGENTS.md files, skills, subagents, and
MCP trust.
Remote LangGraph deployments to expose as async subagent tools.
Loaded from [async_subagents] in config.toml or passed directly.