google / google/adk-docs

Context variable not found: `initial_topic`

Open
#1,062 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Shell
Stars
1.5k
Forks
1.3k
Avg merge
7d 1h
Merged PRs (30d)
34

Description

Hi All,

The loop_agent example which is available in below link is throwing error "'Context variable not found: `initial_topic`.'" on execution from adk web.

[https://google.github.io/adk-docs/agents/workflow-agents/loop-agents/](https://google.github.io/adk-docs/agents/workflow-agents/loop-agents/)

I am wondering if this is because we are trying to access **initial_topic** variable in sub_agent under root_agent. I tried something as shown below and it seems to work. I am wondering if there is a better way to fix the same.

```
state_initializer_agent = LlmAgent(
name="StateInitializer",
model=Gemini(
model=GEMINI_MODEL,
retry_options=retry_config
),
instruction="Output the user's request verbatim.",
description="Captures the initial user topic and saves it to the session state.",
output_key=STATE_INITIAL_TOPIC # <--- This is the key that was missing!
)

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.