Skip to content

[BUG]: Missing seminal_paper State Variable #813

@pang-anglicare

Description

@pang-anglicare

Name of sample affected

python/agents/academic-research/academic_research/agent.py (agent.py for short)
python/agents/academic-research/academic_research/sub_agents/academic_websearch/prompt.py (academic_websearch/prompt.py for short)
python/agents/academic-research/academic_research/sub_agents/academic_newresearch/prompt.py (academic_newresearch/prompt.py for short)

Description of issue

Context variable not found: 'seminal _paper' (See the screenshot at the bottom)

Despite output_key="seminal_paper" being specified in agent.py, the key session.state["seminal_paper"] is not created. This occurs because the academic_coordinator agent initiates a function call rather than producing a final textual response during the first step.

As a result, when the prompt in academic_websearch/prompt.py (as well as academic_newresearch/prompt.py) is rendered, the ADK throws an error because the seminal_paper context variable is missing.

Per the ADK documentation,

An Agent can be configured with an output_key="your_key". ADK will then automatically save the agent's final textual response for a turn into session.state["your_key"].

This means output_key does not capture intermediary steps or function calls.

Environment

  • OS & Architecture: macOS 15.6.1
  • Python version: 3.12.11
  • google-adk: 1.18.0

Reproduction steps or code

cd python/agents/academic-research
adk web

The prompt is
The paper in question is Attention Is All You Need as well as the attached paper.

Error log

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions