> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Register Command • AI Agent SDK

> register_command: Register a shell command as a hook.

# register\_command

<div className="flex items-center gap-2">
  <Badge color="purple">Method</Badge>
</div>

> This is a method of the [**HookRegistry**](../classes/HookRegistry) class in the [**registry**](../modules/registry) module.

Register a shell command as a hook.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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) -> str
```

## Parameters

<ParamField query="event" type="HookEvent" required={true}>
  The event to hook
</ParamField>

<ParamField query="command" type="str" required={true}>
  The shell command to execute
</ParamField>

<ParamField query="matcher" type="Optional" required={false}>
  Optional regex pattern to match targets
</ParamField>

<ParamField query="name" type="Optional" required={false}>
  Optional name for the hook
</ParamField>

<ParamField query="description" type="Optional" required={false}>
  Optional description
</ParamField>

<ParamField query="sequential" type="bool" required={false} default="False">
  Whether to run sequentially
</ParamField>

<ParamField query="timeout" type="float" required={false} default="60.0">
  Timeout in seconds
</ParamField>

<ParamField query="env" type="Optional" required={false}>
  Additional environment variables
</ParamField>

<ParamField query="shell" type="bool" required={false} default="True">
  Whether to run in shell mode
</ParamField>

### Returns

<ResponseField name="Returns" type="str">
  The hook ID
</ResponseField>

## Uses

* `CommandHook`
* `register`

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/hooks/registry.py#L120">
  `praisonaiagents/hooks/registry.py` at line 120
</Card>
