Skip to content

Add Foundry A2A tool schema fixer and code-first agent creator#19

Draft
Codex wants to merge 3 commits into
mainfrom
codex/fix-duplicate-tool-name-error
Draft

Add Foundry A2A tool schema fixer and code-first agent creator#19
Codex wants to merge 3 commits into
mainfrom
codex/fix-duplicate-tool-name-error

Conversation

@Codex

@Codex Codex AI commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

Description

Portal-created Foundry agents were emitting duplicate A2A tool names (“remote protocol”), breaking multi-server clients; add helpers to inspect/rename schemas and create agents in code with pre-unique tool names.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • Test addition/improvement

Related Issues

Changes Made

  • Added tool-schema utilities to slugify/synchronize tool names/server_labels and summarize schemas; included A2A tool spec parsing for code-first agent definitions.
  • Introduced foundry_agent_tools.py CLI to show tool schemas, rename portal-created tools (with dry-run/version support), and create prompt agents with pre-named A2A tools.
  • Documented portal-fix and code-first workflows with runnable commands in foundry-integration.md; added unit tests covering the new schema utilities.

Testing

  • All existing tests pass
  • Added new tests for new functionality
  • Manually tested the changes
  • Updated documentation

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Screenshots (if applicable)

Additional Context

The new CLI workflows resolve the portal “duplicate tool argument name” issue by republishing agents with unique tool names or by creating agents entirely in code:

# Inspect current schema
python -m a2a_servers.foundry_agent_tools show-tools --agent-name <id> --endpoint "$AZURE_AI_PROJECT_ENDPOINT"

# Rename portal-created tools with unique names
python -m a2a_servers.foundry_agent_tools rename-tools --agent-name <id> --prefix <short> --endpoint "$AZURE_AI_PROJECT_ENDPOINT" --dry-run

# Create a code-first agent with pre-named A2A tools
python -m a2a_servers.foundry_agent_tools create-agent \
  --agent-name <name> \
  --model-deployment <deployment> \
  --instructions-path path/to/instructions.txt \
  --a2a-tool "name=quote,base_url=https://<host>/quote,connection_id=<conn>" \
  --endpoint "$AZURE_AI_PROJECT_ENDPOINT"
Original prompt

This will be all only inside of src/a2a_servers. You can however look at /projectOverview.md to see how it fits into the whole project.

Right now a2a_servers is able to set up multiple a2a servers at once with different paths. It does through configuration files in a directory called src/a2a_servers/agents. Currently the LLM agents are hosted on Microsoft foundry and setup via the new foundry portal

(note that it got completely revamped recently past your training data so keep note that we are using the new Microsoft foundry portal and it no longer called azure foundry)

The problem with this setup is that Microsoft doesn't fully support one a2a client connecting to multiple a2a servers if they are setup via the portal and referenced via an ID. The reason is that when setting up the llm agents via the portal and adding a2a server connections they all get added with the same tool name "remote protocol" and I get a "duplicate tool argument name, each tool must have a unique name" error

Note that this error is not documented publicly, but I was able to talk with someone from Microsoft who said their internal documents have a fix for it where you have to rename the schema via code. That is your task.

You will figure out how to either get a foundry agent via ID and modify its tool schema to remove the duplicate name error or just fully setup the agent via code from the get go. Make sure to have a way to see the tool schema.

You will most likely not be able to fully test it as you won't have the azure credentials for it. But let me know how I can test it. Because you likely wont be able to run and test yourself implement both methods of setting up agent fully via code and setting up on portal with referencing via ID then modifying via code mode. Then tell me how to run each one myself

You can still test to make sure your code is syntactically well and passes all the things marked in the precommit

Make sure to really check updated documentation to get it correct. Read through the azure ai projects SDK and new foundry

@Codex Codex AI changed the title [WIP] Fix duplicate tool argument name error in a2a servers setup Add Foundry A2A tool schema fixer and code-first agent creator Mar 23, 2026
@Codex Codex AI requested a review from judacas March 23, 2026 21:02
Base automatically changed from a2aSetup to main March 26, 2026 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants