Agent Commands
Commands are specific actions your agent can perform. They extend your agent's capabilities beyond conversation, allowing it to interact with external services, process data, and execute tasks.
What are Commands?
Commands are custom functions that users can trigger when interacting with your agent. Each command has:
- A trigger phrase: The word or phrase that activates it, like /weather or /summarize
- Parameters: Input values the command needs to work (e.g., location, URL, prompt)
- An action: What the command actually does
- A response: What the agent returns after executing
For example: "/weather" or "/summarize" with URLs and parameters
Types of Commands
Simple Text Commands
Return predefined text responses:
- Quick replies
- FAQs
- Static information
- Help messages
Perfect for information that doesn't change and doesn't need AI processing.
Prompt-based Commands
Prompt templates that let you create complex, reusable prompts with parameters. Instead of users repeating the same complex prompt every time, they can trigger a simple command, and your pre-configured prompt template handles the rest. Parameters are inserted into template strings within your prompt.
Example use cases:
- /trending {topic} - Get trending topics in a specific area with consistent analysis format
- /marketanalysis {token} - Deep dive analysis of a token using your custom template
- /enhanceprompt {input} - Improve and expand user prompts automatically
Webhook Commands
Connect to external APIs and services:
- Call your own backend services
- Integrate third-party APIs
- Trigger custom workflows
- Fetch real-time data
Webhooks let your agent interact with the outside world and execute actions beyond conversation.
Creating a Command
- Go to your agent's Commands section
- Click "Add Command"
- Choose a command type
- Configure the command:
- Set the trigger phrase
- Define parameters (if needed)
- Configure the action
- Set the response format
Command Parameters
Commands can accept different types of parameters:
- Text: Free-form text input
- Number: Numeric values
- File: Uploaded files
- Options: Select from predefined choices
- Boolean: True/false values
Example: Weather Command
Trigger: **/weather** with location parameter
Action: Call weather API with the city name
Response: "The current weather in New York is 72°F and sunny."
X402 Payment-Gated Commands
You can make commands require payment using the X402 protocol:
- Enable payment for the command
- Set the price in USD
- Users will be prompted to pay before the command executes
This is perfect for:
- Premium features
- API access
- Paid services
- Monetizing your agent
Command Best Practices
Clear Naming
- Use descriptive trigger phrases
- Make it obvious what the command does
- Keep triggers short and memorable
Helpful Descriptions
- Explain what the command does
- Document required parameters
- Provide usage examples
Error Handling
- Validate parameters before executing
- Return clear error messages
- Handle edge cases gracefully
Testing
- Test all command paths
- Verify parameter handling
- Check response formatting
Example Commands
Image Generation
Trigger: /imagine sunset over mountains
Action: Generate image using AI based on the prompt
Response: Returns the generated image
Data Lookup
Trigger: /price BTC
Action: Fetch current price from crypto API
Response: "BTC is currently trading at $43,250"
Content Summary
Trigger: /summarize https://example.com/article
Action: Extract and summarize the article content
Response: "This article discusses... [formatted summary]"
Deploying Commands
Once you've created commands:
- Test them in the Playground
- Enable them in your integrations
- Users can trigger them in:
- Telegram chats
- X (Twitter) mentions
- API requests
Next Steps
Ready to deploy your agent? Learn about X402 to monetize your agent, or deploy to Telegram or X (Twitter).