From 3a150c77cac3bf13ea3cfae3579c7f127fe92845 Mon Sep 17 00:00:00 2001 From: Twisha Bansal Date: Thu, 29 Jan 2026 13:00:07 +0530 Subject: [PATCH] Highlight tool level processing --- docs/en/samples/pre_post_processing/_index.md | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/docs/en/samples/pre_post_processing/_index.md b/docs/en/samples/pre_post_processing/_index.md index 64bfd547a7..7ad0c28082 100644 --- a/docs/en/samples/pre_post_processing/_index.md +++ b/docs/en/samples/pre_post_processing/_index.md @@ -28,25 +28,18 @@ Post-processing occurs after a tool has executed or the model has generated a re ## Processing Scopes -Processing logic can be applied at different levels of the application: +While processing logic can be applied at various levels (Agent, Model, Tool), this guide primarily focuses on **Tool Level** processing, which is most relevant for granular control over tool execution. -### Tool Level +### Tool Level (Primary Focus) Wraps individual tool executions. This is best for logic specific to a single tool or a set of tools. - **Scope**: Intercepts the raw inputs (arguments) to a tool and its outputs. - **Use Cases**: Argument validation, output formatting, specific privacy rules for sensitive tools. -### Model Level +### Comparison with Other Levels -Intercepts individual calls to the Large Language Model (LLM). +It is helpful to understand how tool-level processing differs from other scopes: -- **Scope**: Intercepts the list of messages (prompt) sent to the model and the generation (response) received. -- **Use Cases**: Global PII redaction (across all tools/chat), prompt engineering/injection, token usage tracking, and hallucination detection. - -### Agent Level - -Wraps the high-level agent execution loop (e.g., a "turn" in the conversation). - -- **Scope**: Intercepts the initial user input and the final agent response, enveloping one or more model calls and tool executions. -- **Use Cases**: User authentication, rate limiting, session management, and end-to-end audit logging. +- **Model Level**: Intercepts individual calls to the LLM (prompts and responses). Unlike tool-level, this applies globally to all text sent/received, making it better for global PII redaction or token tracking. +- **Agent Level**: Wraps the high-level execution loop (e.g., a "turn" in the conversation). Unlike tool-level, this envelopes the entire turn (user input to final response), making it suitable for session management or end-to-end auditing.