AgentQ SDK — agent observability for Python.
Project description
AgentQ SDK
A Python SDK for instrumenting AI agents with observability. Traces agent runs, LLM calls, and tool invocations, sending data to an AgentQ server via OpenTelemetry.
Installation
pip install agentq
For auto-instrumentation of specific LLM providers, install them alongside:
pip install agentq openai anthropic google-genai
Quick Start
import agentq
# Point to your AgentQ server
agentq.init(endpoint="http://localhost:3000")
# Auto-patch supported LLM libraries
agentq.instrument()
@agentq.agent(name="my-agent")
def run_task(prompt: str) -> str:
# Any OpenAI/Anthropic/Gemini calls inside here are traced automatically
response = openai.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": prompt}],
)
return response.choices[0].message.content
Features
@agentdecorator -- Wraps functions and classes to create traced runs with input/output capture- Auto-instrumentation -- Monkey-patches OpenAI, Anthropic, and Google Gemini to trace every LLM call
- Session tracking -- Group related runs into sessions with the
sessioncontext manager - Nested spans -- Nested
@agentcalls and manualtrack_agent/track_llm/track_toolspans - Celery integration -- Captures queue wait time for Celery tasks
- OpenTelemetry native -- Built on OpenTelemetry, compatible with any OTLP endpoint
API Reference
agentq.init(endpoint, headers, service_name)
Initialize the SDK. Call once at startup.
endpoint-- OTLP HTTP base URL (e.g.http://localhost:3000). Falls back toOTEL_EXPORTER_OTLP_ENDPOINT.headers-- Extra headers for OTLP requests (e.g.{"Authorization": "Bearer sk-xxx"}).service_name-- Value for theservice.nameresource attribute (default:"agentq").
agentq.instrument()
Activate auto-instrumentation for OpenAI, Anthropic, Google Gemini, and Celery. Safe to call even if libraries aren't installed.
@agentq.agent(name, entry_method, description, version, metadata)
Decorator for functions or classes. Creates a traced run for each invocation.
For classes, entry_method specifies which method(s) to instrument (default: "execute").
agentq.session(name, session_id, run_id, metadata)
Context manager that groups runs into a session:
with agentq.session(name="user-chat"):
run_task("Hello")
run_task("Follow up")
Manual Span Context Managers
with agentq.track_agent("sub-agent") as span:
...
with agentq.track_llm("gpt-4") as span:
...
with agentq.track_tool("web-search") as span:
...
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentq-0.1.0.tar.gz.
File metadata
- Download URL: agentq-0.1.0.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36123352d52353e3919b2c8cb6e1cccdd8a311aa5a9f42ca18ddbb789d71c639
|
|
| MD5 |
66c1a5d8ad111ac3e3c823cf2e6c5c71
|
|
| BLAKE2b-256 |
92b4920fee402a50785fa566df8b4c121997113462b4a5d05d15be714bd3ddcd
|
Provenance
The following attestation bundles were made for agentq-0.1.0.tar.gz:
Publisher:
publish-sdk.yml on ryandao/agentq
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentq-0.1.0.tar.gz -
Subject digest:
36123352d52353e3919b2c8cb6e1cccdd8a311aa5a9f42ca18ddbb789d71c639 - Sigstore transparency entry: 1245841101
- Sigstore integration time:
-
Permalink:
ryandao/agentq@29c2e2c835678976e123584130c82d9637fa5885 -
Branch / Tag:
refs/tags/sdk-v0.1.0 - Owner: https://github.com/ryandao
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdk.yml@29c2e2c835678976e123584130c82d9637fa5885 -
Trigger Event:
release
-
Statement type:
File details
Details for the file agentq-0.1.0-py3-none-any.whl.
File metadata
- Download URL: agentq-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6ba590ae59742c0dea61b7f6da328bbf96f1700700bfbc361673edf1c64dcbd
|
|
| MD5 |
a78c2826a56d2b193d37fb6f630a0a32
|
|
| BLAKE2b-256 |
a423a9fa617222286f11e6ed5dd2becf87a69cb8e03dfd937ef8b5d7aac4c330
|
Provenance
The following attestation bundles were made for agentq-0.1.0-py3-none-any.whl:
Publisher:
publish-sdk.yml on ryandao/agentq
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentq-0.1.0-py3-none-any.whl -
Subject digest:
a6ba590ae59742c0dea61b7f6da328bbf96f1700700bfbc361673edf1c64dcbd - Sigstore transparency entry: 1245841104
- Sigstore integration time:
-
Permalink:
ryandao/agentq@29c2e2c835678976e123584130c82d9637fa5885 -
Branch / Tag:
refs/tags/sdk-v0.1.0 - Owner: https://github.com/ryandao
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdk.yml@29c2e2c835678976e123584130c82d9637fa5885 -
Trigger Event:
release
-
Statement type: