Configure post-call delivery for a voice agent (preview)

Use post-call delivery in Foundry Agent Service to send a conversation snapshot to your workflows when a voice session ends. For example, archive the transcript through Azure Event Grid, or use a Foundry routine to invoke an agent that analyzes the call. Post-call delivery runs when the session terminates.

Configure destinations on the voice agent's definition. Each destination receives session metadata and the observed transcript, when available. Event Grid receives a CloudEvent; a routine receives a custom trigger output. Select a configuration method to see its prerequisites and steps.

Important

Items marked preview in this article are currently in preview. This preview is provided without a service-level agreement, and Microsoft doesn't recommend it for production workloads. Certain features might not be supported or might have constrained capabilities. For more information, see Supplemental Terms of Use for Microsoft Azure Previews.

Caution

Post-call delivery doesn't currently support Event Grid topics that are reachable only through a private endpoint. Allow publishing to the topic's public endpoint. For network requirements for routine destinations, see Routine prerequisites.

Prerequisites

  • A Foundry project with access to voice agents.

  • A real-time voice agent. Create one by following Create a voice-based prompt agent.

  • The Foundry User role on the project, or equivalent permissions to create agent versions and configure your chosen destination.

    Important

    The Foundry RBAC roles were recently renamed. Foundry User, Foundry Owner, Foundry Account Owner, and Foundry Project Manager were previously named Azure AI User, Azure AI Owner, Azure AI Account Owner, and Azure AI Project Manager. You might still see the previous names in some places while the rename rolls out. The role IDs and core permissions are unchanged by the rename.

  • An HTTP client for the destination setup requests.

  • For Event Grid: a Basic custom topic, an event subscription, a consumer, and permission to create a project connection. A role assignment administrator must grant the project managed identity EventGrid Data Sender on the topic.

  • For routines: routines available in your project, and a prompt agent or hosted agent to process the call. Check Routine prerequisites, including regional availability.

Use Python 3.10 or later and version 2.11.0 or later of the Azure AI Projects client library:

python -m pip install "azure-ai-projects>=2.11.0" azure-identity

Sign in with az login. Set these environment variables:

  • FOUNDRY_PROJECT_ENDPOINT: your Foundry project endpoint.
  • FOUNDRY_VOICE_AGENT_NAME: the name of the voice agent.
  • FOUNDRY_VOICE_AGENT_VERSION: the existing version to update.

Use Node.js 22 or later and version 2.11.0 or later of the Azure AI Projects client library:

npm install "@azure/ai-projects@>=2.11.0" @azure/identity

Sign in with az login. Set these environment variables:

  • FOUNDRY_PROJECT_ENDPOINT: your Foundry project endpoint.
  • FOUNDRY_VOICE_AGENT_NAME: the name of the voice agent.
  • FOUNDRY_VOICE_AGENT_VERSION: the existing version to update.

Use the .NET 8 SDK or later. Create a console project and install these packages:

dotnet new console --name ConfigurePostCall --framework net8.0
cd ConfigurePostCall
dotnet add package Azure.AI.Extensions.OpenAI --version 3.0.0
dotnet add package Azure.AI.Projects.Agents --version 3.0.0
dotnet add package Azure.Identity --version 1.21.0

Sign in with az login. Set these environment variables:

  • FOUNDRY_PROJECT_ENDPOINT: your Foundry project endpoint.
  • FOUNDRY_VOICE_AGENT_NAME: the name of the voice agent.
  • FOUNDRY_VOICE_AGENT_VERSION: the existing version to update.

Obtain a Microsoft Entra access token for https://ai.azure.com/ to configure the agent and routine. Use a separate token for https://management.azure.com/ to create the Event Grid project connection. For authentication setup, see Authenticate and authorize in Foundry.

Choose your destinations

Choose the destination that fits your processing workflow. You can combine both types in one configuration.

Destination Use it for Required resources
event_grid Archive conversation items or route events to existing applications. An Event Grid topic, a same-project connection, an event subscription, and a consumer.
routine Invoke a Foundry agent for analysis, follow-up, or deterministic processing. A same-project routine and its target agent.

Configure between one and 10 destinations in total. Use bare connection or routine names, not URLs or resource IDs. Duplicate references are rejected. The service sends events to destinations concurrently, so list order doesn't control execution order.

