kitaru-claude-agent-sdk 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.
@@ -0,0 +1,316 @@
1
+ # iCloud conflict duplicates (pattern: "filename 2.ext" or "filename 2")
2
+ *[[:space:]]2.[!.]*
3
+ *[[:space:]]2
4
+
5
+ # Helm dependency artifacts (rebuilt via helm dep update)
6
+ helm/charts/
7
+ helm/Chart.lock
8
+
9
+ # Root TypeScript workspace
10
+ /node_modules/
11
+ /packages/*/node_modules/
12
+ /examples/typescript/mastra_support_triage/node_modules/
13
+ /examples/typescript/mastra_adaptive_conversation/node_modules/
14
+ /examples/typescript/vercel_ai_support_triage/node_modules/
15
+ /packages/*/dist/
16
+ /typescript-dist/
17
+
18
+ # pnpm
19
+ **/.pnpm-store
20
+
21
+ # macOS
22
+ .DS_Store
23
+
24
+ # Byte-compiled / optimized / DLL files
25
+ __pycache__/
26
+ *.py[codz]
27
+ *$py.class
28
+
29
+ # C extensions
30
+ *.so
31
+
32
+ # Distribution / packaging
33
+ .Python
34
+ build/
35
+ develop-eggs/
36
+ dist/
37
+ plugins/candidate-wheels/*
38
+ !plugins/candidate-wheels/.gitkeep
39
+ downloads/
40
+ eggs/
41
+ .eggs/
42
+ lib/
43
+ !docs/lib/
44
+ lib64/
45
+ parts/
46
+ sdist/
47
+ var/
48
+ wheels/
49
+ share/python-wheels/
50
+ *.egg-info/
51
+ .installed.cfg
52
+ *.egg
53
+ MANIFEST
54
+
55
+ # PyInstaller
56
+ # Usually these files are written by a python script from a template
57
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
58
+ *.manifest
59
+ *.spec
60
+
61
+ # Installer logs
62
+ pip-log.txt
63
+ pip-delete-this-directory.txt
64
+
65
+ # Unit test / coverage reports
66
+ htmlcov/
67
+ .tox/
68
+ .nox/
69
+ .coverage
70
+ .coverage.*
71
+ .cache
72
+ nosetests.xml
73
+ coverage.xml
74
+ *.cover
75
+ *.py.cover
76
+ .hypothesis/
77
+ .pytest_cache/
78
+ cover/
79
+
80
+ # Translations
81
+ *.mo
82
+ *.pot
83
+
84
+ # Django stuff:
85
+ *.log
86
+ local_settings.py
87
+ db.sqlite3
88
+ db.sqlite3-journal
89
+
90
+ # Flask stuff:
91
+ instance/
92
+ .webassets-cache
93
+
94
+ # Scrapy stuff:
95
+ .scrapy
96
+
97
+ # Sphinx documentation
98
+ docs/_build/
99
+
100
+ # PyBuilder
101
+ .pybuilder/
102
+ target/
103
+
104
+ # Jupyter Notebook
105
+ .ipynb_checkpoints
106
+
107
+ # IPython
108
+ profile_default/
109
+ ipython_config.py
110
+
111
+ # pyenv
112
+ # For a library or package, you might want to ignore these files since the code is
113
+ # intended to run in multiple environments; otherwise, check them in:
114
+ # .python-version
115
+
116
+ # pipenv
117
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
118
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
119
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
120
+ # install all needed dependencies.
121
+ #Pipfile.lock
122
+
123
+ # UV
124
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
125
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
126
+ # commonly ignored for libraries.
127
+ #uv.lock
128
+
129
+ # poetry
130
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
131
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
132
+ # commonly ignored for libraries.
133
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
134
+ #poetry.lock
135
+ #poetry.toml
136
+
137
+ # pdm
138
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
139
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
140
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
141
+ #pdm.lock
142
+ #pdm.toml
143
+ .pdm-python
144
+ .pdm-build/
145
+
146
+ # pixi
147
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
148
+ #pixi.lock
149
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
150
+ # in the .venv directory. It is recommended not to include this directory in version control.
151
+ .pixi
152
+
153
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
154
+ __pypackages__/
155
+
156
+ # Celery stuff
157
+ celerybeat-schedule
158
+ celerybeat.pid
159
+
160
+ # SageMath parsed files
161
+ *.sage.py
162
+
163
+ # Environments
164
+ .env
165
+ .envrc
166
+ .venv
167
+ env/
168
+ venv/
169
+ ENV/
170
+ env.bak/
171
+ venv.bak/
172
+
173
+ # Spyder project settings
174
+ .spyderproject
175
+ .spyproject
176
+
177
+ # Rope project settings
178
+ .ropeproject
179
+
180
+ # mypy
181
+ .mypy_cache/
182
+ .dmypy.json
183
+ dmypy.json
184
+
185
+ # Pyre type checker
186
+ .pyre/
187
+
188
+ # pytype static type analyzer
189
+ .pytype/
190
+
191
+ # Cython debug symbols
192
+ cython_debug/
193
+
194
+ # PyCharm
195
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
196
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
197
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
198
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
199
+ #.idea/
200
+
201
+ # Abstra
202
+ # Abstra is an AI-powered process automation framework.
203
+ # Ignore directories containing user credentials, local state, and settings.
204
+ # Learn more at https://abstra.io/docs
205
+ .abstra/
206
+
207
+ # Visual Studio Code
208
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
209
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
210
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
211
+ # you could uncomment the following to ignore the entire vscode folder
212
+ # .vscode/
213
+
214
+ # Ruff stuff:
215
+ .ruff_cache/
216
+
217
+ # PyPI configuration file
218
+ .pypirc
219
+
220
+ # Cursor
221
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
222
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
223
+ # refer to https://docs.cursor.com/context/ignore-files
224
+ .cursorignore
225
+ .cursorindexingignore
226
+
227
+ # Marimo
228
+ marimo/_static/
229
+ marimo/_lsp/
230
+ __marimo__/
231
+
232
+ # Cloudflare local state
233
+ .wrangler/
234
+
235
+ # Local project markers
236
+ .kitaru/
237
+ .zen/
238
+
239
+ # Git worktrees (isolated workspaces created via git worktree add)
240
+ .worktrees/
241
+
242
+ # Design docs + Repoprompt
243
+ design/
244
+ dogfood-output/
245
+ prompt-exports/
246
+
247
+ # Local Kitaru UI build artifacts (used by docker/Dockerfile.server-dev)
248
+ docker/kitaru-ui-dist/
249
+
250
+ # MCP
251
+ .mcp.json
252
+
253
+ # Claude
254
+ **/.claude/settings.local.json
255
+ .claude/*
256
+ !.claude/settings.json
257
+ !.claude/skills/
258
+
259
+ # Playwright MCP
260
+ .playwright-mcp/
261
+
262
+ # Bundled Kitaru UI (generated at build time by scripts/download-ui.sh)
263
+ src/kitaru/_ui/dist/
264
+ src/kitaru/_ui/bundle_manifest.json
265
+ .kitaru-ui-bundles/
266
+
267
+ # Codex
268
+ .codex/*
269
+ !.codex/skills/
270
+ AGENTS.override.md
271
+ .agents/skills/*
272
+ !.agents/skills/kitaru-dev/
273
+ !.agents/skills/kitaru-dev/**
274
+ !.agents/skills/kitaru-adapter-development/
275
+ !.agents/skills/kitaru-adapter-development/**
276
+ !.agents/skills/kitaru-docs/
277
+ !.agents/skills/kitaru-docs/**
278
+ !.agents/skills/kitaru-importer-development/
279
+ !.agents/skills/kitaru-importer-development/**
280
+ !.agents/skills/kitaru-release/
281
+ !.agents/skills/kitaru-release/**
282
+ !.agents/skills/kitaru-evaluator-authoring/
283
+ !.agents/skills/kitaru-evaluator-authoring/**
284
+ !.agents/skills/kitaru-session-improvement/
285
+ !.agents/skills/kitaru-session-improvement/**
286
+ !.agents/skills/kitaru-tests-release/
287
+ !.agents/skills/kitaru-tests-release/**
288
+ !.agents/skills/kitaru-ui-api-development/
289
+ !.agents/skills/kitaru-ui-api-development/**
290
+
291
+ # Agent Skills
292
+ .pi/
293
+ .claude/skills/building-pydantic-ai-agents
294
+ .claude/skills/instrumentation
295
+ skills-lock.json
296
+
297
+ # Local PR review screenshots
298
+ .pr-screenshots/
299
+
300
+ # Local scratch — single-developer scratch flow files at repo root
301
+ /my_flow.py
302
+ .claude/skills/logfire-instrumentation
303
+ .clawpatch/
304
+ docs/investigations/
305
+ docs/plans/
306
+ docs/reviews/
307
+ plans/
308
+ replay-verify-reports-live/
309
+ replay-verify-reports/
310
+
311
+ # OpenAPI baseline build output
312
+ openapi/.build/
313
+ src/kitaru/server/application/services/sample_data.json.gz
314
+
315
+ # Per-user publish settings, see devtools/publish.env.example
316
+ devtools/publish.env
@@ -0,0 +1,19 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 - 2026-09-21
4
+
5
+ - Emit `reasoning_selectors` pointing at Claude's thinking blocks in node outputs instead of extracted `reasoning` text.
6
+ - Identify recorded nodes and their parents by external ID. Require Kitaru 0.27.0 or later for the new node contract.
7
+
8
+ ## 0.1.0rc0 - 2026-09-10
9
+
10
+ - Add one-shot string query recording through the public Claude Agent SDK message stream.
11
+ - Add fresh root-input replay with prompt, system-prompt, and model overrides.
12
+ - Add bounded static, history, and passthrough tool policies for adapter-wrapped in-process SDK MCP tools, with fail, error-result, or passthrough behavior on a miss.
13
+ - Preserve native Claude messages while rejecting replay configurations that the public adapter boundary cannot enforce safely.
14
+ - Record one assistant turn as one model node even when the Claude CLI splits that turn across several messages, so a tool call lands under the model call that requested it and the run is no longer ended by a recording error after Claude has already run.
15
+ - Keep everything a split turn produced: reasoning text and answer text recorded from an earlier part of the turn are no longer erased when the next part arrives.
16
+ - Record the most readable failure cause the terminal message carries rather than the word `success`, and keep the HTTP status of a failing provider call in the session's terminal metadata as `api_error_status`.
17
+ - Add the difference between Claude's terminal token totals and the partial per-call counts to the root node, the way the run's total cost is already recorded there, and record Claude's thinking tokens in Kitaru's reasoning-token field.
18
+ - Record `effective_prompt` on the session's root node, the prompt text actually sent to Claude, so a replay that overrides the prompt keeps the overridden question next to the answer it produced.
19
+ - Log a warning on the `kitaru_claude_agent_sdk.runner` logger when a consumer stops the stream early and Kitaru cannot finalize the session or close the Claude iterator, because closing the generator discards notes attached to the exception.
@@ -0,0 +1,207 @@
1
+ Metadata-Version: 2.5
2
+ Name: kitaru-claude-agent-sdk
3
+ Version: 0.1.0
4
+ Summary: Claude Agent SDK recording and replay adapter for Kitaru.
5
+ Project-URL: Homepage, https://kitaru.ai
6
+ Project-URL: Documentation, https://docs.zenml.io/kitaru/adapters/claude-agent-sdk
7
+ Project-URL: Repository, https://github.com/zenml-io/kitaru
8
+ Project-URL: Issues, https://github.com/zenml-io/kitaru/issues
9
+ Project-URL: Changelog, https://github.com/zenml-io/kitaru/blob/develop/plugins/packages/claude-agent-sdk/CHANGELOG.md
10
+ Author-email: ZenML GmbH <info@zenml.io>
11
+ License-Expression: Apache-2.0
12
+ Keywords: ai-agents,anthropic,claude-agent-sdk,kitaru,recording,replay
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Requires-Python: >=3.11
25
+ Requires-Dist: claude-agent-sdk<0.3,>=0.2.149
26
+ Requires-Dist: kitaru>=0.27.0
27
+ Description-Content-Type: text/markdown
28
+
29
+ # Kitaru Claude Agent SDK adapter
30
+
31
+ Record one-shot Claude Agent SDK queries as Kitaru sessions, then rerun the same inputs with prompt, model, and SDK MCP tool overrides.
32
+
33
+ ## Install
34
+
35
+ ```bash
36
+ uv add kitaru-claude-agent-sdk
37
+ ```
38
+
39
+ This package currently supports `claude-agent-sdk>=0.2.149,<0.3` and Python 3.11 or newer.
40
+
41
+ ## Record a query
42
+
43
+ `KitaruClaudeRunner.query()` calls the Claude Agent SDK's public `query()` function and yields its message objects unchanged:
44
+
45
+ ```python
46
+ import contextlib
47
+ import os
48
+ import uuid
49
+
50
+ from claude_agent_sdk import ClaudeAgentOptions
51
+ from kitaru_claude_agent_sdk import KitaruClaudeRunner
52
+
53
+
54
+ async def run() -> None:
55
+ runner = KitaruClaudeRunner(agent_id=uuid.UUID(os.environ["KITARU_AGENT_ID"]))
56
+ stream = runner.query(
57
+ prompt="Investigate ticket 4821.",
58
+ options=ClaudeAgentOptions(
59
+ model="claude-sonnet-4-5",
60
+ setting_sources=[],
61
+ ),
62
+ )
63
+ async with contextlib.aclosing(stream) as messages:
64
+ async for message in messages:
65
+ print(message)
66
+ ```
67
+
68
+ Use `contextlib.aclosing()` whenever the consumer may stop before the terminal message. It closes the Claude iterator and finalizes the partial Kitaru recording promptly.
69
+
70
+ Recording preserves the Claude SDK's settings behavior. With `setting_sources` unset, the SDK can load user, project, and local settings, including output styles from `~/.claude/settings.json`. For recordings intended for replay with tool substitution, set `setting_sources=[]` as above so those settings do not add context that the replay omits. Tool substitution forces this setting on replay; an all-passthrough replay preserves your settings instead.
71
+
72
+ This option disables those settings sources, but does not make the whole execution environment portable. See [Claude's settings isolation limits](https://code.claude.com/docs/en/agent-sdk/claude-code-features#what-settingsources-does-not-control).
73
+
74
+ Standalone queries require either `agent_id` or `agent_version_id`. A Kitaru worker supplies the task-bound identity automatically.
75
+
76
+ Create the runner with `KitaruClaudeRunner(agent_id=None, agent_version_id=None, session_name=None)`. Its `query(*, prompt, options=None, replayable_servers=(), transport=None)` method accepts the same optional transport injection as the underlying SDK. This adapter only accepts string prompts.
77
+
78
+ ## Declare replayable SDK MCP tools
79
+
80
+ Only in-process SDK MCP tools declared with `replayable_sdk_mcp_server()` can use static or history substitution. Creating the definition does not call Claude or run the handler:
81
+
82
+ ```python
83
+ from claude_agent_sdk import SdkMcpTool
84
+ from kitaru_claude_agent_sdk import replayable_sdk_mcp_server
85
+
86
+
87
+ async def lookup(arguments: dict[str, object]) -> dict[str, object]:
88
+ return {"content": [{"type": "text", "text": f"Result for {arguments['query']}"}]}
89
+
90
+
91
+ support_server = replayable_sdk_mcp_server(
92
+ name="support",
93
+ tools=[
94
+ SdkMcpTool(
95
+ name="lookup",
96
+ description="Look up a support record.",
97
+ input_schema={
98
+ "type": "object",
99
+ "properties": {"query": {"type": "string"}},
100
+ "required": ["query"],
101
+ },
102
+ handler=lookup,
103
+ )
104
+ ],
105
+ )
106
+ ```
107
+
108
+ Pass the definition to every query that may use the tool:
109
+
110
+ ```python
111
+ messages = runner.query(
112
+ prompt="Look up ticket 4821.",
113
+ options=ClaudeAgentOptions(
114
+ tools=[],
115
+ setting_sources=[],
116
+ mcp_servers={},
117
+ allowed_tools=["mcp__support__lookup"],
118
+ ),
119
+ replayable_servers=[support_server],
120
+ )
121
+ ```
122
+
123
+ The adapter creates a new SDK MCP server for each query, so concurrent runs do not share handler or history state.
124
+
125
+ `replayable_sdk_mcp_server(name=..., tools=..., version="1.0.0")` returns the frozen `ReplayableSdkMcpServer` definition accepted by `query()`. Most code should use the helper rather than construct the dataclass directly.
126
+
127
+ ## Replay boundary
128
+
129
+ A replay starts a fresh Claude query from the recorded root input. It is a rerun, not playback of the original message trajectory.
130
+
131
+ Supported replay changes are:
132
+
133
+ - root prompt replacement;
134
+ - system-prompt replacement;
135
+ - direct or current-model-keyed model replacement; and
136
+ - `static`, `history`, and `passthrough` tool policies for exact adapter-wrapped SDK MCP tool identities such as `mcp__support__lookup`.
137
+
138
+ An agent version running this adapter keeps the default Kitaru runtime capabilities, `overrides` and `tool_policies` both `true`, because the adapter intercepts model and tool calls inside the agent process. A `model_params` override is therefore accepted when the replay is created and rejected by this adapter's preflight when the run starts, before Claude is called.
139
+
140
+ ## Tool policies
141
+
142
+ The three policy types this adapter supports, and the `llm` type it does not:
143
+
144
+ | Policy | Behavior |
145
+ | --- | --- |
146
+ | `passthrough` | Calls the original handler. Any network request, database write, message send, or other side effect happens for real. |
147
+ | `static` | Returns the first exact or shallow-subset argument match without calling the handler. On a miss, `fail`, `error_result`, and `passthrough` behavior is supported. |
148
+ | `history` | Looks up a recorded result by the exact tool identity and canonical JSON arguments. Baseline scope consumes repeated matches by occurrence; broader scopes use the server-selected match. On a miss, `fail`, `error_result`, and `passthrough` behavior is supported. |
149
+ | `llm` | Rejected before the adapter creates a session or calls Claude; this policy is not supported by this adapter. |
150
+
151
+ `error_result` is a value of `on_miss`, not a policy `type`. A config sent as `{"type": "error_result"}` is rejected by the server with HTTP 422. On a static or history miss, `on_miss: error_result` returns a valid Claude MCP result with text content and `is_error: true`, so Claude reads the failure and can continue the run.
152
+
153
+ A replay that substitutes any tool must set `tool_policy.default` to an empty `static` policy with `on_miss: fail`. Every other default, `passthrough` included, is rejected with `Claude SDK MCP replay requires an empty static fail default policy` before the adapter creates a Kitaru session or calls Claude. A `passthrough` default is valid only for an all-passthrough replay, where no tool carries a substituting policy.
154
+
155
+ ```json
156
+ {
157
+ "default": {"type": "static", "cases": [], "on_miss": "fail"},
158
+ "tools": {
159
+ "mcp__support__lookup": {"type": "static", "cases": [], "on_miss": "error_result"}
160
+ }
161
+ }
162
+ ```
163
+
164
+ The Kitaru [tool policies guide](https://docs.zenml.io/kitaru/guides/tool-policies) covers the shared behavior of these types and their scopes.
165
+
166
+ Static and history results use a versioned format with text MCP content blocks and an optional boolean `is_error`. Kitaru records other result shapes but cannot substitute them during replay.
167
+
168
+ Tool substitution requires `ClaudeAgentOptions(tools=[])`. The adapter rejects existing MCP servers, unwrapped allowed tools, explicit settings, plugins, skills, agents, and extra CLI arguments because they can add tools outside Kitaru's wrappers. It also sets `setting_sources=[]` and `strict_mcp_config=True` on a copy of the options, which stops user settings, project settings, and `.mcp.json` files from adding an unwrapped server. Your original options stay unchanged. An all-passthrough replay does not need this isolation.
169
+
170
+ `passthrough`, including a static or history `on_miss="passthrough"`, calls the original handler. Treat it as a real side effect.
171
+
172
+ Baseline history consumes matching results by occurrence. Concurrent calls with the same tool identity and canonical arguments are ambiguous and fail; use static replay or distinct identities or arguments instead.
173
+
174
+ ## Not supported in v1
175
+
176
+ - async prompt iterables;
177
+ - `ClaudeSDKClient`, resume, continue, or fork workflows;
178
+ - LLM-based tool substitution;
179
+ - substitution of Claude built-in tools or tools from external MCP servers;
180
+ - `model_params` replay overrides;
181
+ - arbitrary mid-run state restoration or broad trajectory playback.
182
+
183
+ ## Data and quality
184
+
185
+ Kitaru stores prompts, tool arguments and results, model output, reasoning text, and failure summaries as trace data. Visible reasoning text lives under `outputs.thinking`, and the node's `reasoning_selectors` point at it, for example `/thinking/0`, the same way `output_text_selector` points at the display text. The adapter limits the size of recorded values and excludes some provider-only fields. It does not add its own redaction policy. Filter data in your application when needed, and set suitable access and retention rules on the Kitaru server.
186
+
187
+ The session's root node records the prompt string actually sent to Claude as the `effective_prompt` attribute. A replay that overrides the prompt keeps the baseline prompt in the session inputs, the shared Kitaru convention that lets a cohort compare arms on one task input, so the root attribute is where you read the text the model received. A prompt longer than the adapter's recorded-value limit is stored as `{"value": "...", "truncated": true}` rather than as a silently shortened string.
188
+
189
+ Claude reports per-call token usage as a snapshot taken before generation finishes, so the count on a single `llm_call` node is a partial. The authoritative totals arrive on the terminal `ResultMessage`, and Kitaru records the difference between those totals and the per-call counts as usage on the root node, the same place it records the run's total cost. Session totals therefore add up to Claude's own numbers, and Claude's thinking tokens appear in Kitaru's reasoning-token field. The difference is never recorded as a negative number, so a field whose per-call counts already exceed Claude's total keeps a session total above that number with the root node carrying nothing. A run that never reaches a terminal message records no cost and keeps only the partial per-call counts.
190
+
191
+ When Claude's terminal message reports a failure, the recorded reason is the most readable cause it carries: the errors Claude reported, then the result text, then the terminal reason, then the subtype. A terminal reason or subtype that reads as a success, `success` and `completed`, is skipped, and a message carrying no cause at all records `Claude reported a failed result`. A provider API error such as a 529 overload arrives with the subtype `success` and the cause in the result text, and its HTTP status is kept in the session's terminal metadata as `api_error_status`.
192
+
193
+ If the consumer stops the stream early and Kitaru then fails to close the session or to close the Claude iterator, the adapter logs a warning naming the session ID on the `kitaru_claude_agent_sdk.runner` logger. Closing an asynchronous generator discards the exception raised inside it, notes included, so the log is the only report that survives.
194
+
195
+ Replay proves that the new run completed under the selected inputs and policies. It does not prove that the answer is better. Add an evaluator for the behavior you need to measure.
196
+
197
+ ## Optional live smoke test
198
+
199
+ After configuring your normal Anthropic credentials and a Kitaru agent identity, run the recording example above with a harmless prompt and no side-effecting tools. The live test is opt-in because it sends a real provider request and may incur cost. The package test suite uses public SDK types and local fakes, so it requires no provider credential.
200
+
201
+ ## Links
202
+
203
+ - [Kitaru documentation](https://docs.zenml.io/kitaru/adapters/claude-agent-sdk)
204
+ - [Source code](https://github.com/zenml-io/kitaru)
205
+ - [Issue tracker](https://github.com/zenml-io/kitaru/issues)
206
+
207
+ Licensed under Apache-2.0.