Skip to main content

The terminal stage for your LangGraph agent — Claude Code-style CLI for any CompiledGraph

Project description

langstage-cli

The terminal stage for your LangGraph agent. A Claude Code-style CLI that runs any LangGraph CompiledGraph — yours, not a bundled one — with streaming, tool-call rendering, and human-in-the-loop approval.

Renamed from deepagent-code (the old package name now just installs this one, and the deepagent-code command still works).

langstage-cli

Every stage for your LangGraph agent

langstage-cli is the terminal stage of the LangStage family: write your agent once — any LangGraph CompiledGraph — and run it on every stage with the same spec string (module:attr or path/to/file.py:attr), the same langstage.toml config file, and the same LANGSTAGE_* environment variables.

Stage Package Try it
Web app langstage langstage run --agent my_agent.py:graph
JupyterLab langstage-jupyter pip install langstage-jupyter, then the chat sidebar in jupyter lab
Terminal langstage-cli you are here
VS Code langstage-vscode chat participant + stdio sidecar
Reference agent langstage-hermes LANGSTAGE_AGENT_SPEC=langstage_hermes.agent:graph on any stage
Shared core langgraph-stream-parser typed events + config resolver behind every stage

📖 Full documentation: https://dkedar7.github.io/langstage-docs/

Serve over AG-UI

This surface's agent — any LangGraph CompiledGraph — can also be served over the AG-UI protocol:

pip install "langgraph-stream-parser[agui]"
langstage-agui --agent my_agent.py:graph

Installation

pip install langstage-cli

Or install directly from GitHub:

pip install git+https://github.com/dkedar7/langstage-cli.git

Quick Start

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

langstage-cli --demo "hello"

Point it at your own agent (any LangGraph CompiledGraph):

export ANTHROPIC_API_KEY="your_api_key"   # if your agent calls Anthropic
langstage-cli -a path/to/your_agent.py:graph

This launches an interactive conversation loop with your agent.

Usage

# Keyless demo agent — no API key, no agent of your own
langstage-cli --demo "Hello"

# Send a message directly to your agent
langstage-cli -a my_agent.py:graph "Hello, agent!"

# Specify a custom agent file
langstage-cli -a my_agent.py:graph

# Use a module path
langstage-cli -a mypackage.agents:chatbot

# Read message from a file
langstage-cli -f ./prompt.md

# Non-interactive mode (auto-approve tool calls)
langstage-cli --no-interactive

# Verbose output
langstage-cli -v

# Keyless demo agent (no API key needed)
langstage-cli --demo

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

Commands

In the interactive loop:

  • /quit (/q, /exit) - Exit
  • /clear (/c) - Clear conversation history
  • /reset - Reset the session
  • /config (/cfg) - Show the resolved configuration
  • /history (/hist) - Show conversation history
  • /help (/h, /?) - Show help
  • Tab autocompletes commands; Ctrl+C exits

Environment Variables

# Agent location (path/to/file.py:variable_name or module:variable)
# (DEEPAGENT_AGENT_SPEC / DEEPAGENT_SPEC still accepted as deprecated aliases)
export LANGSTAGE_AGENT_SPEC="my_agent.py:graph"
langstage-cli

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

# Stream mode (updates or messages)
export LANGSTAGE_STREAM_MODE="updates"

Configuration Files

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

  • Global: ~/.langstage/config.toml
  • Project: langstage.toml in the current directory or any ancestor

Legacy locations (~/.deepagents/config.toml, deepagents.toml) are still read as fallbacks; move your config when convenient — ~/.deepagents/ now belongs to LangChain's dcode.

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

Example langstage.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: langstage-cli [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 [updates|messages]
                                  Stream mode (default: updates)
  -v, --verbose                   Verbose output
  --demo                          Run with the built-in keyless demo agent
  --show-config                   Print the resolved configuration and exit
  --version                       Show the version and exit

Creating Your Own Agent

Your agent file just needs to export a compiled LangGraph graph — langstage-cli runs any CompiledGraph. A minimal stdlib example (no extra deps):

# my_agent.py — needs only langgraph (a base dependency)
from langgraph.graph import StateGraph, START, END
from langgraph.graph.message import MessagesState
from langchain_core.messages import AIMessage

def respond(state):
    last = state["messages"][-1].content
    return {"messages": [AIMessage(content=f"You said: {last}")]}

g = StateGraph(MessagesState)
g.add_node("respond", respond)
g.add_edge(START, "respond")
g.add_edge("respond", END)
graph = g.compile()

Or a full deep agent (requires pip install deepagents):

# 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-6",
    checkpointer=MemorySaver(),
)

Then run it:

langstage-cli -a my_agent.py:graph    # or :agent for the deepagents example

Programmatic Use

from langstage_cli 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

langstage_cli-0.5.8.tar.gz (30.8 kB view details)

Uploaded Source

Built Distribution

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

langstage_cli-0.5.8-py3-none-any.whl (23.6 kB view details)

Uploaded Python 3

File details

Details for the file langstage_cli-0.5.8.tar.gz.

File metadata

  • Download URL: langstage_cli-0.5.8.tar.gz
  • Upload date:
  • Size: 30.8 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 langstage_cli-0.5.8.tar.gz
Algorithm Hash digest
SHA256 182166b7e4dab2dda41cca5ddd96ef5e762ef958060ebd3693f6e2224708a02a
MD5 9dcbfe7b06e6adeff6ca37fa057c6a4f
BLAKE2b-256 3820f329a49202149ded4307b5d47e41be64a69e3c41ed5338685890ee948c86

See more details on using hashes here.

File details

Details for the file langstage_cli-0.5.8-py3-none-any.whl.

File metadata

  • Download URL: langstage_cli-0.5.8-py3-none-any.whl
  • Upload date:
  • Size: 23.6 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 langstage_cli-0.5.8-py3-none-any.whl
Algorithm Hash digest
SHA256 128ac115e88443435a55d4c98714297a1a6c53758fc3903a309d07543be8862c
MD5 ac5223e200c02589c15c3a78c5f3d3d5
BLAKE2b-256 fc74450177e71e582dcd3c8288b7115c1e24ba0c3ddd717db54a38c28894d3ec

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