The transcript is included by default when include is omitted or set to []. Post-call audio isn't supported.

The transcript is an observed conversation-items snapshot, not an audio recording or proof that the caller heard every assistant response. It can include messages, speech transcripts, tool calls, and tool results. Protect this content in your destination, and apply your application's consent, access, and retention requirements.

Set up an Event Grid destination

Event Grid lets you route the post-call event to a webhook, Azure Functions, Logic Apps, or another supported event handler.

  1. Create an Event Grid custom topic. Set its input schema to CloudEvents v1.0 (CloudEventSchemaV1_0).

  2. Configure an event subscription for your consumer. Use the CloudEvents delivery schema. If you use a custom webhook, support the CloudEvents validation handshake so Event Grid can confirm that your endpoint accepts event delivery.

  3. Allow publishing to the topic's public endpoint. Post-call delivery doesn't support topics reachable only through a private endpoint.

  4. Grant the Foundry project's default managed identity EventGrid Data Sender on the topic. See Authenticate publishing clients with Microsoft Entra ID.

  5. Create a connection in the same Foundry project as the voice agent. Use category AzureEventGrid, authentication type ProjectManagedIdentity, and the topic's endpoint as target. The examples use post-call-events as the connection name. If you choose a different name, replace it in the request URL and the agent's connection_name field.

    Create the connection through Azure Resource Manager. Replace {projectResourceId} with the project's ARM resource ID, beginning with /subscriptions/. Use a token for https://management.azure.com/, not the Foundry data-plane token.

    PUT https://management.azure.com{projectResourceId}/connections/post-call-events?api-version=2025-10-01-preview
    Authorization: Bearer {arm-access-token}
    Content-Type: application/json
    

    The following JSON is the request body. Replace the topic endpoint with the endpoint returned for your topic.

    {
      "properties": {
        "category": "AzureEventGrid",
        "authType": "ProjectManagedIdentity",
        "target": "https://<topic-name>.<region>-1.eventgrid.azure.net/api/events",
        "metadata": {}
      }
    }
    

    For project connection permissions and management, see Add a connection to your project.

Use a connection name of 1 through 256 characters: a letter or digit followed by letters, digits, underscores, or hyphens. The managed identity connection uses the project's default identity; specifying a different clientId isn't supported.

Alternatively, use authType: ApiKey and store the topic key in credentials.key. The topic must allow local authentication. Don't put the topic key in the agent definition or consumer logs.

Saving the agent checks the connection reference, category, and authentication type. It doesn't publish a test event or verify topic permissions. Changes to the connection or its permissions affect subsequent deliveries, including deliveries from an existing agent version.

Set up a routine destination

A routine runs its target agent asynchronously with the post-call event as input. Use invoke_agent_responses_api for a prompt agent or a hosted agent that exposes Responses. Use invoke_agent_invocations_api for a hosted agent that exposes Invocations.

  1. Create the target agent and give it the instructions, tools, and permissions required for processing the call.

  2. Create an enabled routine in the same project as the voice agent. The examples use analysis as the routine name.

  3. Configure the routine's action to invoke the target agent. The following configuration fragment uses a prompt agent named postcall-insights. It shows only the action object, not a complete routine creation request.

    {
      "action": {
        "type": "invoke_agent_responses_api",
        "agent_name": "postcall-insights",
        "input": "Analyze the attached call. Report incomplete or unavailable transcripts."
      }
    }
    

    Reference: Create a routine.

Configure the voice agent

Add post_call to the agent definition after you set up the destinations. The following examples configure both post-call-events and analysis. Remove either destination if you don't use it.

Post-call delivery is in preview, so each example sends the VoiceAgents=V1Preview opt-in when it creates the new version.

The examples read an existing agent version and preserve its definition when creating the updated version.

Save the following code as configure_post_call.py, and run it with python configure_post_call.py. Setting allow_preview=True adds the Foundry-Features: VoiceAgents=V1Preview header to agent operations.

import os

from azure.ai.projects import AIProjectClient
from azure.ai.projects.models import (
    VoiceAgentDefinition,
    VoiceAgentEventGridPostCallDestination,
    VoiceAgentPostCallConfig,
    VoiceAgentRoutinePostCallDestination,
)
from azure.identity import DefaultAzureCredential

endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"]
agent_name = os.environ["FOUNDRY_VOICE_AGENT_NAME"]
agent_version = os.environ["FOUNDRY_VOICE_AGENT_VERSION"]

with (
    DefaultAzureCredential() as credential,
    AIProjectClient(
        endpoint=endpoint, credential=credential, allow_preview=True
    ) as project_client,
):
    existing = project_client.agents.get_version(
        agent_name=agent_name, agent_version=agent_version
    )
    definition = existing.definition
    if not isinstance(definition, VoiceAgentDefinition):
        raise ValueError("Select a voice agent version.")

    definition.post_call = VoiceAgentPostCallConfig(
        destinations=[
            VoiceAgentEventGridPostCallDestination(
                connection_name="post-call-events"
            ),
            VoiceAgentRoutinePostCallDestination(name="analysis"),
        ],
    )
    created = project_client.agents.create_version(
        agent_name=agent_name, definition=definition
    )
    print(f"Created voice agent '{agent_name}', version {created.version}")

Reference: Azure AI Projects client library for Python.

The example prints the new agent version.

Save the following code as configurePostCall.mjs, and run it with node configurePostCall.mjs. The foundryFeatures option adds the Foundry-Features: VoiceAgents=V1Preview header to the create-version request.

import { AIProjectClient } from "@azure/ai-projects";
import { DefaultAzureCredential } from "@azure/identity";

const endpoint = /** @type {string} */ (process.env.FOUNDRY_PROJECT_ENDPOINT);
const agentName = /** @type {string} */ (process.env.FOUNDRY_VOICE_AGENT_NAME);
const agentVersion = /** @type {string} */ (
  process.env.FOUNDRY_VOICE_AGENT_VERSION
);
if (!endpoint || !agentName || !agentVersion) {
  throw new Error(
    "Set FOUNDRY_PROJECT_ENDPOINT, FOUNDRY_VOICE_AGENT_NAME, and FOUNDRY_VOICE_AGENT_VERSION.",
  );
}

const project = new AIProjectClient(endpoint, new DefaultAzureCredential());

const existing = await project.agents.getVersion(agentName, agentVersion);
const definition = /** @type {import("@azure/ai-projects").VoiceAgentDefinition} */ (
  existing.definition
);
if (definition.kind !== "voice" || definition.sub_protocol !== "realtime") {
  throw new Error("Select a voice agent version.");
}

/** @type {import("@azure/ai-projects").VoiceAgentPostCallConfig} */
const postCall = {
  destinations: [
    { type: "event_grid", connection_name: "post-call-events" },
    { type: "routine", name: "analysis" },
  ],
};
definition.post_call = postCall;

const created = await project.agents.createVersion(agentName, definition, {
  foundryFeatures: "VoiceAgents=V1Preview",
});
console.log(`Created voice agent '${agentName}', version ${created.version}`);

Reference: Azure AI Projects client library for JavaScript.

The example prints the new agent version.

Replace Program.cs with the following code, and run it with dotnet run. The example reads the raw response as JSON to preserve existing function-tool parameter schemas.

#pragma warning disable AAIP001

using System;
using System.ClientModel;
using System.ClientModel.Primitives;
using Azure.AI.Projects.Agents;
using Azure.Identity;

string endpoint =
    Environment.GetEnvironmentVariable("FOUNDRY_PROJECT_ENDPOINT")
    ?? throw new InvalidOperationException("Set FOUNDRY_PROJECT_ENDPOINT.");
string agentName =
    Environment.GetEnvironmentVariable("FOUNDRY_VOICE_AGENT_NAME")
    ?? throw new InvalidOperationException("Set FOUNDRY_VOICE_AGENT_NAME.");
string agentVersion =
    Environment.GetEnvironmentVariable("FOUNDRY_VOICE_AGENT_VERSION")
    ?? throw new InvalidOperationException("Set FOUNDRY_VOICE_AGENT_VERSION.");

AgentAdministrationClient agentsClient = new(
    new Uri(endpoint), new DefaultAzureCredential());
ClientResult existingResult = await agentsClient.GetAgentVersionAsync(
    agentName, agentVersion, new RequestOptions());
