|
Parameter |
Type |
Description |
Example |
|---|---|---|---|
|
object |
The complete Hook definition. Each Hook is configured with one handler and one event, consistent with the Agent Hook v1 configuration. |
||
| schemaVersion |
string |
The configuration protocol version. |
v1 |
| name |
string |
The Hook name. Only digits, letters, underscores, and hyphens are allowed, and it cannot be empty. Hooks with the same name are executed independently in the order they appear in the list. |
command-guard |
| description |
string |
The description. |
Check whether the command in the tool invoke is safe. |
| enable |
boolean |
Specifies whether the Hook is enabled. It is executed only when set to true, and is disabled if not configured. |
true |
| debug |
boolean |
Specifies whether debug mode is enabled. |
false |
| invisible |
boolean |
Specifies whether to hide Hook call events. When set to true, Hook call events are not sent to the frontend, regardless of whether debug mode is enabled. |
false |
| scope |
string |
The effective scope. A value of all applies to both Chat and Mission scenarios. A value of chat or mission applies only to the corresponding scenario. |
all |
| execution |
object |
The execution configuration, which specifies the synchronous execution, total timeout, number of retries, and handling policy for invalid return values of the Hook. |
|
| type |
string |
The handler type. Only prompt, bash, python3, and hint are supported. |
prompt |
| instruction |
string |
The execution instruction. For the prompt type, it is a prompt. For the bash type, it is a Bash script. For the python3 type, it is a Python 3 script. For the hint type, it is text directly appended to the contextual text. Non-empty UTF-8 text must be provided for all four types. |
Check whether the current tool invoke is safe. |
| timeoutSeconds |
integer |
The timeout in seconds, ranging from 1 to 30 seconds. All attempts and waits for this Hook share this timeout. |
10 |
| maxRetry |
integer |
The maximum number of retries, which specifies the number of additional attempts after a failure. Valid values: 0 to 3. |
0 |
| failResult |
string |
The handling policy for invalid return values. If the handler return value remains invalid after retries, it is processed as allow or reject. |
allow |
| event |
string |
The event. Each Hook processes only one event. |
ToolStart |
| match |
array |
The tool name list. Only ToolStart and ToolEnd perform an exact match on the actual tool names. Tool names such as Read, Write, Bash, and Edit are supported, but wildcards are not supported. An empty array imposes no restrictions on tools, and this field is ignored for other events. |
["Read","Write","Bash","Edit"] |
|
string |
The supported tool. |
Bash,Write,Edit,Read |
Hook
Updated at:
Is this page helpful?