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.1.tar.gz (26.0 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.1-py3-none-any.whl (25.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for converra-0.3.1.tar.gz
Algorithm Hash digest
SHA256 971f1978488038e7d2535893552d10c6da8f274d58fe8aa5316ed130a5447437
MD5 57a19cc86f353b5f588f760b54dda8a1
BLAKE2b-256 f6b864f9ddf0b72aabbb2c93ef372fe8826a30f8528d287c0f45e384b6d478dc

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for converra-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 82a12d7701829870fddff07e9093d1e1d9a5707a03d6abae7237b2e47eaf2be5
MD5 94a2ee73dce2d96161b26dfed1f1446d
BLAKE2b-256 f24b8119d869209ded874a2cf7ea3cff8b476f126475a82f0d6ecc529911df46

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