Skip to content

feat(sample): A2A+MCP Sample - Replaced by https://github.com/google/A2A/compare/a2a_mcp_sdk_py #553

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

rajeshvelicheti
Copy link
Contributor

Description

Thank you for opening a Pull Request!
Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

Fixes #<issue_number_goes_here> 🦕

@rajeshvelicheti rajeshvelicheti requested a review from a team as a code owner May 15, 2025 15:33
@holtskinner holtskinner changed the title A2A+MCP Sample feat(sample): A2A+MCP Sample May 15, 2025
content: TaskList = Field(description="List of tasks when the plan is generated")


class LangraphPlannerAgent(BaseAgent):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Change the name of this class to be LangGraphPlannerAgent

Copy link
Collaborator

@holtskinner holtskinner left a comment

Choose a reason for hiding this comment

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

@rajeshvelicheti Can you convert this to use the A2A SDK?


async def invoke(self, query, session_id) -> dict:
logger.info(f"Running TaskExecutorAgent for session {session_id}")
raise NotImplementedError("Please use the streraming function")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
raise NotImplementedError("Please use the streraming function")
raise NotImplementedError("Please use the streaming function")

Comment on lines +83 to +98
def format_response(self, chunk):
patterns = [
r"```\n(.*?)\n```",
r"```json\s*(.*?)\s*```",
r"```tool_outputs\s*(.*?)\s*```",
]

for pattern in patterns:
match = re.search(pattern, chunk, re.DOTALL)
if match:
content = match.group(1)
try:
return json.loads(content)
except json.JSONDecodeError:
return content
return chunk
Copy link
Collaborator

Choose a reason for hiding this comment

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

This shouldn't be needed if you use Gemini Controlled Generation. Is that possible? https://ai.google.dev/gemini-api/docs/structured-output

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ADK does not like structured output with tools. I tried influencing gemini via config, but ADK does not like that too. So prompt and clean up of the tool use format is what I am left with.

init_api_key()
config_logger(logger=logger)

logger.info("Initializing LanggraphPlannerAgent")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
logger.info("Initializing LanggraphPlannerAgent")
logger.info("Initializing LangGraphPlannerAgent")

Change this name throughout

self.model,
checkpointer=memory,
prompt=prompts.TRAVEL_AGENT_INSTRUCTIONS,
# prompt=prompts.TRIP_PLANNER_INSTRUCTIONS_1,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove commented out code

@rajeshvelicheti rajeshvelicheti changed the title feat(sample): A2A+MCP Sample feat(sample): A2A+MCP Sample - Replaced by https://github.com/google/A2A/compare/a2a_mcp_sdk_py?expand=1 May 22, 2025
@rajeshvelicheti rajeshvelicheti changed the title feat(sample): A2A+MCP Sample - Replaced by https://github.com/google/A2A/compare/a2a_mcp_sdk_py?expand=1 feat(sample): A2A+MCP Sample - Replaced by https://github.com/google/A2A/compare/a2a_mcp_sdk_py May 22, 2025
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