ProjectsAgentVersion existing = ModelReaderWriter.Read<ProjectsAgentVersion>(
    existingResult.GetRawResponse().Content)
    ?? throw new InvalidOperationException("The agent response is empty.");

if (existing.Definition is not VoiceAgentDefinition definition)
{
    throw new InvalidOperationException("Select a voice agent version.");
}

definition.PostCall = new VoiceAgentPostCallConfiguration(
    new VoiceAgentPostCallDestination[]
    {
        new VoiceAgentEventGridPostCallDestination("post-call-events"),
        new VoiceAgentRoutinePostCallDestination("analysis"),
    });

BinaryData request = ModelReaderWriter.Write(
    new ProjectsAgentVersionCreationOptions(definition));
using BinaryContent content = BinaryContent.Create(request);
ClientResult result = await agentsClient.CreateAgentVersionAsync(
    agentName, content, foundryFeatures: "VoiceAgents=V1Preview");
ProjectsAgentVersion created = ModelReaderWriter.Read<ProjectsAgentVersion>(
    result.GetRawResponse().Content)
    ?? throw new InvalidOperationException("The agent response is empty.");

Console.WriteLine(
    $"Created voice agent '{agentName}', version {created.Version}");

Reference: VoiceAgentPostCallConfiguration, AgentAdministrationClient.

The example prints the new agent version.

Replace {projectEndpoint}, {agentName}, and {agentVersion} with your existing agent details. Use a Microsoft Entra access token for https://ai.azure.com/.

  1. Read the definition of the voice agent version you want to update:

    GET {projectEndpoint}/agents/{agentName}/versions/{agentVersion}?api-version=v1
    Authorization: Bearer {access-token}
    Foundry-Features: VoiceAgents=V1Preview
    
  2. Preserve its existing model, instructions, audio settings, tools, and other definition fields. Add the following post_call object to that definition:

    {
      "post_call": {
        "destinations": [
          {
            "type": "event_grid",
            "connection_name": "post-call-events"
          },
          {
            "type": "routine",
            "name": "analysis"
          }
        ],
        "include": []
      }
    }
    

    The preceding object is a definition fragment, not a complete create-version request.

  3. Save a new version by sending the complete updated definition in the definition field of a create-version request:

    POST {projectEndpoint}/agents/{agentName}/versions?api-version=v1
    Authorization: Bearer {access-token}
    Content-Type: application/json
    Foundry-Features: VoiceAgents=V1Preview
    

    Reference: Create an agent version.

The create-version request returns the new version resource.

Post-call delivery currently supports only the realtime protocol. The live protocol isn't supported.

Handle the delivered event

Read the metadata before processing the transcript. Both destination types carry the same logical session event, but their envelopes differ.

Event Grid envelope

Event Grid receives a CloudEvents 1.0 event of type com.microsoft.foundry.voiceagent.postcall.completed. The service publishes a one-element CloudEvents batch to the topic.

For example, a caller and the agent exchange these messages before the session ends:

Caller: Where is my order?
Agent: Please share your order number.

The following event shows what Event Grid receives for this conversation. The two messages appear in data.data. Identifiers and timestamps are illustrative.

{
  "specversion": "1.0",
  "type": "com.microsoft.foundry.voiceagent.postcall.completed",
  "source": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.CognitiveServices/accounts/account/projects/project",
  "subject": "agents/order-support/conversations/conv_abc",
  "id": "vconn_123",
  "time": "2026-11-09T03:10:42Z",
  "datacontenttype": "application/json",
  "dataversion": "2",
  "sessionstarted": "2026-11-09T03:08:01Z",
  "sessionoutcome": "completed",
  "deliveryid": "vpc_5f1c",
  "snapshotstatus": "complete_observed_snapshot",
  "snapshotreason": "none",
  "transcriptquality": "observed_not_verified_heard",
  "contentrequested": "transcript",
  "contentincluded": "transcript",
  "conversationid": "conv_abc",
  "agentversion": "3",
  "voicesessionid": "sess_xyz",
  "data": {
    "data": [
      {
        "id": "item_1",
        "type": "message",
        "role": "user",
        "status": "completed",
        "content": [
          {
            "type": "input_text",
            "text": "Where is my order?"
          }
        ]
      },
      {
        "id": "item_2",
        "type": "message",
        "role": "assistant",
        "status": "completed",
        "content": [
          {
            "type": "output_text",
            "text": "Please share your order number."
          }
        ]
      }
    ],
    "first_id": "item_1",
    "last_id": "item_2",
    "has_more": false
  }
}

