Skip to content

AutoGen (Microsoft): using the VIDAI Control Plane as the backend

AutoGen's agents talk to a model through a client object. The OpenAIChatCompletionClient accepts a base_url — set it to the control plane and every conversation, tool call, and multi-agent handoff flows through it.

TL;DR

from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient

model = OpenAIChatCompletionClient(
    model="gpt-4o-mini",
    base_url="https://your-vidai-server.example.com/v1",
    api_key="your-vidai-key",
)

agent = AssistantAgent("assistant", model_client=model)
result = await agent.run(task="reply with: ok")
print(result.messages[-1].content)

Prerequisites

  • pip install "autogen-agentchat" "autogen-ext[openai]" (v0.4+).
  • Control plane base URL and an API key from the API Keys page.
  • A model registered on the Models page.

Configuring an assistant

from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient

model = OpenAIChatCompletionClient(
    model="gpt-4o-mini",
    base_url="https://your-vidai-server.example.com/v1",
    api_key="your-vidai-key",
)

writer = AssistantAgent(
    name="writer",
    model_client=model,
    system_message="You write concise product blurbs.",
)

Any agent that receives this model_client will route through the control plane.

Group chats and multi-agent teams

The client is shared across agents in a team, so a single control-plane API key attributes all of them:

from autogen_agentchat.teams import RoundRobinGroupChat

planner = AssistantAgent("planner", model_client=model)
critic  = AssistantAgent("critic",  model_client=model)

team = RoundRobinGroupChat([planner, critic], max_turns=6)
result = await team.run(task="Plan a launch checklist and critique it.")

Every turn — planner call, critic call, handoff — is a control-plane request. They show up on Request Logs with a shared attribution.

Different models per agent

Nothing stops each agent from having its own client. If you want the critic on a stronger model:

cheap  = OpenAIChatCompletionClient(model="gpt-4o-mini",       base_url=..., api_key=...)
richer = OpenAIChatCompletionClient(model="claude-sonnet-4.5", base_url=..., api_key=...)

planner = AssistantAgent("planner", model_client=cheap)
critic  = AssistantAgent("critic",  model_client=richer)

The routing rules on your Routing page apply to both; a cost-saver rule that maps claude-sonnet-4.5 → claude-haiku-4-5 will kick in transparently for the critic.

Tools

Tools attached to an AssistantAgent are called through the same model client. No extra config — the tool-call round trip is routed through the control plane:

def get_weather(city: str) -> str:
    return f"Sunny in {city}."

assistant = AssistantAgent(
    "weather_bot",
    model_client=model,
    tools=[get_weather],
)

Structured output

AutoGen's structured-output helpers use the underlying model's JSON mode. Works transparently as long as the model registered in the control plane supports it:

from pydantic import BaseModel

class Answer(BaseModel):
    city: str
    forecast: str

agent = AssistantAgent(
    "forecaster",
    model_client=model,
    output_content_type=Answer,
)

Verify it works

import asyncio
from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient

async def main():
    model = OpenAIChatCompletionClient(
        model="gpt-4o-mini",
        base_url="https://your-vidai-server.example.com/v1",
        api_key="your-vidai-key",
    )
    agent = AssistantAgent("probe", model_client=model)
    result = await agent.run(task="Reply with exactly: ok")
    print(result.messages[-1].content)

asyncio.run(main())

A row appears on Request Logs within a few seconds.

If something's off

Raise an issue at github.com/vidaiUK/vidai-quickstart/issues with your model-client config and the team script that reproduces the issue. We'll get it sorted.

Where to go next