Configurable Agents
The platform provides a flexible system for creating and configuring agents to handle specific tasks. This guide covers how to define and customize agents.
Predefined Agents
The system comes with several preconfigured agents defined in agents.json
:
Core Agents
- RouterAgent: Routes requests to appropriate specialized agents
- ResearchAssistant: Conducts web research and information gathering
- ResearchManager: Manages and coordinates research activities
- ContentManager: Manages content creation and organization
- ContentWriter: Writes and generates content
- ProjectManager: Manages projects and coordinates tasks
- OnboardingConsultant: Handles user onboarding processes
- SolverAgent: Solves problems and provides solutions
Agent Configuration
Each agent in agents.json
has these properties:
{
"className": "AgentClassName",
"sourcePath": "../agents/agentPath",
"userId": "unique-agent-id",
"handle": "@agentname",
"description": "Agent purpose and capabilities",
"enabled": true,
"config": {
// Agent-specific configuration
}
}
Creating New Agents
- Define the Agent Class
- Extend
ConfigurableAgent
orStepBasedAgent
- Implement required methods
- Add custom behavior
export class MyCustomAgent extends ConfigurableAgent {
constructor(params: AgentConstructorParams) {
super(params);
this.setPurpose('My agent purpose');
}
protected async initializeFromConfig(config: any) {
// Initialize from configuration
}
}
- Add to agents.json
- Create new entry with unique ID
- Set source path to agent file
- Define configuration options
"MyCustomAgent": {
"className": "MyCustomAgent",
"sourcePath": "../agents/myCustomAgent",
"userId": "unique-id",
"handle": "@custom",
"description": "Handles custom tasks",
"enabled": true,
"config": {
"option1": "value1",
"option2": "value2"
}
}
- Configure Default Channels
- Add channel mapping in
defaultChannels
- Specify which channel the agent should monitor
"defaultChannels": {
"custom": "channel-id"
}
Agent Configuration Options
Common configuration options include:
- maxSearches: Maximum web searches per request
- maxDepth: Maximum search depth
- timeout: Request timeout in milliseconds
- model: LLM model to use
- temperature: LLM temperature setting
Best Practices
- Clear Purpose
- Define a specific purpose for each agent
-
Avoid overlapping responsibilities
-
Modular Design
- Break complex tasks into smaller steps
-
Use step executors for reusable components
-
Configuration
- Make frequently changed settings configurable
- Provide sensible defaults
-
Validate configuration values
-
Error Handling
- Implement robust error handling
- Provide meaningful error messages
- Include fallback behaviors
Example Workflow
-
Define agent class:
export class DataAnalyzer extends ConfigurableAgent { constructor(params: AgentConstructorParams) { super(params); this.setPurpose('Analyze and visualize data'); } }
-
Add to agents.json:
"DataAnalyzer": { "className": "DataAnalyzer", "sourcePath": "../agents/dataAnalyzer", "userId": "data-analyzer-id", "handle": "@analyzer", "description": "Analyzes and visualizes data", "enabled": true, "config": { "maxRows": 1000, "chartTypes": ["bar", "line", "pie"] } }
-
Configure default channel:
"defaultChannels": { "analysis": "channel-id-for-analysis" }
-
Use in conversations:
[You] @analyzer Can you visualize this data? [DataAnalyzer] Sure! What type of chart would you like?