source identifies the Foundry project by its ARM resource ID. id identifies the session event and is shared across destinations. deliveryid identifies a particular destination's delivery. Deduplicate Event Grid events by source and id.

data contains the conversation-items page only when contentincluded is transcript. The type name doesn't mean the session ended successfully; use sessionoutcome to identify how the session ended, such as normal completion, a client disconnect, or an error. conversationid, agentversion, and voicesessionid appear only when known.

Routine trigger output

A routine receives a custom trigger output, not a CloudEvent. For the same conversation, the messages appear in payload.data, as shown in the following example.

{
  "type": "custom",
  "triggeredAtUtc": "2026-11-09T03:10:42Z",
  "source": "voice_agent",
  "eventType": "on_call_ended",
  "payload": {
    "data": [
      {
        "id": "item_1",
        "type": "message",
        "role": "user",
        "status": "completed",
        "content": [
          {
            "type": "input_text",
            "text": "Where is my order?"
          }
        ]
      },
      {
        "id": "item_2",
        "type": "message",
        "role": "assistant",
        "status": "completed",
        "content": [
          {
            "type": "output_text",
            "text": "Please share your order number."
          }
        ]
      }
    ],
    "first_id": "item_1",
    "last_id": "item_2",
    "has_more": false
  },
  "metadata": {
    "event_source": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.CognitiveServices/accounts/account/projects/project",
    "agent_name": "order-support",
    "event_id": "vconn_123",
    "delivery_id": "vpc_8a2b",
    "data_version": "2",
    "session_started": "2026-11-09T03:08:01Z",
    "session_outcome": "completed",
    "snapshot_status": "complete_observed_snapshot",
    "snapshot_reason": "none",
    "transcript_quality": "observed_not_verified_heard",
    "content_requested": "transcript",
    "content_included": "transcript",
    "conversation_id": "conv_abc",
    "agent_version": "3",
    "voice_session_id": "sess_xyz"
  }
}

All metadata values are strings. The routine binds this output to its configured action input:

Configured action.input Input received by the target agent
Omitted Routine trigger output: followed by a newline and the trigger output JSON.
String The configured string, a blank line, and the same trigger output text.
JSON object The object with a routineTriggerOutput property containing the trigger output.

For a Responses action, the bound input becomes user-message text; an object is serialized to JSON text. For an Invocations action, it becomes the input value in the request body. Use event_id and delivery_id for idempotent routine processing.

Snapshot quality

Apply the same quality checks to both envelopes. Event Grid uses names such as snapshotstatus; routine metadata uses names such as snapshot_status.

Snapshot status Meaning
complete_observed_snapshot The snapshot contains all conversation items observed by the service.
partial The snapshot contains observed conversation items, but some content is missing or unfinished.
unavailable No conversation-items snapshot is available. The event contains metadata only.

The following fields provide more information about the snapshot and its content.

Event Grid field Routine metadata field Meaning
snapshotreason snapshot_reason Explains why the snapshot is incomplete or unavailable.
contentincluded content_included transcript means the transcript is attached. none means the event contains metadata only.

Verify post-call delivery

Use a voice session to verify your post-call delivery configuration.

  1. Start a voice session and have a short conversation.
  2. End the session.
  3. For Event Grid, confirm that your consumer receives the post-call event. For a routine, check its run history and the target agent's output.

Limitations

The following limitations apply to post-call delivery.

Limitation Details
Snapshot size A conversation-items page of 1 MiB or more produces an unavailable snapshot and a metadata-only event. An Event Grid batch exceeding 1 MiB isn't published.
Routine size The request body is limited to 64 KiB. The serialized payload and bound action input are each limited to 32,768 characters. Oversized transcripts fall back to metadata only, with content_omitted_reason: envelope_limit_exceeded; if that input still doesn't fit, dispatch fails.
Protocol Only the realtime protocol is supported. The live protocol isn't supported.
Event Grid networking Private-endpoint-only topics aren't supported. This limitation is separate from routine support for private-network projects.