> ## Documentation Index
> Fetch the complete documentation index at: https://docs.portkey.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Autogen (DEPRECATED)

> AutoGen is a framework that enables the development of LLM applications using multiple agents that can converse with each other to solve tasks.

<Card title="This Integration is DEPRECATED" icon="robot" href="/docs/aigw/integrations/agents/autogen">
  Click here to check out the latest integration of Autogen with Prisma AIRS AI Gateway
</Card>

## Quick Start Integration

Autogen supports a concept of `config\_list` which allows definitions of the LLM provider and model to be used. The AI Gateway seamlessly integrates into the Autogen framework through a custom config we create.

### Example using minimal configuration

```py theme={"system"}
from autogen import AssistantAgent, UserProxyAgent, config_list_from_json

config_list = [
    {
        "api_key": 'Your OpenAI Key',
        "model": "@openai/gpt-3.5-turbo",
        "base_url": "https://aigw.portkey.ai/v1",
        "api_type": "openai",
    }
]

assistant = AssistantAgent("assistant", llm_config={"config_list": config_list})
user_proxy = UserProxyAgent("user_proxy", code_execution_config={"work_dir": "coding", "use_docker": False}) # IMPORTANT: set to True to run code in docker, recommended
user_proxy.initiate_chat(assistant, message="Say this is also a test - part 2.")
# This initiates an automated chat between the two agents to solve the task
```

Notice that we updated the `base_url` to AI Gateway and then added `default_headers` to enable the AI Gateway specific features.

When we execute this script, it would yield the same results as without the AI Gateway, but every request can now be inspected in the AI Gateway Analytics & Logs UI - including token, cost, accuracy calculations.

All the config parameters supported in the AI Gateway are available for use as part of the headers. Let's look at some examples:

## Using 3,000+ models in Autogen through the AI Gateway

Since the AI Gateway [seamlessly connects to 3,000+ models across providers](/docs/aigw/integrations/llms), you can easily connect any of these to now run with Autogen.

Let's see an example using **Mistral-7B on Anyscale** running with Autogen seamlessly:

```py theme={"system"}
from autogen import AssistantAgent, UserProxyAgent, config_list_from_json

config_list = [
    {
        "api_key": 'Your Anyscale API Key',
        "model": "@anyscale/mistralai/Mistral-7B-Instruct-v0.1",
        "base_url": "https://aigw.portkey.ai/v1",
        "api_type": "openai", # the AI Gateway conforms to the openai api_type
    }
]

assistant = AssistantAgent("assistant", llm_config={"config_list": config_list})
user_proxy = UserProxyAgent("user_proxy", code_execution_config={"work_dir": "coding", "use_docker": False}) # IMPORTANT: set to True to run code in docker, recommended
user_proxy.initiate_chat(assistant, message="Say this is also a test - part 2.")
# This initiates an automated chat between the two agents to solve the task
```

## Using Model Catalog

[Model Catalog](/docs/aigw/product/model-catalog) in the AI Gateway lets you manage provider credentials centrally. Add your Anyscale API key to Model Catalog and use the AI Provider slug in your config.

## Using Configs

[Configs](/docs/aigw/product/ai-gateway/configs) in the AI Gateway unlock advanced management and routing functionality including [load balancing](/docs/aigw/product/ai-gateway/load-balancing), [fallbacks](/docs/aigw/product/ai-gateway/fallbacks), [canary testing](/docs/aigw/product/ai-gateway/canary-testing), [switching models](/docs/aigw/product/ai-gateway/universal-api) and more.

You can use AI Gateway configs in Autogen like this:


## Related topics

- [Autogen](/docs/aigw/integrations/agents/autogen.md)
- [Logs Export](/docs/aigw/product/observability/logs-export.md)
- [Rate Limits](/docs/aigw/product/ai-gateway/virtual-keys/rate-limits.md)
- [Virtual Keys](/docs/aigw/product/ai-gateway/virtual-keys.md)
- [Budget Limits](/docs/aigw/product/ai-gateway/virtual-keys/budget-limits.md)
