traceAI for Python
OpenTelemetry instrumentation for AI applications. Install the core and the instrumentor for the framework you use.
All languages · Integration guides · Core API and configuration
Quickstart
Use Python 3.10–3.13 for this OpenAI example.
pip install fi-instrumentation-otel traceai-openai
export FI_API_KEY="your-future-agi-api-key"
export FI_SECRET_KEY="your-future-agi-secret-key"
export OPENAI_API_KEY="your-openai-api-key"
export OPENAI_MODEL="gpt-4.1" # Choose a model available to your account.
Save as quickstart.py, then run python quickstart.py.
import os
from openai import OpenAI
from fi_instrumentation import register
from fi_instrumentation.fi_types import ProjectType
from traceai_openai import OpenAIInstrumentor
provider = register(project_name="traceai-quickstart", project_type=ProjectType.OBSERVE)
OpenAIInstrumentor().instrument(tracer_provider=provider)
try:
response = OpenAI().chat.completions.create(
model=os.environ["OPENAI_MODEL"],
messages=[{"role": "user", "content": "Say hello in one word."}],
)
print(response.choices[0].message.content)
finally:
provider.shutdown() # Flush pending spans before the process exits.
Open the traceai-quickstart project in Observe in Future AGI. provider.shutdown() flushes pending spans before exit.
Shutdown on termination
From fi-instrumentation-otel 1.2.2, register() leaves your SIGINT and SIGTERM handlers unchanged. Default SIGTERM does not run Python exit hooks, so call provider.shutdown() from your application's shutdown path to export pending spans on container stop, and allow enough termination grace time. SIGKILL cannot flush spans.
A standalone script that owns its signal policy can opt in:
import signal
def stop(signum, frame):
provider.shutdown()
raise SystemExit(0) # Your application chooses the exit status.
signal.signal(signal.SIGTERM, stop)
signal.signal(signal.SIGINT, stop)
In a web server, worker or async service, use the framework's shutdown hook instead of replacing its handlers: stop accepting work, finish or cancel active requests, then call provider.shutdown(). force_flush() exports ended spans without shutting down the provider; it does not replace shutdown for operations still running.
Context and privacy
Use using_attributes(session_id=..., user_id=..., metadata=...) to attach application context. The core also provides using_session, using_user, using_tags, and suppress_tracing.
Content capture is on by default. Configure FI_HIDE_INPUTS, FI_HIDE_OUTPUTS, FI_HIDE_INPUT_MESSAGES, FI_HIDE_OUTPUT_MESSAGES, FI_HIDE_INPUT_TEXT, FI_HIDE_OUTPUT_TEXT, FI_HIDE_INPUT_IMAGES, and FI_HIDE_EMBEDDING_VECTORS before initialization. Set each to true to hide that content.
FI_HIDE_ERROR_DETAILS=true hides error descriptions, exception messages, and stack traces while keeping status and error types. When unset, it follows the input/output value, message, and text hide flags. Explicit false overrides the derived value. See the configuration implementation and the cross-language privacy guide.
Use your OpenTelemetry pipeline
Pass your own OpenTelemetry TracerProvider to OpenAIInstrumentor().instrument(tracer_provider=provider) to use an existing exporter. The register() helper configures Future AGI by default. On current source, register(span_exporter=...) replaces that destination; older published versions may not include this option.
Packages
Each package below links to its own installation instructions, supported SDK versions, and examples. Package availability and framework support are independent; do not assume every package supports the same upstream version.
Browse the complete Python instrumentor catalog
| Package | Source |
|---|---|
traceAI-a2a |
a2a |
traceAI-ag2 |
ag2 |
traceAI-ag2-classic |
ag2-classic |
traceAI-agent-framework |
agent-framework |
traceai-agno |
agno |
traceAI-anthropic |
anthropic |
traceAI-autogen |
autogen |
traceAI-bedrock |
bedrock |
traceai-beeai |
beeai |
traceAI-cerebras |
cerebras |
traceAI-chromadb |
chromadb |
traceai-claude-agent-sdk |
claude-agent-sdk |
traceAI-cohere |
cohere |
traceAI-crewai |
crewai |
traceAI-deepseek |
deepseek |
traceAI-discoveryengine |
discoveryengine |
traceAI-DSPy |
dspy |
traceAI-elevenlabs-agents |
elevenlabs-agents |
traceAI-exa |
exa |
traceAI-firecrawl |
firecrawl |
traceAI-fireworks |
fireworks |
traceAI-google-adk |
google-adk |
traceAI-google-genai |
google-genai |
traceAI-google-genai-live |
google-genai-live |
traceAI-groq |
groq |
traceAI-guardrails |
guardrails |
traceAI-haystack |
haystack |
traceAI-hermes-agent |
hermes-agent |
traceAI-huggingface |
huggingface |
traceAI-instructor |
instructor |
traceAI-lancedb |
lancedb |
traceAI-langchain |
langchain |
traceAI-litellm |
litellm |
traceAI-livekit |
livekit |
traceAI-llamaindex |
llama_index |
traceAI-mcp |
mcp |
traceAI-mcp-use |
mcp-use |
traceAI-milvus |
milvus |
traceAI-minimax |
minimax |
traceAI-mistralai |
mistralai |
traceAI-mongodb |
mongodb-vector |
traceAI-ollama |
ollama |
traceAI-openai |
openai |
traceAI-openai-agents |
openai-agents |
traceAI-openai-realtime |
openai-realtime |
traceAI-parallel |
parallel |
traceAI-pgvector |
pgvector |
traceAI-pinecone |
pinecone |
traceAI-pipecat |
pipecat |
traceAI-portkey |
portkey |
traceai-pydantic-ai |
pydantic-ai |
traceAI-qdrant |
qdrant |
traceAI-redis |
redis-vector |
traceAI-replicate |
replicate |
traceAI-semantic-kernel |
semantic-kernel |
traceAI-smolagents |
smolagents |
traceai-strands |
strands |
traceAI-tavily |
tavily |
traceAI-together |
together |
traceAI-typesafe |
typesafe |
traceAI-vertexai |
vertexai |
traceAI-vllm |
vllm |
traceAI-voyage |
voyage |
traceAI-weaviate |
weaviate |
traceAI-xai |
xai |
Contributing and license
Read the contributing guide. Licensed under Apache 2.0.
Metadata
Release files for fi-instrumentation-otel 1.2.2
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 | Actions |
|---|---|---|---|---|
| fi_instrumentation_otel-1.2.2.tar.gz | 55.1 kB | With provenance | Details for fi_instrumentation_otel-1.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fi_instrumentation_otel-1.2.2-py3-none-any.whl | Python 3 | none | any | Details for fi_instrumentation_otel-1.2.2-py3-none-any.whl |
Total release size: 116.0 kB
Release files / fi_instrumentation_otel-1.2.2.tar.gz
| Download URL | fi_instrumentation_otel-1.2.2.tar.gz |
|---|---|
| Size | 55.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b675df47d7a03c506fbd2e4b0420fe4f74d12a6353a88b219bfd97797b276d4c
|
|
BLAKE2b-256 checksum How to use checksums |
162af720385609560f8cd78db67b7da4973b49a44437071a4fa7b240758f8ccb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logRelease files / fi_instrumentation_otel-1.2.2-py3-none-any.whl
| Download URL | fi_instrumentation_otel-1.2.2-py3-none-any.whl |
|---|---|
| Size | 60.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
25cf88f93e33aa928d4fae0f631afe8a32565639490862b715869e0633becbaf
|
|
BLAKE2b-256 checksum How to use checksums |
836ff30ce7da7d251986563f7d86b820d875b2a29eb8cfeb09a82270e0d86fbd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logSecurity for fi-instrumentation-otel 1.2.2
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for fi_instrumentation_otel-1.2.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logA 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.