# run_textual_cli_async

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/main/run_textual_cli_async)

Run the Textual TUI interface (async version).

Starts a LangGraph server in a subprocess and connects the TUI to it via the
`langgraph-sdk` client.

## Signature

```python
run_textual_cli_async(
    assistant_id: str,
    *,
    auto_approve: bool = False,
    sandbox_type: str = 'none',
    sandbox_id: str | None = None,
    sandbox_snapshot_name: str | None = None,
    sandbox_setup: str | None = None,
    model_name: str | None = None,
    model_params: dict[str, Any] | None = None,
    profile_override: dict[str, Any] | None = None,
    thread_id: str | None = None,
    resume_thread: str | None = None,
    initial_prompt: str | None = None,
    initial_skill: str | None = None,
    startup_cmd: str | None = None,
    mcp_config_path: str | None = None,
    no_mcp: bool = False,
    trust_project_mcp: bool | None = None,
    enable_interpreter: bool = False,
    interpreter_ptc: str | list[str] | None = None,
    interpreter_ptc_acknowledge_unsafe: bool = False,
) -> AppResult
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `assistant_id` | `str` | Yes | Agent identifier for memory storage |
| `auto_approve` | `bool` | No | Whether to auto-approve tool usage (default: `False`) |
| `sandbox_type` | `str` | No | Type of sandbox ("none", "agentcore", "modal", "runloop", "daytona", "langsmith") (default: `'none'`) |
| `sandbox_id` | `str \| None` | No | Optional existing sandbox ID to reuse. (default: `None`) |
| `sandbox_snapshot_name` | `str \| None` | No | Snapshot (langsmith) or blueprint (runloop) name. (default: `None`) |
| `sandbox_setup` | `str \| None` | No | Optional path to setup script to run in the sandbox after creation. (default: `None`) |
| `model_name` | `str \| None` | No | Optional model name to use (default: `None`) |
| `model_params` | `dict[str, Any] \| None` | No | Extra kwargs from `--model-params` to pass to the model.  These override config file values. (default: `None`) |
| `profile_override` | `dict[str, Any] \| None` | No | Extra profile fields from `--profile-override`.  Merged on top of config file profile overrides. (default: `None`) |
| `thread_id` | `str \| None` | No | Thread ID for the session.  `None` when `resume_thread` is provided (the TUI resolves the final ID asynchronously). (default: `None`) |
| `resume_thread` | `str \| None` | No | Raw resume intent from `-r` flag.  `'__MOST_RECENT__'` for bare `-r`, a thread ID string for `-r <id>`, or `None` for new sessions.  Resolved asynchronously inside the TUI. (default: `None`) |
| `initial_prompt` | `str \| None` | No | Optional prompt to auto-submit when session starts (default: `None`) |
| `initial_skill` | `str \| None` | No | Optional skill name to invoke when the session starts. (default: `None`) |
| `startup_cmd` | `str \| None` | No | Shell command to run at startup before the first prompt.  Output is rendered in the transcript; non-zero exits warn but do not abort the session. (default: `None`) |
| `mcp_config_path` | `str \| None` | No | Optional path to MCP servers JSON configuration file.  Merged on top of auto-discovered configs (highest precedence). (default: `None`) |
| `no_mcp` | `bool` | No | Disable all MCP tool loading. (default: `False`) |
| `trust_project_mcp` | `bool \| None` | No | Controls project-level stdio server trust.  `True` to allow, `False` to deny, `None` to check trust store. (default: `None`) |
| `enable_interpreter` | `bool` | No | Enable `CodeInterpreterMiddleware` (`js_eval`) on the main agent. Local-mode only. (default: `False`) |
| `interpreter_ptc` | `str \| list[str] \| None` | No | Override for `settings.interpreter_ptc` (PTC allowlist for `js_eval`). (default: `None`) |
| `interpreter_ptc_acknowledge_unsafe` | `bool` | No | Explicit acknowledgement for `interpreter_ptc="all"` outside of `auto_approve`. (default: `False`) |

## Returns

`AppResult`

An `AppResult` with the return code and final thread ID.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/a98f0dfa8d534d8a1885b524632400e52db22ac6/libs/code/deepagents_code/main.py#L1507)