Python: Add Python A2A agent-as-function-tools sample#4889
Open
giles17 wants to merge 2 commits intomicrosoft:mainfrom
Open
Python: Add Python A2A agent-as-function-tools sample#4889giles17 wants to merge 2 commits intomicrosoft:mainfrom
giles17 wants to merge 2 commits intomicrosoft:mainfrom
Conversation
Port of the .NET A2AAgent_AsFunctionTools sample to Python. Resolves a remote A2A agent card, converts each skill to a FunctionTool via as_tool(), and registers them with a host agent using AzureOpenAIResponsesClient. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a Python sample demonstrating how to discover a remote A2A agent’s skills and expose each skill as a FunctionTool so a host AzureOpenAIResponsesClient agent can autonomously choose and invoke those skills.
Changes:
- Added
a2a_agent_as_function_tools.pysample that resolves an AgentCard, turns skills into tools, and runs a host agent. - Updated the A2A samples README with the new entry, required environment variables, and quick-start steps.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| python/samples/04-hosting/a2a/a2a_agent_as_function_tools.py | New runnable sample: resolve AgentCard, map skills → FunctionTools, run host agent against Azure OpenAI Responses. |
| python/samples/04-hosting/a2a/README.md | Documents the new sample and adds quick-start guidance and env vars. |
as_tool() only auto-sanitizes when name is omitted. Since we pass skill.name explicitly, we need to strip special characters ourselves. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Adds a new sample at
python/samples/04-hosting/a2a/a2a_agent_as_function_tools.pythat:FunctionToolviaA2AAgent.as_tool()AzureOpenAIResponsesClientAlso updates the
README.mdwith the new sample entry, environment variables, and quick-start instructions.