How to Add Skills to Your Agent
Quick Setup: Pass your decorated functions to theskills parameter when creating an agent:
What Are Skills?
Skills are essentially Python functions that:- Are decorated with the
@skilldecorator - Have well-defined parameters and return values
- Include Google-style docstrings for automatic metadata extraction
- Can be executed by agents during their workflow
Creating Skills
Basic Skill Creation
Custom Skill Names
You can provide a custom name for your skill:Skills with Optional Parameters
Complex Skills with Multiple Return Types
Using Skills with Agents
Adding Skills to an Agent
Skill Limitations
- Maximum of 10 skills per agent
- Skills must be decorated with
@skill - All parameters must be JSON-serializable
- Return values should be JSON-serializable for best results
How Skills Work Internally
Skill Registration
When you decorate a function with@skill, the system:
-
Parses the docstring using Google-style format to extract:
- Skill description
- Parameter types and descriptions
- Return value description
- Usage examples
-
Analyzes the function signature to determine:
- Required vs optional parameters
- Default values
- Parameter types from annotations
- Creates a Skill object with complete metadata
- Registers the skill in the global SkillRegistry
Parameter Processing
The system automatically converts string inputs to the correct types:{"count": "5", "rate": "2.5", "active": "true"}, the system automatically converts:
"5"→5(int)"2.5"→2.5(float)"true"→True(bool)
Skill Execution Flow
- Agent decides to use a skill based on conversation context
- Parameters are extracted from the conversation or previous results
- Type conversion happens automatically
- Skill function executes with converted parameters
- Result is returned to the agent for further processing