- AgentTool - The LLM can call these when needed based on user messages
- SlashCommand - Users invoke these directly with
/commandsyntax
Command Types
AgentTool
The LLM can call these when it determines they’re needed based on user messages.fetch_emails() → Returns result
SlashCommand
Users invoke these directly with/command syntax.
/fetch_emails → Executes immediately → Shows result
Use slash commands for operations that need explicit user control or have side effects (e.g., /deploy, /delete).
Best Practice: Expose Both
- Say “Check my email” → LLM calls it
- Type
/fetch_emails→ Direct execution
Command Arguments
Define typed arguments with automatic validation.string, integer, number, boolean, array, object
Argument Parameters Reference
| Parameter | Type | Description |
|---|---|---|
name | string | Argument name (required) |
type | string | Data type: string, integer, number, boolean, array, object |
description | string | Helps the LLM understand usage |
required | boolean | Whether argument must be provided (default: False) |
default | any | Default value when not provided |
enum | array | List of allowed values |
items | object | Schema for array items (use with type="array") |
properties | object | Schema for object properties (use with type="object") |
minLength / maxLength | integer | String length constraints |
minimum / maximum | number | Numeric value constraints |
minItems / maxItems | integer | Array length constraints |
Async Commands
Long-running commands can run in background threads and persist after closing the TUI.async_enabled=True for operations > 5 seconds (file processing, API calls, etc.).
For persisting data across command executions and agent restarts, see State Management.
max(1, min(8, cpu_count)) - scales with CPU cores, capped at 8.
Additional register_command Parameters
Beyond the basics,register_command accepts these parameters:
| Parameter | Type | Description |
|---|---|---|
slash_command | string | Custom slash command name (automatically adds SLASH_COMMAND to expose_as) |
slash_scope | SlashCommandScope | LOCAL allows the command to only be invoked when the agent is focused, GLOBAL is from anywhere in the TUI. Default: LOCAL |
argument_hint | string | Hint text shown in slash command picker |
argument_required | boolean | Whether slash command requires arguments. Default: False |
slash_command parameter automatically adds CommandExposure.SLASH_COMMAND to expose_as.
Best Practices
- Use verb-based names:
fetch_emailsnotemails - Write detailed descriptions: Help the LLM understand when to use the tool
- Return structured data: Use dicts with clear keys, not plain strings
- Handle errors gracefully: Catch exceptions and return helpful error messages
- Use async for slow ops: Mark operations > 5 seconds as
async_enabled=True