Teach agents new capabilities and domain-specific knowledge
Skills enable agents to learn and master new capabilities, from specialized domain knowledge to complex procedural tasks, making them more capable and autonomous over time.
The Skills primitive allows you to teach agents new capabilities that they can apply across different contexts. Unlike tools which are function calls, skills represent learned behaviors, procedures, and domain knowledge that agents internalize and adapt to various situations.Skills are essential for:
Specialization: Train agents in specific domains or disciplines
Procedure Learning: Teach multi-step processes and best practices
Knowledge Transfer: Share expertise across agent instances
Capability Extension: Add new abilities without code changes
Continuous Improvement: Agents learn from experience and feedback
Consistency: Ensure standard approaches across tasks
Domain Expertise
Teach specialized knowledge in law, medicine, finance, etc.
// Teach skill through demonstrationawait agentbase.teachSkill({ skillId: "customer_support", examples: [ { situation: "Customer reports login issue", response: `Thank you for contacting us. I'll help you resolve this. Let me verify a few things: 1. Are you using the correct email address? 2. Have you tried resetting your password? 3. Which browser are you using? Based on your answers, I'll guide you through the solution.`, feedback: "positive", notes: "Empathetic, systematic approach" }, { situation: "Customer angry about service outage", response: `I sincerely apologize for the inconvenience. I understand this is frustrating. Here's what happened: [brief explanation] Here's what we're doing: [resolution steps] Here's how we'll prevent it: [prevention measures] How can I make this right for you?`, feedback: "positive", notes: "Acknowledges emotions, takes responsibility, offers solution" } ]});
const supportSkill = await agentbase.createSkill({ name: "technical_troubleshooting", description: "Systematically diagnose and resolve technical issues", type: "procedural", instructions: `Troubleshooting methodology: 1. Gather information - What exactly happened? - When did it start? - What changed recently? - Error messages or codes? 2. Reproduce the issue - Can you show me the steps? - Does it happen consistently? 3. Isolate the cause - Test in different environments - Check logs and diagnostics - Eliminate variables 4. Propose solution - Explain what caused it - Provide fix with steps - Verify solution works 5. Document and prevent - Record solution - Suggest preventive measures`, domain: "technical_support"});// Agent applies systematic troubleshooting
const analyticsSkill = await agentbase.createSkill({ name: "data_analysis", description: "Analyze data to extract insights and recommendations", type: "analytical", instructions: `Data analysis approach: 1. Understand the Question - What decision needs to be made? - What metrics matter? 2. Examine the Data - Data quality and completeness - Identify patterns and outliers - Check for biases 3. Perform Analysis - Descriptive statistics - Trend analysis - Correlation and causation - Segment analysis 4. Visualize Findings - Choose appropriate charts - Highlight key insights - Make data accessible 5. Provide Recommendations - Data-driven insights - Actionable next steps - Quantify impact - Note limitations and caveats Always explain your reasoning and show your work.`});
const salesSkill = await agentbase.createSkill({ name: "lead_qualification", description: "Qualify leads using BANT methodology", type: "procedural", domain: "sales", instructions: `BANT Qualification Framework: 1. Budget - Does prospect have budget allocated? - What's the budget range? - When is budget available? 2. Authority - Who makes the decision? - What's the approval process? - Who are the stakeholders? 3. Need - What problem are they solving? - What's the impact of not solving it? - Current solution inadequacies? 4. Timeline - When do they need to decide? - What's driving urgency? - Any blockers to moving forward? Scoring: - 4/4 BANT criteria: High quality lead - 3/4: Medium quality, nurture - 2/4 or less: Low priority Document findings and next steps.`});
// Good: Detailed skill with clear instructions{ name: "api_design", instructions: `REST API design principles: 1. Use nouns for resources (/users, not /getUsers) 2. HTTP methods for actions (GET, POST, PUT, DELETE) 3. Consistent naming conventions 4. Proper status codes (200, 201, 400, 404, 500) 5. Versioning in URL (/v1/users) 6. Pagination for lists 7. Clear error messages 8. Rate limiting headers Follow JSON:API specification when possible.`}// Avoid: Vague skill definition{ name: "api_design", instructions: "Design good APIs"}
Include Examples
Copy
// Provide good and bad examples{ name: "email_communication", examples: [ { scenario: "Responding to customer complaint", good: "I apologize for the inconvenience. Let me resolve this for you...", bad: "That's not our fault. You should have...", reasoning: "Good response shows empathy and takes ownership" } ]}
// Enable continuous learning{ skillId: "customer_support", learningMode: { enabled: true, feedbackWeight: 0.7, // How much to weight user feedback selfCorrection: true, // Learn from mistakes adaptToContext: true // Adapt based on situation }}
Practice Scenarios
Copy
// Create practice scenariosawait agentbase.createSkillPractice({ skillId: "negotiation", scenarios: [ { situation: "Vendor asking for 20% price increase", context: "Current contract expires in 30 days", goal: "Minimize increase or find alternative value" }, { situation: "Customer requesting refund after policy deadline", context: "Customer has been with company for 5 years", goal: "Maintain relationship while following policy" } ]});
Pro Tip: Start with pre-built skills from the library and customize them for your specific needs. This accelerates agent capability development significantly.