-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
core[Component] This issue is related to the core interface and implementation[Component] This issue is related to the core interface and implementation
Description
** Please make sure you read the contribution guide and file the issues in the right place. **
Contribution guide.
Describe the bug
The agent graph was not displaying with LoopAgent
it was correctly displaying in ADK version 0.4.0, but throwing errors in 1.2.1
This is my Loop Agent, and one of my subagent
profile_agent = LlmAgent(
name="profile_agent",
model="gemini-2.0-flash",
description=(
"Agent to answer questions about the this person's social profile. User will ask person's profile using their name, make sure to fetch the id before getting other data."
),
instruction=(
"You are a helpful agent who can answer user questions about this person's social profile."
),
tools=[get_person_posts,get_person_friends,get_person_id_by_name,get_person_attended_events],
)
.....
root_agent = LoopAgent(
name="InteractivePipeline",
sub_agents=[
profile_agent,
summary_agent,
check_agent,
CheckCondition(name="Checker")
],
description="Find everyone's social profile on events, post and friends",
max_iterations=10,
after_agent_callback=modify_output_after_agent
)
Expected behavior
It was showing all the sub-agents and the tools with version 0.4.0
https://codelabs.developers.google.com/static/instavibe-adk-multi-agents/img/09-02-ui-graph_1920.png
Are there any breaking changes for defining the loop agent?
Desktop (please complete the following information):
- Python version(python -V): 3.12
- ADK version(pip show google-adk): 1.2.1
Additional context
Error Log
2025-06-05 03:44:42,998 - ERROR - __init__.py:157 - Failed to detach context
Traceback (most recent call last):
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/opentelemetry/trace/__init__.py", line 589, in use_span
yield span
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/opentelemetry/sdk/trace/__init__.py", line 1105, in start_as_current_span
yield span
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/opentelemetry/trace/__init__.py", line 454, in start_as_current_span
yield span
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/google/adk/agents/base_agent.py", line 148, in run_async
yield event
GeneratorExit
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/opentelemetry/context/__init__.py", line 155, in detach
_RUNTIME_CONTEXT.detach(token)
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/opentelemetry/context/contextvars_context.py", line 53, in detach
self._current_context.reset(token)
ValueError: <Token var=<ContextVar name='current_context' default={} at 0x78357cf7dee0> at 0x783554416c80> was created in a different Context
INFO: 127.0.0.1:47558 - "GET /apps/social/users/user/sessions/380227d3-6e5b-4502-8d72-bcc13907b0e3 HTTP/1.1" 200 OK
INFO: 127.0.0.1:47404 - "GET /debug/trace/session/380227d3-6e5b-4502-8d72-bcc13907b0e3 HTTP/1.1" 200 OK
build graph
INFO: 127.0.0.1:47404 - "GET /apps/social/users/user/sessions/380227d3-6e5b-4502-8d72-bcc13907b0e3/events/mGzfci53/graph HTTP/1.1" 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in __call__
await super().__call__(scope, receive, send)
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/starlette/applications.py", line 112, in __call__
await self.middleware_stack(scope, receive, send)
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/starlette/middleware/errors.py", line 187, in __call__
raise exc
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/starlette/middleware/errors.py", line 165, in __call__
await self.app(scope, receive, _send)
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/starlette/routing.py", line 714, in __call__
await self.middleware_stack(scope, receive, send)
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/starlette/routing.py", line 734, in app
await route.handle(scope, receive, send)
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/starlette/routing.py", line 288, in handle
await self.app(scope, receive, send)
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/starlette/routing.py", line 76, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/starlette/routing.py", line 73, in app
response = await f(request)
^^^^^^^^^^^^^^^^
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/fastapi/routing.py", line 301, in app
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/fastapi/routing.py", line 212, in run_endpoint_function
return await dependant.call(**values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/google/adk/cli/fast_api.py", line 827, in get_event_graph
dot_graph = await agent_graph.get_agent_graph(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/google/adk/cli/agent_graph.py", line 286, in get_agent_graph
await build_graph(graph, root_agent, highlights_pairs)
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/google/adk/cli/agent_graph.py", line 267, in build_graph
draw_node(agent)
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/google/adk/cli/agent_graph.py", line 232, in draw_node
build_cluster(cluster, agent, name)
File "/home/meerabaelish_560773/instavibe-bootstrap/env/lib/python3.12/site-packages/google/adk/cli/agent_graph.py", line 150, in build_cluster
draw_edge(parent_agent.name, agent.sub_agents[0].name)
^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'name'
Metadata
Metadata
Assignees
Labels
core[Component] This issue is related to the core interface and implementation[Component] This issue is related to the core interface and implementation