adk-python icon indicating copy to clipboard operation
adk-python copied to clipboard

'coroutine' object has no attribute 'sub_agents' after upgrade to 1.0.0

Open AeonMind opened this issue 1 year ago • 2 comments

I use Multi-agent, below is the code.

async def get_coordinator_agent():

    gis_data_search_agent, exit_stack = await create_gis_data_search_agent()
    gis_command_agent, command_exit_stack = await create_gis_command_agent()
    root_tool_agent = LlmAgent(
        model=LiteLlm(model=default_model_name),
        name=coordinator_agent_name,
        instruction=coordinator_agent_instruction,
        sub_agents=[
            gis_data_search_agent,
            gis_command_agent
        ]
    )
    return root_tool_agent, command_exit_stack

root_agent = get_coordinator_agent()

that code works with 0.5.0 version, after I upgrade to 1.0.0 , it's show me "Error in event_generator: 'coroutine' object has no attribute 'sub_agents' "

AeonMind avatar May 27 '25 03:05 AeonMind

Do you mean to post this for https://github.com/google/adk-python/issues? or you are seeing similar issues in Java version of ADK?

cornellgit avatar May 27 '25 16:05 cornellgit

@wanyedu This code snippet was a temp solution for MCP tools. We've revamp how to instantiate an agent with MCP tools.

Now, we don't need to handle exit_stack.

You could check out below samples for the latest agent.py structure:

  • https://github.com/google/adk-python/tree/main/contributing/samples/mcp_stdio_server_agent
  • https://github.com/google/adk-python/tree/main/contributing/samples/mcp_sse_agent

Jacksunwei avatar May 28 '25 06:05 Jacksunwei