Skip to main content

Universal AI Observability and Security Agent — trace, guard, and govern LLM calls across every provider.

Project description

Syntropy Python SDK

Trace, guard, and govern your AI agents with zero-effort integration.

Installation

pip install syntropy-ai

Quick Start

from syntropy import Syntropy

client = Syntropy(
    api_key="syn_your_key_here",
    base_url="https://ingest.syntropy.dev",
    agent_id="my-agent",
)

# Trace an LLM call (buffered, non-blocking)
client.trace(
    prompt="What is the capital of France?",
    response="The capital of France is Paris.",
    model="gpt-4o",
    tokens_in=12,
    tokens_out=8,
    latency_ms=340,
)

# Synchronous trace (blocks until confirmed)
result = client.trace_sync(
    prompt="Hello",
    response="Hi there!",
    model="gpt-4o-mini",
)
print(result.success, result.trace_id)

OpenAI Integration

Auto-trace all chat.completions.create() calls:

import openai
from syntropy import Syntropy
from syntropy.integrations.openai import wrap_openai

syn = Syntropy(api_key="syn_...", agent_id="my-agent")
client = wrap_openai(openai.OpenAI(), syntropy=syn)

# This call is now auto-traced — no code changes needed:
response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello!"}],
)

Async Support

from syntropy.client import AsyncSyntropy

async def main():
    client = AsyncSyntropy(
        api_key="syn_...",
        base_url="https://ingest.syntropy.dev",
        agent_id="my-agent",
    )

    result = await client.trace(
        prompt="Hello",
        response="Hi!",
        model="gpt-4o",
    )
    print(result.success)
    await client.close()

Batch Tracing

client.trace_batch([
    {"agent_id": "agent-1", "prompt": "Q1", "response": "A1", "model": "gpt-4o"},
    {"agent_id": "agent-2", "prompt": "Q2", "response": "A2", "model": "gpt-4o"},
])

Configuration

Option Default Description
api_key required Your Syntropy API key
base_url http://localhost:4000 Ingestion service URL
agent_id "" Default agent ID
flush_interval 2.0 Seconds between buffer flushes
batch_size 50 Max traces per batch
max_queue_size 10000 Max buffered traces
enabled True Set False to disable tracing

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

syntropy_ai-0.2.1.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

syntropy_ai-0.2.1-py3-none-any.whl (25.8 kB view details)

Uploaded Python 3

File details

Details for the file syntropy_ai-0.2.1.tar.gz.

File metadata

  • Download URL: syntropy_ai-0.2.1.tar.gz
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for syntropy_ai-0.2.1.tar.gz
Algorithm Hash digest
SHA256 38fd48fbc828804842f302c548aa007d067ebf32171c9c765bf0b36c0f4c3fd5
MD5 8d2491d732f8196df03f58d951fe7249
BLAKE2b-256 370009a08eb509ccb40b51cfd49708c8313e75babf8f7e55b8b18a85f9fd6968

See more details on using hashes here.

File details

Details for the file syntropy_ai-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: syntropy_ai-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 25.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for syntropy_ai-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 33888e016b0c2a40cb1d32733d1f09aa5038a905ae8b82fd581fbddb2dd8eefe
MD5 ead59bb2b52ab43832b8972f2644f50e
BLAKE2b-256 1c6586c79723ef1b44bdae985ed3c350e44fd258e7ce7f1b662f439744580fa4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page