Tracify Python SDK
Observability and tracing for AI agents. Gain full visibility into your agent's decision-making process, tool usage, and LLM costs.
Installation
pip install tracify-sdk
Quickstart
- Get your API Key from the Tracify Dashboard.
- Set it as an environment variable:
export TRACIFY_API_KEY=your_sk_live_...
- Instrument your agent:
from tracify import trace_agent, llm_call, tool_call
@trace_agent(environment="development", release="quickstart")
async def my_agent(query: str):
# LLM Call
llm_call(
input_data=query,
output_data="Thinking...",
model_id="gpt-4o",
cost_usd=0.002,
latency_ms=800
)
# Tool Use
tool_call(
tool_name="web_search",
input_data={"q": query},
output_data="Found results...",
latency_ms=1200
)
return "Final Answer"
Steps
Inside a @trace_agent function, every step you record is linked to the step it ran in, so the trace graph
shows which step called which and how loops repeat. Use span for a block and observe for a function:
import tracify
@tracify.observe(type="tool")
def search_docs(query):
return search(query)
@tracify.trace_agent()
def answer(question):
for turn in range(5):
with tracify.span("think", type="agent"):
with tracify.span("chat", type="llm", input=question) as step:
reply = call_model(question)
step.set_output(reply.text)
step.set(model="claude-sonnet-5-5", input_tokens=reply.usage.input, output_tokens=reply.usage.output)
if reply.done:
return reply.text
search_docs(reply.query)
type is one of agent, llm, tool, retrieval or span. Errors are recorded with their type and
message. Concurrent runs (threads or asyncio tasks) stay in separate traces. Inputs and outputs have obvious
secrets (bearer tokens, API keys, JWTs, password= values) removed and are capped at 10,000 characters;
avoid sending anything else you would not want stored.
Features
- @trace_agent Decorator: Automatically captures run lifecycle and errors.
- Granular Spans: Manually record LLMs, tools, and custom decisions.
- Cost Tracking: Monitor your infrastructure spend in real-time.
- Asynchronous & Synchronous Support: Works with
async/awaitor standard functions. - Session context: Attach
session_id,end_user_id,environment,release, andtagsto connect related traces.
Feedback and evaluation scores
Pass project_id when constructing the client to attach end-user feedback and typed scores to traces:
client = TracifyClient(project_id="your-project-id")
client.feedback(run_id, True, kind="thumb", comment="Helpful answer")
client.score(run_id, "answer_quality", 0.92, data_type="numeric")
Feedback and scores use the same API key as ingestion and do not interrupt the agent when delivery fails.
Prompt deployment
Resolve a deployed prompt without shipping a new application build:
deployed = client.get_prompt("support-agent", "production")
client.ingest(spanType="llm", input=question, output=answer, promptVersionId=deployed["version"]["id"])
Prompt responses are cached for 60 seconds by default. Use cache_ttl_seconds=0 or provide a fallback for development and guaranteed-availability behavior.
License
MIT
Metadata
Release files for tracify-sdk 0.3.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 | Provenance | |
|---|---|---|---|---|
| tracify_sdk-0.3.0.tar.gz | 15.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tracify_sdk-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.7 kB
Release files / tracify_sdk-0.3.0.tar.gz
| Download URL | tracify_sdk-0.3.0.tar.gz |
|---|---|
| Size | 15.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
65cdaa6213351e65a8ed4aeea888f73dbdb58e181f28e6d06b8065c15a6ae21e
|
|
BLAKE2b-256 checksum How to use checksums |
ccd72426c7f9e6ceffe3bb857042eb6501be85d190f61c5b7806c958c63c9288
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.15
|
Release files / tracify_sdk-0.3.0-py3-none-any.whl
| Download URL | tracify_sdk-0.3.0-py3-none-any.whl |
|---|---|
| Size | 11.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6367f10c794825825b2a87f1a1197e6284931ae7379fe53957ebcf917b0cef76
|
|
BLAKE2b-256 checksum How to use checksums |
299b8fe6e63681c712d58b8f2205e3b96d356e088b6c3de7f0cb57d58f499bdc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.15
|
Security for tracify-sdk 0.3.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.