Skip to content

Impossible to resume agents throught fastapi endpoint without "new_message" #4100

Description

@Armadindon

Describe the bug
Unable to resume agents without specifying "new_message"

To Reproduce

  1. Create a new session
> curl -X POST -H "Content-Type: application/json" http://localhost:8000/apps/my_app/users/user/sessions
{"id":"a0eccf39-5499-4990-8b09-14a336a3c14e","appName":"my_app","userId":"user","state":{},"events":[],"lastUpdateTime":1767879087.399263}
  1. Start an invocation
> curl -X POST -H "Content-Type: application/json" -H "Accept: text/event-stream" -H "Cache-Control: no-cache" http://localhost:8000/run_sse --data '{"app_name": "my_app", "user_id": "user", "session_id": "a0eccf39-5499-4990-8b09-14a336a3c14e", "new_message": {"role": "user", "parts": [{"text": "Hello !"}]}}'
...
data: {...,"invocationId":"e-8679c93c-6a64-4669-a35a-d05c018cd40a", ...}
  1. Cut the server during the invocation
  2. Restart the adk server
  3. Try to resume the invocation using
> curl -X POST -H "Content-Type: application/json" -H "Accept: text/event-stream" -H "Cache-Control: no-cache" http://localhost:8000/run_sse --data '{"app_name": "my_app", "user_id": "user", "session_id": "a0eccf39-5499-4990-8b09-14a336a3c14e", "invocation_id": "e-8679c93c-6a64-4669-a35a-d05c018cd40a"}'
{"detail":[{"type":"missing","loc":["body","newMessage"],"msg":"Field required","input":{"app_name":"my_app","user_id":"user","session_id":"a0eccf39-5499-4990-8b09-14a336a3c14e","invocation_id":"e-8679c93c-6a64-4669-a35a-d05c018cd40a"}}]}% 

Expected behavior
Should resume invocation with given id as stated in the documentation: https://google.github.io/adk-docs/runtime/resume/#resume-a-stopped-workflow.

Desktop (please complete the following information):

  • OS: Linux
  • Python version(python -V): 3.10.12
  • ADK version(pip show google-adk): 1.21.0

Additional context
I think we only need to make Optional "newMessage" in the pydantic model here:

new_message: types.Content

Metadata

Metadata

Assignees

Labels

core[Component] This issue is related to the core interface and implementation

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions