# start_server_and_get_agent

> **Function** in `deepagents_cli`

📖 [View in docs](https://reference.langchain.com/python/deepagents-cli/server_manager/start_server_and_get_agent)

Start a LangGraph server and return a connected remote agent client.

## Signature

```python
start_server_and_get_agent(
    *,
    assistant_id: str,
    model_name: str | None = None,
    model_params: dict[str, Any] | None = None,
    auto_approve: bool = False,
    interrupt_shell_only: bool = False,
    shell_allow_list: list[str] | None = None,
    sandbox_type: str = 'none',
    sandbox_id: str | None = None,
    sandbox_setup: str | None = None,
    enable_shell: bool = True,
    enable_ask_user: bool = False,
    mcp_config_path: str | None = None,
    no_mcp: bool = False,
    trust_project_mcp: bool | None = None,
    interactive: bool = True,
    host: str = '127.0.0.1',
    port: int = 2024,
) -> tuple[RemoteAgent, ServerProcess, MCPSessionManager | None]
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `assistant_id` | `str` | Yes | Agent identifier. |
| `model_name` | `str \| None` | No | Model spec string. (default: `None`) |
| `model_params` | `dict[str, Any] \| None` | No | Extra model kwargs. (default: `None`) |
| `auto_approve` | `bool` | No | Auto-approve all tools. (default: `False`) |
| `interrupt_shell_only` | `bool` | No | Validate shell commands via middleware instead of HITL. (default: `False`) |
| `shell_allow_list` | `list[str] \| None` | No | Restrictive shell allow-list for `ShellAllowListMiddleware`. (default: `None`) |
| `sandbox_type` | `str` | No | Sandbox type. (default: `'none'`) |
| `sandbox_id` | `str \| None` | No | Existing sandbox ID to reuse. (default: `None`) |
| `sandbox_setup` | `str \| None` | No | Path to setup script for the sandbox. (default: `None`) |
| `enable_shell` | `bool` | No | Enable shell execution tools. (default: `True`) |
| `enable_ask_user` | `bool` | No | Enable ask_user tool. (default: `False`) |
| `mcp_config_path` | `str \| None` | No | Path to MCP config. (default: `None`) |
| `no_mcp` | `bool` | No | Disable MCP. (default: `False`) |
| `trust_project_mcp` | `bool \| None` | No | Trust project MCP servers. (default: `None`) |
| `interactive` | `bool` | No | Whether the agent is interactive. (default: `True`) |
| `host` | `str` | No | Server host. (default: `'127.0.0.1'`) |
| `port` | `int` | No | Server port. (default: `2024`) |

## Returns

`tuple[RemoteAgent, ServerProcess, MCPSessionManager | None]`

Tuple of `(remote_agent, server_process, mcp_session_manager)`.
The `mcp_session_manager` is currently always `None` (MCP lifecycle
is handled server-side).

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/64ecf141be0479f859f4efe25d139166b45ee18c/libs/cli/deepagents_cli/server_manager.py#L191)