Files
Giles Odigwe 5affc9c333 Python: Reorganize A2A samples and use package A2AExecutor (#6165)
* Reorganize A2A samples: client demos in 02-agents, use package A2AExecutor

- Move client samples (agent_with_a2a, a2a_agent_as_function_tools) to samples/02-agents/a2a/
- Add new concept samples: polling, stream reconnection, protocol selection
- Replace sample agent_executor.py with package-level A2AExecutor (stream=True)
- Update 04-hosting/a2a to focus on server-side, point to 02-agents for clients
- Add README.md for the new 02-agents/a2a/ sample collection

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix streaming artifact coalescing and address PR review feedback

A2AExecutor fix:
- Generate a stable artifact_id per stream in _run_stream so all streaming
  chunks share the same ID, enabling proper append=True coalescing per the
  A2A spec (TaskArtifactUpdateEvent with same artifactId).
- Previously, item.message_id was None for OpenAI/Foundry streaming updates,
  causing the SDK to generate a new random UUID per token (100+ separate
  artifacts instead of 1 appended artifact).

Sample improvements:
- Replace join workaround with response.text now that coalescing works
- Add background=True to stream reconnection resume call (required for
  continuation token emission on in-progress tasks)
- Fix type ignore specificity in polling sample

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
5affc9c333 ยท 2026-06-01 07:09:11 +00:00
History
..

Hosting Samples

This directory contains Python samples that demonstrate different ways to host Agent Framework agents. Use this page to choose the hosting model that best fits your scenario, then continue to the README in the relevant subdirectory.

Hosting Options

Option Use this when you need... Start here
A2A Agent-to-Agent protocol interoperability or remote agent invocation. a2a/README.md
Azure Functions HTTP or serverless hosting on Azure Functions. azure_functions/README.md
Durable Task Durable execution, long-running flows, or orchestration patterns. durabletask/README.md
Foundry Hosted Agents Azure AI Foundry hosted agent deployment. foundry-hosted-agents/README.md

How to Choose

  • Start with A2A if you want one agent to call or expose another agent over the A2A protocol.
  • Start with Azure Functions if you want an HTTP-hosted or serverless entry point using Azure Functions.
  • Start with Durable Task if you need persistent state, durable workflows, or orchestration across multiple steps.
  • Start with Foundry Hosted Agents if you want to package and deploy an agent as a hosted agent in Azure AI Foundry.

Common Prerequisites

Most hosting samples share a small set of prerequisites:

  • A supported Python environment for running the samples locally.
  • An Azure AI Foundry project endpoint and model deployment name for FOUNDRY_PROJECT_ENDPOINT and FOUNDRY_MODEL.
  • Azure CLI authentication via az login when the sample uses AzureCliCredential.
  • Any hosting-specific tools or extra services called out in the subdirectory README.

Next Steps

  1. Pick the hosting approach that matches your scenario.
  2. Open the corresponding README for setup and run instructions.
  3. Follow that sample's environment, dependency, and execution steps.