Official Python SDK for the Prometa Agentic Lifecycle Intelligence Platform
Project description
prometa-sdk (Python)
Official Python SDK for the Prometa Agentic Lifecycle Intelligence Platform.
Wraps OpenTelemetry GenAI semantic conventions with @prometa decorators that
automatically emit lifecycle metadata (solution_id, stage, agent) to your
Prometa instance via OTLP/JSON.
Install
pip install prometa-sdk
Quick start
import asyncio
from prometa import Prometa
prometa = Prometa(
endpoint="https://prometa.example.com/api/v2/otlp/v1/traces",
api_key="prm_live_...",
solution_id="sol_abc123",
agent_name="customer-support",
stage="production",
)
@prometa.workflow(name="handle-ticket")
async def handle_ticket(ticket_id: str) -> str:
@prometa.agent(name="classifier")
async def classify() -> str:
return "billing"
@prometa.tool(name="kb-search")
async def kb_search(q: str) -> list[str]:
return ["doc1", "doc2"]
category = await classify()
results = await kb_search(category)
return f"resolved {ticket_id} via {results}"
asyncio.run(handle_ticket("T-1234"))
prometa.flush()
What gets captured
Each decorated function emits a span with:
prometa.kind—workflow | agent | tool | taskprometa.solution_id,prometa.stagegen_ai.agent.name,gen_ai.agent.id- Parent/child relationships across async/sync calls
- Errors → span status
errorpluserror.message
LLM client auto-instrumentation
For traces to show token usage, cost, and prompt/completion text,
opt in to the per-client patcher matching the LLM library you use.
Without this, spans render but the cost panel reads $0.000 and the
trace UI has no prompt/completion to display.
from prometa import Prometa
from prometa.integrations import openai as prometa_openai
from prometa.integrations import anthropic as prometa_anthropic
from prometa.integrations import google as prometa_google
Prometa(endpoint=..., agent_name="my-agent")
# Call install() once at startup. Each returns False (no-op) if the
# corresponding library isn't installed — so it's safe to call all three.
prometa_openai.install()
prometa_anthropic.install()
prometa_google.install()
Once installed, every client.chat.completions.create(...),
client.messages.create(...), and client.models.generate_content(...)
call (sync, async, and streaming) emits a child span carrying:
gen_ai.system(openai/anthropic/google)gen_ai.request.model,temperature,top_p,max_tokensgen_ai.usage.input_tokens/gen_ai.usage.output_tokens→ drives costgen_ai.prompt(truncated JSON of input messages)gen_ai.completion(truncated assistant reply)gen_ai.response.id,gen_ai.response.model,gen_ai.response.finish_reasons
Streaming spans propagate context properly — any @prometa.tool /
@prometa.agent invoked from inside the stream consumer nests under
the LLM span, not under whatever was active when .create() returned.
A note on the trace "Conversation" panel
The Prometa trace UI renders a Conversation panel that reads from a
dedicated prometa.conversation_turns ClickHouse table. As of platform
version compatible with this SDK release, no ingest path writes to
that table — so the panel will show "No conversation turns recorded
for this trace." even with auto-instrumentation enabled.
The prompt/completion text is still captured as gen_ai.prompt /
gen_ai.completion span attributes and is queryable from the Spans
table, the trace export API, and any downstream LLM-as-a-Judge / replay
tooling. The Conversation panel itself will start populating once the
platform team wires the OTLP ingest handler to fan-out span attributes
into prometa.conversation_turns (tracked separately).
Configuration
| Param | Env var | Default |
|---|---|---|
endpoint |
— | required |
api_key |
PROMETA_API_KEY |
none |
solution_id |
— | none |
agent_name |
— | "prometa-agent" |
stage |
— | "development" |
flush_interval_seconds |
— | 2.0 |
License
Apache-2.0
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 prometa_sdk-0.2.1.tar.gz.
File metadata
- Download URL: prometa_sdk-0.2.1.tar.gz
- Upload date:
- Size: 26.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c5a22bbcbca9e31b5fc880a093dfb06c1c96ecb235ae1defa75b0c20428598e
|
|
| MD5 |
3cd9baddc85d38c2b8b38f53b10ea814
|
|
| BLAKE2b-256 |
f0fa7c9e50474a5fd1ef407aed2fc42c5c1643dae6af0ac3663ffe19d39584d1
|
Provenance
The following attestation bundles were made for prometa_sdk-0.2.1.tar.gz:
Publisher:
sdk-release.yml on caglarsubas/agent-hook-v2
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prometa_sdk-0.2.1.tar.gz -
Subject digest:
5c5a22bbcbca9e31b5fc880a093dfb06c1c96ecb235ae1defa75b0c20428598e - Sigstore transparency entry: 1379774248
- Sigstore integration time:
-
Permalink:
caglarsubas/agent-hook-v2@f59a0206f2b70680ef5640dc7681e6a2c8abeca2 -
Branch / Tag:
refs/tags/sdk-python-v0.2.1 - Owner: https://github.com/caglarsubas
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
sdk-release.yml@f59a0206f2b70680ef5640dc7681e6a2c8abeca2 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file prometa_sdk-0.2.1-py3-none-any.whl.
File metadata
- Download URL: prometa_sdk-0.2.1-py3-none-any.whl
- Upload date:
- Size: 35.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81c37f50a124929343b13082d93c63c84dc1d72885a110340a2e318e7b1c242d
|
|
| MD5 |
b92f8520fd0777cb8eb391ab9afe7a1c
|
|
| BLAKE2b-256 |
cc2921be38341d6ae40f9040c3bf4a088daf51715371a4185dcac2b9a15ea4b8
|
Provenance
The following attestation bundles were made for prometa_sdk-0.2.1-py3-none-any.whl:
Publisher:
sdk-release.yml on caglarsubas/agent-hook-v2
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prometa_sdk-0.2.1-py3-none-any.whl -
Subject digest:
81c37f50a124929343b13082d93c63c84dc1d72885a110340a2e318e7b1c242d - Sigstore transparency entry: 1379774487
- Sigstore integration time:
-
Permalink:
caglarsubas/agent-hook-v2@f59a0206f2b70680ef5640dc7681e6a2c8abeca2 -
Branch / Tag:
refs/tags/sdk-python-v0.2.1 - Owner: https://github.com/caglarsubas
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
sdk-release.yml@f59a0206f2b70680ef5640dc7681e6a2c8abeca2 -
Trigger Event:
workflow_dispatch
-
Statement type: