langgraph-stream-parser 0.1.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.
Files changed (40) hide show
  1. langgraph_stream_parser-0.1.0/.claude/settings.local.json +12 -0
  2. langgraph_stream_parser-0.1.0/.gitignore +208 -0
  3. langgraph_stream_parser-0.1.0/CHANGELOG.md +22 -0
  4. langgraph_stream_parser-0.1.0/LICENSE +21 -0
  5. langgraph_stream_parser-0.1.0/PKG-INFO +332 -0
  6. langgraph_stream_parser-0.1.0/README.md +298 -0
  7. langgraph_stream_parser-0.1.0/examples/agent.py +97 -0
  8. langgraph_stream_parser-0.1.0/examples/jupyter_display.py +267 -0
  9. langgraph_stream_parser-0.1.0/examples/jupyter_example.ipynb +836 -0
  10. langgraph_stream_parser-0.1.0/pyproject.toml +73 -0
  11. langgraph_stream_parser-0.1.0/spec.md +1443 -0
  12. langgraph_stream_parser-0.1.0/src/langgraph_stream_parser/__init__.py +81 -0
  13. langgraph_stream_parser-0.1.0/src/langgraph_stream_parser/adapters/__init__.py +7 -0
  14. langgraph_stream_parser-0.1.0/src/langgraph_stream_parser/adapters/base.py +432 -0
  15. langgraph_stream_parser-0.1.0/src/langgraph_stream_parser/adapters/cli.py +471 -0
  16. langgraph_stream_parser-0.1.0/src/langgraph_stream_parser/adapters/jupyter.py +288 -0
  17. langgraph_stream_parser-0.1.0/src/langgraph_stream_parser/adapters/print.py +211 -0
  18. langgraph_stream_parser-0.1.0/src/langgraph_stream_parser/compat.py +273 -0
  19. langgraph_stream_parser-0.1.0/src/langgraph_stream_parser/events.py +182 -0
  20. langgraph_stream_parser-0.1.0/src/langgraph_stream_parser/extractors/__init__.py +14 -0
  21. langgraph_stream_parser-0.1.0/src/langgraph_stream_parser/extractors/base.py +74 -0
  22. langgraph_stream_parser-0.1.0/src/langgraph_stream_parser/extractors/builtins.py +127 -0
  23. langgraph_stream_parser-0.1.0/src/langgraph_stream_parser/extractors/interrupts.py +135 -0
  24. langgraph_stream_parser-0.1.0/src/langgraph_stream_parser/extractors/messages.py +149 -0
  25. langgraph_stream_parser-0.1.0/src/langgraph_stream_parser/handlers/__init__.py +10 -0
  26. langgraph_stream_parser-0.1.0/src/langgraph_stream_parser/handlers/updates.py +268 -0
  27. langgraph_stream_parser-0.1.0/src/langgraph_stream_parser/parser.py +217 -0
  28. langgraph_stream_parser-0.1.0/src/langgraph_stream_parser/resume.py +120 -0
  29. langgraph_stream_parser-0.1.0/tests/__init__.py +1 -0
  30. langgraph_stream_parser-0.1.0/tests/fixtures/__init__.py +1 -0
  31. langgraph_stream_parser-0.1.0/tests/fixtures/mocks.py +241 -0
  32. langgraph_stream_parser-0.1.0/tests/test_cli_adapter.py +349 -0
  33. langgraph_stream_parser-0.1.0/tests/test_compat.py +203 -0
  34. langgraph_stream_parser-0.1.0/tests/test_events.py +157 -0
  35. langgraph_stream_parser-0.1.0/tests/test_extractors.py +319 -0
  36. langgraph_stream_parser-0.1.0/tests/test_jupyter.py +366 -0
  37. langgraph_stream_parser-0.1.0/tests/test_parser.py +348 -0
  38. langgraph_stream_parser-0.1.0/tests/test_print_adapter.py +349 -0
  39. langgraph_stream_parser-0.1.0/tests/test_resume.py +69 -0
  40. langgraph_stream_parser-0.1.0/uv.lock +1460 -0
@@ -0,0 +1,12 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(source ~/.venvs/langgraph-stream-parser/bin/activate)",
5
+ "Bash(pytest:*)",
6
+ "Bash(test:*)",
7
+ "Bash(uv run python -m pytest:*)",
8
+ "Bash(~/.venvs/langgraph-stream-parser/bin/python -m pytest:*)",
9
+ "Bash(uv run pytest:*)"
10
+ ]
11
+ }
12
+ }
@@ -0,0 +1,208 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+ #poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ #pdm.lock
116
+ #pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ #pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .envrc
140
+ .venv
141
+ env/
142
+ venv/
143
+ ENV/
144
+ env.bak/
145
+ venv.bak/
146
+
147
+ # Spyder project settings
148
+ .spyderproject
149
+ .spyproject
150
+
151
+ # Rope project settings
152
+ .ropeproject
153
+
154
+ # mkdocs documentation
155
+ /site
156
+
157
+ # mypy
158
+ .mypy_cache/
159
+ .dmypy.json
160
+ dmypy.json
161
+
162
+ # Pyre type checker
163
+ .pyre/
164
+
165
+ # pytype static type analyzer
166
+ .pytype/
167
+
168
+ # Cython debug symbols
169
+ cython_debug/
170
+
171
+ # PyCharm
172
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
175
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
176
+ #.idea/
177
+
178
+ # Abstra
179
+ # Abstra is an AI-powered process automation framework.
180
+ # Ignore directories containing user credentials, local state, and settings.
181
+ # Learn more at https://abstra.io/docs
182
+ .abstra/
183
+
184
+ # Visual Studio Code
185
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
188
+ # you could uncomment the following to ignore the entire vscode folder
189
+ # .vscode/
190
+
191
+ # Ruff stuff:
192
+ .ruff_cache/
193
+
194
+ # PyPI configuration file
195
+ .pypirc
196
+
197
+ # Cursor
198
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
199
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
200
+ # refer to https://docs.cursor.com/context/ignore-files
201
+ .cursorignore
202
+ .cursorindexingignore
203
+
204
+ # Marimo
205
+ marimo/_static/
206
+ marimo/_lsp/
207
+ __marimo__/
208
+ .jupyter_ystore.db
@@ -0,0 +1,22 @@
1
+ # Changelog
2
+
3
+ ## [0.1.0] - 2026-02-01
4
+
5
+ ### Initial Release
6
+
7
+ - Add `StreamParser` for parsing LangGraph stream outputs into typed events
8
+ - Add typed event classes: `ContentEvent`, `ToolCallStartEvent`, `ToolCallEndEvent`, `ToolExtractedEvent`, `InterruptEvent`, `StateUpdateEvent`, `CompleteEvent`, `ErrorEvent`
9
+ - Add tool lifecycle tracking (start → end)
10
+ - Add extensible extractor system with built-in `ThinkToolExtractor` and `TodoExtractor`
11
+ - Add interrupt handling with `create_resume_input()` and `prepare_agent_input()`
12
+ - Add async support via `aparse()`
13
+ - Add legacy dict-based API for backward compatibility (`stream_graph_updates`, `resume_graph_from_interrupt`)
14
+
15
+ ### Display Adapters
16
+
17
+ - Add `BaseAdapter` abstract class for building custom display adapters
18
+ - Add `PrintAdapter` for plain text output in any Python environment
19
+ - Add `CLIAdapter` for styled terminal output with ANSI colors and spinner animation
20
+ - Add `JupyterDisplay` for rich notebook display with live updates
21
+ - Add configurable `reflection_types` and `todo_types` for custom tool rendering
22
+ - Add `**stream_kwargs` pass-through to `graph.stream()`
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kedar Dabhadkar
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,332 @@
1
+ Metadata-Version: 2.4
2
+ Name: langgraph-stream-parser
3
+ Version: 0.1.0
4
+ Summary: Universal parser for LangGraph streaming outputs
5
+ Project-URL: Homepage, https://github.com/dkedar7/langgraph-stream-parser
6
+ Project-URL: Documentation, https://github.com/dkedar7/langgraph-stream-parser#readme
7
+ Project-URL: Repository, https://github.com/dkedar7/langgraph-stream-parser
8
+ Project-URL: Issues, https://github.com/dkedar7/langgraph-stream-parser/issues
9
+ Author: Kedar Dabhadkar
10
+ License: MIT
11
+ License-File: LICENSE
12
+ Keywords: agents,ai,langchain,langgraph,parser,streaming
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Requires-Python: >=3.10
23
+ Provides-Extra: dev
24
+ Requires-Dist: langchain-core>=0.2.0; extra == 'dev'
25
+ Requires-Dist: langgraph>=0.2.0; extra == 'dev'
26
+ Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
27
+ Requires-Dist: pytest-cov>=4.0; extra == 'dev'
28
+ Requires-Dist: pytest>=7.0; extra == 'dev'
29
+ Requires-Dist: rich>=13.0; extra == 'dev'
30
+ Provides-Extra: jupyter
31
+ Requires-Dist: ipython>=8.0; extra == 'jupyter'
32
+ Requires-Dist: rich>=13.0; extra == 'jupyter'
33
+ Description-Content-Type: text/markdown
34
+
35
+ # langgraph-stream-parser
36
+
37
+ Universal parser for LangGraph streaming outputs. Normalizes complex, variable output shapes from `graph.stream()` and `graph.astream()` into consistent, typed event objects.
38
+
39
+ ## Installation
40
+
41
+ ```bash
42
+ pip install langgraph-stream-parser
43
+ ```
44
+
45
+ ## Quick Start
46
+
47
+ ```python
48
+ from langgraph_stream_parser import StreamParser
49
+ from langgraph_stream_parser.events import ContentEvent, ToolCallStartEvent, InterruptEvent
50
+
51
+ parser = StreamParser()
52
+
53
+ for event in parser.parse(graph.stream(input_data, stream_mode="updates")):
54
+ match event:
55
+ case ContentEvent(content=text):
56
+ print(text, end="")
57
+ case ToolCallStartEvent(name=name):
58
+ print(f"\nCalling {name}...")
59
+ case InterruptEvent(action_requests=actions):
60
+ # Handle human-in-the-loop
61
+ decision = get_user_decision(actions)
62
+ # Resume with create_resume_input()
63
+ ```
64
+
65
+ ## Features
66
+
67
+ - **Typed Events**: All stream outputs normalized to dataclass events with full type hints
68
+ - **Tool Lifecycle Tracking**: Automatic tracking of tool calls from start to completion
69
+ - **Interrupt Handling**: Parse and resume from human-in-the-loop interrupts
70
+ - **Extensible Extractors**: Register custom extractors for domain-specific tools
71
+ - **Async Support**: Both sync and async parsing via `parse()` and `aparse()`
72
+ - **Zero Dependencies**: LangGraph/LangChain imported dynamically only when needed
73
+ - **Backward Compatible**: Legacy dict-based API available for gradual migration
74
+
75
+ ## Event Types
76
+
77
+ | Event | Description |
78
+ |-------|-------------|
79
+ | `ContentEvent` | Text content from AI messages |
80
+ | `ToolCallStartEvent` | Tool call initiated by AI |
81
+ | `ToolCallEndEvent` | Tool call completed with result |
82
+ | `ToolExtractedEvent` | Special content extracted from tool (e.g., reflections, todos) |
83
+ | `InterruptEvent` | Human-in-the-loop interrupt requiring decision |
84
+ | `StateUpdateEvent` | Non-message state updates (opt-in) |
85
+ | `CompleteEvent` | Stream finished successfully |
86
+ | `ErrorEvent` | Error during streaming |
87
+
88
+ ## Usage Examples
89
+
90
+ ### Basic Parsing
91
+
92
+ ```python
93
+ from langgraph_stream_parser import StreamParser
94
+
95
+ parser = StreamParser()
96
+
97
+ for event in parser.parse(graph.stream({"messages": [...]}, stream_mode="updates")):
98
+ print(event)
99
+ ```
100
+
101
+ ### Pattern Matching (Python 3.10+)
102
+
103
+ ```python
104
+ from langgraph_stream_parser import StreamParser
105
+ from langgraph_stream_parser.events import *
106
+
107
+ parser = StreamParser()
108
+
109
+ for event in parser.parse(stream):
110
+ match event:
111
+ case ContentEvent(content=text, node=node):
112
+ print(f"[{node}] {text}", end="")
113
+
114
+ case ToolCallStartEvent(name=name, args=args):
115
+ print(f"\n⏳ Calling {name}...")
116
+
117
+ case ToolCallEndEvent(name=name, status="success"):
118
+ print(f"✅ {name} completed")
119
+
120
+ case ToolCallEndEvent(name=name, status="error", error_message=err):
121
+ print(f"❌ {name} failed: {err}")
122
+
123
+ case InterruptEvent() as interrupt:
124
+ if interrupt.needs_approval:
125
+ handle_approval(interrupt.action_requests)
126
+
127
+ case CompleteEvent():
128
+ print("\n✓ Done")
129
+
130
+ case ErrorEvent(error=err):
131
+ print(f"⚠️ Error: {err}")
132
+ ```
133
+
134
+ ### Handling Interrupts
135
+
136
+ ```python
137
+ from langgraph_stream_parser import StreamParser, create_resume_input
138
+ from langgraph_stream_parser.events import InterruptEvent
139
+
140
+ parser = StreamParser()
141
+ config = {"configurable": {"thread_id": "my-thread"}}
142
+
143
+ for event in parser.parse(graph.stream(input_data, config=config)):
144
+ if isinstance(event, InterruptEvent):
145
+ # Show user the pending actions
146
+ for action in event.action_requests:
147
+ print(f"Tool: {action['tool']}")
148
+ print(f"Args: {action['args']}")
149
+
150
+ # Get user decision
151
+ decision = input("Approve? (y/n): ")
152
+
153
+ # Resume
154
+ resume_input = create_resume_input(
155
+ decisions=[{"type": "approve" if decision == "y" else "reject"}]
156
+ )
157
+
158
+ for resume_event in parser.parse(graph.stream(resume_input, config=config)):
159
+ handle_event(resume_event)
160
+ break
161
+ ```
162
+
163
+ ### Custom Tool Extractors
164
+
165
+ ```python
166
+ from langgraph_stream_parser import StreamParser, ToolExtractor
167
+ from langgraph_stream_parser.events import ToolExtractedEvent
168
+
169
+ class CanvasExtractor:
170
+ tool_name = "add_to_canvas"
171
+ extracted_type = "canvas_item"
172
+
173
+ def extract(self, content):
174
+ if isinstance(content, dict):
175
+ return content
176
+ return {"type": "text", "data": str(content)}
177
+
178
+ parser = StreamParser()
179
+ parser.register_extractor(CanvasExtractor())
180
+
181
+ for event in parser.parse(stream):
182
+ if isinstance(event, ToolExtractedEvent) and event.extracted_type == "canvas_item":
183
+ add_to_canvas_ui(event.data)
184
+ ```
185
+
186
+ ### Async Support
187
+
188
+ ```python
189
+ from langgraph_stream_parser import StreamParser
190
+
191
+ parser = StreamParser()
192
+
193
+ async def stream_agent():
194
+ async for event in parser.aparse(graph.astream(input_data)):
195
+ handle_event(event)
196
+ ```
197
+
198
+ ### Configuration Options
199
+
200
+ ```python
201
+ parser = StreamParser(
202
+ # Track tool call lifecycle (start -> end)
203
+ track_tool_lifecycle=True,
204
+
205
+ # Skip these tools entirely (no events emitted)
206
+ skip_tools=["internal_tool"],
207
+
208
+ # Include StateUpdateEvent for non-message state keys
209
+ include_state_updates=False,
210
+ )
211
+ ```
212
+
213
+ ## Legacy Dict-Based API
214
+
215
+ For backward compatibility or simpler use cases:
216
+
217
+ ```python
218
+ from langgraph_stream_parser import stream_graph_updates, resume_graph_from_interrupt
219
+
220
+ for update in stream_graph_updates(agent, input_data, config=config):
221
+ if update.get("status") == "interrupt":
222
+ interrupt = update["interrupt"]
223
+ # Handle interrupt...
224
+ elif "chunk" in update:
225
+ print(update["chunk"], end="")
226
+ elif "tool_calls" in update:
227
+ print(f"Calling tools: {update['tool_calls']}")
228
+ elif update.get("status") == "complete":
229
+ break
230
+
231
+ # Resume from interrupt
232
+ for update in resume_graph_from_interrupt(agent, decisions=[{"type": "approve"}], config=config):
233
+ handle_update(update)
234
+ ```
235
+
236
+ ## Display Adapters
237
+
238
+ Pre-built adapters for rendering stream events in different environments:
239
+
240
+ ### CLIAdapter - Styled Terminal Output
241
+
242
+ ```python
243
+ from langgraph_stream_parser.adapters import CLIAdapter
244
+
245
+ adapter = CLIAdapter()
246
+ adapter.run(
247
+ graph=agent,
248
+ input_data={"messages": [("user", "Hello")]},
249
+ config={"configurable": {"thread_id": "my-thread"}}
250
+ )
251
+ ```
252
+
253
+ Features:
254
+ - ANSI color formatting
255
+ - Spinner animation during tool execution
256
+ - Interactive arrow-key interrupt handling
257
+
258
+ ### PrintAdapter - Plain Text Output
259
+
260
+ ```python
261
+ from langgraph_stream_parser.adapters import PrintAdapter
262
+
263
+ adapter = PrintAdapter()
264
+ adapter.run(graph=agent, input_data=input_data, config=config)
265
+ ```
266
+
267
+ Universal output that works in any Python environment without dependencies.
268
+
269
+ ### JupyterDisplay - Rich Notebook Display
270
+
271
+ ```python
272
+ from langgraph_stream_parser.adapters.jupyter import JupyterDisplay
273
+
274
+ display = JupyterDisplay()
275
+ display.run(graph=agent, input_data=input_data, config=config)
276
+ ```
277
+
278
+ Requires: `pip install langgraph-stream-parser[jupyter]`
279
+
280
+ ### Adapter Options
281
+
282
+ All adapters support:
283
+
284
+ ```python
285
+ adapter = CLIAdapter(
286
+ show_tool_args=True, # Show tool arguments
287
+ max_content_preview=200, # Max chars for extracted content
288
+ reflection_types={"thinking"}, # Custom reflection type names
289
+ todo_types={"tasks"}, # Custom todo type names
290
+ )
291
+ ```
292
+
293
+ ### Custom Adapters
294
+
295
+ Extend `BaseAdapter` for custom rendering:
296
+
297
+ ```python
298
+ from langgraph_stream_parser.adapters import BaseAdapter
299
+
300
+ class MyAdapter(BaseAdapter):
301
+ def render(self):
302
+ # Implement your rendering logic
303
+ pass
304
+
305
+ def prompt_interrupt(self, event):
306
+ # Handle interrupt prompts
307
+ return [{"type": "approve"}]
308
+ ```
309
+
310
+ ## Built-in Extractors
311
+
312
+ The package includes extractors for common LangGraph tools:
313
+
314
+ - **ThinkToolExtractor**: Extracts reflections from `think_tool`
315
+ - **TodoExtractor**: Extracts todo lists from `write_todos`
316
+
317
+ ## Development
318
+
319
+ ```bash
320
+ # Install with dev dependencies
321
+ pip install -e ".[dev]"
322
+
323
+ # Run tests
324
+ pytest
325
+
326
+ # Run tests with coverage
327
+ pytest --cov=langgraph_stream_parser
328
+ ```
329
+
330
+ ## License
331
+
332
+ MIT