Skip to main content

Converra SDK — conversation capture, optimization, and A/B testing for AI agents

Project description

converra

Official Python SDK for Converra — the AI agent optimization platform.

Installation

pip install converra

With provider support:

pip install converra[openai]      # OpenAI wrapping
pip install converra[anthropic]   # Anthropic wrapping
pip install converra[all]         # All providers

Quick Start

from converra import Converra

converra = Converra(api_key="sk_...")

# Log a conversation — one method, handles everything
converra.send(
    agent="Support Bot",
    messages=[
        {"role": "user", "content": "I need help with my order"},
        {"role": "assistant", "content": "I'd be happy to help!"},
    ],
)

converra.send()

The simplest way to get conversations into Converra. Works with complete conversations or incremental turns.

from converra import Converra, ConversationMessage

converra = Converra(api_key="sk_...")

# Complete conversation
result = converra.send(
    agent="Support Bot",
    messages=[
        {"role": "user", "content": "Hello"},
        {"role": "assistant", "content": "Hi! How can I help?"},
    ],
)

# Incremental turns
result = converra.send(
    agent="Chat Bot",
    messages=[
        {"role": "user", "content": "Hi"},
        {"role": "assistant", "content": "Hello!"},
    ],
    status="active",
)

# Append more turns
converra.send(
    agent="Chat Bot",
    conversation_id=result.conversation_id,
    messages=[
        {"role": "user", "content": "Thanks!"},
        {"role": "assistant", "content": "You're welcome!"},
    ],
    status="completed",  # triggers analysis
)

Enriched messages

Each message can optionally carry per-turn context:

converra.send(
    agent="Support Bot",
    messages=[
        {"role": "user", "content": "What is your return policy?"},
        {
            "role": "assistant",
            "content": "Our return policy allows...",
            "model": "gpt-4o",
            "tool_calls": [{"name": "lookup_policy", "arguments": {"topic": "returns"}}],
            "usage": {"prompt_tokens": 200, "completion_tokens": 85},
            "latency_ms": 1200,
        },
    ],
)

Organizing conversations

Use agent to group by project/workflow and user_id to group by end customer:

converra.send(
    agent="Churn Research Q1",       # groups conversations by research/project
    user_id="customer_acme",         # groups conversations by customer
    messages=[...],
)

You can also use dataclasses instead of dicts:

from converra import ConversationMessage, ToolCall, Usage

messages = [
    ConversationMessage(role="user", content="Hello"),
    ConversationMessage(
        role="assistant",
        content="Hi!",
        model="gpt-4o",
        usage=Usage(prompt_tokens=100, completion_tokens=20),
    ),
]

LLM Client Wrapping

Wrap your LLM client to automatically capture every call:

OpenAI

from converra import Converra
from openai import OpenAI

converra = Converra(api_key="sk_...")
client = converra.wrap(OpenAI())

# Use normally — all calls captured
response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello"}],
)

Anthropic

from anthropic import Anthropic

client = converra.wrap(Anthropic())
response = client.messages.create(
    model="claude-sonnet-4-20250514",
    messages=[{"role": "user", "content": "Hello"}],
    max_tokens=100,
)

Requirements

License

MIT

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

converra-0.3.4.tar.gz (32.9 kB view details)

Uploaded Source

Built Distribution

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

converra-0.3.4-py3-none-any.whl (29.4 kB view details)

Uploaded Python 3

File details

Details for the file converra-0.3.4.tar.gz.

File metadata

  • Download URL: converra-0.3.4.tar.gz
  • Upload date:
  • Size: 32.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for converra-0.3.4.tar.gz
Algorithm Hash digest
SHA256 9c25f162c489ba1a5da0d3a26933aafcd4a8b0d1afd2beae14480b36b1a68456
MD5 3546a7cac070660d0c4f080e111105dc
BLAKE2b-256 d94e01fe354571ea9add259821ff92a6024cfd993a92dcfefa59564917b2d6ac

See more details on using hashes here.

File details

Details for the file converra-0.3.4-py3-none-any.whl.

File metadata

  • Download URL: converra-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 29.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for converra-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 389b6386b50433deaca2b1cc6c5cf44daffd63274ca00d8404d430b116ac91e9
MD5 03e5241507e7c1c3f18f73630d16b281
BLAKE2b-256 ce8961ff6498eba5ecdd202050611efd49aa3cb74054f26fc79d0df7cf4a9d67

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