Skip to content

ENH: Add "reason" to interrupt agent #2178

Description

@alex-schulster

Problem
I have a code agent that can have multiple reasons to stop mid-run (critical tool fail, user initiated stop, etc...). I would to be able to stop the agent and return a message based on what lead the agent to stop instead of a generic "Agent interrupted."

Proposed solution
Maybe the interrupt() method could be extended to accept an optional string that would be put inside the AgentError exception instead of the default "Agent interrupted."

Is this not possible with the current options.
Right now, we can stop an agent with the agent.interrupt() method. This method however does not take any argument, and it is therefore not possible to indicate the "reason" we are stopping the agent.


Checklist

  • I have searched the existing issues and have not found a similar feature request.
  • I have verified that this feature is not already implemented in the latest version.
  • I am willing to work on this feature and submit a pull request. (optional)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions