Skip to content

Commit 5450cde

Browse files
committed
feat: enhance AI Agent tool usage display with configurable verbosity levels and length limits
1 parent cc0922d commit 5450cde

File tree

4 files changed

+344
-67
lines changed

4 files changed

+344
-67
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,10 @@ The functions include a built-in encryption mechanism for sensitive information:
117117
> [!TIP]
118118
> **N8N Workflow Automation Integration**
119119
>
120-
> Connect Open WebUI with N8N to leverage powerful workflow automation. Includes AI Agent tool usage display for complete transparency into your agent's actions.
120+
> Connect Open WebUI with N8N to leverage powerful workflow automation. Includes configurable AI Agent tool usage display for complete transparency into your agent's actions.
121121
122122
- Integrates **Open WebUI** with **N8N**, an automation and workflow platform.
123-
- **AI Agent Tool Usage Display (v2.2.0)** 🛠️: Shows tool calls from N8N AI Agent workflows with collapsible details (non-streaming mode only).
123+
- **AI Agent Tool Usage Display (v2.2.0)** 🛠️: Shows tool calls from N8N AI Agent workflows with three verbosity levels (minimal, compact, detailed) and customizable length limits (non-streaming mode only).
124124
- Streaming and non-streaming support for real-time and batch data processing.
125125
- Sends messages from Open WebUI to an **N8N webhook**.
126126
- Supports real-time message processing with dynamic field handling.

docs/n8n-integration.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,15 @@ This integration allows Open WebUI to communicate with workflows created in **n8
2222
## Features
2323

2424
> [!TIP]
25-
> **AI Agent Tool Usage Display (NEW in v2.2.0)** 🛠️
25+
> **AI Agent Tool Usage Display (v2.2.0)** 🛠️
2626
>
27-
> Automatically extracts and displays tool calls from N8N AI Agent workflows in **non-streaming mode**. Shows tool names, inputs, and results in collapsible `<details>` sections. Parses the `intermediateSteps` array to provide transparency into the AI agent's workflow execution.
27+
> Automatically extracts and displays tool calls from N8N AI Agent workflows in **non-streaming mode**.
28+
>
29+
> - 📊 **Three verbosity levels**: `minimal` (names only), `compact` (names + preview), `detailed` (full info)
30+
> - 📏 **Customizable length limits**: Control input/output text length
31+
> - 🎯 **Flexible configuration**: Adapt display to your needs
32+
>
33+
> Shows tool names, inputs, and results from the `intermediateSteps` array to provide transparency into the AI agent's workflow execution.
2834
>
2935
> 📖 [Learn more about Tool Usage Display](./n8n-tool-usage-display.md)
3036

docs/n8n-tool-usage-display.md

Lines changed: 108 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
Starting with version 2.2.0, the N8N pipeline automatically displays AI Agent tool calls in a user-friendly format. When your N8N workflow includes an AI Agent node that uses tools (like Wikipedia, Date/Time, Calculator, etc.), the pipeline will extract and display detailed information about each tool invocation.
66

7+
Version 2.2.0 includes **configurable verbosity levels** and **length limits** for tool display, allowing you to control how detailed the tool information is shown.
8+
79
## Important Limitation
810

911
> [!IMPORTANT]
@@ -17,30 +19,92 @@ Starting with version 2.2.0, the N8N pipeline automatically displays AI Agent to
1719

1820
- Works with **non-streaming** N8N responses
1921
- Automatically extracts `intermediateSteps` from the N8N response payload
20-
- No additional configuration required
22+
- Configurable verbosity levels (v2.2.0+)
23+
- Customizable length limits for inputs and outputs (v2.2.0+)
24+
25+
### Verbosity Levels (v2.2.0+)
26+
27+
> [!TIP]
28+
> **Configure via Pipeline Settings**: Set `TOOL_DISPLAY_VERBOSITY` to control the detail level.
29+
30+
#### 1. **Minimal** (`minimal`)
31+
32+
Shows only tool names in a collapsible list:
33+
34+
```txt
35+
🛠️ Tool Calls (4 steps) ▶
36+
1. Date_Time
37+
2. Crypto
38+
3. Wikipedia
39+
4. Calculator
40+
```
41+
42+
**Best for**: Quick overview, minimal UI clutter, collapsible for space-saving
43+
44+
#### 2. **Compact** (`compact`)
45+
46+
Shows tool names with short result previews:
47+
48+
```txt
49+
🛠️ Tool Calls (4 steps) ▶
50+
Step 1: Date_Time → [{"currentDate":"2025-10-10T11:22:38.697+01:00"}]
51+
Step 2: Crypto → [{"Property_Name":"uuid4","uuid4":"c28495ca-1eb8-419f-8941-7a38c753e809"}]
52+
Step 3: Wikipedia → Page: List of tz database time zones...
53+
Step 4: Calculator → 128675.5415958103
54+
```
55+
56+
**Best for**: Balance between overview and detail
57+
58+
#### 3. **Detailed** (`detailed`) - Default
59+
60+
Shows full collapsible sections with all information:
61+
62+
```txt
63+
🛠️ Tool Calls (4 steps) ▶
64+
├─ Step 1: Date_Time ▶
65+
│ 🔧 Tool: Date_Time
66+
│ 🆔 Call ID: call_i7JgGhwh7xV0ghqR9mD4qTJ9
67+
│ 📥 Input: {"Include_Current_Time": true, "Timezone": "Europe/London"}
68+
│ 📤 Result: [{"currentDate":"2025-10-10T11:22:38.697+01:00"}]
69+
│ 📝 Log: Invoking "Date_Time" with...
70+
├─ Step 2: Crypto ▶
71+
└─ ...
72+
```
73+
74+
**Best for**: Debugging, full transparency
2175

22-
### Rich Display Format
76+
### Length Limits (v2.2.0+)
77+
78+
> [!NOTE]
79+
> **Control Output Size**: Set `TOOL_INPUT_MAX_LENGTH` and `TOOL_OUTPUT_MAX_LENGTH` to limit text length.
80+
81+
- **`TOOL_INPUT_MAX_LENGTH`** (default: 500): Maximum characters for tool input display in `detailed` and `compact` modes
82+
- **`TOOL_OUTPUT_MAX_LENGTH`** (default: 500): Maximum characters for tool output/observation display
83+
- Set to **0** for unlimited length (no truncation)
84+
85+
> [!IMPORTANT]
86+
> **Behavior with `0` (unlimited)**:
87+
>
88+
> - **Detailed mode**: Shows complete input and output without any truncation
89+
> - **Compact mode**: For inputs, shows full data. For outputs, still uses a 100-character preview for UI readability
90+
91+
**Example**: For very long Wikipedia results, set `TOOL_OUTPUT_MAX_LENGTH` to 200 to show only the first 200 characters, or set to 0 to show everything.
92+
93+
### Rich Display Format (Detailed Mode)
2394

2495
Each tool call is displayed with:
2596

2697
- 🔧 **Tool Name**: The name of the tool that was invoked
2798
- 🆔 **Call ID**: Unique identifier for debugging (e.g., `call_FB0sIgrwuIGJkOaROor7raU2`)
28-
- 📥 **Input**: The parameters passed to the tool (formatted as JSON)
29-
- 📤 **Result**: The tool's response/observation
30-
- 📝 **Log**: Optional log messages from the tool execution
99+
- 📥 **Input**: The parameters passed to the tool (formatted as JSON, respects `TOOL_INPUT_MAX_LENGTH`)
100+
- 📤 **Result**: The tool's response/observation (respects `TOOL_OUTPUT_MAX_LENGTH`)
101+
- 📝 **Log**: Optional log messages from the tool execution (max 200 chars)
31102

32103
### Collapsible UI
33104

34105
Uses HTML `<details>` tags for a clean, expandable interface:
35106

36-
```txt
37-
🛠️ Tool Calls (3 steps) ▶
38-
├─ Step 1: Date_Time ▶
39-
├─ Step 2: Wikipedia ▶
40-
└─ Step 3: Wikipedia ▶
41-
```
42-
43-
Click to expand each step and view full details.
107+
Click to expand each step and view full details (in detailed mode).
44108

45109
## Example
46110

@@ -169,6 +233,36 @@ The display works with any N8N tool, including:
169233
- 💾 Database queries
170234
- And any custom tools you create!
171235

236+
## Configuration
237+
238+
### Pipeline Settings
239+
240+
Configure tool display in the N8N pipeline settings (Admin Panel → Functions → N8N Pipeline):
241+
242+
| Setting | Default | Description |
243+
|---------|---------|-------------|
244+
| `TOOL_DISPLAY_VERBOSITY` | `detailed` | Display mode: `minimal`, `compact`, or `detailed` |
245+
| `TOOL_INPUT_MAX_LENGTH` | `500` | Maximum characters for tool input. Set to `0` for unlimited (no truncation) |
246+
| `TOOL_OUTPUT_MAX_LENGTH` | `500` | Maximum characters for tool output. Set to `0` for unlimited in detailed mode (compact mode uses 100 char preview) |
247+
248+
### Recommendations
249+
250+
> [!TIP]
251+
> **For Production Use**:
252+
>
253+
> - Use `compact` mode for cleaner UI with essential info
254+
> - Set `TOOL_OUTPUT_MAX_LENGTH` to 200-300 for long outputs like Wikipedia
255+
>
256+
> **For Development/Debugging**:
257+
>
258+
> - Use `detailed` mode to see all information
259+
> - Set lengths to 0 (unlimited) to see complete data
260+
>
261+
> **For Minimal UI**:
262+
>
263+
> - Use `minimal` mode to just show tool names
264+
> - Perfect for when you only need to know which tools were called
265+
172266
## Troubleshooting
173267

174268
### Tool Calls Not Showing?
@@ -179,6 +273,7 @@ Check that:
179273
2. ✅ The response includes the `intermediateSteps` array
180274
3. ✅ The N8N pipeline version is 2.2.0 or higher
181275
4. ✅ The response structure matches the expected format (see examples above)
276+
5. ✅ You're using non-streaming mode (streaming doesn't support tool display)
182277

183278
### Debugging
184279

0 commit comments

Comments
 (0)