-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
base: main
Are you sure you want to change the base?
Conversation
content: TaskList = Field(description="List of tasks when the plan is generated") | ||
|
||
|
||
class LangraphPlannerAgent(BaseAgent): |
There was a problem hiding this comment.
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
There was a problem hiding this 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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raise NotImplementedError("Please use the streraming function") | |
raise NotImplementedError("Please use the streaming function") |
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove commented out code
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:
CONTRIBUTING
Guide.nox -s format
from the repository root to format)Fixes #<issue_number_goes_here> 🦕