Main Textual application for deepagents-cli.
DeepAgentsApp(
self,
*,
agent: Pregel | None = None,
assistant_id: str | None = None,
backend: CompositeBackend | None = None,
auto_approve: bool = False,
cwd: str | Path | None = None,
thread_id: str | None = None,
initial_prompt: str | None = None,
checkpointer: BaseCheckpointSaver | None = None,
tools: list[Callable[..., Any] | dict[str, Any]] | None = None,
sandbox: SandboxBackendProtocol | None = None,
sandbox_type: str | None = None,
**kwargs: Any = {}
)| Name | Type | Description |
|---|---|---|
agent | Pregel | None | Default: NonePre-configured LangGraph agent (optional for standalone mode) |
assistant_id | str | None | Default: NoneAgent identifier for memory storage |
backend | CompositeBackend | None | Default: NoneBackend for file operations |
auto_approve | bool | Default: FalseWhether to start with auto-approve enabled |
cwd | str | Path | None | Default: NoneCurrent working directory to display |
thread_id | str | None | Default: NoneOptional thread ID for session persistence |
initial_prompt | str | None | Default: NoneOptional prompt to auto-submit when session starts |
checkpointer | BaseCheckpointSaver | None | Default: NoneCheckpointer for session persistence (enables model hot-swap) |
tools | list[Callable[..., Any] | dict[str, Any]] | None | Default: NoneTools used to create the agent (for model hot-swap) |
sandbox | SandboxBackendProtocol | None | Default: NoneSandbox backend (for model hot-swap) |
sandbox_type | str | None | Default: NoneType of sandbox provider (for model hot-swap) |
**kwargs | Any | Default: {}Additional arguments passed to parent |
| Name | Type |
|---|---|
| agent | Pregel | None |
| assistant_id | str | None |
| backend | CompositeBackend | None |
| auto_approve | bool |
| cwd | str | Path | None |
| thread_id | str | None |
| initial_prompt | str | None |
| checkpointer | BaseCheckpointSaver | None |
| tools | list[Callable[..., Any] | dict[str, Any]] | None |
| sandbox | SandboxBackendProtocol | None |
| sandbox_type | str | None |
Compose the application layout.
Initialize components after mount.
Handle terminal resize to recalculate layout.
Handle scroll up to check if we need to hydrate older messages.
Handle submitted input from ChatInput widget.
Update status bar when input mode changes.
Handle approval menu decision - remove from messages and refocus input.
Handle Ctrl+C - interrupt agent, reject approval, or quit on double press.
Priority order:
Handle escape key.
Dismiss completion popup, dismiss modal, interrupt agent, or reject approval. This is the primary way to stop a running agent.
Handle quit action (Ctrl+D).
Exit the app, restoring iTerm2 cursor guide if applicable.
Overrides parent to restore iTerm2's cursor guide before Textual's cleanup. The atexit handler serves as a fallback for abnormal termination.
Toggle auto-approve mode for the current session.
When enabled, all tool calls (shell execution, file writes/edits, web search, URL fetch) run without prompting. Updates the status bar indicator and session state.
Toggle expand/collapse of the most recent tool output.
Handle up arrow in approval menu.
Handle down arrow in approval menu.
Handle enter in approval menu.
Handle yes/1 in approval menu.
Handle no/2 in approval menu.
Handle auto/3 in approval menu.
Handle escape in approval menu - reject.
Route unfocused paste events to chat input for drag/drop reliability.
Restore chat input focus when the terminal regains OS focus.
When the user opens a link via webbrowser.open, OS focus shifts to
the browser. On returning to the terminal, Textual fires AppFocus
(requires a terminal that supports FocusIn events). Re-focusing the chat
input here keeps it ready for typing.
Handle clicks anywhere in the terminal to focus on the command line.
Copy selection to clipboard on mouse release.