Skip to content

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

@soultaster

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions