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.0.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.0-py3-none-any.whl (25.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: syntropy_ai-0.2.0.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.0.tar.gz
Algorithm Hash digest
SHA256 621836bcaed80faa9f845542e1a6be43cd7ae25c21b7f1971bc5cb4311d875ec
MD5 89bd0d017e86955a621310a1574679c8
BLAKE2b-256 babd5f5b195a2c951a3c59d1975a637861fc3dad6e5bbc6c7c2e538e7bb68245

See more details on using hashes here.

File details

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

File metadata

  • Download URL: syntropy_ai-0.2.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 af1597dbcacd3eed36c603a81e0d2c2aa4b655fcdaa58531e527946db49b661f
MD5 75003c3baef18d640ab74e26c6398660
BLAKE2b-256 50e5466c2841574ec555cd92e21e71b2af3e57b9dd5eaef51b661484c22ed623

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