DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk4 min

How to Pick an API Contract for a Foundry Hosted Agent

Responses suits most conversational Foundry hosted agents; Invocations is better for custom JSON contracts and non-chat work. Here’s how to choose and when to expose both.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For most conversational Microsoft Foundry hosted agents, start with Responses: it uses an OpenAI-compatible request contract and provides platform-managed conversation history and streaming behavior. Choose Invocations when a caller needs a custom JSON contract, the work is not conversational, or your handler must control the payloads directly. A hosted agent can expose both protocols, so the choice does not have to lock out future integrations.

What the protocol choice controls

Responses and Invocations are endpoint contracts between Foundry and the hosted-agent container. They determine how callers send requests and receive results, and how conversation state and streaming are handled. They do not, by themselves, dictate which agent framework you use: Microsoft documents hosting integrations for its Agent Framework as well as adapters that can work with LangGraph and custom code. Microsoft’s hosted-agent overview and adapter guidance describe these choices.

As an Amazon Associate I earn from qualifying purchases.

How the two protocols differ

Decision point Responses Invocations
Best fit Conversational assistants, including multi-turn Q&A, RAG, and tool use Webhooks, structured extraction or classification, batch work, and custom protocol bridges
Request contract OpenAI-compatible Responses API shape Arbitrary JSON defined by the handler
Container endpoint POST /responses POST /invocations
Response format JSON or server-sent events (SSE) JSON or optional SSE, as implemented by the handler
Conversation history Managed through the Responses adapter/platform flow Not managed as conversation history by the platform; the application owns any needed state
Streaming Uses the managed Responses event lifecycle The handler controls any custom SSE format
Typical client An OpenAI-compatible SDK can call the endpoint A caller built to the agent’s custom contract

These distinctions are documented in Microsoft’s hosted-agent protocol comparison and runtime contract.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose based on the caller and workload

Choose Responses for conversational integrations

Responses is the natural starting point when a client already sends the Responses API request shape, or when the agent needs multi-turn conversations, tool use, and platform-managed history and streaming. Microsoft identifies it as the default starting point for most conversational hosted agents. It reduces the amount of conversation lifecycle plumbing the handler has to own.

#1 Best Overall
API Design Patterns
  • API Design Patterns
  • ABIS BOOK
  • Manning Publications

Choose Invocations for custom or non-chat requests

Invocations fits a webhook or existing service that sends its own JSON schema, especially when changing that caller to the Responses shape is impractical. It also suits structured or batch tasks such as extraction and classification. The handler defines the request and response behavior; if the operation needs continuity between calls, the application must manage that state itself.

Use both when callers have different needs

A hosted agent can support Responses and Invocations simultaneously. For example, a conversational client can use Responses while an internal webhook uses Invocations. Adding a second protocol lets the integration surface evolve without requiring a different agent core solely to serve another kind of caller. Microsoft’s hosted-agent guidance documents multi-protocol support.

How state and streaming differ in practice

Responses delegates history hydration and the streaming event lifecycle to its adapter/platform contract. This is useful when the application is a conversation and the caller expects a familiar Responses-style interaction.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Invocations does not turn a session identifier into platform-managed conversation history. In Microsoft Agent Framework’s example, the caller reuses the agent_session_id returned in a response header as a query parameter on a later request. That routes the request to the session; application logic remains responsible for any conversational state it needs. The handler can also implement SSE, but it controls the event format rather than relying on the managed Responses lifecycle. The Agent Framework hosting guide shows that session-routing example.

The same guide demonstrates continuing a Responses turn with previous_response_id. For hosted deployments where later turns also need the same hosted sandbox filesystem, it describes using an agent_session_id or a conversation ID. These are framework-specific examples; convenience APIs and session behavior should not be assumed identical across every adapter.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What the container must implement

A hosted-agent container must implement at least one protocol endpoint. Microsoft’s runtime contract specifies that it listens on port 8088, serves GET /readiness with 200 OK, consumes platform-provided environment variables, and shuts down gracefully on SIGTERM. The official protocol adapters handle contract plumbing such as HTTP setup, health checks, protocol parsing and formatting, Responses history hydration, SSE infrastructure, OpenTelemetry instrumentation, environment-variable consumption, and graceful shutdown. The agent author supplies the handler logic. See the hosted-agent runtime contract.

Microsoft’s runtime reference names these adapter packages:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Python: azure-ai-agentserver-responses and azure-ai-agentserver-invocations
  • .NET: Azure.AI.AgentServer.Responses and Azure.AI.AgentServer.Invocations

Package versions and compatibility can change. Check the current adapter documentation before selecting versions or relying on SDK examples.

A practical decision checklist

  1. Inspect the caller’s contract. If it already speaks the OpenAI-compatible Responses shape, use Responses. If it emits a fixed custom schema, consider Invocations.
  2. Classify the work. Multi-turn chat, tools, and history point to Responses; discrete extraction, classification, batch jobs, or webhook handling point to Invocations.
  3. Assign ownership deliberately. Use Responses when the managed history and event lifecycle are useful. Use Invocations when your handler should define payloads and any application-owned state or SSE formatting.
  4. Keep the integration adaptable. If different callers need different contracts, expose both protocols rather than forcing every caller through one shape.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.