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
await 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, SendInput

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

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

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

# Append more turns
await 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:

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: converra-0.3.0.tar.gz
  • Upload date:
  • Size: 25.9 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.0.tar.gz
Algorithm Hash digest
SHA256 5017f50d156e679128dfad520a534a5da76381f5b876c39c2b4a706de30773b8
MD5 0def7c6835a104a91dad3ed23c5e0820
BLAKE2b-256 ca37638cfbc407cdaa3e7922a189c18593b75be663c63a11be9325eb0a050375

See more details on using hashes here.

File details

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

File metadata

  • Download URL: converra-0.3.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 67fecaa294bbfc42df237bb9d4f2f6040bef9dd9ef1d7d26263eb605e9e20f8c
MD5 eacdfab5b758a43f57c1af9ec98e694f
BLAKE2b-256 17d12223aed27cb244ecbf28b485cef07937bb3837a51789ff77d1551efad42a

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