Menu

Language
Theme

deepagents-code

Description

๐Ÿง ๐Ÿค– Deep Agents Code

PyPI - Version PyPI - License PyPI - Downloads Twitter

Deep Agents Code

Quick Install

curl -LsSf https://langch.in/dcode | bash
# With model provider extras
# OpenAI, Anthropic, and Gemini are included by default
curl -LsSf https://langch.in/dcode | DEEPAGENTS_CODE_EXTRAS="nvidia,ollama" bash

Run:

dcode

๐Ÿค” What is this?

The fastest way to start using Deep Agents. deepagents-code is a pre-built coding agent in your terminal โ€” similar to Claude Code or Cursor โ€” powered by any LLM that supports tool calling. One install command and you're up and running, no code required.

What deepagents-code adds on top of the SDK:

  • Interactive TUI โ€” rich terminal interface with streaming responses
  • Conversation resume โ€” pick up where you left off across sessions
  • Web search โ€” ground responses in live information
  • Remote sandboxes โ€” run code in isolated environments (LangSmith, AgentCore, Daytona, Modal, Runloop, & more)
  • Persistent memory โ€” agent remembers context across conversations
  • Custom skills โ€” extend the agent with your own slash commands
  • Headless mode โ€” run non-interactively for scripting and CI
  • Human-in-the-loop โ€” approve or reject tool calls before execution

๐Ÿ”’ Security model

By default, dcode trusts the directory you run it in. Human-in-the-loop approval gates model-requested tool calls, but project artifacts are read before any approval prompt.

Do not run dcode in a directory you do not trust without a sandbox backend. For untrusted repositories, use a remote sandbox so execution is isolated from your machine. Running dcode in a directory lets that directory's files shape execution. See THREAT_MODEL.md for details.

๐Ÿ“– Resources

๐Ÿ“• Releases & Versioning

See our Releases and Versioning policies.

๐Ÿ’ Contributing

As an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation.

For local setup, see the Development Guide. For contribution policy, see the Contributing Guide.

๐Ÿค Acknowledgements

This project was primarily inspired by Claude Code, and initially was largely an attempt to see what made Claude Code general purpose, and make it even more so.

Classes

Class

ReliableRubricState

Rubric state carrying dcode's private runtime model selections.

These three channels are declared a second time here, because this middleware's state_schema must list every channel it reads. Each a

Class

RubricGraderState

Nested-grader state used to scope verification-tool budgets.

Class

ReliableRubricMiddleware

Run a context-aware nested grader with CLI verification middleware.

The nested grader receives Deep Agents Code's verification middleware and runtime context without requiring those application-speci

Class

BypassTier

Classification that controls whether a command can skip the message queue.

Class

SlashCommand

A single slash-command definition.

Class

CommandEntry

A single autocomplete entry for the slash-command controller.

Class

ImageData

Represents a pasted image with its base64 encoding.

Class

VideoData

Represents a pasted video with its base64 encoding.

Class

ApiKeyCredential

A persisted API key credential.

The type field is the discriminator that lets OAuthCredential (added later) coexist in the same file without migration.

Class

OAuthCredential

A persisted OAuth subscription credential.

Stub kept here so the StoredCredential discriminated union narrows correctly today and the OAuth implementation lands as a pure addition. No code path pro

Class

WriteOutcome

Result of a credential write that may have warnings to surface.

Class

DeleteOutcome

Result of a credential delete that may have warnings to surface.

A delete rewrites the whole store, so it can hit the same chmod failures as a write. warnings carries them symmetrically with `Write

Class

ServerConfig

Full configuration payload passed from the app to the server subprocess.

Serialized to/from DEEPAGENTS_CODE_SERVER_* environment variables so that the server graph (which runs in a separate Python

Class

SubagentMetadata

Metadata for a custom subagent loaded from filesystem.

Class

OutputTruncation

Why a provider stopped a reply early.

Class

ModelOutputTruncatedError

The model stopped before it gave any reply.

Subclasses ValueError so that the LangGraph server keeps the message when it serializes the error for the client. Other exception types are redacted to "

Class

EmptyTruncatedReplyMiddleware

Fail the main run when the provider cut off a reply before any output.

Without this, a reply with no text, no tool calls, and a truncation stop reason ends the run as a success. The empty message is

Class

SubagentTruncatedReplyMiddleware

Keep partial subagent answers and fail empty ones for the parent to handle.

Class

DeterministicIntegrationChatModel

Deterministic chat model for integration tests.

This subclasses _ToolBindingFakeModel (itself a GenericFakeChatModel) so the implementation stays aligned with the core fake-chat-model test surfac

Class

ToolCallingIntegrationChatModel

Deterministic tool-calling model for auto-approve integration tests.

Generation is driven entirely by prompt markers (the module-level DCA_* constants), so output is restart-safe and independent of

Class

GoalCriteriaIntegrationChatModel

Exercise nested criteria generation with a repository read.

Class

GoalRubricChannels

Goal/rubric state channels shared by every schema that touches them.

Declared once here so each schema that carries these channels โ€” ResumeState and goal_tools.GoalToolState โ€” inherits the same

Class

ResumeState

Extends agent state with per-checkpoint facts restored on resume.

Inherits the shared goal/rubric channels from GoalRubricChannels and adds the channels unique to resume: the after-model token/spec

Class

ResumeStateMiddleware

Persists per-checkpoint resume facts after each model call.

See the module docstring for why this rides the model node's checkpoint instead of a separate aupdate_state (avoids a standalone `UpdateS

Class

MCPBackendMiddleware

Recover failed connections and preserve actionable login errors.

Class

InMemoryLogRecord

Structured log record retained by the in-memory debug buffer.

Class

InMemoryLogBuffer

Logging handler retaining the most recent structured records in memory.

Retention is partitioned by level: each recognized level name (see LOG_LEVELS) keeps its own bounded deque of capacity re

Class

BtwOperation

Capture effective main-call context and answer tool-free side questions.

Register after middleware that modifies the model, prompt, or settings, including extensions. ConfigurableModelMiddleware re

Class

PastedContent

Stored content for a collapsed paste.

The paste's numeric identifier is the key under which this record is stored in the input's paste map, so it is not duplicated on the record.

Class

GoalStateProjection

Canonical goal/rubric fields used for notices and fingerprints.

Class

NoticeTextSections

The three user-controlled text sections a goal-state notice can embed.

Named rather than a bare tuple[str | None, str | None, str | None]: all five call sites unpack positionally and immediately re

Class

GoalStateNoticeInfo

Metadata extracted from a canonical goal-state notice.

Class

WorkspaceSnapshot

Versioned, allowlisted policy snapshot persisted beside a binding.

Class

FieldChange

One drifted policy field, reported within the snapshot allowlist.

Class

WorkspaceDiagnostics

Structured, secret-free detail attached to a workspace refusal.

Class

MCPProviderToolSearchMiddleware

Defer only currently exposed MCP tools on verified native endpoints.

Class

WorkspacePayload

JSON-safe workspace descriptor carried in LangGraph runtime context.

Class

WorkspaceBinding

Server-authoritative workspace and resource policy for one thread.

Class

WorkspaceConflictError

A workspace claim or runtime conflicts with server resource policy.

Class

DeepAgentsHomeError

Raised when the launch-time profile location cannot be resolved.

Covers an unsupported DEEPAGENTS_HOME value and a launch home that cannot be determined or is itself unusable. It is a ValueError

Class

ConfigErrorKind

Discriminator for ConfigResolutionError reasons.

Only NO_CONFIG_FOUND maps to exit code 2 in the mcp login CLI handlers (run_mcp_login, run_mcp_login_list); all other kinds map to exit code

Class

ConfigResolutionError

Structured error returned when a login target cannot be resolved.

Class

ConfigResolution

Successful resolution of a merged MCP config for login.

Class

ServerSelection

Resolved server config plus enough context for error messages.

Class

AgentServerACP

ACP server that supplies trusted classifier context in Auto mode.

Class

ServerRuntime

The one-per-process result with named slots to prevent transposition.

Class

TerminalStderrGuard

Suppress native stderr writes while the TUI owns the terminal.

Class

CatalogProfile

Displayable model capabilities with override provenance.

Class

CatalogProvider

Provider presentation and readiness, without credential values.

Class

ModelCatalog

Validated catalog from the environment that constructs models.

Class

UnicodeIssue

A dangerous Unicode character found in text.

Class

UrlSafetyResult

Safety analysis output for a URL string.

A result may have safe=True with non-empty warnings when informational warnings (e.g. punycode decoding) are present without suspicious patterns.

Class

ActionId

Stable identifiers for notification actions dispatched by the app.

Class

NotificationAction

One button/action row in the notification modal.

Class

MissingDepPayload

Typed payload for a missing-dependency notification.

Class

UpdateAvailablePayload

Typed payload for an update-available notification.

Class

PendingNotification

A single notice waiting for user action.

Immutable value object: the registry owns the key-to-toast-identity binding (see NotificationRegistry) so external callers cannot corrupt click-routing indi

Class

NotificationRegistry

In-memory store of pending notifications.

Instance-scoped (one per app) so test apps don't pollute each other. Owns the bidirectional key-to-toast-identity binding so callers cannot accidentally desy

Class

ModelMetadata

Resolved model properties needed by the interactive client.

Class

DiffStats

Line counts for a change, named so the pair cannot be swapped silently.

Keyword-only and frozen so that claim holds at construction as well as in transit: a positional pair is exactly the transpositi

Class

CLIContextSchema

Declared context_schema for the agent graph.

Registered via context_schema= when the graph is built, so LangGraph coerces each run's context= payload into this dataclass โ€” in-process, `runtime.

Class

CLIContext

Client-facing builder for the per-run graph context payload.

Callers populate this and pass it via context= to astream/ainvoke. ConfigurableModelMiddleware and the interrupt_on when predi

Class

ProjectContext

Explicit user/project path context for project-sensitive behavior.

Class

AskUserMiddleware

Middleware that provides an ask_user tool for interactive questioning.

This middleware adds an ask_user tool that allows agents to ask the user questions during execution. Questions can be free-for

Class

ColdCacheSkip

A known reason to skip a cache prompt, distinct from missing pricing.

Class

CacheActivity

A cache-using request's start time and effective cache identity.

Class

PromptCachePolicy

Prompt-cache behavior needed to decide and price a warning.

Keyword-only because window_seconds and minimum_tokens are adjacent bare ints: positionally, transposing them builds a plausible-lookin

Class

RewarmEstimate

Estimated input cost for a cold prefix and its warm-cache delta.

Both figures are USD, non-negative, and finite; incremental_cost_usd is the part of cold_cost_usd that a cache hit would have avoi

Class

ColdCacheWarning

Validated data needed to render one advisory warning.

Constructed only after every gate has passed -- a policy resolved, the prefix cleared the provider's cache minimum, and the priced delta reached

Class

ShellAllowListMiddleware

Validate shell commands against an allow-list without HITL interrupts.

When the agent invokes the execute shell tool, this middleware checks the command against the configured allow-list **before e

Class

AsyncApprovalHITLMiddleware

Stock HITL routing with an async live-mode read after model completion.

The transient routing marker is added only to a shallow state copy passed directly into stock HITL routing. It is neither check

Class

CachingRuleProcessor

Apply secret rules per string and remember the result in a bounded LRU.

The output for a string is the same whether it comes from the cache or from the rules, so the cache cannot let a secret through

Class

ExternalEditorError

Raised when an external editor cannot be opened or read.

Class

ProfilePaths

Paths whose contents belong to one user profile and trust root.

Class

InstallationPaths

Paths owned by the installed tool rather than a selected profile.

Class

ProjectPaths

Project-controlled paths derived from an explicit repository root.

Class

DeepAgentsPathSnapshot

Frozen launch-time profile and installation paths.

Class

PathState

Whether a probed path exists, is absent, or could not be read.

A StrEnum so the value serializes directly to JSON without a custom encoder.

Class

GitTraceMiddleware

Observe backend work and backfill only the initiating user turn.

Class

GoalStateSizeError

Goal/rubric text exceeds a model-visible context budget.

Class

TurnTrace

Keep sibling invocation roots alive until the thread starts another turn.

Class

LocalContextState

State for local context middleware.

Class

LocalContextMiddleware

Inject local context (git state, project structure, etc.) into the system prompt.

Runs a bash detection script via backend.execute() on first interaction and stores that snapshot for stable system-

Class

GitSnapshot

Repository identity and opaque non-content evidence of checkout work.

Class

ContextDoctorRow

One component in the context audit.

Class

ContextDoctorReport

Structured context audit ready for presentation.

Class

LocalMarketplaceSource

Local directory or JSON file used as a marketplace source.

Class

RepositoryMarketplaceSource

GitHub or Git repository used as a marketplace source.

ref selects an optional branch or tag. Commit SHA checkout is not part of the shallow-clone flow.

Class

UrlMarketplaceSource

Marketplace manifest downloaded from an HTTP URL.

Class

PluginManifest

Parsed plugin manifest.

Class

ComponentInventory

Inventory of supported plugin components.

unsupported lists plugin component directories that deepagents-code does not load (e.g. agents/, commands/).

Class

PluginInstance

A discovered plugin ready to feed dcode adapters.

Class

LocalPluginSource

A plugin stored relative to its marketplace.

Class

GithubPluginSource

A plugin sourced from a GitHub repository.

Class

GitSubdirectoryPluginSource

A plugin sourced from a subdirectory in a Git repository.

Class

