Context is precious. Execution is sacred. Trust is earned.Python 3.10–3.13

Framework guide

Microsoft Agent Framework

Agent-Gantry's native integration for Microsoft Agent Framework (AF 1.5+). Attach semantic tool routing as an AF ContextProvider so each agent.run(...) surfaces only the top-k relevant tools — without stuffing the full registry into every model call.

Advanced Agent Framework usage →

Install

uv add "agent-gantry[agent-frameworks]"

Basic page: GantryContextProvider (recommended)

The idiomatic path is GantryContextProvider (via AgentFrameworkAdapter). AF calls before_run on every invocation, retrieves semantically relevant tools from Gantry, and injects them into the session — no pre-baked tool list required.

  1. Register tools with @gantry.register and await gantry.sync().
  2. Attach GantryContextProvider to your AF Agent.
  3. Run the agent normally — tool selection happens per run (or per chat round in advanced mode).
Per-run dynamic tool selection
import asyncio

from agent_framework import Agent
from agent_framework.openai import OpenAIChatClient
from agent_gantry import AgentGantry, GantryContextProvider

gantry = AgentGantry()

@gantry.register
def get_weather(city: str) -> str:
    """Get the current weather for a city."""
    return f"Weather in {city}: Sunny, 22°C"

@gantry.register
def book_flight(origin: str, destination: str) -> str:
    """Book a flight between two cities."""
    return f"Booked flight: {origin} -> {destination}"

async def main():
    await gantry.sync()

    agent = Agent(
        OpenAIChatClient(),
        "You are a helpful concierge. Use tools to fulfil requests.",
        context_providers=[
            GantryContextProvider(gantry, top_k=3, score_threshold=0.0),
        ],
    )

    result = await agent.run("What's the weather in Tokyo?")
    print(result.text)

asyncio.run(main())

Coexist with AF SkillsProvider

GantryContextProvider and AF's SkillsProvider are sibling context providers with distinct source_id values. AF merges their tools and instructions — neither overwrites the other.

from agent_framework import Agent, Skill, SkillsProvider
from agent_gantry import GantryContextProvider

summarise_skill = Skill(
    name="summarise",
    description="Summarise the conversation so far.",
    content="When asked, produce a 3-bullet recap.",
)

agent = Agent(
    OpenAIChatClient(),
    "You are a customer-service assistant.",
    context_providers=[
        GantryContextProvider(
            gantry,
            top_k=3,
            skills=True,                      # pin Gantry skill-bound tools
            always_include=["lookup_user"],   # always surface this tool
        ),
        SkillsProvider(skills=[summarise_skill]),
    ],
)

Static tool bridge (fixed tool set at construction)

When the tool surface is known upfront, use GantryToolBridge to bake tools once at agent construction. Useful for orchestration builders that need a first-class Agent with a fixed schema.

from agent_gantry.integrations.agent_framework_bridge import GantryToolBridge

bridge = GantryToolBridge(gantry, score_threshold=0.1)
agent = await bridge.as_agent(
    OpenAIChatClient(),
    query="billing invoices payments",
    name="BillingAgent",
    instructions="Handle billing and invoice questions.",
    limit=3,
)

Basic testing checklist

Before wiring a live model: verify tool names and JSON schemas reach the agent, confirm destructive tools carry the right capabilities, and run a happy-path tool call through gantry.execute.

Next steps

See the advanced guide for per-call re-selection, workflow orchestration, approval middleware, observability, and AF 1.6 concurrent-workflow notes.