This guide demonstrates how to define custom agent capabilities in the Genesis framework, providing consistency across implementations and rich metadata for agent discovery.
You do NOT need to define capabilities for your agents to work!
- If you define capabilities: Your custom definitions are used
- If you don't define capabilities: Automatic intelligent generation (model-based → heuristic)
- All existing agents continue to work unchanged - no breaking changes
- Backward compatible: Current examples work exactly as before
The Genesis framework supports multiple ways to define agent capabilities (all optional):
- Programmatic Definition - Using
define_capabilities()method - Method Override - Overriding
get_agent_capabilities() - Class-Level Definition - Using
CAPABILITIESclass attribute - Dynamic Management - Using convenience methods for runtime updates
All capability definition methods are available through the inheritance chain:
GenesisAgent (base class)
↓ inherits
MonitoredAgent (monitoring wrapper)
↓ inherits
OpenAIGenesisAgent (provider implementation)
Users can call capability methods directly on OpenAIGenesisAgent instances - no additional implementation needed in MonitoredAgent or provider classes.
The system checks for user-defined capabilities in this order:
- User-defined capabilities (highest priority)
- Model-based generation (if available)
- Heuristic approach (fallback)
If you don't define any capabilities, the system automatically:
- Analyzes your agent using the model (if available)
- Generates rich metadata based on:
- Your
@genesis_toolmethods and their descriptions - Your agent's class name and attributes
- Your agent's specializations and capabilities
- Performance characteristics and interaction patterns
- Your
- Falls back to heuristic generation if model is unavailable
- Provides sensible defaults for all required fields
This means your existing agents work perfectly without any changes!
Use the define_capabilities() method for structured, comprehensive capability definition:
from genesis_lib.genesis_agent import GenesisAgent
from genesis_lib.decorators import genesis_tool
class WeatherAgent(GenesisAgent):
def __init__(self):
super().__init__("WeatherAgent", "WeatherService")
# Define comprehensive capabilities
self.define_capabilities(
agent_type="specialist",
specializations=["weather", "meteorology", "climate"],
capabilities=[
"current_weather_queries",
"weather_forecasting",
"climate_analysis",
"weather_pattern_recognition"
],
classification_tags=["weather", "forecast", "climate", "meteorology"],
performance_metrics={
"estimated_response_time": "fast",
"complexity_handling": "moderate",
"domain_expertise": "specialized",
"accuracy": "high"
},
interaction_patterns=[
"location_based_queries",
"forecast_requests",
"weather_data_analysis"
],
strengths=[
"Accurate weather data retrieval",
"Multi-day forecasting capabilities",
"Pattern analysis and trend detection"
],
limitations=[
"Requires location input for most queries",
"Limited to weather and climate domains",
"Dependent on external weather data sources"
],
default_capable=False # Specialized agent
)
@genesis_tool(description="Get current weather", operation_type="weather_query")
async def get_weather(self, location: str) -> dict:
# Implementation here
passOverride get_agent_capabilities() for custom logic or dynamic capabilities:
class FinanceAgent(GenesisAgent):
def __init__(self):
super().__init__("FinanceAgent", "FinanceService")
self.market_data_available = True
def get_agent_capabilities(self) -> dict:
"""Override to provide custom capabilities with dynamic logic."""
base_capabilities = {
'agent_type': 'specialist',
'specializations': ['finance', 'investment', 'trading'],
'capabilities': ['stock_analysis', 'portfolio_optimization'],
'classification_tags': ['finance', 'investment', 'stocks'],
'default_capable': False
}
# Add dynamic capabilities based on state
if self.market_data_available:
base_capabilities['capabilities'].extend([
'real_time_market_data',
'live_trading_analysis'
])
base_capabilities['performance_metrics'] = {
'estimated_response_time': 'fast',
'data_freshness': 'real_time'
}
else:
base_capabilities['capabilities'].append('historical_analysis_only')
base_capabilities['limitations'] = [
'Limited to historical data',
'No real-time market access'
]
return base_capabilitiesUse the CAPABILITIES class attribute for static, reusable capability definitions:
class MathAgent(GenesisAgent):
# Class-level capabilities definition
CAPABILITIES = {
'agent_type': 'specialist',
'specializations': ['mathematics', 'statistics', 'calculus'],
'capabilities': [
'mathematical_calculations',
'statistical_analysis',
'equation_solving',
'graph_plotting'
],
'classification_tags': ['math', 'statistics', 'calculus', 'algebra'],
'default_capable': False,
'performance_metrics': {
'estimated_response_time': 'fast',
'complexity_handling': 'complex',
'domain_expertise': 'expert'
},
'interaction_patterns': [
'mathematical_problem_solving',
'statistical_analysis'
],
'strengths': [
'Accurate mathematical calculations',
'Statistical analysis expertise',
'Complex equation solving'
],
'limitations': [
'Mathematical domain only',
'Requires clear problem statements'
]
}
def __init__(self):
super().__init__("MathAgent", "MathService")
# Capabilities automatically loaded from CAPABILITIESUse convenience methods for runtime capability updates:
class DynamicAgent(GenesisAgent):
def __init__(self):
super().__init__("DynamicAgent", "DynamicService")
# Start with basic capabilities
self.define_capabilities(
agent_type="general",
specializations=["general"],
capabilities=["general_assistance"],
default_capable=True
)
def add_weather_capabilities(self):
"""Dynamically add weather capabilities."""
self.add_specialization("weather")
self.add_capability("weather_forecasting")
self.add_capability("current_weather")
self.set_performance_metric("weather_accuracy", "high")
def add_math_capabilities(self):
"""Dynamically add math capabilities."""
self.add_specialization("mathematics")
self.add_capability("calculations")
self.add_capability("statistical_analysis")
self.set_performance_metric("math_precision", "expert")
def enable_advanced_features(self):
"""Enable advanced features based on configuration."""
if self.config.get('advanced_mode', False):
self.add_capability("advanced_analysis")
self.set_performance_metric("analysis_depth", "expert")All capability definitions should include these fields:
agent_type: String - "general", "specialist", "tool_agent", etc.specializations: List[str] - Domain expertise areascapabilities: List[str] - Specific capabilities the agent can performclassification_tags: List[str] - Tags for categorization and discoverydefault_capable: Boolean - Whether agent can handle general requests
model_info: Dict - Information about underlying modelsperformance_metrics: Dict - Performance characteristicsinteraction_patterns: List[str] - How the agent typically interactsstrengths: List[str] - Key strengthslimitations: List[str] - Known limitations
# Good: Specific and descriptive
capabilities=[
"real_time_weather_forecasting",
"multi_location_weather_comparison",
"climate_trend_analysis"
]
# Avoid: Too generic
capabilities=["weather", "forecast"]# Good: Consistent domain terminology
specializations=["meteorology", "climatology", "atmospheric_science"]
classification_tags=["weather", "forecast", "climate", "meteorology"]
# Avoid: Mixed terminology
specializations=["weather", "meteorology", "climate_stuff"]# Good: Comprehensive metadata
self.define_capabilities(
agent_type="specialist",
specializations=["finance", "investment"],
capabilities=["portfolio_optimization", "risk_assessment"],
performance_metrics={
"estimated_response_time": "fast",
"complexity_handling": "complex",
"domain_expertise": "expert"
},
strengths=["Real-time market data", "Advanced algorithms"],
limitations=["Not financial advice", "Requires current data"]
)# Good: Tags that help with discovery
classification_tags=[
"weather", "forecast", "temperature", "humidity",
"meteorology", "climate", "atmospheric"
]
# Good: Clear interaction patterns
interaction_patterns=[
"location_based_queries",
"forecast_requests",
"weather_data_analysis"
]self.define_capabilities(
agent_type="specialist",
specializations=["weather", "meteorology", "climate"],
capabilities=[
"current_weather_queries",
"weather_forecasting",
"climate_analysis",
"weather_pattern_recognition"
],
classification_tags=["weather", "forecast", "climate", "meteorology"],
performance_metrics={
"estimated_response_time": "fast",
"complexity_handling": "moderate",
"domain_expertise": "specialized"
},
default_capable=False
)self.define_capabilities(
agent_type="specialist",
specializations=["finance", "investment", "trading", "economics"],
capabilities=[
"stock_analysis",
"portfolio_optimization",
"market_trend_analysis",
"risk_assessment"
],
classification_tags=["finance", "investment", "trading", "stocks"],
performance_metrics={
"estimated_response_time": "medium",
"complexity_handling": "complex",
"domain_expertise": "expert"
},
default_capable=False
)self.define_capabilities(
agent_type="general",
specializations=["general_assistance"],
capabilities=[
"conversation",
"information_retrieval",
"task_assistance",
"problem_solving"
],
classification_tags=["general", "assistant", "conversation"],
performance_metrics={
"estimated_response_time": "medium",
"complexity_handling": "moderate",
"domain_expertise": "general"
},
default_capable=True
)The system automatically validates user-defined capabilities:
- Required fields: Ensures all required fields are present
- Type validation: Ensures lists are lists, dicts are dicts, etc.
- Default values: Provides sensible defaults for missing fields
- Model info: Automatically adds model information if available
- Error handling: Graceful fallback to auto-generation if validation fails
User-defined capabilities take priority over auto-generation:
- User-defined (if provided) → Used directly
- Model-based (if available) → Used as fallback
- Heuristic → Final fallback
This ensures consistency while maintaining the benefits of intelligent auto-generation for agents that don't define custom capabilities.
The user-definable capability system provides:
- Consistency across agent implementations
- Rich metadata for better discovery and routing
- Flexibility with multiple definition approaches
- Validation to ensure proper formatting
- Priority over auto-generation for custom control
Choose the approach that best fits your agent's needs, from simple class-level definitions to complex dynamic capability management.
(c) 2025 Copyright, Real-Time Innovations, Inc. (RTI) All rights reserved.
RTI grants Licensee a license to use, modify, compile, and create derivative works of the Software. Licensee has the right to distribute object form only for use with RTI products. The Software is provided "as is", with no warranty of any type, including any warranty for fitness for any purpose. RTI is under no obligation to maintain or support the Software. RTI shall not be liable for any incidental or consequential damages arising out of the use or inability to use the software.