Skip to main content

claude-monitor (Python)

Push traces and spans to claude-monitor from any Python script — wandb-style, zero install dependencies.

pip install claude-monitor

Quickstart

import claude_monitor as cm

cm.init(
    api_key="ba_…",          # or set CLAUDE_MONITOR_API_KEY
    project="my-bot",
    session_id="run-001",    # idempotent: same id resumes the same trace
    task_name="demo task",
    model="claude-opus-4-7",
)

cm.log_user("hello")
cm.log_assistant("hi there")
cm.log_tool_use("Read", {"file_path": "x.py"})
cm.log_tool_result("file contents")

cm.finish(outcome="good", metadata={"k": "v"})

Class-based / with

import claude_monitor as cm

with cm.Run(project="my-bot", session_id="run-002") as run:
    run.log_user("how do I install jq?")
    run.log_assistant("brew install jq")
    # implicit run.finish() on exit; on exception → outcome="bad" + error metadata

API

  • cm.init(**kwargs) -> Run — create the module-level run (wandb style).
  • cm.Run(**kwargs) — explicit run; identical kwargs.
  • cm.log_user(text), cm.log_assistant(text), cm.log_thinking(text), cm.log_tool_use(tool, input), cm.log_tool_result(text, parent_span_id=…), cm.log_attachment(name, attributes) — convenience helpers.
  • cm.log(kind=…, name=…, text=…, attributes=…, parent_span_id=…) — generic.
  • cm.finish(outcome="good"|"bad"|"neutral", metadata={…}, task_name=…, model=…).

Configuration

Argument Env var Default
api_key CLAUDE_MONITOR_API_KEY required
api_base CLAUDE_MONITOR_API_BASE hosted Railway URL
session_id — random py-<uuid>
project — None
scaffold — "python-sdk"
machine_id — derived from hostname

Span kinds

user_msg | assistant_msg | tool_use | tool_result | thinking | attachment

Common attributes the UI surfaces directly: text (string), result_text (string), tool_input (object). Anything else lands in the raw JSON view.

Metadata

Release files for claude-monitor-sdk 0.5.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 claude-monitor-sdk 0.5.0
File Size Uploaded Provenance Actions
claude_monitor_sdk-0.5.0.tar.gz 19.0 kB Without provenance Details for claude_monitor_sdk-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for claude-monitor-sdk 0.5.0
File Interpreter ABI Platform Actions
claude_monitor_sdk-0.5.0-py3-none-any.whl Python 3 none any Details for claude_monitor_sdk-0.5.0-py3-none-any.whl

Total release size: 41.8 kB

Release files / claude_monitor_sdk-0.5.0.tar.gz

Download URL claude_monitor_sdk-0.5.0.tar.gz
Size 19.0 kB
Tags Source
SHA-256 checksum
How to use checksums
851e1c75c8ef7623b0bd2018e3d194c15b4ee32edce958b76ee9eb3acdf328c1
BLAKE2b-256 checksum
How to use checksums
4c3eaf25280d8e400e001045c5aac2eabfd0074b465727ce0bcc05d123d61277
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.0

Release files / claude_monitor_sdk-0.5.0-py3-none-any.whl

Download URL claude_monitor_sdk-0.5.0-py3-none-any.whl
Size 22.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fee017842ced56299f29da51476e4d50e15c0a0467c40c752f2b4e166865a485
BLAKE2b-256 checksum
How to use checksums
102fa0a852303b7773c4fd1ecfc693d9fac879b35ee0b89b84350839e8904c0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.0

Security for claude-monitor-sdk 0.5.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.

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