Getting Started

1. Install the required packages:

pip install -qU pyautogen obiguard

2. Configure your Autogen configs:

from autogen import AssistantAgent, UserProxyAgent, config_list_from_json
from obiguard import OBIGUARD_GATEWAY_URL, createHeaders

config = [
    {
        "api_key": "OPENAI_API_KEY",
        "model": "gpt-3.5-turbo",
        "base_url": OBIGUARD_GATEWAY_URL,
        "api_type": "openai",
        "default_headers": createHeaders(
            obiguard_api_key="vk-obg***",  # Your Obiguard virtual key
            provider = "openai",
        )
    }
]

Make your agents Production-ready with Obiguard

Obiguard makes your Autogen agents reliable, robust, and production-grade with its observability suite and AI Gateway. Seamlessly integrate 200+ LLMs with your Autogen agents using Obiguard. Gain granular insights into agent performance and costs, and continuously optimize your AI operations—all with just 2 lines of code. Let’s dive deep! Let’s go through each of the use cases!

1. Interoperability

Easily switch between 200+ LLMs. Call various LLMs such as Anthropic, Gemini, Mistral, Azure OpenAI, Google Vertex AI, AWS Bedrock, and many more by simply changing the provider and obiguard_api_key in the ChatOpenAI object.
If you are using OpenAI with autogen, your code would look like this:
config = [
  {
    "api_key": "OPENAI_API_KEY",
    "model": "gpt-3.5-turbo",
    "base_url": OBIGUARD_GATEWAY_URL,
    "api_type": "openai",
    "api_type": "openai", # Obiguard conforms to the openai api_type
    "default_headers": createHeaders(
      obiguard_api_key="sk-obg***",  # Your Obiguard API key
      provider = "openai",
    )
  }
]
To switch to Azure as your provider, add your Azure details to Obiguard vault (here’s how) and use Azure OpenAI using virtual keys.
config = [
  {
    "api_key": "api-key",
    "model": "gpt-3.5-turbo",
    "base_url": OBIGUARD_GATEWAY_URL,
    "api_type": "openai", # Obiguard conforms to the openai api_type
    "default_headers": createHeaders(
      obiguard_api_key="sk-obg***",  # Your Obiguard API key
      provider = "azure-openai",
    )
  }
]

3. Metrics

Agent runs can be costly. Tracking agent metrics is crucial for understanding the performance and reliability of your AI agents. Metrics help identify issues, optimize runs, and ensure that your agents meet their intended goals. Obiguard automatically logs comprehensive metrics for your AI agents, including cost, tokens used, latency, etc. Whether you need a broad overview or granular insights into your agent runs, Obiguard’s customizable filters provide the metrics you need.
config = [
    {
        "api_key": "OPENAI_API_KEY",
        "model": "gpt-3.5-turbo",
        "base_url": OBIGUARD_GATEWAY_URL,
        "api_type": "openai",
        "default_headers": createHeaders(
            obiguard_api_key="sk-obg***",  # Your Obiguard API key
            provider = "openai",
        )
    }
]

4. Logs

Agent runs are complex. Logs are essential for diagnosing issues, understanding agent behavior, and improving performance. They provide a detailed record of agent activities and tool use, which is crucial for debugging and optimizing processes. Obiguard offers comprehensive logging features that capture detailed information about every action and decision made by your AI agents. Access a dedicated section to view records of agent executions, including parameters, outcomes, function calls, and errors. Filter logs based on multiple parameters such as trace ID, model, tokens used, and metadata.