Add a2a_trading_agents: runnable project replacing the A2A notebook - #77
Merged
Conversation
Turns the A2A multi-agent notebook into a real project. The notebook built its own file tree at runtime by writing triple-quoted strings to disk; those are now actual modules, so the code can be read, imported, and run without a notebook. Two agents on different frameworks (Pydantic AI Bear, Google ADK Bull) collaborate over A2A, each with MCP tools, all traced to Arize AX. The orchestrator reaches both through their agent cards, so the frameworks are interchangeable behind the protocol. Fixes found by running it: - a2a-sdk is pinned to >=0.3.4,<0.4. google-adk requires that range, and a2a-sdk 1.x removed a2a.server.apps, a2a.types.TextPart, a2a.types.TransportProtocol, and a2a.utils.new_agent_text_message. The notebook's unpinned install resolves to 1.x, where none of its imports work. - Agent(instrument=True) was removed in pydantic-ai 2.x, which crashed the Bear agent. The orchestrator absorbed the failure and reported that no risk signal was found rather than surfacing an error. Tracing now uses Agent.instrument_all(). - register() followed by add_span_processor() shuts down the default Arize exporter, so that pattern sends no spans at all. The OpenInference processor for Pydantic AI is passed through register(span_processors=[...]) instead. - The Bear executor built its agent outside its try block, so a build failure escaped as a server-level JSON-RPC error instead of a failed A2A task. - MCP servers launch with sys.executable and run as modules, rather than "python" with a path that depends on the working directory. No credentials in the code: Arize and model keys come from the environment, with a .env.example placeholder and .env gitignored. Verified end to end with MODEL_PROVIDER=openai: A2A discovery and calls, both agents' MCP tools, the orchestrator, and 486 spans across 13 traces in Arize AX. The Vertex model bindings and Agent Engine deployment follow the Vertex API but were not run, since they need a billed Google Cloud project. The README says so.
Removes the OpenAI provider switch entirely: config exposes Vertex model ids directly, and the openai pin is dropped from requirements since litellm already requires it transitively and ADK needs litellm to reach Llama regardless. The provider switch existed so the A2A and tracing layers could be exercised without a Google Cloud project. That verification stands, since those layers do not depend on which model answers, and the README now states plainly which parts were run and which were only reviewed against the installed SDKs.
Internal testing status is not useful to someone following the tutorial. The two remaining notes stay because a reader hits both: the a2a-sdk pin explains why to install from requirements.txt, and the shutdown warning is something they will see on screen.
jimbobbennett
approved these changes
Aug 5, 2026
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.
Replaces the A2A multi-agent notebook with a real project, so the companion docs guide can drop its Colab links. Paired with a docs PR in
Arize-ai/docs.The notebook built its own file tree at runtime by writing triple-quoted strings to disk (
mcp_tools/bear_tools.pyand friends). Those are now actual modules that can be read, imported, and run.What it is
Two agents on different frameworks collaborate over A2A, each with MCP tools, all traced to Arize AX. The orchestrator reaches both through their agent cards, so the frameworks are interchangeable behind the protocol.
Fixes found by running it
The notebook cannot run today.
google-adkrequiresa2a-sdk>=0.3.4,<0.4.0, buta2a-sdk1.x removeda2a.server.apps,a2a.types.TextPart,a2a.types.TransportProtocol, anda2a.utils.new_agent_text_message. The unpinned install resolves to 1.x and none of the imports work. Now pinned inrequirements.txt.Agent(instrument=True)was removed in pydantic-ai 2.x, which crashed the Bear agent. Worse, the orchestrator absorbed the failure and answered that no risk signal was found instead of erroring. Tracing now usesAgent.instrument_all().register()thenadd_span_processor()silently disables tracing. That call shuts down the default Arize exporter, and the OpenInference processor only translates spans, so the process exports nothing. The processor now goes throughregister(span_processors=[...]).The Bear executor built its agent outside its
try, so a build failure escaped as a server-level JSON-RPC error rather than a failed A2A task.MCP servers launch with
sys.executableand run as modules, instead of"python"plus a path that depends on the working directory.Credentials
None in the code. Arize and model keys come from the environment, with an empty
.env.exampleand.envgitignored.Note separately: the existing notebook has a live Arize API key hardcoded in cells 49 and 60, public since the Copybara import. This PR does not touch that notebook; the key needs rotating regardless, since it is in git history.
Verification
Verified end to end with
MODEL_PROVIDER=openai: A2A discovery and calls, both agents' MCP tools, the orchestrator, and 486 spans across 13 traces in Arize AX with all six MCP tools appearing asTOOLspans. Static checks clean on Python 3.12.🤖 Generated with Claude Code