Action Framework
The Arjux action framework provides a clean, type-safe way to extend your agent's capabilities across multiple platforms.
Core Structure
Base Class: Abstract Action class with core functionality
Environment: Automatic environment injection
Type Safety: Full TypeScript support with platform-specific types
Creating Actions
Extend the base Action class:
export class CustomAction extends Action {
constructor() {
super('name', 'description');
}
shouldExecute(message: Message): boolean {
// Define when action should trigger
return message.text?.includes('/command');
}
async execute(message: Message): Promise {
// Implement action logic
return {
text: "Response text",
shouldSendMessage: true,
context: "Optional LLM context"
};
}
}
Action Results
Actions can return:
text
: Response messageshouldSendMessage
: Whether to send directlycontext
: Optional LLM context for AI processing
Integration
Actions are automatically:
- Loaded and initialized with environment
- Checked for each incoming message
- Executed with proper platform context
- Integrated with the memory system