Skip to content

Conversation

@cescoffier
Copy link
Collaborator

@cescoffier cescoffier commented Nov 27, 2025

Implement a guardrail system for tool invocations, providing input validation and output filtering capabilities.

Features:

  • Input guardrails (@ToolInputGuardrails) validate parameters before execution
  • Output guardrails (@ToolOutputGuardrails) filter/transform results after execution
  • Guardrails can allow, block, modify, or request retry with custom logic
  • Support for multiple chained guardrails with fail-fast behavior
  • CDI integration with full dependency injection support
  • JSON parameter access via argumentsAsJson() for easy validation
  • Access to tool metadata, invocation context, and memory ID

Limitations:

  • Guardrails cannot execute on Vert.x event loop due to synchronous API
  • Tools with guardrails must use blocking execution model
  • Clear error message guides users to mark tools as @Blocking

@cescoffier cescoffier requested a review from a team as a code owner November 27, 2025 10:02
@quarkus-bot

This comment has been minimized.

@quarkus-bot

This comment has been minimized.

Implement a guardrail system for tool invocations, providing input validation and output filtering capabilities.

Features:
- Input guardrails (@ToolInputGuardrails) validate parameters before execution
- Output guardrails (@ToolOutputGuardrails) filter/transform results after execution
- Guardrails can allow, block, modify, or request retry with custom logic
- Support for multiple chained guardrails with fail-fast behavior
- CDI integration with full dependency injection support
- JSON parameter access via argumentsAsJson() for easy validation
- Access to tool metadata, invocation context, and memory ID

Limitations:
- Guardrails cannot execute on Vert.x event loop due to synchronous API
- Tools with guardrails must use blocking execution model
- Clear error message guides users to mark tools as @Blocking

Fix quarkiverse#990
@cescoffier cescoffier force-pushed the function-calling-guardrails-uncommitted branch from 7b7d262 to 20f04a8 Compare November 27, 2025 14:49
@quarkus-bot
Copy link

quarkus-bot bot commented Nov 27, 2025

Status for workflow Build (on pull request)

This is the status report for running Build (on pull request) on commit 20f04a8.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

@cescoffier cescoffier merged commit 523d635 into quarkiverse:main Nov 27, 2025
81 checks passed
@cescoffier cescoffier added the enhancement New feature or request label Nov 27, 2025
@edeandrea
Copy link
Collaborator

Why not implement this upstream first so that it could be inherited by Quarkus?

@cescoffier cescoffier deleted the function-calling-guardrails-uncommitted branch November 28, 2025 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Development

Successfully merging this pull request may close these issues.

Add GuardRails for Tool input and output

3 participants