Skip to main content

chatsee-claude-agent-sdk

ChatSee connector for the Claude Agent SDK — Anthropic's agent framework, the one that powers Claude Code.

pip install chatsee-claude-agent-sdk
from chatsee_claude_agent_sdk import instrument_claude_agent_sdk

chatsee = instrument_claude_agent_sdk(agent_id="...", tenant_id="...")

async for message in chatsee.query(prompt="where is my order", options=opts):
    ...

chatsee-ai is installed for you as a dependency.

Not the same thing as chatsee-anthropic

chatsee-anthropic this
Package it hooks anthropic claude-agent-sdk
Who writes the agent loop the customer Anthropic
What we hook client.messages.create the query() message stream

Use chatsee-anthropic when they call the Messages API and run their own tool-use loop. Use this when they call query() and let the SDK run it.

Why a handle rather than a one-liner

There is no client object to patch — the entry point is a module-level query(). So instrument_claude_agent_sdk returns a handle whose .query is a drop-in: every message still reaches the caller, unchanged and in order, while the turn is assembled alongside.

claude_agent_sdk.query is replaced too, so code calling it through the module needs no change. Code that did from claude_agent_sdk import query already holds its own reference to the original and cannot be reached that way — that code uses the handle.

What it captures

Per turn: the prompt, the final answer, the system prompt, every tool call with its arguments and result, and one model call per model, with tokens, cached tokens and a real dollar cost.

This SDK is the only one that states its own cost (total_cost_usd), so that figure is passed through rather than estimated. Nothing here invents a price, and a turn's cost is never divided across models — a split we made up would look like measurement.

Three things this framework does that nothing else does

The CLI's system prompt is enormous. Claude Code injects roughly 21k cached tokens on every call, so a one-line "hello" costs around $0.027. Those land in cache_read_input_tokens, not input_tokens — both are captured, or the turn looks far cheaper than the bill.

The CLI calls its own tools. It loads tools on demand and emits a ToolSearch tool-use alongside the agent's real one. Those are filtered: a support agent that never touched a search tool must not show one in its trace.

Tool names arrive MCP-qualified. Custom tools reach the model as mcp__<server>__<tool>. The customer named it get_order_status, so the prefix is stripped and that is what the screens say.

Guarantees

  • Fails open. A failure inside capture is logged and swallowed.
  • Never consumes the stream. Every message is forwarded unchanged, in order.
  • Idempotent. Instrumenting twice does not capture twice.
  • Concurrency-safe. State is per query() call, not per handle.

All four are enforced by the contract suite, not just intended.

Tests

No network, no API key, no CLI subprocess — the SDK is stubbed, ChatSee is not. That matters more here than anywhere else: a real turn costs about $0.027, so finding a capture bug by running one would be slow and expensive.

pip install -e python/connectors/_shared
pip install -e python/connectors/ai_sdk/claude_agent_sdk
pytest python/connectors/ai_sdk/claude_agent_sdk/tests -q

Known gap

Turn-level duration_ms comes from the tracker's own wall clock, and all four tracker calls are made together once the turn is known to be complete — so it reads near zero. The honest latency is on the model call, from the SDK's duration_api_ms. Fixing it properly means letting end_turn accept a measured duration, which is a core-SDK change and not this connector's to make.

Metadata

Release files for chatsee-claude-agent-sdk 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chatsee-claude-agent-sdk 0.1.0
File Size Uploaded Provenance Actions
chatsee_claude_agent_sdk-0.1.0.tar.gz 15.8 kB Without provenance Details for chatsee_claude_agent_sdk-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for chatsee-claude-agent-sdk 0.1.0
File Interpreter ABI Platform Actions
chatsee_claude_agent_sdk-0.1.0-py3-none-any.whl Python 3 none any Details for chatsee_claude_agent_sdk-0.1.0-py3-none-any.whl

Total release size: 27.1 kB

Release files / chatsee_claude_agent_sdk-0.1.0.tar.gz

Download URL chatsee_claude_agent_sdk-0.1.0.tar.gz
Size 15.8 kB
Tags Source
SHA-256 checksum
How to use checksums
89c7470084224b3a2e2784b7cf671faa0a7d8b7a2c99b7d05069a8e75afeb740
BLAKE2b-256 checksum
How to use checksums
3bf6ac36aeb1bf0d6b6bb067ed7bd7865bb29c07f41065dc43c71a398eb5d3ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.11

Release files / chatsee_claude_agent_sdk-0.1.0-py3-none-any.whl

Download URL chatsee_claude_agent_sdk-0.1.0-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0586aa353e1e203f45a795def28e14d1759f2e96572512e7de3b3b6a468f5775
BLAKE2b-256 checksum
How to use checksums
073e39b61ee84fc77cf17feceb8baff595668bd19216da6e0b85f2d8c43b1a81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.11

Security for chatsee-claude-agent-sdk 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page