Skip to main content

A Claude Code-style CLI for running LangGraph agents from the terminal

Project description

deepagent-code

A Claude Code-style CLI for running LangGraph agents from the terminal.

deepagent-code

One agent, every surface

deepagent-code is the terminal surface of the deep-agent family: write your agent once — any LangGraph CompiledGraph — and run it on every surface with the same spec string (module:attr or path/to/file.py:attr), the same deepagents.toml config file, and the same DEEPAGENT_* environment variables.

Surface Package Try it
Web app cowork-dash cowork-dash run --agent my_agent.py:graph
JupyterLab deepagent-lab pip install deepagent-lab, then the chat sidebar in jupyter lab
Terminal deepagent-code you are here
VS Code deepagent-vscode chat participant + stdio sidecar
Reference agent deepagent-hermes DEEPAGENT_AGENT_SPEC=deepagent_hermes.agent:graph on any surface
Shared core langgraph-stream-parser typed events + config resolver behind every surface

Installation

pip install deepagent-code

Or install directly from GitHub:

pip install git+https://github.com/dkedar7/deepagent-code.git

Quick Start

No agent or API key yet? See the CLI working in one command:

deepagent-code --demo "hello"

Run with the default agent (requires ANTHROPIC_API_KEY):

export ANTHROPIC_API_KEY="your_api_key"
deepagent-code

Or specify your own agent:

deepagent-code -a path/to/your_agent.py:graph

This launches an interactive conversation loop with your agent.

Usage

# Use the default agent
deepagent-code

# Send a message directly
deepagent-code "Hello, agent!"

# Specify a custom agent file
deepagent-code -a my_agent.py:graph

# Use a module path
deepagent-code -a mypackage.agents:chatbot

# Read message from a file
deepagent-code -f ./prompt.md

# Non-interactive mode (auto-approve tool calls)
deepagent-code --no-interactive

# Verbose output
deepagent-code -v

# Keyless demo agent (no API key needed)
deepagent-code --demo

# Print the resolved configuration: each value, its source, and the
# env var / deepagents.toml key that sets it
deepagent-code --show-config

Commands

In the interactive loop:

  • /q or /quit - Exit
  • /c - Clear conversation history
  • /h or /help - Show help

Environment Variables

# Agent location (path/to/file.py:variable_name or module:variable)
# (DEEPAGENT_SPEC is still accepted as a deprecated alias)
export DEEPAGENT_AGENT_SPEC="my_agent.py:graph"
deepagent-code

# Working directory
export DEEPAGENT_WORKSPACE_ROOT="/path/to/workspace"

# Stream mode (updates or values)
export DEEPAGENT_STREAM_MODE="updates"

Configuration Files

deepagent-code reads TOML config from two locations and merges them (project overrides global):

  • Global: ~/.deepagents/config.toml (shared with the upstream deepagents CLI)
  • Project: deepagents.toml in the current directory or any ancestor

Precedence: CLI args > env vars > project TOML > global TOML > defaults.

Example deepagents.toml:

[agent]
spec = "my_agent.py:graph"
workspace_root = "."

[ui]
verbose = true
async_mode = false
stream_mode = "updates"

[configurable]
# seeds LangGraph RunnableConfig.configurable
thread_id = "my-thread"

CLI Options

Usage: deepagent-code [OPTIONS] [MESSAGE]

Arguments:
  MESSAGE  Optional input to send to the agent immediately

Options:
  -a, --agent TEXT                Agent spec (path/to/file.py:graph or module:graph)
  -g, --graph-name TEXT           Graph variable name (default: "graph")
  -f, --file PATH                 Read message from a file (any extension)
  --interactive/--no-interactive  Handle interrupts (default: interactive)
  --async-mode/--sync-mode        Async streaming (default: sync)
  --stream-mode TEXT              Stream mode (updates or values)
  -v, --verbose                   Verbose output

Creating Your Own Agent

Your agent file should export a compiled LangGraph graph:

# my_agent.py
from deepagents import create_deep_agent
from langgraph.checkpoint.memory import MemorySaver

agent = create_deep_agent(
    name="My Agent",
    model="anthropic:claude-sonnet-4-20250514",
    checkpointer=MemorySaver(),
)

Then run it:

deepagent-code -a my_agent.py:agent

Programmatic Use

from deepagent_code import stream_graph_updates, prepare_agent_input

input_data = prepare_agent_input(message="Hello!")

for chunk in stream_graph_updates(graph, input_data):
    if chunk.get("chunk"):
        print(chunk["chunk"], end="")

License

MIT License - see LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deepagent_code-0.3.0.tar.gz (24.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deepagent_code-0.3.0-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file deepagent_code-0.3.0.tar.gz.

File metadata

  • Download URL: deepagent_code-0.3.0.tar.gz
  • Upload date:
  • Size: 24.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for deepagent_code-0.3.0.tar.gz
Algorithm Hash digest
SHA256 386012e29f451fc45fed1d17b94fa399e0cd367eae021c6c13f70bd5fc5ca70a
MD5 eb07fe6efe7e6da9b8f49b7236d3a095
BLAKE2b-256 d7f8cf5ad2c2eef22336796911e5d147e1111022442ff095071d13ad72266ddf

See more details on using hashes here.

File details

Details for the file deepagent_code-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: deepagent_code-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for deepagent_code-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 44f7f1bac20fc96070770d08412e55a8154aad20be2a96b4837529688fe5925a
MD5 bd30d91cf8f7b976b5d0e71303d7cd93
BLAKE2b-256 b890b16184be99275cb027ad1ee7c423125f1954dd37fe39753e3ed808f5273e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page