Microsoft Agent Framework (gateway)

Route Microsoft Agent Framework model calls through the Respan gateway to use models and provider credentials configured in Respan. Only your RESPAN_API_KEY is needed in the application.

Setup

1

Install packages

$pip install agent-framework-openai
2

Set environment variables

$export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"
$export RESPAN_BASE_URL="https://api.respan.ai/api"
$export RESPAN_MODEL="gpt-5-mini"

No OPENAI_API_KEY is needed when the request is routed through the Respan gateway.

3

Point Agent Framework to the Respan gateway

1import asyncio
2import os
3
4from agent_framework import Agent, tool
5from agent_framework.openai import OpenAIChatCompletionClient
6
7@tool
8def lookup_weather(city: str) -> str:
9 return f"The weather in {city} is sunny."
10
11async def main() -> None:
12 client = OpenAIChatCompletionClient(
13 api_key=os.environ["RESPAN_API_KEY"],
14 base_url=os.getenv("RESPAN_BASE_URL", "https://api.respan.ai/api"),
15 model=os.getenv("RESPAN_MODEL", "gpt-5-mini"),
16 )
17
18 agent = Agent(
19 client=client,
20 name="weather_agent",
21 instructions="Use the weather tool when asked about weather.",
22 tools=[lookup_weather],
23 )
24 result = await agent.run("What is the weather in Seattle?")
25 print(result)
26
27asyncio.run(main())

Use OpenAIChatCompletionClient for the gateway path. Agent Framework clients that target the Responses API may use a different endpoint shape than this OpenAI-compatible chat-completions route.

Switch models

Change RESPAN_MODEL to another model available in your Respan account.

$export RESPAN_MODEL="gpt-5.5"
$export RESPAN_MODEL="gpt-5-mini"

See the full model list.