Skip to content

a2a - #17

Merged
jmoreno45 merged 10 commits into
developfrom
feature/a2a
Aug 7, 2026
Merged

a2a#17
jmoreno45 merged 10 commits into
developfrom
feature/a2a

Conversation

@jmoreno45

@jmoreno45 jmoreno45 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Adds A2A capability with some example agents.

python examples/a2a_table_mcp_server.py --port 9101 &
python examples/a2a_average_mcp_server.py --port 9102 &
python examples/a2a_langchain_agent.py --port 9111 --config configs/example_a2a_agents.json --mcp-url http://localhost:9101/mcp &
python examples/a2a_google_adk_agent.py --port 9112 --config configs/example_a2a_agents.json --mcp-url http://localhost:9102/mcp &
mada-cli configs/example_a2a_agents.json
mada-gradio /g/g20/moreno45/Projects/GITHUB-MADA/mada/configs/example_a2a_agents.json

Can also be exposed as an A2A agent

Run MADA in A2A mode on the same port advertised in the card:

mada-a2a --port 9120 /g/g20/moreno45/Projects/GITHUB-MADA/mada/configs/example_a2a_agents.json

Other A2A agents can discover it at:

http://localhost:9120/.well-known/agent-card.json

If another machine/agent needs to reach it, use --public-url with the externally reachable URL:

mada-a2a --port 9120 --public-url http://hostname:9120/ /g/g20/moreno45/Projects/GITHUB-MADA/mada/configs/example_a2a_agents.json

CLI

Initializing agents and MCP servers...
Status: Connection Successful: Orchestrator initialized with 0 MCP Servers and 2 remote A2A agents and 3 agents
Orchestration mode: agent-as-tool
Model: gpt-5.4 from livai

Available tools:
   • A2A: LangChainAgent - Table reader specialist that can load and display a small built-in CSV table by calling its MCP table-reader tool.
   • A2A: GoogleADKAgent - Column average specialist that can compute averages for numeric columns in a small built-in CSV table by calling its MCP average tool.

Chat with the agents (type 'quit' to exit)
--------------------------------------------------
 
You: load table

Agents:
--------------------
[task-1] Started in background.


[task-1] Completed:

[Calling: call_langchainagent]
Loaded table:

| experiment | temperature_c | pressure_kpa |
|---|---:|---:|
| alpha | 21.2 | 101.3 |
| beta | 24.8 | 99.8 |
| gamma | 19.6 | 103.1 |
| delta | 22.4 | 100.6 |

 
You: average table

Agents:
--------------------
[task-2] Started in background.


[task-2] Completed:

[Calling: call_googleadkagent]
Column averages:

- temperature_c: 22.00
- pressure_kpa: 101.20

 
You:

Gradio

image image

@jmoreno45
jmoreno45 requested a review from bgunnar5 July 30, 2026 22:15
@bgunnar5

Copy link
Copy Markdown
Member

If another machine/agent needs to reach it, use --public-url with the externally reachable URL:

mada-a2a --port 9120 --public-url http://hostname:9120/ /g/g20/moreno45/Projects/GITHUB-MADA/mada/configs/example_a2a_agents.json

Haven't looked at any of the code here yet but this sounds like it would be a perfect use-case for Wormhole.

@bgunnar5 bgunnar5 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, this will definitely help to expand MADA outreach and usability in the future. In addition to the comments I left, here are some additional requests:

  • Add documentation on the mada-a2a command.
  • Can we group a2a examples in a subfolder under examples/?
  • If we don't implement the A2AAgent from Microsoft Agent Framework, then we should add tests for the new a2a_client.py file.

@Mamorri there may be some modifications you need to add to your magentic implementation to support A2A.

Don't need you to do this but I'm putting this here to remind myself to create a bunch of tutorials for MADA. We should definitely use the example scripts you put together for a full A2A tutorial. It would also be a good idea to have a tutorial for starting URSA and connecting it via A2A with MADA. This could lead to a concrete agent card for MADA x URSA collaboration that we could keep in our repo as well.

Comment thread configs/agent_cards/mada_orchestrator_card.json Outdated
Comment thread configs/agent_cards/mada_orchestrator_card.json
Comment thread configs/example_a2a_agents.json Outdated
Comment thread docs/user_guide/configuration.md Outdated
Comment thread src/mada/core/a2a_client.py
Comment thread examples/a2a_google_adk_agent.py Outdated
Comment thread examples/a2a/a2a_example_utils.py
Comment thread src/mada/core/config/app.py Outdated
Comment on lines +4 to +15
"""
Agent-to-Agent HTTP interface for MADA Orchestrator.

This module exposes the configured MADA planning agent as an A2A-compatible
JSON-RPC service. The MADA agent card is available under the standard
`/.well-known/agent-card.json` path.

This is the server-side A2A entry point: use it when another A2A client or
agent needs to discover MADA and send work to MADA. The client-side support
for MADA calling other A2A agents lives in `mada.core.a2a_client` and is wired
through the `a2a_agents` configuration block.
"""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this is only starting the planning agent as an A2A-compatible service? Would it make more sense to do something like mada-a2a config.json and then every agent defined in the config file is started as an A2A-compatible service?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should start the orchestrator which then has access to all the other agents listed in the config, including mcp tools. So its a central entry point for mada. Up to you, what do you prefer?

            await orchestrator.initialize_orchestrator(
                self.config.agents,
                self.config.mcp_servers,
                getattr(self.config, "a2a_agents", {}),
            )

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably fine for now. Just not sure how this will behave with @Mamorri's orchestration updates, specifically for sequential which likely won't need a planning agent.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went ahead and merged these changes into my branch, not too many conflicts directly. Functionality wise, there may be some overlap. It looks like for magentic there was a small breakage just in how the new arguments were set up, but it should be a fairly small adjustment. However, once restored A2A should complement the dynamic orchestration functionality.

For sequential, if remote A2A agents are only implemented as planner tools, sequential would need its own way to include them as steps. My best thought here would be a “participant/callable agent” interface that local specialists and remote A2A agents both implement. Then agent-as-tool, magentic, and sequential could each decide how to use the same pool.

For now I think it should be fine.

Comment thread src/mada/interfaces/a2a/main.py Outdated
@jmoreno45

Copy link
Copy Markdown
Contributor Author

Nice work, this will definitely help to expand MADA outreach and usability in the future. In addition to the comments I left, here are some additional requests:

* [ ]  Add documentation on the `mada-a2a` command.

* [ ]  Can we group a2a examples in a subfolder under `examples/`?

* [ ]  If we don't implement the `A2AAgent` from Microsoft Agent Framework, then we should add tests for the new a2a_client.py file.

@Mamorri there may be some modifications you need to add to your magentic implementation to support A2A.

Don't need you to do this but I'm putting this here to remind myself to create a bunch of tutorials for MADA. We should definitely use the example scripts you put together for a full A2A tutorial. It would also be a good idea to have a tutorial for starting URSA and connecting it via A2A with MADA. This could lead to a concrete agent card for MADA x URSA collaboration that we could keep in our repo as well.

@bgunnar5

bgunnar5 commented Aug 5, 2026

Copy link
Copy Markdown
Member

@jmoreno45 I think I missed that on the first review, that's fine.

@bgunnar5
bgunnar5 marked this pull request as ready for review August 5, 2026 14:44

@bgunnar5 bgunnar5 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LG2M but I'd like to hear Michael's thoughts on some of my comments that I tagged him in.

card = self._a2a_agent_cards.get(agent_name, {})
description = self._remote_a2a_description(
card["description"],
card,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After merging my changes it looks like this presented a potential issue:
remote A2A cards are indexed withcard["description"]. If a remote card omits description or serializes differently, orchestrator initialization fails with KeyError. I think agent_as_tool_strategy.py and other orchestration strategies would require a method to parse the remote description:

description = orchestrator._remote_a2a_base_description(agent_name, card)
labels.append(f"A2A: {agent_name} - {description}")

I can go ahead and add this to my commits, if it makes more sense than fixing in this merge

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please add it to your commits.

@jmoreno45
jmoreno45 merged commit 64943f0 into develop Aug 7, 2026
53 of 54 checks passed
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.

3 participants