Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Feature Request: Add an Endpoint to Explicitly Stop/Terminate a Conversation #1621

@limboinf

Description

@limboinf

Feature Request: Add an Endpoint to Explicitly Stop/Terminate a Conversation

Background

In many real-world applications that integrate LLMs or agent frameworks, managing the lifecycle of a conversation is essential. It's not just about "starting" or "continuing"—sometimes we need to gracefully end a session. For example, a user may want to abort a long-running inference, free up backend resources, or quickly reset state in the case of an error. Currently, ADK does not appear to provide an explicit API to terminate a conversation.

Why Is This Important?

  • Resource Management: Conversations left open for extended periods can consume memory, file handles, or external service connections, leading to potential resource leaks.
  • User Experience: Users expect to be able to "end" a conversation with a single action, rather than waiting for a timeout or closing the frontend window.
  • Error Handling: In cases of infinite loops or stuck streaming responses, both developers and users need a way to interrupt processing immediately.
  • Business Logic Alignment: Many business flows naturally require an "abort" function, such as escalating to a human agent or canceling a task.

What Would Be Ideal?

I suggest exposing a RESTful endpoint in ADK, such as:

POST /conversations/{conversation_id}/stop

Calling this endpoint would immediately terminate all backend processing for the specified conversation (including streaming outputs and async tasks) and release related resources. The API should return a confirmation that the conversation has been stopped.

Design Suggestions

  • The endpoint should be idempotent: repeated calls to stop the same conversation should not cause errors.
  • If the conversation is already ended, return an appropriate message.
  • If the conversation does not exist, return a 404.
  • Optionally, support proactively notifying the frontend (e.g., via SSE) that the conversation has been terminated.

Related Discussion

I have not found existing issues or discussions on this feature in the tracker. If I've missed something, please let me know.


If this feature is on the roadmap, it would be great to hear about the expected timeline or design considerations. If community contributions are welcome, please advise on the contribution process.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bot triaged[Bot] This issue is triaged by ADK botservices[Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions