Skip to content

Feature Request: tool.execute.before hook with cancel capability #26521

Closed as not planned

Description

@soultaster

Background

The current plugin API only provides tool.execute.after. This allows post-execution detection but not pre-execution blocking. As demonstrated by AgentSpec (ICSE 2026), AWS Strands, and CommBank Policy Engine, true guardrails require intervention before tool execution.

Request

Add plugin hook tool.execute.before:

  • Signature: (input: ToolInput) => Promise<{ cancel?: string } | void>
  • When cancel string is returned, abort tool execution and relay the message to the agent

Use Cases

  • Repeated failure prevention: block 4th execution after 3 failures of the same command pattern
  • Safety policies: block file operations outside allowed directories
  • Self-improvement: pre-emptively block commands known to fail based on learned patterns

Activity

  1. github-actions commented on May 9, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • Feature request titles must start with [FEATURE]: (e.g. [FEATURE]: tool.execute.before hook with cancel capability)
    • The feature request template requires checking the verification checkbox confirming the feature hasn't been suggested before

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.


    This issue might be a duplicate of existing issues. Please check:

    If you believe this was flagged incorrectly, please let a maintainer know.

  2. github-actions commented on May 9, 2026

    @github-actions
    Contributor

    This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

    Feel free to open a new issue that follows our issue templates.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions