Register Command • AI Agent SDK
register_command: Register a shell command as a hook.
register_command
Method
</div>
This is a method of the HookRegistry class in the registry module.
Register a shell command as a hook.
Signature
def register_command(event: HookEvent, command: str, matcher: Optional[str], name: Optional[str], description: Optional[str], sequential: bool, timeout: float, env: Optional[Dict[str, str]], shell: bool, priority: int) -> strParameters
ParamField
HookEventThe event to hook
ParamField
strThe shell command to execute
ParamField
Optional[str]Optional regex pattern to match targets
ParamField
Optional[str]Optional name for the hook
ParamField
Optional[str]Optional description
ParamField
boolWhether to run sequentially
ParamField
floatTimeout in seconds
ParamField
OptionalAdditional environment variables
ParamField
boolWhether to run in shell mode
ParamField
intExecution order (lower runs earlier). Default 100
Returns
ResponseField
strThe hook ID
Uses
CommandHookregister
Source
View on GitHubpraisonaiagents/hooks/registry.py at line 134