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,
resume_thread: str | None = None,
initial_prompt: str | None = None,
initial_skill: str | None = None,
mcp_server_info: list[MCPServerInfo] | None = None,
profile_override: dict[str, Any] | None = None,
server_proc: ServerProcess | None = None,
server_kwargs: dict[str, Any] | None = None,
mcp_preload_kwargs: dict[str, Any] | None = None,
model_kwargs: dict[str, Any] | None = None,
**kwargs: Any = {}
)| Name | Type | Description |
|---|---|---|
agent | Pregel | None | Default: NonePre-configured LangGraph agent, or |
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: NoneThread ID for the session.
|
resume_thread | str | None | Default: NoneRaw resume intent from
Resolved via Requires |
initial_prompt | str | None | Default: NoneOptional prompt to auto-submit when session starts |
initial_skill | str | None | Default: NoneOptional skill name to invoke when session starts. |
mcp_server_info | list[MCPServerInfo] | None | Default: NoneMCP server metadata for the |
profile_override | dict[str, Any] | None | Default: NoneExtra profile fields from |
server_proc | ServerProcess | None | Default: NoneLangGraph server process for the interactive session. |
server_kwargs | dict[str, Any] | None | Default: NoneWhen provided, server startup is deferred. The app shows a "Connecting..." state and starts the server in
the background using these kwargs
for |
mcp_preload_kwargs | dict[str, Any] | None | Default: NoneKwargs for |
model_kwargs | dict[str, Any] | None | Default: NoneKwargs for deferred When provided, model creation runs in a background worker after first paint instead of blocking startup. |
**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 |
| resume_thread | str | None |
| initial_prompt | str | None |
| initial_skill | str | None |
| mcp_server_info | list[MCPServerInfo] | None |
| profile_override | dict[str, Any] | None |
| server_proc | ServerProcess | None |
| server_kwargs | dict[str, Any] | None |
| mcp_preload_kwargs | dict[str, Any] | None |
| model_kwargs | dict[str, Any] | None |
Textual application title.
Path to the Textual CSS stylesheet for the app layout.
Disable Textual's built-in command palette in favor of the custom slash command system.
Vertical scroll speed (reduced from Textual default for finer control).
App-level keybindings for interrupt, quit, toggles, and approval menu navigation.
Return custom CSS variable defaults for the current theme.
Most styling uses Textual's built-in variables ($primary,
$text-muted, $error-muted, etc.). This override injects the
app-specific variables ($mode-bash, $mode-command, $skill,
$skill-hover, $tool, $tool-hover) that have no Textual equivalent.
Compose the application layout.
Initialize components after mount.
Only widget queries and lightweight config go here — anything that
would delay the first rendered frame (subprocess calls, heavy
imports) is deferred to _post_paint_init via call_after_refresh.
Handle successful background server startup.
Handle background server startup failure.
Handle scroll up to check if we need to hydrate older messages.
Handle ask_user menu answers - remove widget and refocus input.
Handle ask_user menu cancellation - remove widget and refocus input.
Handle submitted input from ChatInput widget.
Update status bar when input mode changes.
Record the most recent keystroke time for typing-aware approval deferral.
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.
Priority order:
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 or skill body.
Handle up arrow in approval menu.
Handle down arrow in approval menu.
Handle enter in approval menu.
Handle yes/1 in approval menu.
Handle auto/2 in approval menu.
Handle no/3 in approval menu.
Handle escape in approval menu - reject.
Open the current prompt text in an external editor ($VISUAL/$EDITOR).
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.