Skip to main content

Sentro Python SDK

Error tracking and agent observability for AI agents. Zero dependencies.

Sentro is an open-source Sentry alternative built specifically for AI agents. This SDK gives you full observability into your agent runs — every step, tool call, LLM call, token count, and cost.

Install

pip install sentro-sdk

Quick Start

Error tracking

from sentro import Sentro

sentro = Sentro(dsn="http://token@localhost:3000/api/ingest/proj_1")

try:
    do_something()
except Exception as e:
    sentro.capture_exception(e)

Agent observability

from sentro import Sentro

sentro = Sentro(dsn="http://token@localhost:3000/api/ingest/proj_1")

with sentro.trace("order-processor", goal="Process refund #456") as run:
    with run.trace("Looking up order") as step:
        # Track tool calls
        with step.trace_tool_call("db.query", input={"sql": "SELECT 1"}) as tool:
            result = db.query("SELECT 1")
            tool.set_result(result)

        # Track LLM calls
        llm = step.llm_call(model="claude-sonnet-4-6")
        response = call_llm("Approve refund?")
        llm.end(prompt_tokens=150, completion_tokens=20, cost=0.001)
# Auto-ends on exit, auto-errors on exception

Async support

async with sentro.trace("async-agent", goal="Async task") as run:
    async with run.trace("Step 1") as step:
        result = await some_async_work()

Features

  • Zero dependencies — standard library only, works in any Python 3.10+ environment
  • Context managers — with blocks for automatic lifecycle management
  • Async support — async with for async frameworks
  • Auto error capture — exceptions automatically mark runs as failed
  • Batched transport — events are batched and sent efficiently
  • Run tracing — full agent execution timeline
  • Step replay — ordered reasoning chain with tool and LLM call details
  • Cost tracking — token counts and cost per LLM call

Configuration

sentro = Sentro(
    dsn="http://token@localhost:3000/api/ingest/proj_1",
    default_tags={"env": "production", "version": "1.0.0"},
)

Security Considerations

  • The capture_prompts option is disabled by default to avoid storing LLM prompt/response bodies that may contain PII
  • DSN tokens are API keys — treat them like passwords, don't commit them to source control
  • Tool call inputs/outputs are stored as-is — avoid passing sensitive data (API keys, passwords) through traced tool calls

Framework Integrations

LangChain

from sentro import Sentro
from sentro.integrations.langchain import SentroMiddleware

sentro = Sentro(dsn="YOUR_DSN")

agent = create_agent(
    model="gpt-4o",
    tools=[...],
    middleware=[SentroMiddleware(sentro)],
)

Requires pip install langchain langgraph.

CrewAI

from sentro import Sentro
from sentro.integrations.crewai import SentroCrewListener

sentro = Sentro(dsn="YOUR_DSN")
SentroCrewListener(sentro)  # auto-registers — just kick off your crew

Requires pip install crewai.

License

MIT

Metadata

Release files for sentro-sdk 0.2.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 sentro-sdk 0.2.0
File Size Uploaded Provenance
sentro_sdk-0.2.0.tar.gz 18.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for sentro-sdk 0.2.0
File Interpreter ABI Platform
sentro_sdk-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 31.3 kB

Release files / sentro_sdk-0.2.0.tar.gz

Download URL sentro_sdk-0.2.0.tar.gz
Size 18.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8c81678340753d527e5c0fc4e0f6077f1e04aaa6d3b79217b6d189a6c3b88b1f
BLAKE2b-256 checksum
How to use checksums
2bf8a107cdc167bc19e17d0a423c914ef3722e9f7d8ddcc45ae4b4b6d16413e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / sentro_sdk-0.2.0-py3-none-any.whl

Download URL sentro_sdk-0.2.0-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6bedc528958333278891694a15a9d76d8afb11a5e022aaa24e2bb0c827284667
BLAKE2b-256 checksum
How to use checksums
fdbd9408ddc74242dfbacd1286195aa789544d780613b0c38fda46fd29db99ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Security for sentro-sdk 0.2.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