langstage-cli 0.0.1__tar.gz → 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 deepagent-code contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,237 @@
1
+ Metadata-Version: 2.4
2
+ Name: langstage-cli
3
+ Version: 0.5.0
4
+ Summary: The terminal stage for your LangGraph agent — Claude Code-style CLI for any CompiledGraph
5
+ Author-email: Kedar Dabhadkar <kdabhadk@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/dkedar7/langstage-cli
8
+ Project-URL: Repository, https://github.com/dkedar7/langstage-cli
9
+ Project-URL: Issues, https://github.com/dkedar7/langstage-cli/issues
10
+ Keywords: langgraph,langchain,langstage,cli,agents,llm,ai
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Requires-Python: >=3.11
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: langgraph>=0.2.0
22
+ Requires-Dist: langgraph-stream-parser<0.5,>=0.3
23
+ Requires-Dist: click>=8.0.0
24
+ Requires-Dist: python-dotenv
25
+ Requires-Dist: deepagents
26
+ Provides-Extra: dev
27
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
28
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
29
+ Requires-Dist: black>=23.0.0; extra == "dev"
30
+ Requires-Dist: ruff==0.15.15; extra == "dev"
31
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
32
+ Provides-Extra: agui
33
+ Requires-Dist: langgraph-stream-parser[agui]<0.5,>=0.4; extra == "agui"
34
+ Dynamic: license-file
35
+
36
+ # langstage-cli
37
+
38
+ **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.
39
+
40
+ > Renamed from **deepagent-code** (the old package name now just installs this one, and the `deepagent-code` command still works).
41
+
42
+ ![langstage-cli](examples/image.png)
43
+
44
+ ## Every stage for your LangGraph agent
45
+
46
+ 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.
47
+
48
+ | Stage | Package | Try it |
49
+ |---|---|---|
50
+ | Web app | [langstage](https://github.com/dkedar7/langstage) | `langstage run --agent my_agent.py:graph` |
51
+ | JupyterLab | [langstage-jupyter](https://github.com/dkedar7/langstage-jupyter) | `pip install langstage-jupyter`, then the chat sidebar in `jupyter lab` |
52
+ | Terminal | langstage-cli | **you are here** |
53
+ | VS Code | [langstage-vscode](https://github.com/dkedar7/langstage-vscode) | chat participant + stdio sidecar |
54
+ | Reference agent | [langstage-hermes](https://github.com/dkedar7/langstage-hermes) | `LANGSTAGE_AGENT_SPEC=langstage_hermes.agent:graph` on any stage |
55
+ | Shared core | [langgraph-stream-parser](https://github.com/dkedar7/langgraph-stream-parser) | typed events + config resolver behind every stage |
56
+
57
+ 📖 **Full documentation:** <https://dkedar7.github.io/langstage-docs/>
58
+
59
+ ### Serve over AG-UI
60
+
61
+ This surface's agent — any LangGraph `CompiledGraph` — can also be served over the [AG-UI protocol](https://github.com/dkedar7/langgraph-stream-parser):
62
+
63
+ ```bash
64
+ pip install "langgraph-stream-parser[agui]"
65
+ langstage-agui --agent my_agent.py:graph
66
+ ```
67
+
68
+ ## Installation
69
+
70
+ ```bash
71
+ pip install langstage-cli
72
+ ```
73
+
74
+ Or install directly from GitHub:
75
+ ```bash
76
+ pip install git+https://github.com/dkedar7/langstage-cli.git
77
+ ```
78
+
79
+ ## Quick Start
80
+
81
+ No agent or API key yet? See the CLI working in one command:
82
+ ```bash
83
+ langstage-cli --demo "hello"
84
+ ```
85
+
86
+ Run with the default agent (requires `ANTHROPIC_API_KEY`):
87
+ ```bash
88
+ export ANTHROPIC_API_KEY="your_api_key"
89
+ langstage-cli
90
+ ```
91
+
92
+ Or specify your own agent:
93
+ ```bash
94
+ langstage-cli -a path/to/your_agent.py:graph
95
+ ```
96
+
97
+ This launches an interactive conversation loop with your agent.
98
+
99
+ ## Usage
100
+
101
+ ```bash
102
+ # Use the default agent
103
+ langstage-cli
104
+
105
+ # Send a message directly
106
+ langstage-cli "Hello, agent!"
107
+
108
+ # Specify a custom agent file
109
+ langstage-cli -a my_agent.py:graph
110
+
111
+ # Use a module path
112
+ langstage-cli -a mypackage.agents:chatbot
113
+
114
+ # Read message from a file
115
+ langstage-cli -f ./prompt.md
116
+
117
+ # Non-interactive mode (auto-approve tool calls)
118
+ langstage-cli --no-interactive
119
+
120
+ # Verbose output
121
+ langstage-cli -v
122
+
123
+ # Keyless demo agent (no API key needed)
124
+ langstage-cli --demo
125
+
126
+ # Print the resolved configuration: each value, its source, and the
127
+ # env var / langstage.toml key that sets it
128
+ langstage-cli --show-config
129
+ ```
130
+
131
+ ## Commands
132
+
133
+ In the interactive loop:
134
+ - `/q` or `/quit` - Exit
135
+ - `/c` - Clear conversation history
136
+ - `/h` or `/help` - Show help
137
+
138
+ ## Environment Variables
139
+
140
+ ```bash
141
+ # Agent location (path/to/file.py:variable_name or module:variable)
142
+ # (DEEPAGENT_AGENT_SPEC / DEEPAGENT_SPEC still accepted as deprecated aliases)
143
+ export LANGSTAGE_AGENT_SPEC="my_agent.py:graph"
144
+ langstage-cli
145
+
146
+ # Working directory
147
+ export LANGSTAGE_WORKSPACE_ROOT="/path/to/workspace"
148
+
149
+ # Stream mode (updates or values)
150
+ export LANGSTAGE_STREAM_MODE="updates"
151
+ ```
152
+
153
+ ## Configuration Files
154
+
155
+ `langstage-cli` reads TOML config from two locations and merges them
156
+ (project overrides global):
157
+
158
+ - **Global**: `~/.langstage/config.toml`
159
+ - **Project**: `langstage.toml` in the current directory or any ancestor
160
+
161
+ Legacy locations (`~/.deepagents/config.toml`, `deepagents.toml`) are still
162
+ read as fallbacks; move your config when convenient — `~/.deepagents/` now
163
+ belongs to LangChain's `dcode`.
164
+
165
+ Precedence: CLI args > env vars > project TOML > global TOML > defaults.
166
+
167
+ Example `langstage.toml`:
168
+
169
+ ```toml
170
+ [agent]
171
+ spec = "my_agent.py:graph"
172
+ workspace_root = "."
173
+
174
+ [ui]
175
+ verbose = true
176
+ async_mode = false
177
+ stream_mode = "updates"
178
+
179
+ [configurable]
180
+ # seeds LangGraph RunnableConfig.configurable
181
+ thread_id = "my-thread"
182
+ ```
183
+
184
+ ## CLI Options
185
+
186
+ ```
187
+ Usage: langstage-cli [OPTIONS] [MESSAGE]
188
+
189
+ Arguments:
190
+ MESSAGE Optional input to send to the agent immediately
191
+
192
+ Options:
193
+ -a, --agent TEXT Agent spec (path/to/file.py:graph or module:graph)
194
+ -g, --graph-name TEXT Graph variable name (default: "graph")
195
+ -f, --file PATH Read message from a file (any extension)
196
+ --interactive/--no-interactive Handle interrupts (default: interactive)
197
+ --async-mode/--sync-mode Async streaming (default: sync)
198
+ --stream-mode TEXT Stream mode (updates or values)
199
+ -v, --verbose Verbose output
200
+ ```
201
+
202
+ ## Creating Your Own Agent
203
+
204
+ Your agent file should export a compiled LangGraph graph:
205
+
206
+ ```python
207
+ # my_agent.py
208
+ from deepagents import create_deep_agent
209
+ from langgraph.checkpoint.memory import MemorySaver
210
+
211
+ agent = create_deep_agent(
212
+ name="My Agent",
213
+ model="anthropic:claude-sonnet-4-20250514",
214
+ checkpointer=MemorySaver(),
215
+ )
216
+ ```
217
+
218
+ Then run it:
219
+ ```bash
220
+ langstage-cli -a my_agent.py:agent
221
+ ```
222
+
223
+ ## Programmatic Use
224
+
225
+ ```python
226
+ from langstage_cli import stream_graph_updates, prepare_agent_input
227
+
228
+ input_data = prepare_agent_input(message="Hello!")
229
+
230
+ for chunk in stream_graph_updates(graph, input_data):
231
+ if chunk.get("chunk"):
232
+ print(chunk["chunk"], end="")
233
+ ```
234
+
235
+ ## License
236
+
237
+ MIT License - see LICENSE file for details.
@@ -0,0 +1,202 @@
1
+ # langstage-cli
2
+
3
+ **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.
4
+
5
+ > Renamed from **deepagent-code** (the old package name now just installs this one, and the `deepagent-code` command still works).
6
+
7
+ ![langstage-cli](examples/image.png)
8
+
9
+ ## Every stage for your LangGraph agent
10
+
11
+ 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.
12
+
13
+ | Stage | Package | Try it |
14
+ |---|---|---|
15
+ | Web app | [langstage](https://github.com/dkedar7/langstage) | `langstage run --agent my_agent.py:graph` |
16
+ | JupyterLab | [langstage-jupyter](https://github.com/dkedar7/langstage-jupyter) | `pip install langstage-jupyter`, then the chat sidebar in `jupyter lab` |
17
+ | Terminal | langstage-cli | **you are here** |
18
+ | VS Code | [langstage-vscode](https://github.com/dkedar7/langstage-vscode) | chat participant + stdio sidecar |
19
+ | Reference agent | [langstage-hermes](https://github.com/dkedar7/langstage-hermes) | `LANGSTAGE_AGENT_SPEC=langstage_hermes.agent:graph` on any stage |
20
+ | Shared core | [langgraph-stream-parser](https://github.com/dkedar7/langgraph-stream-parser) | typed events + config resolver behind every stage |
21
+
22
+ 📖 **Full documentation:** <https://dkedar7.github.io/langstage-docs/>
23
+
24
+ ### Serve over AG-UI
25
+
26
+ This surface's agent — any LangGraph `CompiledGraph` — can also be served over the [AG-UI protocol](https://github.com/dkedar7/langgraph-stream-parser):
27
+
28
+ ```bash
29
+ pip install "langgraph-stream-parser[agui]"
30
+ langstage-agui --agent my_agent.py:graph
31
+ ```
32
+
33
+ ## Installation
34
+
35
+ ```bash
36
+ pip install langstage-cli
37
+ ```
38
+
39
+ Or install directly from GitHub:
40
+ ```bash
41
+ pip install git+https://github.com/dkedar7/langstage-cli.git
42
+ ```
43
+
44
+ ## Quick Start
45
+
46
+ No agent or API key yet? See the CLI working in one command:
47
+ ```bash
48
+ langstage-cli --demo "hello"
49
+ ```
50
+
51
+ Run with the default agent (requires `ANTHROPIC_API_KEY`):
52
+ ```bash
53
+ export ANTHROPIC_API_KEY="your_api_key"
54
+ langstage-cli
55
+ ```
56
+
57
+ Or specify your own agent:
58
+ ```bash
59
+ langstage-cli -a path/to/your_agent.py:graph
60
+ ```
61
+
62
+ This launches an interactive conversation loop with your agent.
63
+
64
+ ## Usage
65
+
66
+ ```bash
67
+ # Use the default agent
68
+ langstage-cli
69
+
70
+ # Send a message directly
71
+ langstage-cli "Hello, agent!"
72
+
73
+ # Specify a custom agent file
74
+ langstage-cli -a my_agent.py:graph
75
+
76
+ # Use a module path
77
+ langstage-cli -a mypackage.agents:chatbot
78
+
79
+ # Read message from a file
80
+ langstage-cli -f ./prompt.md
81
+
82
+ # Non-interactive mode (auto-approve tool calls)
83
+ langstage-cli --no-interactive
84
+
85
+ # Verbose output
86
+ langstage-cli -v
87
+
88
+ # Keyless demo agent (no API key needed)
89
+ langstage-cli --demo
90
+
91
+ # Print the resolved configuration: each value, its source, and the
92
+ # env var / langstage.toml key that sets it
93
+ langstage-cli --show-config
94
+ ```
95
+
96
+ ## Commands
97
+
98
+ In the interactive loop:
99
+ - `/q` or `/quit` - Exit
100
+ - `/c` - Clear conversation history
101
+ - `/h` or `/help` - Show help
102
+
103
+ ## Environment Variables
104
+
105
+ ```bash
106
+ # Agent location (path/to/file.py:variable_name or module:variable)
107
+ # (DEEPAGENT_AGENT_SPEC / DEEPAGENT_SPEC still accepted as deprecated aliases)
108
+ export LANGSTAGE_AGENT_SPEC="my_agent.py:graph"
109
+ langstage-cli
110
+
111
+ # Working directory
112
+ export LANGSTAGE_WORKSPACE_ROOT="/path/to/workspace"
113
+
114
+ # Stream mode (updates or values)
115
+ export LANGSTAGE_STREAM_MODE="updates"
116
+ ```
117
+
118
+ ## Configuration Files
119
+
120
+ `langstage-cli` reads TOML config from two locations and merges them
121
+ (project overrides global):
122
+
123
+ - **Global**: `~/.langstage/config.toml`
124
+ - **Project**: `langstage.toml` in the current directory or any ancestor
125
+
126
+ Legacy locations (`~/.deepagents/config.toml`, `deepagents.toml`) are still
127
+ read as fallbacks; move your config when convenient — `~/.deepagents/` now
128
+ belongs to LangChain's `dcode`.
129
+
130
+ Precedence: CLI args > env vars > project TOML > global TOML > defaults.
131
+
132
+ Example `langstage.toml`:
133
+
134
+ ```toml
135
+ [agent]
136
+ spec = "my_agent.py:graph"
137
+ workspace_root = "."
138
+
139
+ [ui]
140
+ verbose = true
141
+ async_mode = false
142
+ stream_mode = "updates"
143
+
144
+ [configurable]
145
+ # seeds LangGraph RunnableConfig.configurable
146
+ thread_id = "my-thread"
147
+ ```
148
+
149
+ ## CLI Options
150
+
151
+ ```
152
+ Usage: langstage-cli [OPTIONS] [MESSAGE]
153
+
154
+ Arguments:
155
+ MESSAGE Optional input to send to the agent immediately
156
+
157
+ Options:
158
+ -a, --agent TEXT Agent spec (path/to/file.py:graph or module:graph)
159
+ -g, --graph-name TEXT Graph variable name (default: "graph")
160
+ -f, --file PATH Read message from a file (any extension)
161
+ --interactive/--no-interactive Handle interrupts (default: interactive)
162
+ --async-mode/--sync-mode Async streaming (default: sync)
163
+ --stream-mode TEXT Stream mode (updates or values)
164
+ -v, --verbose Verbose output
165
+ ```
166
+
167
+ ## Creating Your Own Agent
168
+
169
+ Your agent file should export a compiled LangGraph graph:
170
+
171
+ ```python
172
+ # my_agent.py
173
+ from deepagents import create_deep_agent
174
+ from langgraph.checkpoint.memory import MemorySaver
175
+
176
+ agent = create_deep_agent(
177
+ name="My Agent",
178
+ model="anthropic:claude-sonnet-4-20250514",
179
+ checkpointer=MemorySaver(),
180
+ )
181
+ ```
182
+
183
+ Then run it:
184
+ ```bash
185
+ langstage-cli -a my_agent.py:agent
186
+ ```
187
+
188
+ ## Programmatic Use
189
+
190
+ ```python
191
+ from langstage_cli import stream_graph_updates, prepare_agent_input
192
+
193
+ input_data = prepare_agent_input(message="Hello!")
194
+
195
+ for chunk in stream_graph_updates(graph, input_data):
196
+ if chunk.get("chunk"):
197
+ print(chunk["chunk"], end="")
198
+ ```
199
+
200
+ ## License
201
+
202
+ MIT License - see LICENSE file for details.
@@ -0,0 +1,23 @@
1
+ """Deprecated alias package: ``deepagent_code`` is now ``langstage_cli``.
2
+
3
+ Kept for one transition window so existing imports keep working. Import
4
+ ``langstage_cli`` instead.
5
+ """
6
+
7
+ import sys as _sys
8
+ import warnings as _warnings
9
+
10
+ import langstage_cli as _new
11
+ from langstage_cli import * # noqa: F401,F403
12
+ from langstage_cli import cli, config # noqa: F401
13
+
14
+ _warnings.warn(
15
+ "deepagent_code has been renamed to langstage_cli; "
16
+ "this alias package will be removed in a future release.",
17
+ DeprecationWarning,
18
+ stacklevel=2,
19
+ )
20
+
21
+ _sys.modules[__name__ + ".cli"] = cli
22
+ _sys.modules[__name__ + ".config"] = config
23
+ __version__ = getattr(_new, "__version__", "0")
@@ -0,0 +1,27 @@
1
+ """
2
+ langstage_cli - A Claude Code-style CLI for running LangGraph agents.
3
+
4
+ The streaming / interrupt utilities that used to live here now come from
5
+ ``langgraph-stream-parser``. This package re-exports its dict-based convenience
6
+ API for backward compatibility; the lower-level helpers (interrupt parsing,
7
+ tool-call serialization, content extraction) are available from
8
+ ``langgraph_stream_parser.extractors`` if needed directly.
9
+ """
10
+
11
+ from langgraph_stream_parser import (
12
+ prepare_agent_input,
13
+ stream_graph_updates,
14
+ resume_graph_from_interrupt,
15
+ astream_graph_updates,
16
+ aresume_graph_from_interrupt,
17
+ )
18
+
19
+ __version__ = "0.4.0"
20
+
21
+ __all__ = [
22
+ "prepare_agent_input",
23
+ "stream_graph_updates",
24
+ "resume_graph_from_interrupt",
25
+ "astream_graph_updates",
26
+ "aresume_graph_from_interrupt",
27
+ ]