AgentTrail Python SDK
Client library for tracing agent and LLM workloads: it records spans and sends them to your ingestion endpoint (POST {base_url}/v1/spans). It does not include a server, database, or UI—only instrumentation and export.
Install (PyPI)
pip install agenttrail-sdk
LangGraph, OpenAI, and Anthropic clients are dependencies of this package—customers install once; new framework support ships in new SDK releases, not separate extras.
Developers can use uv with this repo: see pyproject.toml and uv.lock.
Quick usage
Set base_url to your span ingestion service, or set the environment variable AGENTTRAIL_BASE_URL (default if both omitted: http://127.0.0.1:8080).
from agenttrail import init, shutdown
init(
api_key="your-api-key",
project="my-agent",
base_url="https://ingest.example.com",
)
try:
... # app / agents
finally:
shutdown()
By default, init() auto-instruments LangGraph (invoke / ainvoke / stream / astream), OpenAI chat.completions.create, and Anthropic messages.create. Use auto_instrument=False to disable.
Docs
Links use the GitHub repository so they work from PyPI and from this checkout.
| Doc | Purpose |
|---|---|
| QUICKSTART | Examples (LangGraph, OpenAI, Anthropic, manual spans) |
| CONNECTOR_SPEC | Building third-party connectors |
| TESTING | Automated checks and manual smoke tests |
| PUBLISHING | PyPI release (uv build, uv publish) |
| SDK_Plan | Internal roadmap / program context |
Development
cd /path/to/repo # repository root containing pyproject.toml
uv sync
uv run pytest
uv run ruff check src tests
uv run ruff format --check src tests
uv run mypy src
License
Release files for agenttrail-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)
| File | Size | Uploaded | |
|---|---|---|---|
| agenttrail_sdk-0.1.0.tar.gz | 80.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| agenttrail_sdk-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 102.9 kB
Release files / agenttrail_sdk-0.1.0.tar.gz
| Download URL | agenttrail_sdk-0.1.0.tar.gz |
|---|---|
| Size | 80.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ee7b35ee873843cd4dbd9a9696cc8b7b0458b955e96e8ba1ad38ab3cbfeac4cd
|
|
BLAKE2b-256 checksum How to use checksums |
51506e06d7c89526cdaec1a2a72ffea17e7fc12fe7761575f73fe42bb14bab39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / agenttrail_sdk-0.1.0-py3-none-any.whl
| Download URL | agenttrail_sdk-0.1.0-py3-none-any.whl |
|---|---|
| Size | 22.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c39c5e9df63e2a12d94d6ff3f7cabb17779a58ccf93205296223a5a288bbca64
|
|
BLAKE2b-256 checksum How to use checksums |
817db7c38a268397b64266cbff83b4e6a7a2adad5924a8a28e96447ce00dd114
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|