Conversation
AG2 v1.0.0 is a full API rewrite, so the sample no longer ran at all. - switch from the `autogen` package to `ag2` - `ConversableAgent`/`LLMConfig` -> `Agent`/`OpenAIResponsesConfig` - `register_for_llm` -> the `@tool` decorator passed via `tools=` - `A2aAgentServer(...).build()` -> `A2AServer(...).build_jsonrpc(url=, card=)` - `A2aRemoteAgent` -> `Agent(config=A2AConfig(card_url=))` - replace `a_initiate_chat` + `is_termination_msg`, both gone in v1, with `as_tool()` delegation; the termination condition moves into the prompt - add `a2a-sdk[http-server,grpc]`: `ag2.a2a.server` imports the grpc transport unconditionally, so JSON-RPC-only usage still needs grpcio - bump google-genai in samples/python/uv.lock: `import ag2` crashed on 1.31.0 because ag2 guards its optional gemini import with `except ImportError` only - fix the mypy tool never flushing its tempfile, so it checked an empty file - update the model to gpt-5.6-luna and refresh the README
…ivity Update AG2 Python samples by changing the host binding from 0.0.0.0 to 127.0.0.1 to improve local security and adding docstrings to main functions for better documentation.
This branch has not been deployed
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.
Description
AG2 v1.0.0 is a full API rewrite — the package moved from
autogentoag2and none of the APIs this sample used still exist, so it did not run at all.
This migrates it.
API changes
autogen, 0.10)ag2, 1.0)ConversableAgent/LLMConfigAgent/OpenAIResponsesConfigsystem_message=prompt=@agent.register_for_llm(...)@tool(...)passed viatools=A2aAgentServer(agent).build()A2AServer(agent).build_jsonrpc(url=, card=)A2aRemoteAgent(url=)Agent(config=A2AConfig(card_url=))a_initiate_chat+is_termination_msgas_tool()+ask()initiate_chatand termination predicates are gone in v1. The idiomaticreplacement: the remote reviewer is a plain
Agentconfigured withA2AConfig, andas_tool()turns it into a tool of the local codegen agent,so the delegation still crosses A2A. The "stop when the reviewer reports no
issues" condition moves from
is_termination_msginto the prompt.Other changes
a2a-sdk[http-server,grpc].ag2.a2a.serverimports its grpc transport unconditionally, so JSON-RPC-only usage still
needs
grpcio— without it the server fails to import.google-genai1.31.0 -> 1.75.0 insamples/python/uv.lock.import ag2crashed withAttributeError: module 'google.genai.types' has no attribute 'ImageConfig'because ag2 guards its optional gemini import with
except ImportErroronly. See the caveat below.
flush()on its tempfile, so mypychecked an empty file and always reported success.
gpt-5.6-lunaand refreshed the README.Verification
Ran the reviewer server and both clients end to end against a stub
OpenAI-compatible endpoint: codegen agent ->
review_codetool -> A2AJSON-RPC -> reviewer agent -> real mypy -> back to the client. The agent card
is served at
/.well-known/agent-card.json.ruff checkreports the samefindings as before this PR, no new ones.
Not verified:
/chat/completions,while
OpenAIResponsesConfigtargets the Responses API, so that leg needsa run with a real key.
google-genaibump. The new version satisfiesevery other member's constraint (
>=1.9,>=1.27), but I only confirmedthe ag2 sample works — the lock is shared across the whole workspace, so
this is worth a look during review.
Relates to #462 (moves this sample onto
a2a-sdk1.x).Does not address #454 — the sample still defaults to OpenAI.
CONTRIBUTINGGuide.