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

import asyncio
import os
from agent_framework import Agent, tool
from agent_framework.openai import OpenAIChatCompletionClient
@tool
def lookup_weather(city: str) -> str:
return f"The weather in {city} is sunny."
async def main() -> None:
client = OpenAIChatCompletionClient(
api_key=os.environ["RESPAN_API_KEY"],
base_url=os.getenv("RESPAN_BASE_URL", "https://api.respan.ai/api"),
model=os.getenv("RESPAN_MODEL", "gpt-5-mini"),
)
agent = Agent(
client=client,
name="weather_agent",
instructions="Use the weather tool when asked about weather.",
tools=[lookup_weather],
)
result = await agent.run("What is the weather in Seattle?")
print(result)
asyncio.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.