UrlPluginSource

A plugin sourced from a Git repository URL.

Class

MarketplacePluginEntry

A catalog entry from a marketplace manifest.

Class

PluginMarketplace

A parsed marketplace manifest.

Class

MarketplaceRecord

Persisted marketplace source record.

Class

InstalledPluginEntry

Install record for a plugin.

version is the value declared by the plugin manifest, if any.

Class

BrokenPluginInstall

An enabled, registered plugin whose installed files are missing.

Class

PluginDiscoveryResult

Result from plugin discovery.

broken lists enabled plugins whose installed files are missing. They are reported separately from warnings so callers can present them once with repair guidance inst

Class

PluginUpdate

A marketplace plugin version that differs from the installed one.

Class

PluginUpdateResult

Outcome of checking installed plugins against their marketplaces.

Class

MarketplaceError

Raised when a marketplace cannot be loaded.

Class

SandboxProviderConfig

Configuration for a single config-declared sandbox provider.

Warning

Setting class_path executes arbitrary Python code imported from the user's config file. This has the same trust mod

Class

SandboxConfig

Parsed [sandboxes] configuration from config.toml.

Instances are immutable once constructed; providers is wrapped in a MappingProxyType to prevent accidental mutation.

Class

SandboxInstallHint

How to install the package that provides a sandbox backend.

Built-in providers ship as deepagents-code extras (kind="extra"); third-party providers install as arbitrary packages (kind="package"

Class

SandboxProviderMetadata

Static description of a sandbox provider used by the registry.

Lets the CLI and registry describe built-in and config providers without instantiating them (which may require credentials or optional d

Class

SandboxError

Base error for sandbox provider operations.

Class

SandboxNotFoundError

Raised when the requested sandbox cannot be found.

Class

SandboxProvider

Interface for creating and deleting sandbox backends.

Class

CodexAuthStatus

Snapshot of the ChatGPT OAuth login state.

Class

CodexLoginCancelledError

Raised when the user cancels a sign-in flow mid-callback wait.

Class

CodexAuthExpiredError

Raised when a stored ChatGPT token cannot be refreshed.

Distinct from a missing token (FileNotFoundError): a token exists on disk but its refresh token was revoked or expired, so an automatic refre

Class

CodexLoginInteraction

UI hooks for the browser loopback sign-in flow.

Implementations decide how to surface the authorize URL and whether to auto-open a browser. The Textual screen subclasses this; CLI / headless callers

Class

SandboxRegistry

Merged view of built-in, entry-point, and config sandbox providers.

Class

HookSessionIdentity

Live client identity projected into every hook invocation.

Class

HookOutcome

Result of a lifecycle hook that may halt the caller.

Class

PromptOutcome

Result of UserPromptSubmit, including its prompt rewrites.

Class

HooksManager

Owns the Hooks v2 runtime, presenter, hook service, and transcripts.

The presenter is the manager's, not the runtime's: one instance is created once and handed to every runtime the manager loads, so

Class

HookEnvelopeAdapter

Adapt hook invocations and handler output across the wire boundary.

Class

ClientHookStopError

Raised when a client-owned hook stops lifecycle processing.

Class

ClientHookContext

Client state required to create a domain hook invocation.

Class

ClientHookService

Execute client-owned events and apply their common side effects.

User-facing output goes through the runtime's presenter, which the owning HooksManager also holds. The service never wraps or replac

Class

PermissionReviewDecision

Client approval decision compatible with HITL resume payloads.

Class

PermissionHookOutcome

Normalized result shared by TUI and headless permission handling.

Class

PermissionPlan

How one batch of gated tool calls was resolved by hooks.

Indices refer to positions in the originating action_requests list, so a caller can line outcomes back up with its own UI rows.

Class

PreparedHookInvocation

Client-only materialization needed to build one hook wire envelope.

Class

HooksRuntime

Client-owned session runtime around an immutable Hooks snapshot.

Owns configuration snapshot identity, transcript materialization, and the HookEngine. Server-owned lifecycle events reach this runti

Class

HookHandler

One ordered command handler in a configuration snapshot.

Class

HookMatch

Matched handlers for one invocation.

Class

HooksSnapshot

Immutable, declaration-ordered Hooks v2 runtime configuration.

Class

HookEngine

Execute Hooks v2 invocations against one immutable snapshot.

Class

HooksSource

Origin of the matcher groups contributed by one hooks document.

Class

FileHooksSource

A project or user hooks file, which defines no variables.

Class

PluginHooksSource

Origin and environment for groups one enabled plugin contributed.

Class

LoadedHooksConfig

Validated configuration plus load diagnostics and source paths.

Class

HookFulfillmentLedger

Deduplicate hook fulfillment for one client session.

Class

HookInvocationRequest

Request sent for a server-owned hook invocation.

Class

HookInvocationResponse

Response returned for a server-owned hook invocation.

Class

CommandHandlerSpec

Configuration for a synchronous command hook.

Currently only type: "command" is supported. Additional handler types remain a discriminated-union extension point and are rejected until implemented.

Class

MatcherGroup

A matcher and its ordered hook handlers.

Class

HooksConfig

Top-level configuration grouped by hook event.

Class

ResumeRequest

An explicit -r <id> resume request from the command line.

Class

ResumeTarget

A thread that exists and passes the resume-age policy.

Class

ResumeError

A user-facing reason the requested thread cannot be resumed.

Class

SessionCost

Presentation total derived from the latest independent subtotals.

Class

SessionCostTracker

Retain each source independently so delayed updates cannot erase spend.

Class

ResolvedOption

An option paired with its resolved effective value, for display.

Bundles the four values that always travel together through the render helpers as one named record, so they can't be reordered or misa

Class

PrespawnedServer

A start_server_and_get_agent call that spawns before the app loads.

The subprocess boots while the caller imports and paints the app. The start then pauses until adopt releases it, so the health

Class

GitHubProvider

GitHub-hosted MCP: RFC 8628 Device Authorization Grant.

Class

LoginResult

Outcome of a provider's pre-handshake run_login step.

Class

OAuthProvider

Base class for provider-specific OAuth dispatch.

Subclasses override matches plus whichever of client_metadata and run_login they customize. The default implementations cover the spec-compliant

Class

GenericProvider

Fallback provider for spec-compliant MCP servers with no quirks.

Class

SlackProvider

Slack-hosted MCP: loopback authorization using the selected app.

Class

SkillInvocationEnvelope

Structured prompt and checkpoint metadata for a skill invocation.

Class

ResolvedManagedPath

Where managed policy is read from, and whether that location is certain.

fallback holds why the path is a guess, or None when the path is authoritative. A failed registry query leaves the lookup

Class

InterpreterConfig

Configuration consumed by CodeInterpreterMiddleware.

Class

ConfigSources

Managed and user TOML snapshots from one resolution generation.

Class

ManagedConfigError

Raised when an enforced managed source cannot be read safely.

Class

ManagedPolicyError

Raised when managed policy declares a value that cannot be enforced.

The file parses, so provider health is OK; the policy it states is what cannot be applied. A subclass of ManagedConfigError so

Class

ManagedHealth

Provider health and policy enforceability from one managed snapshot.

Class

WriteResult

Outcome of one user config transaction.

Class

ExtensionRuntimeMiddleware

Expose tools registered after the agent graph was built.

Class

TrustPolicy

Default decision for project-authored extension code.

Class

ExtensionSettings

Effective extension configuration for one process.

Class

ExtensionMode

Runtime mode exposed to extensions.

Class

ExtensionAPI

Factory-scoped registrar and read-only session context.

Each extension receives a dedicated instance, which attributes every registration to the extension's source without exposing mutable dcode appl

Class

ThreadAgentSwitchPromptScreen

Ask before changing agents to resume a thread.

Class

MCPLoginCancelledError

Raised by MCPLoginScreen.action_cancel when the user cancels the flow.

Class

MCPLoginScreen

Modal that renders the OAuth login flow and collects user input.

Implements the OAuthInteraction Protocol structurally so a mcp_auth.login(..., ui=screen) call drives the same modal. Each interac

Class

DetailActionActivated

Posted when an _ActionOption is clicked with the mouse.

Class

NotificationDetailScreen

Modal displaying a single notification's title, body, and actions.

Activation returns the chosen ActionId via dismiss(); Esc returns None so the caller can keep the underlying notification cent

Class

LaunchGoalCriteriaPreferenceScreen

One-time choice for how Auto mode handles generated goal criteria.

Class

LaunchNameScreen

Onboarding screen that asks for the user's name.

Dismissal values:

  • Non-empty stripped/title-cased name when the user submits one.
  • "" when the user submits an empty input (continue, but skip na
Class

LaunchDependenciesScreen

Onboarding screen that summarizes installed optional integrations.

Class

ContextUsageScreen

Modal visualization of the current model context window.

Class

CwdSwitchPromptScreen

Modal asking whether to switch cwd when resuming or switching to a thread.

Class

HookTrustScreen

Ask how project hooks in a newly entered workspace should be trusted.

Class

ToolRenderer

Strategy for building a tool's HITL approval widget.

Each renderer maps a tool name to a (widget_class, data) pair that controls what the user sees in the approval box. Tools not registered in `_RE

Class

WriteFileRenderer

Renderer for write_file tool - shows full file content.

Class

TaskRenderer

Renderer for task tool โ€” interrupt description provides full context.

Class

DeleteFileRenderer

Renderer for delete tool - shows removed file content when available.

Class

EditFileRenderer

Renderer for edit_file tool - shows unified diff.

Class

StartupTip

One startup tip displayed above the chat input.

Class

Region

The closed set of LangSmith region selections in the /auth prompt.

Class

ResolvedEndpoint

Outcome of resolving the region selector to an endpoint to persist.

endpoint is the canonical URL to store (empty for the US SaaS default); error is a user-facing message when a Custom URL is mis

Class

AuthResult

Outcome of an AuthPromptScreen interaction.

The three outcomes need to stay distinguishable because callers in the recovery path retry the original failing operation only on SAVED โ€” retrying afte

Class

AuthConfirmScreen

Confirm before launching an authentication flow for a model.

A provider-agnostic gate shown when a selected model needs credentials that aren't detected, and starting the auth flow is disruptive enou

Class

DeleteCredentialConfirmScreen

Confirmation overlay shown before clearing a stored credential.

Patterned on DeleteThreadConfirmScreen so the destructive prompt feels consistent across the app. Always dismisses with True on con

Class

AuthPromptScreen

Modal that captures and persists an API key for one provider.

Dismissal values are members of AuthResult so callers in the recovery path can distinguish "user just saved a key โ€” retry the failed op

Class

AuthManagerScreen

Modal that lists configured providers and lets the user manage keys.

Reachable via the /auth slash command. Always dismisses with None; state changes are persisted by AuthPromptScreen and refle

Class

CredentialSaved

Posted when a key prompt successfully persists credentials.

Carries the /auth config key that was saved so the app can react to credentials that gate spawn-time behavior โ€” e.g. a Tavily key that en

Class

CredentialDeleted

Posted when a key prompt deletes stored credentials.

Carries the /auth config key that was deleted so the app can clear any in-memory state derived from the now-removed credential.

Class

InstallPackageConfirmScreen

Confirmation overlay for installing an arbitrary --package.

Dismisses with True when the user confirms and False when the user cancels. Esc is treated as cancel so the user is never forced into

Class

InstallProviderConfirmScreen

Confirmation overlay for installing a model provider's extra.

Shown from the model selector when the user picks a model whose provider integration package is not installed. Dismisses with True to i

Class

UpdateProgressScreen

Modal that shows self-update progress and a bounded log tail.

Class

AgentSelectorScreen

Modal dialog for switching between available agents.

Displays agent profiles from ~/.deepagents/ (directories that contain an AGENTS.md marker) in an OptionList. Returns the selected agent name

Class

GoalReviewAccepted

Widget result when the generated criteria are accepted unchanged.

Class

GoalReviewEdited

Widget result when the user submits revised criteria.

Class

GoalReviewRejected

Widget result when the user rejects criteria with feedback.

Class

GoalReviewCancelled

Widget result when the user cancels the proposal.

Class

GoalReviewTextArea

Text input that keeps goal-review edit keystrokes inside the editor.

Class

Submitted

Posted when the user presses Enter to submit goal-review text.

Class

CancelEdit

Posted when Escape should leave goal criteria edit mode.

Class

GoalReviewMenu

Inline review widget for generated goal acceptance criteria.

Class

Decided

Message sent when the user accepts, edits, or cancels.

Class

PasteBurstTextArea

TextArea that detects paste-like keystroke bursts.

Subclasses drive the state machine from their own _on_key by calling the helper methods here, and override the policy hooks (`in_slash_command

Class

CollapsingPasteTextArea

Paste-aware text area that collapses large pastes into placeholders.

The full pasted text is stored off-screen in _pasted_contents and a compact [Pasted text #N] placeholder is shown in its place

Class

MessageType

Types of messages in the chat.

Class

ToolStatus

Status of a tool call.

Class

MessageData

In-memory message data for virtualization.

This dataclass holds all information needed to recreate a message widget. It is designed to be lightweight so that thousands of messages can be stored witho

Class

MessageStore

Manages message data and widget window for virtualization.

This class stores all messages as data and manages a sliding window of widgets that are actually mounted in the DOM.

Class

NotificationActionResult

Dismissal payload identifying which action the user picked.

The screen returns this via dismiss() when the user drills into a notification and selects an action; it returns None when the user can

Class

NotificationRowClicked

Posted when a notification row is clicked with the mouse.

Class

NotificationSuppressRequested

Posted when the user picks SUPPRESS from a notification's detail modal.

The center does not dismiss on SUPPRESS because the remaining notifications should still be reachable in place. The app handles

Class

NotificationSettingsRequested

Posted when the user toggles the settings disclosure row.

The app responds by refreshing the open center's settings state from config; the center also handles the message itself so toggles stay respo

Class

NotificationActionRequested

Posted for an action that opens a follow-up modal in place.

Some actions (those in IN_PLACE_ACTIONS, currently ENTER_API_KEY) push another modal, such as the API-key prompt, on top of the still-o

Class

NotificationCenterScreen

Shared hub for pending notifications and warning preferences.

Each PendingNotification is a single row followed by a settings disclosure row. Up/Down (or j/k) moves the cursor; Enter or click drill

Class

MCPReconnectPromptScreen

Modal asking whether to restart the server after an MCP login.

Dismisses with "reconnect" when the user accepts the restart and "later" when the user defers. Esc is treated as "later" so the user

Class

MCPDisableReconnectPromptScreen

Modal asking whether to reconnect after /mcp disable/enable toggles.

Shown when the user closes the /mcp viewer with pending F2 disable-state changes but without pressing Ctrl+R, so the toggl

Class

MCPReconnectForceConfirmScreen

Confirmation overlay for /mcp reconnect --force with no pending login.

Guards a fat-fingered force-restart when nothing is actually queued.

Class

PromptFilterInput

Prompt filter with standard modified-Backspace word deletion.

Class

PromptSearchInput

Query field for the inline prompt search panel.

Plain Input apart from the class name, which lets ChatInput filter Input.Changed / Input.Submitted messages down to this field, plus bindings f

Class

AbandonSearch

Posted on Escape or empty-query Backspace, to close the search.

Class

PromptSearchOption

One clickable prompt row in the inline search panel.

Class

Clicked

Message sent when a prompt row is clicked.

Class

PromptSearchPanel

Inline prompt history search rendered above the input row.

Display-only: ChatInput owns the query, filtered snapshot, and selection, drives key handling, and re-opens the modal tier. The panel mirr

Class

RowsChanged

Message sent when the panel's rendered row count changes.

Class

OptionSelected

Message sent when a prompt row is clicked in the panel.

Class

MCPToolItem

A selectable tool item in the MCP viewer.

Class

MCPServerErrorScreen

Read-only modal for a failed MCP server's error details.

Class

MCPServerHeaderItem

A selectable server-header row in the MCP viewer.

Cursor-selectable so users can navigate to every server โ€” even those in unauthenticated or error states which have no tool rows by the `MCPServer

Class

MCPViewerScreen

Modal viewer for active MCP servers and their tools.

Displays servers grouped by name with transport type and tool count. Navigate with arrow keys, Enter to expand/collapse tool descriptions, start i

Class

ThemeSelectorScreen

Modal dialog for theme selection with live preview.

Displays available themes in an OptionList. Navigating the option list applies a live preview by swapping the app theme. Returns the selected the

Class

ApprovalMenu

Approval menu using standard Textual patterns.

Key design decisions (following mistral-vibe reference):

  • Container base class with compose()
  • BINDINGS for key handling (not on_key)
  • can_focus_chil
Class

Decided

Message sent when user makes a decision.

Class

SkillTrustScreen

Approval overlay for a skill resolving outside trusted directories.

Dismisses with True when the user allows the resolved target and False when the user declines. Esc is treated as deny so the us

Class

AskUserTextArea

Free-form answer input for ask-user questions.

Adds two behaviors over the shared base:

  • When the cursor is on the first or last line of a choice question's Other free-text input, Up/Down are han
Class

Submitted

Posted when the user presses Enter to submit an ask-user answer.

Class

AskUserMenu

Interactive widget for asking the user questions.

Supports text input, multiple choice (pick exactly one), and multi-select (toggle one or more) questions. Choice questions always include an "Other"

Class

Answered

Message sent when user submits all answers.

Class

Cancelled

Message sent when user cancels the ask_user prompt.

Class

ChangelogClicked

Posted when the changelog row is clicked with the mouse.

Class

UpdateAvailableScreen

Modal dedicated to the update-available notification.

Renders the entry's title and body, a "View changelog" row, and one row per configured action. Dismisses with the selected ActionId, or None

Class

Spinner

Animated spinner using charset-appropriate frames.

Class

LoadingWidget

Animated loading indicator with status text and elapsed time.

Displays: Thinking... (3s, esc to interrupt)
Class

GoalStatusPanel

Keep the current goal and lifecycle state visible above the input.

Class

AutoModeNoticeScreen

In-TUI first-run notice describing what Auto mode does.

Dismisses with True on Enter (confirm switch to Auto) and False on Esc (cancel, stay in current mode). Programmatic dismiss may yield `None

Class

EffortSelectorScreen

Modal dialog for selecting a reasoning effort level.

Class

YoloModeNoticeResult

Outcome of the YOLO first-enable notice.

ACKNOWLEDGE enables YOLO (and records the acknowledgement); MANUAL switches to Manual instead; CANCEL keeps the previous mode. A programmatic dismiss ma

Class

YoloModeNoticeScreen

In-TUI acknowledgement shown before unrestricted YOLO becomes active.

Dismisses with YoloModeNoticeResult.ACKNOWLEDGE on Enter (acknowledge and enable), YoloModeNoticeResult.MANUAL on m (switch

Class

JsEvalStdout

Captured stdout printed during a js_eval evaluation.

Class

JsEvalResult

A successful js_eval evaluation result.

Class

JsEvalError

An error raised during a js_eval evaluation.

Class

CodexAuthScreen

Run the ChatGPT OAuth Authorization Code Flow with PKCE inline.

Dismissal value:

  • True: a token was saved (caller should refresh provider lists / retry the operation that needed the credentia
Class

CodexSignedInAction

Outcome of the CodexSignedInScreen quick-action overlay.

Encoded as an enum (mirroring AuthResult) rather than bare strings so a typo in either the producing action_* method or the consuming di

Class

CodexSignedInScreen

Quick-action overlay shown when openai_codex is already signed in.

Dismissal values:

  • CodexSignedInAction.SIGN_OUT: delete the stored token.
  • CodexSignedInAction.REAUTH: open the OAuth flow
Class

RestartPromptScreen

Modal asking whether to restart the server for a spawn-time change.

Serves both the post-install offer and the post-/auth web-search offer; the caller supplies the title verb and body copy.

Di

Class

CompletionOption

A clickable completion option in the autocomplete popup.

Class

Clicked

Message sent when a completion option is clicked.

Class

InputActionButton

Small clickable button shown at the right edge of the chat input row.

Provides discoverable mouse alternatives to keyboard shortcuts for clearing ([ X ]) and copying ([ COPY ]) the current draft.

Class

Clicked

Message sent when an input action button is clicked.

Class

CompletionPopup

Popup widget that displays completion suggestions as clickable options.

Class

RowsChanged

Message sent when the popup's visible row count changes.

Deduplicated by the sender, so receiving this always means the rendered row count actually moved.

Class

OptionClicked

Message sent when a completion option is clicked.

Class

ChatTextArea

TextArea subclass with custom key handling for chat input.

Modifier-Enter / Ctrl+J newline bindings and the VSCode backslash+enter fallback are inherited from PasteBurstTextArea.

Class

Submitted

Message sent when text is submitted.

Class

HistoryPrevious

Request previous history entry.

Class

HistoryNext

Request next history entry.

Class

Typing

Posted when the user presses a printable key or backspace.

Relayed by ChatInput as ChatInput.Typing for the app to track typing activity.

Class

ChatInputBox

Bordered box that owns the chat composer size.

Sizing is either automatic (content-driven, the default) or manual, and _requested_height is the discriminator: None means automatic.

A manual size

Class

ChatInputResizeHandle

Drag target docked over the chat input's top border.

Only the background is transparent: the handle sits on the layer above the box's border and would blank the line it covers, so render repaints t

Class

DragStarted

Message sent when a resize drag begins.

Class

Dragged

Message sent with the current drag delta.

Class

DragEnded

Message sent when a resize drag stops, however it stopped.

Class

HoverChanged

Message sent when resize hover feedback changes.

Class

ToggleExpanded

Message sent when expanded sizing should be toggled.

Class

ChatInput

Chat input widget with prompt, multi-line text, autocomplete, and history.

Features:

  • Multi-line input with TextArea
  • Enter to submit, modifier key for newlines (see config.newline_shortcut)
  • Up
Class

Submitted

Message sent when input is submitted.

Class

ModeChanged

Message sent when input mode changes.

Class

Typing

Posted when the user presses a printable key or backspace in the input.

The app uses this to delay approval widgets while the user is actively typing, preventing accidental key presses (e.g. y, n

Class

SelectionAction

Floating "Ask about this" button for the current selection.

It snapshots the selected text because clicking it clears the screen selection before the Click arrives.

Class

Ask

Request insertion of the captured selection into the chat input.

Class

UpdateBeforeDependenciesConfirmScreen

Confirmation overlay before /update --deps upgrades dcode itself.

Dismisses with True when the user chooses the app update first and False when they prefer to refresh dependencies for the curre

Class

RefreshDependenciesConfirmScreen

Confirmation overlay for a dependency refresh.

Dismisses with True when the user confirms and False when the user cancels. Esc is treated as cancel so the user is never forced into a refresh they

Class

Theme

Theme facts that change block geometry, colors, or fence highlighting.

Block backgrounds and borders with alpha are inline styles rather than component classes: a partial component style pre-blends i

Class

Layout

Lay out parsed blocks at a width, following Textual's block CSS.

Class

Node

A parsed markdown block.

Class

FinalMarkdown

A finished markdown reply drawn as one widget.

Looks like Textual's Markdown (validated against Textual 8.2.8) but holds no child widgets. Long fence lines fold instead of scrolling.

Class

Row

One rendered line of the reply.

parts holds (content, selectable) pairs. Selectable parts carry the selection offset meta, so they take the text pointer, mouse selection, and copy; the others (

Class

Block

Rows of a laid-out block plus the margins Textual's CSS gives it.

Class

Table

Lay out a table like MarkdownTableContent's keylined grid.

Class

PromptRow

One prompt summary row.

Public so its Clicked message resolves to the idiomatic on_prompt_row_clicked handler; nothing outside this module builds one.

Class

Clicked

Message sent when a prompt row is clicked.

Class

PromptClipboardScreen

Filter, preview, copy, or select a previously submitted prompt.

Class

MCPServersScreen

Show a live, scrollable, copyable list of MCP server statuses.

Class

ResumeBlockedScreen

Ask whether to start a new session or exit after a blocked resume.

Class

ModelSwitchWarningScreen

Confirm a model switch that preserves a large conversation context.

Class

BtwTextArea

Side-question editor with the shared multiline and paste conventions.

Class

Submitted

Posted when Enter submits the complete side question.

Class

BtwScreen

Chat independently of the main run with restorable side exchanges.

Class

CostBreakdownScreen

Modal showing the copyable entire-thread token and cost breakdown.

Class

ColdCacheChoice

How to resolve a cold prompt-cache warning.

Class

ColdCacheWarningScreen

Offer actions for a turn whose prompt cache may be cold.

Dismisses with the chosen ColdCacheChoice, or None on a programmatic pop. Esc is mapped to CANCEL so the user is never forced into a spe

Class

ThreadNameScreen

Confirm or edit a suggested name without changing the thread yet.

Class

ResumeCompactPromptScreen

Ask whether to compact a just-resumed thread before the next turn.

Class

SessionCostWarningScreen

Keep the session cost warning visible until acknowledged.

Class

PluginManagerScreen

Arrow-key navigable plugin manager for /plugins.

Closing runs the optional check_reload_required callback while this screen stays mounted. Changed plugin state transitions in place to a reload pr

Class

PluginTabSelected

Posted when a plugin manager tab label is clicked.

Class

PluginTabLabel

Mouse-clickable tab label in the plugin manager header.

Functions

Function

get_slash_commands

Return autocomplete entries for slash commands.

Function

parse_skill_command

Extract skill name and args from a /skill:<name> command.

Function

build_skill_commands

Build autocomplete entries for discovered skills.

Each skill becomes a /skill:<name> entry with its description and the skill name as a hidden keyword for fuzzy matching. Plugin skills keep their n

Function

strip_media_placeholders

Remove display-only media placeholders from user text.

Placeholders like [image 1] are inserted into the terminal input purely for display; the actual media travels as structured content blocks. Th

Function

get_clipboard_image

Attempt to read an image from the system clipboard.

Supports macOS via pngpaste or osascript.

Function

get_image_from_path

Read and encode an image file from disk.

Function

get_video_from_path

Read and encode a video file from disk.

Function

is_media_path

Return whether a path's extension is a known image or video extension.

This is a cheap, extension-only check (no file read or decode). Use it to classify a dropped file path as media without loading

Function

get_media_from_path

Try to load a file as an image first, then as a video.

Function

encode_to_base64

Encode raw bytes to a base64 string.

Function

create_multimodal_content

Create multimodal message content with text, images, and videos.

Function

get_disabled_servers

Return the server names disabled by the user or by managed config.

Function

is_server_disabled

Return True when server_name is in the disabled set.

Function

set_server_disabled

Add or remove server_name from the persistent disabled set.

Refuses to write when the existing config cannot be parsed so a corrupt or permission-denied file is not silently overwritten โ€” that woul

Function

auth_path

Return the resolved path to the credential store (auth.json).

Resolved at call time (not import time) so tests can redirect storage by monkeypatching `deepagents_code.model_config.DEFAULT_STATE_DIR

Function

load_credentials

Return all stored credentials keyed by provider name.

Function

get_stored_key

Return the stored API key for provider, or None if unset.

Returns None for stored OAuth credentials too โ€” callers that need OAuth tokens should read load_credentials() directly and narrow on

Function

get_stored_base_url

Return the base URL paired with provider's stored key, or None.

Returns None both when no key is stored and when a key is stored without an accompanying base URL (the user left the field blank,

Function

get_stored_project

Return the LangSmith project paired with provider's stored key, or None.

Returns None when no key is stored and when a key is stored without a custom project (the user left the field blank, mea

Function

set_stored_key

Persist an API key for provider.

Empty / whitespace-only keys are rejected so callers don't accidentally write a sentinel that masks a working environment variable (see apply_stored_credentials i

Function

delete_stored_key

Remove a stored credential for provider.

Function

list_configured_providers

Return providers that currently have a stored credential, sorted.

Function

generate_thread_name

Generate a safe name using the selected model without conversation callbacks.

Cancellation waits for model initialization, which can update process-wide provider settings, even if the generation time

Function

classified_config_fields

Classify every ServerConfig field for the policy/runtime split.

Every dataclass field must land in exactly one bucket so the fingerprint split cannot silently drop a setting. A field missing from a

Function

list_subagents

List subagents from user and/or project directories.

Scans for subagent definitions in the provided directories. Project subagents override user subagents with the same name.

Function

escape_markdown

Normalize line breaks and escape markdown syntax in external text.

Function

resolve_mcp_server_env

Resolve ${VAR} references in one MCP server's supported fields.

Interpolates the command, url, args, env, headers, and oauth fields (see _interpolate_env for the reference syntax); ev

Function

output_truncation

Classify whether the provider stopped this message early.

Reads the raw provider metadata on response_metadata, so it also works on the streamed chunk that carries the stop reason.

Function

has_visible_reply

Return whether a message has reply text or a tool call to act on.

Reasoning alone does not count: the user still gets no answer.

Function

describe_truncation

Return a short, user-facing explanation of a truncation.

Function

supports_kitty_keyboard_protocol

Return whether the attached terminal should be treated as kitty-aware.

Detection is side-effect free: it never writes escape sequences or reads queued input bytes. That means it may under-detect some

Function

onboarding_marker_path

Return the first-run onboarding marker path.

Function

has_completed_onboarding

Return whether the user has completed onboarding.

Function

mark_onboarding_complete

Persist that onboarding has completed.

Function

goal_auto_accept_prompt_marker_path

Return the goal criteria preference prompt marker path.

Function

has_shown_goal_auto_accept_prompt

Return whether the goal criteria preference prompt was answered.

Function

mark_goal_auto_accept_prompt_shown

Persist that the goal criteria preference prompt was answered.

Function

write_onboarding_name_memory

Persist the optional onboarding name into user agent memory.

Empty or whitespace-only names are skipped (no file is written).

Function

extract_onboarding_name_block

Return the managed onboarding name block (markers included) if present.

Function

strip_onboarding_name_markers

Remove every onboarding-name marker occurrence from text.

A partial edit can leave a lone start or end marker behind. Stripping all marker strings before re-inserting the managed block keeps re-ins

Function

should_run_onboarding

Return whether onboarding should open at interactive startup.

DEEPAGENTS_CODE_ONBOARDING overrides the marker in both directions: a truthy value forces the flow open on every startup, and a falsy v

Function

coerce_model_spec

Narrow a persisted model-spec channel to a usable value.

Shared by _rubric_model_spec and _model_spec. INHERIT_RUBRIC_MODEL passes through unchanged; callers compare the result against it thems

Function

coerce_goal_proposal_kind

Narrow a persisted proposal kind to a known value.

Function

coerce_goal_status

Narrow a persisted goal-status value to a known GoalStatus.

A corrupt or forward-version checkpoint can carry an unexpected status string (or a non-string). Coercing to None rather than passing t

Function

format_auth_badge

Format an auth manager badge for a provider.

Used by the /auth manager, where each provider renders a bracketed, styled badge (e.g. [stored], [env set: ANTHROPIC_API_KEY], [missing]).

Function

format_auth_indicator

Format a model selector provider-header indicator.

Used by /model, where the indicator is plain text shown next to the provider name. Returns an empty string for CONFIGURED providers, which need

Function

install_untraced_inline_override

Install the override for this process.

The override is process-global. Call it only in the server process, which owns its event loop and pins one tracing configuration for its lifetime.

Function

stream_trace_config

Mark a graph invocation as an interrupt-resume round when it is one.

A turn's initial run stays untagged, so the tag identifies continuations rather than the turn itself. Keep that asymmetry: tagging

Function

retention_bucket_for_level

Return the bounded retention bucket key for a log level name.

Function

install_log_buffer

Attach the in-memory buffer handler to target (idempotent).

Lowers target's level to at most INFO so the console shows a useful tail even when DEEPAGENTS_CODE_DEBUG is off; never raises the l

Function

get_log_buffer

Return the installed buffer handler.

Function

supported_efforts_for_model

Return the ordered reasoning effort levels supported by model_spec.

Function

available_efforts_for_model

Return profile efforts compatible with the effective thinking mode.

Function

default_effort_for_model

Return the profile's reasoning effort default independently of its levels.

Function

is_effort_supported_for_model

Return whether effort is a supported level for model_spec.

Function

has_explicit_effort_model_params

Return whether canonical or native effort parameters are present.

Function

current_effort_from_model_params

Read canonical or native effort settings using integration precedence.

This compatibility reader does not modify the supplied parameters. It only reports settings that may come from --model-params,

Function

without_effort_model_params

Remove canonical and native effort settings without changing siblings.

Function

with_effort_model_params

Replace existing effort settings with the standard flat parameter.

Function

install_run_queue_wakeup

Patch the in-memory run queue to start new runs without the poll delay.

Function

count_lines

Return the number of newline characters in text.

Function

should_collapse_paste

Return whether text should be collapsed into a placeholder.

Collapses when the text exceeds the character threshold or the line threshold.

Function

format_paste_ref

Format a paste placeholder reference string.

Function

expand_paste_refs

Replace all paste placeholders in text with their full content.

Placeholders whose IDs are not in pasted_contents are left unchanged.

Function

create_web_search_tool

Bind web search to one workspace credential.

The schema is taken from web_search via functools.wraps so the built-in and workspace-bound variants can never present different arguments. The two al

Function

is_web_search_tool

Return whether candidate is a built-in or workspace-bound search tool.

Function

get_current_thread_id

Get the current Deep Agents thread ID for LangSmith or MCP tooling.

Function

web_search

Search the web for current information.

Function

fetch_url

Fetch a URL and return the page content as markdown.

Function

reasoning_text

Extract renderable reasoning text from a content block.

Function

message_text

Return ordinary text from a local or serialized message.

Function

message_additional_kwargs

Return message metadata from a local or serialized message.

Function

message_source

Return a message's lc_source value when present.

Function

is_human_message

Return whether a local or serialized message has the human role.

Function

is_goal_internal_message

Return whether a message is a goal-state notice or continuation.

Function

is_goal_state_message

Return whether a message claims to be a goal-state notice.

Function

latest_human_is_unsaved_goal_continuation

Return whether the latest human turn carries an unsaved goal fallback.

Function

is_conversation_control_message

Return whether a message should be omitted from derived transcripts.

Function

is_internal_message

Return whether a message is hidden from user-facing session history.

Function

is_pinned_skill_message

Return whether a message carries SDK-pinned skill instructions.

The SDK appends this message after the user prompt that requested the pin, so lookups for the latest user turn must skip it.

Function

build_goal_continuation

Build a one-time goal continuation.

Function

validated_summarization_cutoff

Return a valid absolute cutoff index from a summarization event.

This is the canonical explanation of the cutoff rule; the notice predicates and the /offload accounting point here rather than resta

Function

summarization_cutoff

Return the absolute cutoff index of a _summarization_event.

The degrading variant of validated_summarization_cutoff, which documents the rule and why an out-of-bounds cutoff is rejected rather th

Function

log_malformed_summarization_event

Record that a restored summarization event was discarded.

Dropping the event also drops its summary_message, so the next request re-sends the whole untrimmed history. That is a large, silent token

Function

project_goal_state

Project authoritative channels into deterministic notice state.

Function

serialize_goal_state

Serialize authoritative notice state with canonical JSON formatting.

Function

goal_state_fingerprint

Return a stable digest for authoritative goal/rubric state.

Function

has_goal_or_rubric_state

Return whether state contains a goal or an active rubric.

Function

notice_text_sections

Select the user-controlled text a notice built from projected embeds.

The objective and status note are withheld unless the goal is actionable, while criteria are embedded whenever a rubric is acti

Function

goal_notice_size_error

Return why state cannot render as a safe notice, or None when it can.

Collapses the project-then-validate sequence its callers each performed separately. Their correctness depended on all of them

Function

build_goal_state_notice

Build one canonical append-only goal/rubric state notice.

Function

goal_state_notice_info

Return validated canonical notice metadata from a message.

Function

latest_goal_state_notice

Return the newest valid notice and its raw-history index.

Function

latest_goal_state_message_index

Return the newest goal-state source index, including invalid messages.

Function

is_oversized_goal_state_message

Return whether embedded goal-state text violates current size limits.

Function

superseded_goal_state_placeholder

Build a bounded same-index stand-in for an oversized prior notice.

An oversized notice must stop being model-visible, but it cannot be removed from a model request. The summarizer picks its cutoff fr

Function

build_snapshot

Extract the allowlisted, reportable policy snapshot from a payload.

Function

snapshot_for_payload

Build the snapshot persisted with a workspace binding.

Function

diff_snapshots

Compare a persisted snapshot against the current one.

Fields present in the snapshots are compared with values; fields named in changed_names (e.g. fingerprint-only or path-valued fields detected b

Function

join_content

Join Content lines with newlines (Content.join is instance-level).

Function

format_diagnostics_content

Render workspace refusal diagnostics as markup-safe TUI content.

Every dynamic value (field names, allowlisted values) flows through Content.from_markup $var substitution, so square brackets in a

Function

reserved_agent_dir_names

Return non-agent directory names reserved by the app under the profile root.

These directories are created by the app for its own use and must never appear in the agent picker โ€” even if they contain

Function

is_reserved_agent_dir_name

Report whether name resolves onto an app-owned profile directory.

Use this instead of name in reserved_agent_dir_names() wherever the input is a user-supplied agent name: the membership test is e

Function

canonical_workspace_config

Return bounded canonical JSON and its SHA-256 fingerprint.

Function

canonical_fingerprint

Fingerprint value with the canonical workspace serialization.

Function

resolve_workspace

Resolve a client-supplied cwd into a canonical workspace binding.

cwd is untrusted and is validated here. workspace_config is not: every caller passes server-resolved policy. A client claim is ve

Function

get_snapshot_for_binding

Read the persisted comparison snapshot recorded for a binding.

Function

drifted_project_fields

Name the project-scoped fields that drifted from their binding.

The refusal these feed is safe either way, but it is not diagnosable without the field names: the resolution reads the extension trust

Function

bind_thread_workspace

Atomically create or verify a thread workspace binding.

Function

get_thread_workspace

Read a thread's durable workspace binding.

Function

require_thread_workspace

Validate run context against the durable workspace binding.

Function

add_json_output_arg

Add a --json flag to an argparse parser.

Function

write_json

Write a JSON envelope to stdout and flush.

The envelope is a single-line JSON object with a stable schema:

{"schema_version": 1, "command": "...", "data": ...}
Function

normalize_mcp_arguments

Drop empty-string values for optional MCP tool params.

Some MCP servers (e.g. Slack's slack_search_public_and_private) validate optional ID-typed params with value is not a channel ID when the mo

Function

mcp_tool_middleware

Build the middleware wrapping every MCP tool call.

Function

resume_cutoff_explanation

Explain why the active resume cutoff exists and who set it.

Function

resume_cutoff

Resolve the strictest configured thread-resume cutoff.

Function

thread_resume_block

Return why policy blocks resuming a thread, if it does.

Function

classify_thread_cwd

Classify a stored thread cwd against the current cwd.

Function

resolve_mcp_config

Resolve an MCP config dict for login without printing anything.

Function

select_server

Pull server out of a resolved config and validate its shape.

Function

format_policy_error_notice

Build the CLI-style hint for an unreadable user trust policy.

Surfaced by dcode mcp login so a config.toml read failure is never swallowed just because a user-level config or an env-enabled serve

Function

format_untrusted_project_notice

Build the CLI-style hint string for skipped project server entries.

Function

format_legacy_ignored_notice

Build the CLI-style hint for servers dropped by the legacy-key removal.

Mirrors the resolve_and_load_mcp_tools migration message so non-interactive dcode mcp login explains why a previously allow

Function

format_legacy_env_ignored_notice

Build the CLI-style hint for the renamed, now-ignored env var.

Mirrors format_legacy_ignored_notice for the env surface so a user who still exports DEEPAGENTS_CODE_ENABLED_PROJECT_MCP_SERVERS lea

Function

format_malformed_approvals_notice

Build the CLI-style hint for dropped malformed saved approvals.

Mirrors format_legacy_ignored_notice so non-interactive dcode mcp login explains why a previously-approved server stopped loading (

Function

format_load_errors_notice

Build the CLI-style hint for discovered configs that failed to load.

Surfaced by dcode mcp login on a partially successful resolution so a broken .mcp.json is reported instead of silently dropped

Function

build

Function

get_server_runtime

Return resources shared by the graph and dcode operation routes.

Builds once and caches. A construction failure is converted into a startup-error marker (scraped by the parent app process) before `sy

Function

make_graph

Return the graph after validating execution workspace context.

Function

startup_error_from_output

Restore a typed recovery error, falling back to the ordinary log summary.

Function

emit_startup_failure

Report a server graph startup failure to the parent app process.

Emits the full traceback for logs/debugging, then a single-line {STARTUP_ERROR_MARKER}{type}: {summary} line that `server._extract_s

Function

stdout_driver_class

Return a Textual Unix driver class that renders through stdout.

Textual's LinuxDriver writes every frame to sys.__stderr__, while TerminalStderrGuard points fd 2 at /dev/null โ€” so under an ac

Function

delete_cost

Erase spend in the caller's thread-deletion transaction.

Retain only an ID tombstone to discard pending retries and late provider completions, including answers that have not written their first char

Function

load_cost

Retry pending settlements and read the durable subtotal.

Function

answer_with_cost

Save completed usage before delivering an answer or finishing cancellation.

Function

invoked_name

Return the command name this process was launched with.

Cached: sys.argv[0] and the launch environment are fixed for the life of the process. Tests that vary either must call `invoked_name.cache_cl

Function

log_nonstandard_invoked_name

Note a non-standard launch name in the Debug Console, once per process.

Cached so repeated calls cannot repeat the note; tests that vary the launch environment must call `log_nonstandard_invoked_name

Function

load_model_catalog

Discover models in the caller's active environment without constructing them.

Function

detect_dangerous_unicode

Detect deceptive or hidden Unicode code points in text.

Function

strip_dangerous_unicode

Remove known dangerous/invisible Unicode characters from text.

Function

sanitize_control_chars

Neutralize control characters and deceptive Unicode in untrusted text.

Untrusted strings (MCP server errors, config-file contents, tool output) can carry ANSI escape sequences, other control characte

Function

is_safe_file_path

Reject deceptive controls and line separators without rewriting file paths.

Function

render_with_unicode_markers

Render hidden Unicode characters as explicit markers.

Example output: abc<U+202E RIGHT-TO-LEFT OVERRIDE>def.

Function

summarize_issues

Summarize Unicode issues for warning messages.

Deduplicates by code point. When more than max_items unique entries exist, the summary is truncated with a +N more entries suffix.

Function

format_warning_detail

Join safety warnings into a display string with overflow indicator.

Function

check_url_safety

Check a URL for suspicious Unicode and domain spoofing patterns.

Function

iter_string_values

Flatten nested dict/list structures into key-path/string pairs.

Function

looks_like_url_key

Return whether a key path suggests URL-like content.

Function

positive_int

Argparse type for integer arguments that must be >= 1.

Function

non_negative_int

Argparse type for integer arguments that must be >= 0.

Function

shell_allow_list_arg

Argparse type that validates a shell allow-list without normalizing it.

Function

show_help

Show top-level help information.

Function

show_list_help

Show help information for the list subcommand.

Invoked via the -h argparse action or directly from cli_main.

Function

show_agents_help

Show help information for the agents subcommand.

Function

show_reset_help

Show help information for the reset subcommand.

Function

show_skills_help

Show help information for the skills subcommand.

Invoked via the -h argparse action or directly from execute_skills_command when no subcommand is given.

Function

show_plugins_help

Show help information for the plugin / plugins subcommand.

Function

show_skills_list_help

Show help information for the skills list subcommand.

Function

show_skills_create_help

Show help information for the skills create subcommand.

Function

show_skills_info_help

Show help information for the skills info subcommand.

Function

show_skills_delete_help

Show help information for the skills delete subcommand.

Function

show_skills_trust_help

Show help information for the skills trust subcommand.

Function

show_update_help

Show help information for the update subcommand.

Function

show_doctor_help

Show help information for the doctor subcommand.

Function

show_tools_help

Show help information for the tools subcommand.

Function

show_tools_list_help

Show help information for the tools list subcommand.

Function

show_tools_install_help

Show help information for the tools install subcommand.

Function

show_install_help

Show help information for the install subcommand.

Function

show_uninstall_help

Show help information for the uninstall subcommand.

Function

show_mcp_help

Show help information for the mcp subcommand.

Function

show_mcp_login_help

Show help information for the mcp login subcommand.

Function

show_mcp_config_help

Show help information for the mcp config subcommand.

Function

show_config_help

Show help information for the config command.

Invoked via the -h argparse action. Kept import-light so help remains on the startup fast path.

Function

show_auth_help

Show help information for the auth subcommand.

Invoked via the -h argparse action, the startup fast-path, or run_auth_command when no auth subcommand is given. Kept import-light so it stays on

Function

show_threads_help

Show help information for the threads subcommand.

Invoked via the -h argparse action or directly from cli_main when no threads subcommand is given.

Function

show_threads_delete_help

Show help information for the threads delete subcommand.

Function

show_threads_list_help

Show help information for the threads list subcommand.

Function

install_delta_history_forwarding

Make langgraph-api's checkpointer adapter use the inner saver's fast path.

Call this in the server process before the adapter serves requests. It is idempotent and a no-op when the adapter is missing

Function

is_truncation_marker

Return whether a diff line is the truncation marker.

One predicate for both readers, which previously disagreed: the renderer stripped, the recount compared exactly.

Exact, deliberately. `compute_un

Function

split_diff_lines

Split a unified diff back into the lines it was assembled from.

Deliberately not splitlines(). Every diff reaching this function is "\n"-joined from lines that themselves came from splitlines()

Function

file_header_indexes

Locate paired file headers immediately preceding a hunk.

A ---/+++ pair is only a file header when it appears outside a hunk body โ€” a diff of a file that itself contains such lines would otherw

Function

count_diff_change_lines

Count added and removed lines in unified-diff lines.

Function

get_server_project_context

Read the server project context from environment transport data.

Function

find_project_root

Find the project root by looking for git metadata.

Function

find_project_agent_md

Find project-specific AGENTS.md file(s).

Checks two locations and returns ALL that exist:

  1. project_root/.deepagents/AGENTS.md
  2. project_root/AGENTS.md

Both files will be loaded and combined if bo

Function

parse_cache_activity

Validate a checkpointed cache activity record.

Function

debug_stand_in_policy

Build the placeholder policy used by DEEPAGENTS_CODE_DEBUG_COLD_CACHE.

Keeps the modal reachable on providers with no documented cache policy. Lives here rather than in the caller so the Anthropic

Function

endpoint_cache_identity

Return a stable identity for the endpoint that owns a prompt cache.

A missing endpoint means the provider's default API. Only scheme, host, port, path and a digest of the query are significant; every

Function

load_trusted_cache_endpoints

Read [warnings].trusted_cache_endpoints as a set of hostnames.

Entries declare that an alternate endpoint forwards cache-affecting request fields (cache_control, prompt_cache_key, `prompt_cache

Function

resolve_prompt_cache_policy

Resolve a documented cache policy for one effective model invocation.

Policies apply only when the endpoint is the provider's official API or a user-declared trusted endpoint (see `load_trusted_cache

Function

cache_identity_params

Project the params that participate in prompt-cache identity.

Function

estimate_rewarm_cost

Estimate cold input spend and the incremental cost over a cache hit.

Prices are derived by running two synthetic usage payloads through the ordinary estimate_cost path -- one billed as a full cache

Function

parse_cache_timestamp

Parse a persisted UTC timestamp, rejecting malformed or naive values.

Function

format_cache_age

Format elapsed cache age for compact modal copy.

Function

format_cache_window

Format a provider cache window for compact modal copy.

Function

load_async_subagents

Load async subagent definitions from config.toml.

Reads the [async_subagents] section where each sub-table defines a remote LangGraph deployment:

[async_subagents.researcher]
description
Function

get_available_agent_names

Return a sorted list of available agent names from ~/.deepagents/.

Scans the user's .deepagents directory and returns each real subdirectory that contains the AGENTS.md agent marker and is not

Function

list_agents

List all available agents.

Function

reset_agent

Reset an agent to default or copy from another agent.

Function

build_model_identity_section

Build the ### Model Identity section for the system prompt.

Function

get_system_prompt

Get the base system prompt for the agent.

Loads the base system prompt template from system_prompt.md and interpolates dynamic sections (model identity, working directory, skills path, and executio

Function

get_skill_sources

Return ordered skill sources for PluginSkillsMiddleware and audit tooling.

Lowest to highest precedence: built-in -> plugins -> user .deepagents -> user .agents -> project .deepagents -> project .age

Function

create_cli_agent

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).

Function

create_cached_secret_anonymizer

Build a secret anonymizer that matches create_secret_anonymizer.

It uses the same default rules and depth, and adds a per-string cache so unchanged history strings are not scanned again on each tra

Function

resolve_editor

Resolve editor command from environment.

Checks $VISUAL, then $EDITOR, then falls back to platform default.

Function

editor_display_name

Return a safe configured editor name for user-facing hints.

Function

open_in_editor

Open current_text in an external editor.

Creates a temp .md file, launches the editor, and reads back the result.

Function

copy_text_to_clipboard

Copy text to the system clipboard.

Function

copy_text_with_feedback

Copy text to the clipboard and surface the outcome as a toast.

Centralizes the copy-then-notify pattern shared by the Ctrl+C and [ COPY ] paths so the success/failure messaging stays consistent.

Function

copy_selection_to_clipboard

Copy selected text from one screen's widgets to the clipboard.

Selections live on the screen that owns them (Screen.selections) and survive a modal being pushed on top, so a scan has to target exac

Function

project_paths

Return project-controlled paths for an explicit repository root.

Function

user_deepagents_dir

Return the immutable launch-time user profile root.

Function

get_agent_dir

Return the validated profile directory for an agent name.

Function

ensure_agent_dir

Create the validated profile directory for an agent.

Function

get_user_agent_md_path

Return the user-level AGENTS.md path for an agent profile.

Function

get_project_agent_md_path

Return existing project-level AGENTS.md paths.

Function

get_user_skills_dir

Return the user-level skills directory for an agent profile.

Function

ensure_user_skills_dir

Create the user-level skills directory for an agent.

Function

get_project_skills_dir

Return the project-level dcode skills directory, when in a project.

Function

ensure_project_skills_dir

Create the project-level dcode skills directory.

Function

get_user_agents_dir

Return the custom-subagent directory for an agent profile.

Function

get_project_agents_dir

Return the project-level custom-subagent directory, when available.

Function

user_agents_dir

Return the launch user's tool-agnostic ~/.agents directory.

Function

get_user_agent_skills_dir

Return the launch user's tool-agnostic ~/.agents/skills directory.

Function

get_project_agent_skills_dir

Return the project-level tool-agnostic .agents/skills directory.

Function

get_user_claude_skills_dir

Return the launch user's experimental ~/.claude/skills directory.

Function

get_project_claude_skills_dir

Return the project's experimental .claude/skills directory.

Function

get_built_in_skills_dir

Return the directory containing skills bundled with dcode.

Function

classify_path

Classify a path as existing, missing, or unreadable.

Function

probe_writable

Create directory and prove the process can write files inside it.

mkdir(exist_ok=True) only proves the directory exists; it succeeds on a pre-existing root-owned directory. Creating a file is the

Function

first_writable

Return the first candidate directory that accepts a file.

Shared by the managed-bin and update-lock resolvers, which both walk a preferred-then-fallback pair. Callers keep their own "fell back" warni

Function

harden_state_dir

Create a state directory and restrict it to its owner.

The state directory holds sessions.db and history.jsonl, which hold full conversation content and are written with the default file mode. Th

Function

export_profile_env

Pin the resolved profile selection into a child environment.

Writes the resolved root, then sets or clears the defaulted/configured marker, so a child reconstructs the same snapshot the parent captur

Function

get_deepagents_home

Return the immutable launch-time user profile root.

Function

classify_env_bool

Classify a raw env-var string as a truthy, falsy, or unrecognized token.

The single source of truth for which strings count as boolean on/off values; is_env_truthy and the config resolver both buil

Function

is_env_truthy

Return whether env var name is set to a recognizably truthy value.

Unlike bool(os.environ.get(name)), this does not treat "0" or "false" as enabled. Use this for on/off flags where the user w

Function

validate_goal_objective

Reject a goal objective that cannot fit its persistent context budget.

This checks raw length only. HTML escaping can still expand the text fivefold, so a caller about to run criteria generation shou

Function

validate_rubric

Reject criteria that cannot fit their persistent context budget.

Function

validate_goal_application

Validate an objective and its generated criteria as one application.

Function

validate_goal_application_total

Validate only the combined budget, not either field's own limit.

Split out because the two kinds of overshoot need opposite handling in the criteria agent's structured-output loop: a per-field oversh

Function

validate_goal_application_rendered_total

Validate the escaped size an accepted pair will occupy in the notice.

Split from validate_goal_application_total because the two budgets answer different questions. The raw combined check shares it

Function

validate_goal_objective_rendered

Reject an objective whose escaped text alone cannot fit a notice.

Function

validate_goal_status_note

Reject a goal status note that cannot fit its persistent context budget.

Function

validate_goal_notice_text

Validate every user-controlled section of a goal-state notice.

Function

capture_turn

Return current-turn roots, or None when no scoped trace is active.

Function

build_detect_script

Concatenate all section functions into the full detection script.

Independent sections run as parallel background jobs writing to temp files, then results are concatenated in the original display ord

Function

hold_session_lock

Register this process as a running session for its lifetime.

Idempotent and fail-soft: when the lock cannot be taken, the process runs unregistered and is_sole_session reports False. The descript

Function

session_lock_fds

Return descriptors a spawned server must inherit to count as this session.

flock locks belong to the open file description, so a child given the descriptor holds the same lock: the server keeps the

Function

session_lock_unavailable

Return whether this POSIX process failed to register as a session.

Lets callers tell "other sessions are running" apart from "presence cannot be known", which quitting other sessions would never fix.

Function

is_sole_session

Return whether no other dcode session holds this installation.

Converting a flock is not atomic: the shared lock is released before the exclusive one is tried, so two processes checking at once cou

Function

resolve_log_level

Resolve the configured runtime logging level.

Function

configure_debug_logging

Configure runtime logging and register target for per-thread files.

Function

bind_debug_logging_to_thread

Route configured debug loggers to the active thread's log file.

Function

installed_debug_log_path

Return the path of the active debug log file, or None if not logging.

Reflects the file handler actually attached by configure_debug_logging, not the current DEEPAGENTS_CODE_DEBUG env value. Th

Function

migrate_legacy_state

Move legacy state entries from config_dir into state_dir.

Idempotent: each entry is skipped when the destination already exists (the migration ran on a prior invocation) or when the source does n

Function

probe_git

Inspect candidate checkouts on the backend; optional failures may propagate.

Function

aprobe_git

Inspect backend checkouts without blocking the event loop.

Function

changed_snapshots

Compare successful observations, including newly created checkouts.

Function

estimate_text_tokens

Estimate tokens using the same four-characters-per-token rule as whip.

Function

format_memory_prompt

Approximate the memory fragment after middleware strips HTML comments.

Function

format_skills_locations

Format skills locations matching SkillsMiddleware display.

Function

format_skills_prompt

Approximate the progressive-disclosure skill index sent to the model.

Function

build_context_doctor_report

Build a fresh-session audit and reconcile it with live usage when available.

Function

render_context_doctor_report

Render a plain-text report.

Function

plugin_environment

Build environment variables exposed to plugin subprocesses.

Function

substitute_string

Substitute plugin path variables in a string.

Function

substitute_json

Substitute plugin variables throughout a JSON-compatible value.

Function

split_plugin_id

Split a plugin id in {plugin}@{marketplace} form.

Function

setup_plugin_parser

Set up the plugin CLI parser.

Function

execute_plugin_command

Execute a plugin management command.

Function

json_value

Normalize a decoded value to the supported JSON type.

Function

json_object

Normalize a decoded value to a JSON object.

Function

redact_marketplace_source

Return a marketplace source safe for display.

Function

redact_urls_in_text

Redact credentials from every HTTP URL embedded in text.

Function

parse_marketplace_source

Parse a user-provided marketplace source.

Function

materialize_marketplace_source

Load a marketplace source and return its local install location.

Function

load_marketplace_location

Load a marketplace from either a cached directory or JSON file.

Function

find_marketplace_manifest

Return a marketplace manifest path under root, if present.

Function

materialize_plugin_source

Resolve or materialize a marketplace plugin entry to a plugin root.

Function

unresolved_source_message

Explain why materialize_plugin_source produced no plugin root.

A rejected path and an unsupported source type both yield None, and saying "unsupported source" for the first sends readers looking

Function

load_marketplace

Load a marketplace manifest from a root directory.

Function

add_local_marketplace

Add a local marketplace to dcode state.

Function

add_marketplace_source

Add a marketplace from a pasted source string.

Function

remove_marketplace

Remove a marketplace and every plugin installed from it.

Local marketplace source directories are never deleted. Managed marketplace clones and installed plugin caches are removed.

Function

set_installed_plugin_enabled

Set the enabled state of an installed plugin.

Function

uninstall_plugin

Uninstall a plugin (disable, clear records, delete orphaned cache).

Function

load_record_marketplace

Load a cached catalog, fetching the default on first browse.

Function

install_plugin

Install a marketplace plugin into the versioned cache and enable it.

Copies the plugin source into plugins/cache/{marketplace}/{plugin}/{version}/, writes installed_plugins.json, and enables the

Function

reinstall_plugin

Restore an installed plugin's files from its marketplace source.

Unlike install_plugin, this always replaces the cached copy, even when the registry already lists the same version, so it repairs mi

Function

plugin_auto_update_setting

Resolve whether plugin auto-updates are enabled and from which source.

Function

available_updates_message

Build the notification announcing plugin updates that were not installed.

Function

check_plugin_updates

Refresh remote marketplaces and update enabled, opted-in plugins.

Plugins whose manifest opts into autoUpdate are installed; other plugins with a different marketplace version are reported as avail

Function

update_plugins

Update installed plugins to their marketplace versions.

Function

discover_plugins

Discover enabled marketplace plugins from their install cache paths.

Function

claim_broken_install_notices

Return broken installs that have not yet been shown in this process.

Several consumers (skills, hooks, MCP, the plugin manager) run discovery independently. Routing user-facing notices through this c

Function

list_available_plugins

List plugins from configured marketplaces.

Function

list_installed_plugin_ids

Return plugin ids that have install records.

Function

discover_plugin_hook_sources

Build hook sources from enabled or already-discovered plugins.

Function

plugin_hook_event_names

List the hook events a plugin declares, for display before it loads.

Only events Hooks v2 recognizes are returned, so the plugin manager never advertises a hook that the loader will later reject.

Function

default_store_path

Return the ChatGPT OAuth token store path.

Stored under Deep Agents' own state dir (~/.deepagents/.state/chatgpt-auth.json) so the credential lives alongside the rest of the app's state rather than

Function

get_status

Return the current ChatGPT OAuth sign-in state.

Reads the on-disk token without triggering a refresh (a passive inspect, suitable for switcher labels and the /auth manager). If a refresh is neede

Function

is_logged_in

Return whether a ChatGPT OAuth token is stored on disk.

Function

logout

Delete the stored ChatGPT OAuth token.

Function

run_browser_login

Run the ChatGPT OAuth Authorization Code Flow with PKCE.

Reimplements the upstream langchain_openai.chatgpt_oauth browser sign-in flow over its lower-level helpers, but routes the authorize-URL dis

Function

build_chat_model

Construct a _ChatOpenAICodex model wired to the on-disk token store.

Function

sanitize_hook_environ

Build an inherited environment safe to pass to hook subprocesses.

Strips values whose names look like secrets. Hooks are user-authored trusted code, but secret values should not be ambiently availabl

Function

format_mcp_wire_name

Format a compatible MCP wire tool name.

Function

to_wire_tool_name

Map a native tool name to the compatible wire tool name.

Function

to_wire_tool_input

Map native tool arguments to the compatible wire input object.

Function

to_wire_call

Project a native tool call into compatible wire name and input.

Function

validate_terminal_sequence

Return value when it is composed only of allowlisted sequences.

Allowed tokens are OSC 0/1/2/9/99/777 (BEL or ST terminated) and bare BEL. Any other escape or control content rejects th

Function

project_hook_input

Project a native hook invocation into the compatible wire contract.

Function

serialize_hook_input

Serialize a hook invocation as validated compatible JSON.

Function

to_wire_notification_type

Return the compatible notification matcher and wire value.

Function

dispatch_hook

Fire matching hook commands with payload serialized as JSON on stdin.

The event name is automatically injected into the payload under the "event" key so callers don't need to duplicate it.

The

Function

dispatch_hook_fire_and_forget

Schedule dispatch_hook as a background task with a strong reference.

Use this instead of bare create_task(dispatch_hook(...)) to prevent the task from being garbage collected before completion.

Function

has_pending_hooks

Return whether fire-and-forget hook tasks are still in flight.

Function

drain_pending_hooks

Await all in-flight fire-and-forget hook tasks.

Call this before the event loop tears down (e.g. at the end of a headless run driven by asyncio.run) so background dispatches โ€” most importantly the

Function

permission_hook_outcome

Translate a hook permission decision into a client review outcome.

Function

merge_permission_decisions

Interleave hook decisions with human decisions in request order.

Function

apply_hooks_context

Attach Hooks v2 snapshot identity and server event gates to context.

Function

project_hooks_path

Return the project-scoped hooks configuration path.

Function

user_hooks_path

Return the user-scoped hooks configuration path.

Function

load_hooks_config

Load, validate, merge, and hash Hooks v2 configuration.

Function

compute_snapshot_id

Return the canonical SHA-256 snapshot id for config.

Function

canonical_hooks_bytes

Serialize configuration into a stable byte representation.

Function

read_hooks_json

Decode one hooks document and fingerprint the exact bytes read.

Function

fulfill_hook_invocation

Execute a server-owned hook request and return a resume payload.

Function

fulfill_hook_interrupt

Fulfill a raw interrupt value when it is a hook invocation.

Function

fulfill_pending_hook_interrupts

Fulfill pending hook interrupts into a resume map keyed by interrupt id.

Function

reduce_hook_results

Reduce ordered handler results into an event-specific decision.

Function

resolve_resume_target

Look up a thread to resume and enforce the resume-age policy.

Function

cwd_conflict

Explain why target cannot be resumed from current_cwd.

The server refuses a directory change through the thread's workspace binding; checking first turns that generic refusal into a specific mess

Function

resume_launch_model

Return the thread's model, or its saved-preference fallback.

Function

persisted_model

Read the model a thread last ran with from its checkpoint values.

Function

setup_mcp_parsers

Register the dcode mcp command group.

Function

run_mcp_login_list

List configured OAuth servers without stored tokens.

Servers are drawn from the same trust-gated resolution as run_mcp_login, so untrusted project-level entries are excluded from the scan.

A serve

Function

run_mcp_login

Handle dcode mcp login <server>.

When config_path is omitted, auto-discovered MCP configs are merged in the same precedence order as the runtime loader, with matching trust gating: user-level con

Function

run_mcp_config

Handle dcode mcp config.

Prints the MCP config discovery paths in precedence order with a marker showing which exist on disk. Stat-only; never opens config files, so config-trust prompts are not tr

Function

run_tools_command

Dispatch a dcode tools subcommand.

Function

setup_auth_parser

Register the dcode auth command group.

Function

run_auth_command

Dispatch a parsed dcode auth invocation.

Function

setup_config_parser

Register the dcode config command group.

Function

run_config_command

Dispatch a parsed config invocation.

Function

run_uninstall_command

Dispatch dcode uninstall <name>.

Function

run_uninstall_request

Remove one selected optional extra from the dcode tool environment.

Shared by dcode uninstall NAME and the dcode --uninstall NAME alias.

Function

run_install_command

Dispatch dcode install <name>.

Function

run_install_request

Install an optional extra or an arbitrary package via uv --with.

Shared by dcode install and the legacy dcode --install flag.

Function

start_server_and_get_agent

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

Function

server_session

Async context manager that starts a server and guarantees cleanup.

Wraps start_server_and_get_agent so callers don't need to duplicate the try/finally pattern for stopping the server.

Function

resolve_provider

Return the provider policy that owns server_url.

Function

skills_load_errors_event

Return the custom stream payload for errors.

Function

skills_load_errors_from_event

Return the errors of a skills load-error event.

Function

format_skills_load_errors

Return the user notice for unreadable skill sources.

Function

discover_skills_and_roots

Discover skills and build pre-resolved containment roots.

Function

extra_skill_roots

Return configured extra and user-approved skill roots.

Function

pinned_skill_body

Return the instructions the SDK pins for skill.

The SDK skips a skill it cannot pin. The agent server raises instead, so a skill the user invoked never runs silently without its instructions.

Function

build_skill_invocation_envelope

Build the user request and persisted metadata for SDK skill pinning.

The agent server resolves, trust-checks, and reads the skill, so only the name the user typed is sent.

Function

pinned_skill_parts

Return the skill a pinned-skill message carries.

Function

resolve_managed_path

Return the fixed managed-config path and whether it is authoritative.

What the snapshot loader reads. Callers that report health need this rather than managed_config_path, so a guessed path is neve

Function

managed_config_path

Return the fixed managed-config path for the current operating system.

For display and error messages. Anything that decides whether policy is enforceable wants resolve_managed_path.

Function

union_paths_under

Return UNION_PATHS rebased onto a subtree rooted at prefix.

merge_toml_tables matches paths relative to where it starts. A merge of one option's own subtree therefore never matches an absolute

Function

managed_decided

Return whether managed policy decided a value with this source label.

A structured option merges both layers and reports a combined label, so source == MANAGED_SOURCE is the wrong test and silently

Function

merge_managed_over_user

Merge managed policy over user config with this project's precedence.

The single statement of managed-over-user precedence. It was assembled by hand at three call sites, two carrying "must match" com

Function

is_valid_managed_scalar

Return whether a managed scalar has the declared type for its path.

Unknown and structured paths retain the deep-merger's existing behavior; their dedicated readers own validation. Manifest-backed sc

Function

managed_declaration

Classify what managed policy says at one manifest path.

Function

managed_policy_violations

Return managed settings whose declaration cannot be safely applied.

A key is a violation when an enforced managed policy declaration cannot be applied, when a known managed section has a non-table va

Function

resolve_managed_option

Resolve one manifest option and retain its rank-keyed managed result.

Function

managed_rejections

Return manifest keys managed policy declares whose value was dropped.

Not a launch failure: only ENFORCED_MANAGED_KEYS stops a launch, and every other rejected managed value deliberately falls thro

Function

managed_section_shape_violations

Return known managed sections declared as non-table values.

Unknown leaf keys remain forward compatible. Every parent path of a manifest-backed option is known to be a table, however, as are the stru

Function

get_managed_snapshot

Return the process snapshot, or an isolated snapshot for an explicit path.

A reload that cannot parse the file never evicts policy that parsed cleanly earlier. An unusable snapshot carries `data == {

Function

managed_refresh_failure

Return the status of the last refresh that produced no policy.

A failed refresh does not change what the process enforces: the last enforceable generation keeps resolving, which is what fail-closed r

Function

get_config_sources

Load one user snapshot and the current managed snapshot.

Managed policy is included exactly when user_path is None, which is what every production caller passes. Reading an explicit path is a tes

Function

invalidate_config_sources

Drop the cached managed snapshot and the shared process resolver.

Test-only. Production reloads pass refresh=True instead, which keeps the last snapshot that parsed cleanly if the new one fails; cl

Function

get_healthy_managed_snapshot

Return managed policy only when it can be enforced.

A file that parses is not necessarily enforceable: a privilege-affecting key can carry a value the manifest rejects, or a known section can be a sc

Function

require_healthy_managed_config

Fail startup when present managed policy cannot be parsed or enforced.

Propagates from get_healthy_managed_snapshot: ManagedConfigError when a managed file is present but unreadable, and `Managed

Function

managed_config_status

Return managed provider health for diagnostics and config inspection.

Function

managed_health

Return both halves of exit 78 for one managed snapshot.

Reading health and violations as two calls is a live bug, not a style choice. get_managed_snapshot declines to cache a candidate it cannot en

Function

managed_snapshot_health

Evaluate provider health and policy diagnostics for one snapshot.

Function

resolve_theme_name

Resolve a user-supplied theme name to a canonical registry key.

Accepts the registry key or the human-readable label, case-insensitive on both, with surrounding whitespace stripped - config values (e

Function

as_toml_table

Return value as a TOML table when it has the expected runtime shape.

tomllib parses TOML tables as string-keyed dicts, which ty cannot infer from a runtime dict check. Keep the cast at this b

Function

resolve_terminal_mapping

Resolve [ui.terminal_themes][TERM_PROGRAM] to a registered theme.

Centralizes both the lookup and the misconfiguration warnings, which are logged exactly once per call. Three callers now share that

Function

update_user_config

Serialize a read-modify-write of the user config and replace it atomically.

Writes the user tier only. The managed path is refused rather than trusted to be unreachable.

A committed write to the def

Function

refresh_shared_resolver

Make a committed write visible to the shared process resolver.

Only the default path is refreshed. get_config_resolver is keyed on DEFAULT_CONFIG_PATH, so reloading it after a write to an overrid

Function

validate_backend_route

Reject a backend route that violates host storage boundaries.

The sandbox check is deliberately shallow. Wrapping a filesystem backend in another BackendProtocol implementation changes who owns tha

Function

bind_runtime_host_policy

Validate late routes and flag graph-bound registrations for restart.

Function

is_project_extensions_trusted

Return whether extension execution is trusted for a project.

Function

trust_project_extensions

Persist extension execution trust for a project.

Function

parse_trust_policy

Parse a project extension trust policy.

Function

load_extension_settings

Resolve extension settings through the shared config generation.

Function

modal_navigation_hint

Build the navigation hint for modals whose Tab keys move the cursor.

Only for screens where Tab and Shift+Tab step the selection. A modal that binds Tab to something else writes its own line rather t

Function

get_renderer

Get the renderer for a tool by name.

Function

copy_span_style

Build the style that marks a span as click-to-copy.

Function

copy_span_target

Return the copy text and field label from a span style, if any.

Function

show_startup_tip

Return whether startup tips should be shown.

Function

provider_display_name

Return a human-readable provider label.

Shared by the auth UI and the model selector so a provider is labeled identically in both. (The install prompt reuses the underlying PROVIDER_DISPLAY_NAMES m

Function

provider_short_name

Return a compact brand label for a provider.

For space-constrained UI (e.g. the /model Recent tag). Resolution order: a configured short_name, then the built-in PROVIDER_SHORT_NAMES map, then t

Function

condense_path

Condense path so it renders within width terminal cells.

Directory components are replaced by a single ellipsis, growing outward from the middle of the component list, because the tail of a path

Function

prompt_search_hint

Build the footer line for the current charset mode.

The Ctrl+R mention is what makes the modal tier discoverable. The line is kept short enough to wrap within PROMPT_SEARCH_MAX_HINT_ROWS at the nar

Function

prompt_title

Return a prompt's first non-empty line for a one-row summary.

Function

filter_prompts

Return prompts containing the query, case-insensitively.

Function

update_in_place

Update a Static, and relayout only when the content width changes.

Static.update relayouts the whole screen by default. That reflows every mounted transcript widget, so a 10 Hz spinner gets slowe

Function

clamp_selection

Return selection shifted past a diff row's gutter, if one is set.

Every form a selection can take over a single-line row covers the gutter unless its start is moved past it:

  • `Selection(None, Non
Function

compose_diff_lines

Yield syntax-highlighted widgets for a unified diff.

Function

format_diff_stats

Format addition/deletion counts as styled +N -M content.

Takes the pair as a DiffStats rather than two ints so the counts cannot be transposed on the way to the places the user reads them โ€” the `

Function

highlight_source_prefixes

Keep the bounded source prefixes needed to highlight a diff.

Idempotent, and rehydration depends on it: DiffMessage.__init__ calls this on whatever it is handed, which is the full file from the liv

Function

build_auto_mode_notice_body

Describe the reviewing model in the Auto notice body.

Function

unescape_js_eval_text

Reverse the XML escaping applied by the js_eval wire format.

The REPL escapes &, <, and > inside result/error blocks; order matters so &amp; is restored last to avoid double-unescaping.

Function

parse_js_eval_blocks

Parse js_eval output into structured display blocks.

Parses the wire format structurally rather than scanning for any tag-like substring: the trailing <result>/<error> block is anchored to the

Function

open_chatgpt_login_url

Open the ChatGPT account page in the user's browser.

Used by /auth to let signed-in users jump to chatgpt.com (e.g., to change account, manage billing).

Function

is_transcript_selection

Return whether a non-empty selection shows only transcript text.

Headers, toggles, hints, status lines, notices, and inline prompts in the conversation are UI chrome, so a selection that touches one

Function

quote_after

Return text as a Markdown blockquote to append after draft.

A non-empty draft gets at least one blank line before the quote, and the quote ends with a blank line so the user can type below it.

Function

layout

Lay out a whole reply.

Only top-level paragraphs get a bottom margin (Markdown > MarkdownParagraph). AssistantMessage sets margin-bottom: 0 on the last block so a reply has no trailing blank ro

Function

parse

Parse markdown into the block tree Textual's Markdown would mount.

Function

blank

Return an empty row: block spacing, or a decorative blank row.

Function

wrap_prose

Wrap inline content and record how copied text rejoins the lines.

A soft wrap rejoins with the space it replaced, a fold inside a long word with nothing, and a hard break with a newline.

Function

stylize

Layer style beneath every part and the fill of rows.

Function

pad

Return the row's parts with its fill drawn out to width cells.

Function

stack

Stack blocks vertically, collapsing adjacent margins like Textual.

The first block's top margin and the last block's bottom margin stay, as they do inside an auto-height Textual container.

Function

format_cost_breakdown_table

Build the copyable entire-thread estimated token/cost table.

Function

open_cost_breakdown

Open the live breakdown without stacking duplicate modals.

Modules

Module

deepagents_code

Deep Agents Code - Interactive AI coding assistant.

Module

reliable_rubric

CLI-specific rubric middleware customizations.

Module

command_registry

Unified slash-command registry.

Every slash command is declared once as a SlashCommand entry in COMMANDS. Bypass-tier frozensets and autocomplete entries are derived automatically โ€” no other file

Module

media_utils

Utilities for handling image and video media from clipboard and files.

Module

mcp_disabled

Persistent store of MCP server names the user has disabled.

Disabled servers are skipped at config merge time so their tools never reach the agent and no connection is attempted. State lives under `[

Module

auth_store

User-level credential storage for model providers.

Persists API keys (and, in the future, OAuth tokens) under ~/.deepagents/.state/auth.json (file mode 0600, parent 0700) so users can enter credent

Module

thread_titles

Bounded, isolated conversation title generation.

Module

subagents

Subagent loader for app.

Loads custom subagent definitions from the filesystem. Subagents are defined as markdown files with YAML frontmatter in the agents/ directory.

Module

mcp_config

Validation and environment-variable expansion for MCP server config.

Resolves ${VAR} and ${VAR:-default} references in the supported configuration fields (command, url, args, env, `header

Module

output_truncation

Detect model replies that a provider cut off before they were complete.

LangChain has no normalized stop reason, so each provider's raw metadata is read here. output_truncation classifies one messa

Module

terminal_capabilities

Terminal capability detection.

Detect optional terminal features without reading from stdin.

The app only uses kitty-keyboard-protocol support to choose a user-facing newline shortcut label. To ke

Module

onboarding

First-run onboarding state for the interactive TUI.

Module

resume_state

Schema and middleware for per-checkpoint state restored when resuming.

ResumeState declares several checkpointed, schema-private channels. They fall into two groups with different write paths:

W

Module

auth_display

Shared provider auth status formatting.

Module

mcp_proxy

Backend recovery at the proxy boundary, before errors reach the wire.

Module

reasoning_effort

Reasoning effort support for /effort.

Supported levels and defaults come from LangChain model profiles. Provider integrations translate the standard reasoning_effort constructor parameter into th

Module

btw

Tool-free side answers from a snapshot of the main conversation.

Module

paste_collapse

Large paste collapsing for the chat input.

When the user pastes text exceeding a size or line threshold, the full text is stored off-screen and a compact [Pasted text #N +M lines] placeholder is in

Module

tools

Custom tools for the agent.

Module

goal_state_notice

Canonical internal model-context messages for goal state and continuation.

Goal context is represented as a HumanMessage so it participates in the provider's normal turn ordering. Its lc_source m

Module

workspace_diagnostics

Safe, structured diagnostics for workspace binding and runtime rejections.

When the server refuses to bind or run a thread's workspace, the user sees only a one-line refusal. This module defines the

Module

provider_tool_search

Provider-native discovery for MCP tools on supported models.

Module

workspace

Durable, server-authoritative thread workspace bindings.

Module

output

Machine-readable JSON output helpers for CLI subcommands.

This module deliberately stays stdlib-only so it can be imported from CLI startup paths without pulling in unnecessary dependency trees.

Module

mcp_middleware

Agent middleware covering what MCP tools need around every call.

The tools themselves come out of langchain.mcp unmodified. Everything this app wants on top โ€” an argument quirk, and translating a d

Module

resume_policy

Thread-resume policy shared by the TUI and non-interactive mode.

Kept free of Textual imports so the headless path can enforce the same resume-age cutoff and working-directory comparison without load

Module

mcp_login_service

UI-agnostic helpers for resolving an MCP login target.

The MCP login flow historically inlined config discovery, trust gating, shape validation, and print()-based error reporting. The TUI cannot co

Module

acp

Dcode-specific ACP approval-mode adapter.

Module

server_graph

Server-side graph entry point for langgraph dev.

This module is referenced by the generated langgraph.json and exposes a graph factory that the LangGraph server can load and serve.

The graph is

Module

btw_cost

Persist side-question and naming spend outside the graph's checkpoints.

The sessions database owns this subtotal. Readers add it to the graph's total; it is never fed back into the graph's cost recor

Module

model_catalog

Model discovery data shared by the inference host and model pickers.

Module

unicode_security

Unicode security helpers for deceptive text and URL checks.

This module is intentionally lightweight so it can be imported in display and approval paths without affecting startup performance.

Module

ui

Help screens and argparse utilities for the app.

This module is imported at app startup to wire -h actions into the argparse tree. It must stay lightweight โ€” no SDK or langchain imports.

Module

notifications

Registry of pending actionable notifications.

Stores plain data for notices the user can act on from a dedicated modal screen. The registry is deliberately UI-agnostic: UI routing (toast click, keybi

Module

model_metadata

Provider-independent model metadata exchanged with the server.

Module

diff_utils

Shared unified-diff helpers.

Every diff passing through this module is "\n"-joined from lines that came from splitlines() or split("\n"), so no element can contain a line boundary. That is what

Module

project_utils

Utilities for project root detection and project-specific configuration.

Module

ask_user

Ask user middleware for interactive question-answering during agent execution.

Module

cold_cache

Provider policy and pricing helpers for cold prompt-cache warnings.

Module

agent

Agent management and creation.

Module

editor

External editor support for composing prompts.

Module

clipboard

Clipboard utilities.

Module

git_trace

Reconcile observed checkout work onto the current turn's traces.

Module

goal_state_limits

Shared size limits and status vocabulary for model-visible goal state.

Module

turn_trace

Retrospective metadata updates for the current turn's traced runs.

Module

local_context

Middleware for injecting local context into system prompt.

Detects git state, project structure, package managers, runtimes, and directory layout by running a bash script via the backend. Because the

Module

state_migration

One-time migration of legacy state files into ~/.deepagents/.state/.

Earlier versions wrote internal state directly under ~/.deepagents/, mixing it with user-facing agent directories (so e.g. `mc

Module

git_evidence

Bounded, read-only Git evidence collected in the tool execution environment.

Module

context_doctor

Estimated context audit for the /context-doctor command.

Module

plugins

Plugin support for dcode.

Module

substitution

Variable substitution for plugin-provided configuration.

Module

models

Data models for plugins.

Module

commands_cli

CLI helpers for plugin management.

Module

marketplace

Marketplace parsing for plugins.

Module

discovery

Plugin discovery, install, and enablement helpers.

Module

adapters

Plugin subsystem adapters.

Module

hooks

Adapter from plugin hook declarations to Hooks v2 configuration sources.

Module

integrations

Integrations for external systems used by the Deep Agents Code.

Module

sandbox_config

Parsing for the [sandboxes] section of ~/.deepagents/config.toml.

Parallels the [models] provider configuration in model_config.py. Config providers declare a class_path (same trust model a

Module

sandbox_provider

Sandbox provider interface used by Deep Agents Code.

Module

openai_codex

ChatGPT OAuth integration for the openai_codex model provider.

Thin orchestration layer over langchain_openai.chatgpt_oauth. Reuses the upstream PKCE/token primitives directly (`_generate_pkce_pa

Module

sandbox_registry

Discovery and instantiation of sandbox providers.

Merges three provider sources into one registry:

  1. Built-in providers curated in this repo (installed as deepagents-code extras).
  2. Entry-poi
Module

hooks

Hook contracts and compatibility dispatch.

This package contains two hook systems: Hooks v2 (current) and legacy hooks (deprecated, removal September 1, 2026).

To write a new hook integration, use t

Module

manager

Single-owner coordinator for client-side Hooks v2 state.

HooksManager is the only place in the client that builds or holds a HooksRuntime. The Textual app, the Textual stream adapter, and the hea

Module

envelope

Canonical boundary between hook domain and wire models.

Module

env

Sanitized subprocess environments for Hooks v2 command handlers.

Module

tools

Native dcode tool vocabulary mapped to compatible wire names.

Module

client_lifecycle

Client-owned Hooks v2 lifecycle facade.

Module

validate_terminal_sequence

Terminal escape-sequence validation for hook output.

Module

projection

Projection from Hooks v2 domain invocations to compatible wire input.

Module

legacy

Lightweight hook dispatch for external tool integration.

DEPRECATED: This is the legacy hook system, kept for backward compatibility until September 1, 2026. New integrations should use Hooks v2 โ€” se

Module

permissions

Translation between PermissionRequest decisions and HITL review payloads.

Shared by the Textual and headless approval paths so both surfaces resolve hook-driven permission decisions identically.

Module

runtime

Session-scoped client facade for the Hooks v2 runtime.

Module

snapshot

Immutable runtime snapshots for Hooks v2 configuration.

Module

engine

Standalone orchestration for the Hooks v2 execution engine.

Module

context

Helpers for attaching Hooks v2 session identity to graph context.

Module

loading

Validated Hooks v2 configuration loading, merging, and hashing.

Precedence (highest first, earlier in reduction order):

  1. Project: {project_root}/.deepagents/hooks.json
  2. User: `~/.deepagents/ho
Module

client

Client-side fulfillment for server-owned Hooks v2 interrupts.

Module

reducer

Event-aware reduction for Hooks v2 command output.

Module

models

Typed contracts for the hooks system.

Module

adapters

Cached runtime validators for hook model boundaries.

Module

transport

Versioned hook invocation transport models.

Module

config

Validated hook configuration models.

Module

client

Client-side transport and headless execution for Deep Agents Code.

Module

headless_resume

Resolve dcode -r <id> -n ... into a thread the headless run may continue.

Headless resume never falls back to a new thread. Threads stay bound to the workspace policy they were created with, so onl

Module

session_cost

Combine independently reported main-task and side-question usage for display.

Module

commands

Client-facing CLI command implementations.

Module

mcp

CLI commands of the MCP module.

Module

tools

The dcode tools command group: provision managed external tools.

dcode tools install fetches the pinned, SHA-256-verified ripgrep binary into the dcode installation (the same managed path used on

Module

auth

CLI commands for the auth group: manage stored provider credentials.

These subcommands mirror the in-TUI /auth modal verbs so credentials can be managed non-interactively (dotfile bootstrap, CI,

Module

config

CLI commands for inspecting the configuration surface.

Bare config resolves each option against the app credential store (for credentials), the live environment, and config.toml, reporting the ef

Module

extras

CLI install path for optional deepagents-code extras.

dcode install <name> installs a curated optional extra (for example a sandbox or model-provider dependency) into the current dcode environmen

Module

launch

Local LangGraph server launch helpers for Deep Agents Code clients.

Module

server_manager

Server lifecycle orchestration for the app.

Provides start_server_and_get_agent which handles the full flow of:

  1. Building a ServerConfig from application arguments
  2. Writing config to env var
Module

mcp_providers

Provider-specific MCP OAuth dispatch.

resolve_provider(url) returns the registered policy whose matches predicate fires for url, with GenericProvider as the fallback.

Module

github

GitHub-hosted MCP OAuth provider.

GitHub's remote MCP at api.githubcopilot.com authenticates via RFC 8628 Device Authorization Grant โ€” the app runs the device flow, persists the resulting token plu

Module

base

Policy interface for provider-specific MCP OAuth quirks.

Each concrete provider module (e.g. slack, github) subclasses OAuthProvider to encode its own URL match rule, client metadata, and any p

Module

slack

Slack-hosted MCP OAuth provider.

Slack's hosted MCP endpoint uses the Authorization Code flow with a default public app or configured app credentials and a fixed loopback redirect URI (`http://localh

Module

skills

Skills module for Deep Agents Code.

Public API:

  • execute_skills_command: Execute skills subcommands (list/create/info/delete)
  • setup_skills_parser: Setup argparse configuration for skills commands
Module

load_errors

Stream event that tells the user about unreadable skill sources.

The SDK shows skill load errors only to the model. PluginSkillsMiddleware also streams the errors for skill directories that exist b

Module

invocation

Helpers for loading and formatting skill invocations.

Module

configuration

Managed and user configuration: paths, providers, and merge.

Writes live in deepagents_code.configuration.writer and are imported from there directly, so no writer symbol is re-exported here.

Module

paths

Fixed operating-system paths for managed configuration.

Module

interpreter

Resolver-backed interpreter configuration snapshots.

Module

service

Process-local snapshots for managed and user TOML configuration.

Module

theme_resolution

Lightweight theme preference coercion shared by config providers and the UI.

Module

writer

User-config-only atomic TOML writes.

Module

built_in_skills

Built-in skills that ship with the Deep Agents Code.

These skills are always available at the lowest precedence level. User and project skills with the same name will override them.

Module

extensions

Public contract for dcode Python extensions.

Module

hosting

Host startup and runtime extension registrations.

Module

trust

Persist project-extension trust decisions.

Module

settings

Resolve extension configuration from user config and environment.

Module

api

Public registrar passed to Python extension factories.

Module

tui

Textual user interface package for deepagents-code.

Module

key_hints

Shared keyboard hints for terminal UI components.

Modal footers advertise the same navigation keys in a dozen screens. Keeping the wording here means a binding change is edited once instead of being

Module

screens

Screen UI components.

Module

widgets

Textual widgets for deepagents-code.

Import directly from submodules, e.g.:

from deepagents_code.tui.widgets.chat_input import ChatInput
from deepagents_code.tui.widgets.mess
Module

thread_agent_switch

Confirmation prompt for resuming a thread owned by another agent.

Module

mcp_login

In-TUI MCP OAuth login modal.

MCPLoginScreen is both a Textual ModalScreen and an implementation of OAuthInteraction. The login worker awaits its interaction methods while the user sees and act

Module

notification_detail

Generic detail modal for a single pending notification.

Used by NotificationCenterScreen when the user drills into an entry whose payload does not have a dedicated modal (e.g. missing-dependency no

Module

launch_init

Onboarding screens for the interactive TUI.

Module

context_usage

Color-coded context-window visualization for /context.

Module

cwd_switch

Prompt for switching cwd when resuming or switching threads.

Module

tool_renderers

Tool renderers for approval widgets - registry pattern.

Module

startup_tip

Startup tip widget shown above the chat input.

Module

auth

TUI screens for managing stored model-provider credentials.

AuthPromptScreen accepts an API key for a single provider, persists it via auth_store, and is the sole place that deletes existing cred

Module

install_confirm

Confirmation modal for /install <package> --package in the TUI.

Arbitrary packages have no curated allowlist to vet against, so installing one pulls in third-party code. Rather than forcing the use

Module

update_progress

Progress modal for app self-update installs.

Module

agent_selector

Interactive agent selector screen for /agents command.

Module

goal_review

Goal acceptance-criteria review widget.

Module

message_store

Message store for virtualized chat history.

This module provides data structures and management for message virtualization, allowing the TUI to handle large message histories efficiently by keeping o

Module

notification_center

Notification hub for pending notices and warning preferences.

Surfaces PendingNotification entries as single-line rows plus an expandable settings section, including when no notices are pending. Se

Module

mcp_reconnect

Confirmation modals for MCP changes that need a server restart.

Restarting the LangGraph server is required for newly minted MCP tokens and for /mcp disable/enable toggles to take effect, but auto-

Module

prompt_search

Inline prompt history search panel for the chat composer.

Opened by a first Ctrl+R; a second Ctrl+R escalates to the full PromptClipboardScreen modal. Key handling lives on ChatInput (`_prompt_se

Module

mcp_viewer

Read-only MCP server and tool viewer modal.

Module

theme_selector

Interactive theme selector screen for /theme command.

Module

approval

Approval widget for HITL - using standard Textual patterns.

Module

skill_trust

Trust prompt for skills that resolve outside trusted skill directories.

When a /skill:<name> invocation reads a SKILL.md whose resolved path (via symlink) falls outside every trusted skill root,

Module

ask_user

Ask user widget for interactive questions during agent execution.

Module

update_available

Dedicated modal for the update-available notification.

Shown automatically at startup when a newer version of deepagents-code is available on PyPI. Surfaces the same actions the notification center

Module

loading

Loading widget with animated spinner for agent activity.

Module

goal_status

Persistent inline display for the current goal.

Module

diff

Renderers turning a unified diff into one Static per row.

Rows carry a line-number gutter, a +/- marker, syntax highlighting lifted from whole-file lexer state, and word-level emphasis on the s

Module

auto_mode_notice

First-enable confirmation modal for Auto mode.

Shown at most once per install (per notice version) before Auto activates. Enter confirms the switch and records the notice; Esc cancels and leaves the

Module

notification_settings

Warning-toggle definitions for the notification hub's settings section.

Module

effort_selector

Interactive reasoning effort selector for /effort.

Module

yolo_mode_notice

First-enable confirmation modal before Shift+Tab enters YOLO.

Shown when the user cycles into unrestricted YOLO without a persisted acknowledgement. Enter acknowledges YOLO and records the policy ver

Module

codex_auth

ChatGPT OAuth sign-in screen, reachable via /auth -> openai_codex.

Mirrors the MCP loopback flow in mcp_auth from the user's POV: a modal shows progress, surfaces the authorize URL inline (so h

Module

restart_prompt

Confirmation modal offered when a change needs an owned-server respawn.

Some changes take effect only when the app-owned LangGraph server subprocess spawns: provider/sandbox extras and --package in

Module

chat_input

Chat input widget for deepagents-code with autocomplete and history support.

Module

selection_action

Floating action for asking about selected conversation text.

Module

update_confirm

Confirmation modals for /update dependency-refresh flows in the TUI.

When deepagents-code itself is already on the latest release, /update can still re-resolve its dependencies to the newest ve

Module

final_markdown

Render a finished assistant reply as one widget.

Textual's Markdown mounts one child widget per block, list item, bullet, table cell, and fence label. A long transcript therefore holds thousands of

Module

modals

Modal UI components.

Module

prompt_clipboard

Searchable local prompt history modal.

Module

mcp_servers

Read-only MCP server details for the debug console.

Module

resume_blocked

Action modal shown when policy blocks a launch-time thread resume.

Module

model_switch

Confirmation modal for switching models with a large context.

Module

btw

Side conversation with follow-ups and app-owned history.

Module

cost_breakdown

Detailed token and estimated-cost breakdown modal.

Module

cold_cache

Modal for a cold prompt cache: send-time confirmation or expiry handoff.

Module

thread_name

Editable confirmation for a generated thread name.

Module

resume_compact

Prompt for compacting a large resumed thread.

Module

session_cost

Persistent warning when a session exceeds its configured cost threshold.

Module

plugin_manager

Interactive plugin manager screen.

Module

tabs

Clickable tab labels for the plugin manager header.

Module

models

Plugin manager view models.

Module

content

Pure plugin manager content builders.

Types

Type

StoredCredential

Tagged union of every persisted credential shape, narrowed by type.

Type

Payload

Type

MarketplaceSource

Type

PluginSource

Type

HITLDecision

Element type of HITLResponse["decisions"].

Type

GoalReviewResult

Type

JsEvalBlock

Type

PluginManagerResult

Value the plugin manager dismisses with.

None means no action is needed: the close check found no pending changes, or no checker was wired. Textual also produces None for a bare dismiss(), so h