Skip to content

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

Closed

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

Activity

  1. added
    web[Component] This issue will be transferred to adk-web
    on Jan 8, 2026
  2. added theissue type on Jan 8, 2026
  3. changed the title [-]Impossible to resume agents throught fastapi endpoint with[/-] [+]Impossible to resume agents throught fastapi endpoint without "new_message"[/+] on Jan 9, 2026
  4. Akshat8510 commented on Jan 9, 2026

    @Akshat8510
    Contributor

    I'd like to help fix this FastAPI session resume issue. I've been working on the ADK adapters and would like to ensure the session state flow is working correctly for web deployments. Can I take this on?

  5. added
    core[Component] This issue is related to the core interface and implementation
    and removed
    web[Component] This issue will be transferred to adk-web
    on Jan 9, 2026
  6. self-assigned this
    on Jan 9, 2026
  7. Akshat8510 commented on Jan 10, 2026

    @Akshat8510
    Contributor

    Hi @wuliang229, I see you've self-assigned this and moved it to core. I was planning to look into the FastAPI side of this flow. If there are specific parts of the fix you'd like to delegate, or if you'd like me to help with testing the FastAPI integration once the core fix is ready, please let me know!
    Otherwise, I'll look for another open issue to help with. Thanks!

  8. klateefa commented on Jan 12, 2026

    @klateefa

    @Armadindon Thanks for reporting!
    Making new_message optional in the FastAPI request model fixes this issue. Currently, FastAPI requires new_message because it is defined as a mandatory field, so resume requests that only provide invocation_id fail validation before reaching the resume logic. Resume flows do not represent a new user input, so they should not require a message. Defining new_message as Optional[types.Content] = None allows FastAPI to accept resume requests and correctly pass them to the existing resume implementation, which already works as documented.
    Thank you.

  9. added
    answered[Status] This issue has been answered by the maintainer
    on Jan 12, 2026
  10. wuliang229 commented on Jan 12, 2026

    @wuliang229
    Collaborator

    @Akshat8510 Hi, feel free to raise any PRs that you think would fix this and any other issues that you find yourself interested in solving. Please do follow the ADK contribution guide. The ADK team will promptly review the PRs.

  11. Armadindon commented on Jan 13, 2026

    @Armadindon
    Author

    Thanks a lot ! 🙏 Didn't have time to do the change this weekend :)

  12. Akshat8510 commented on Jan 20, 2026

    @Akshat8510
    Contributor

    Hi @Armadindon , I’ve raised PR #4185 to resolve this. It makes new_message optional in the request model and updates the runner logic to handle resumption gracefully. Ready for review!

  13. veevortexiq commented on Jan 21, 2026

    @veevortexiq

    How Do you add resumability config to fast_api_app wrapped agent?

    Currently there's no flag / config Variable in
    [adk-python]/[src]/[google]/[adk]/[cli]/fast_api.py
    to add this :

    def get_fast_api_app(
        *,
        agents_dir: str,
        session_service_uri: Optional[str] = None,
        session_db_kwargs: Optional[Mapping[str, Any]] = None,
        artifact_service_uri: Optional[str] = None,
        memory_service_uri: Optional[str] = None,
        use_local_storage: bool = True,
        eval_storage_uri: Optional[str] = None,
        allow_origins: Optional[list[str]] = None,
        web: bool,
        a2a: bool = False,
        host: str = "127.0.0.1",
        port: int = 8000,
        url_prefix: Optional[str] = None,
        trace_to_cloud: bool = False,
        otel_to_cloud: bool = False,
        reload_agents: bool = False,
        lifespan: Optional[Lifespan[FastAPI]] = None,
        extra_plugins: Optional[list[str]] = None,
        logo_text: Optional[str] = None,
        logo_image_url: Optional[str] = None,
    ) -> FastAPI:
    
  14. Akshat8510 commented on Jan 21, 2026

    @Akshat8510
    Contributor

    That’s a great point, @veevortexiq. You're right that get_fast_api_app currently lacks a direct flag to pass resumability_config.

  15. Akshat8510 commented on Jan 21, 2026

    @Akshat8510
    Contributor

    My PR (#4185) specifically addresses the bug where the API schema itself was blocking resume requests (the 422 error), which was the first major hurdle

  16. Akshat8510 commented on Jan 21, 2026

    @Akshat8510
    Contributor

    Regarding your point: currently, resumability is typically defined within the Agent/App definition itself before it’s wrapped. However, adding a flag to get_fast_api_app to make this more accessible via the CLI/Web wrapper is a great candidate for a follow-up feature request. I’d be happy to look into that once this blocker is cleared!

  17. veevortexiq commented on Jan 21, 2026

    @veevortexiq

    Thank you @Akshat8510

  18. removed
    answered[Status] This issue has been answered by the maintainer
    on Feb 5, 2026
  19. added a commit that references this issue on Feb 13, 2026
    30b2ed3
  20. added a commit that references this issue on Feb 22, 2026
    e5be451
  21. added a commit that references this issue on Aug 11, 2026
    9240b67
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

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

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions