Terminal interface for Deep Worker - interactive AI agent with file operations, shell access, and sub-agent capabilities.
pip install deep-worker==0.0.27 Copy PIP instructions
deep-worker is a Python package that runs LangChain agents as background daemon processes and exposes them to the interactive dwcli client.
This is a fork of LangChain's deepagents-cli, renamed to deep-worker and extended with additional providers, tools, and infrastructure (see the root README for the component map).
Python >=3.11, Linux kernel >=4.19 (WSL2 included). See docs/REQUIREMENTS.md — it also lists the syscalls that postdate that floor and must stay optional.
There are two supported ways to use deep-worker:
1. From a source checkout (recommended for development) — no pip install:
# Point the launchers into your PATH (project policy: no virtual environments) ln -sf /path/to/checkout/deep_worker/deep_worker_cli/deep-worker ~/.local/bin/deep-worker ln -sf /path/to/checkout/deep_worker/deep_worker_cli/dwcli ~/.local/bin/dwcli 2. From a built wheel (pip install deep-worker) — for consuming the package without the source tree. See docs/BUILD_INSTALL_GUIDE.md for build, check, and install instructions. Note the wheel's limitations (--import-claude is unavailable; deepagents is vendored, so the official PyPI deepagents must not be co-installed).
See deep_worker/README.md for the no-venv runtime model.
The wheel ships its five provider packages inside the deep_worker namespace — never as top-level packages (avoids collisions with real PyPI distributions such as claude-code-sdk-provider / semantic-search):
from deep_worker.providers.claude_code_sdk_provider import ClaudeCodeChatModel from deep_worker.providers.semantic_search import SemanticSearchIndexer Optional capabilities are gated behind extras and reported with actionable CapabilityError remedies when missing:
The universal web_search delegation tool works with any LLM provider (tri-state policy): default auto skips it with a single warning when the SDK fork is absent; --enable-web-search fails loudly; --disable-web-search never touches the SDK. DEEP_WORKER_SOURCE_ROOT / DEEP_WORKER_PROVIDER_SOURCE force source-checkout provider resolution (development). Full details: docs/BUILD_INSTALL_GUIDE.md.
⚠️ IMPORTANT: deep-worker-cli is designed for LOCAL TRUSTED ENVIRONMENTS ONLY
Never expose deep-worker ports to external networks!
Using an LLM to call tools in a loop is the simplest form of an agent. This architecture, however, can yield agents that are "shallow" and fail to plan and act over longer, more complex tasks.
Applications like "Deep Research", "Manus", and "Claude Code" have gotten around this limitation by implementing a combination of four things: a planning tool, sub agents, access to a file system, and a detailed prompt.
deep-worker implements these in a general purpose way so that you can easily create a Deep Agent for your application.
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.
By default, agents persist conversation history to SQLite database. You can control storage behavior:
# Default: SQLite persistence (production) deep-worker my_agent # Temporary in-memory storage (no persistence) deep-worker --memory-only temp_agent # Force SQLite even in test environment deep-worker --use-sqlite test_agent List all conversation threads:
# List all threads deep-worker --list # List with message counts (slower) deep-worker --list --with-counts # Filter by agent name deep-worker --list --agent my_agent # JSON output deep-worker --list --format json Thread management commands:
# Remove a specific thread deep-worker -rm thread_id # Dry run (preview without deleting) deep-worker -rm thread_id --dry-run # View thread history (works offline) deep-worker --history thread_id # View history as JSON deep-worker --history thread_id --format json # ⚠️ DANGER: --remove-before is GLOBAL and DESTRUCTIVE. # It sweeps every per-agent checkpoint DB under ~/.deep_worker/ AND every # ~/.deep_worker/ /summaries/ .md across ALL agents for the # current $HOME. NEVER run this command from an ad-hoc shell / integration # test without first isolating $HOME to a temp directory (see the # isolated_home / fake_home fixtures under tests/). # # Safety guard: if DATE resolves to a future timestamp, the command # refuses by default (exit code 2) and requires --force to proceed. # Future cutoffs match every row and are almost always bugs. # # Always start with --dry-run. # Remove old conversation data (threads AND offloaded summary sections) # before a specific date. See the Summarization storage section below # for what "summary sections" means. deep-worker --remove-before 2026-01-01 # Remove data older than 30 days deep-worker --remove-before 30d # Other relative formats: 7d, 2w, 3m, 1y deep-worker --remove-before 1y --dry-run Summarization storage — find and manage offloaded conversation history:
When the model's context fills up, SummarizationMiddleware evicts older messages and writes them to an on-disk file so the agent can later refer back to them. Files live at:
~/.deep_worker/ /summaries/ .md Each file is an append-only log with one ## Summarized at section per summarization event. The path quoted in the synthetic summary message injected into the agent's history is exactly this absolute path — you can cat/grep/less it directly. See deep_worker/docs/DESIGN_SUMMARIZATION_PERSISTENT_STORAGE.md.
# List all offloaded summaries (text table) deep-worker --list-summaries # Filter by agent deep-worker --list-summaries --agent my_agent # Machine-readable JSON output deep-worker --list-summaries --format json The --remove-before DATE command also prunes summary files:
Note: Tests automatically use in-memory storage by default for faster execution and test isolation.
Some tools are the agent's answer for a turn: once they succeed there is nothing useful left for the model to say, and calling it again only produces filler text. send_message_to_agent works this way out of the box — an outgoing inter-agent message is the agent's response for that turn.
Any tool can be given the same behavior by declaring it explicitly:
from deep_worker_cli.agent import create_cli_agent from deep_worker_cli.middleware import TurnEndingTool agent, backend = create_cli_agent( model="anthropic:claude-sonnet-4-5-20250929", assistant_id="extractor-42", project_memory_dir=work_dir, tools=[submit_fragments_tool], turn_ending_tools=[ TurnEndingTool( tool_name="submit_fragments", is_success=lambda result: result.get("document_closed") is True, echo_field=None, ), ], ) TurnEndingTool fields:
Agents started with the stock deep-worker binary have no launcher code of their own, so they use the repeatable --turn-ending-tool flag instead:
deep-worker rg_extractor --provider deepseek --model deepseek-chat \ --dir /path/to/workdir -m -sp \ --turn-ending-tool code_graph__submit_fragments:document_closed Value Predicate ends the turn when success is truthy : ends the turn only when that top-level field is exactly True is matched with .get(), so a missing key and false behave identically — the turn simply continues. The check is is True, not truthiness: 1, "true" and ["yes"] do NOT end the turn. CLI-declared tools are always jump-only (echo_field=None); no assistant message is injected.
must be a single top-level key: a dot in the FIELD (tool:a.b) is rejected, because nested paths are out of scope. A dot in the tool NAME is fine (a.b:c is a valid spec for a tool literally named a.b) — only the part after the : is constrained. Whitespace is rejected anywhere in the spec rather than trimmed, so a stray space from shell quoting fails loudly instead of silently producing a second, near-identical declaration.
⚠️ is the graph-side tool name, not the form the model calls. For a tool exposed by an external MCP server, that is the mangled __ name — server code_graph exposing submit_fragments becomes code_graph__submit_fragments. Do not pass the provider-visible mcp__… form; the middleware matches on ToolMessage.name, which carries the graph name.
The flag is repeatable, and each start logs one machine-greppable line per declaration, so a launcher can prove its flag arrived:
turn_ending_tool_registered name=code_graph__submit_fragments turn_ending_tool_not_found name=code_graph__submit_fragment candidates=['code_graph__submit_fragments', ...] A name that is not in the final tool inventory is a WARNING, never a startup failure — an external MCP endpoint may come up after the agent, and the declaration still matches if the tool appears later.
Declarations are persisted to session_metadata.json and survive --restart. Passing --turn-ending-tool together with --restart REPLACES the saved list wholesale (same semantics as --mcp-config); passing nothing inherits it. Declaring the same name twice — including a bare foo alongside foo:done — or declaring the built-in send_message_to_agent fails at startup before the agent is constructed.
See docs/DESIGN_TOOL_COMPLETION_MIDDLEWARE.md and docs/DESIGN_CLI_TURN_ENDING_TOOL_FLAG.md for the full contract.
All 2 files in this release have provenance metadata.
agents ai cli deep-agent langchain langgraph llm terminal
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
All 2 files in this release have been uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.




