Let agents create, edit, and patch their own skills at runtime
Self-improving skills enable agents to create, edit, and manage their own capabilities dynamically, learning from user interactions and building persistent knowledge.
from praisonaiagents import Agentagent = Agent( name="Skill Builder", instructions="When users teach you something, save it as a skill for next time.", tools=["skill_manage", "skills_list", "skill_view"] # auto-injected in bots)agent.start("Create a skill called 'weekly-summary' that summarises the week's work.")
2
Agent Learns and Improves
# Agent creates skills automatically from user interactions# User: "Create a weekly summary skill"# Agent calls: skill_manage(action="create", name="weekly-summary", content="...")# Later interaction# User: "Update the summary to include metrics"# Agent calls: skill_manage(action="patch", name="weekly-summary", old_string="...", new_string="...")
Skills are stored in directories according to this precedence order (highest to lowest):
Project:./.praisonai/skills/ (centralized) — and ./.claude/skills/ for compatibility
Ancestor walk: any .praisonai/skills or .claude/skills in parent directories (monorepo support)
User:~/.praisonai/skills/
System (Unix):/etc/praison/skills/
When creating new skills, they are written to the first existing directory in this list. If none exist, the system falls back to creating ~/.praisonai/skills/.
The current documentation incorrectly states that skills are stored “in ~/.praisonai/skills/ by default”. This is only the fallback location, not the actual default behavior.
# Real agent-centric example you can copy and runfrom praisonaiagents import Agentagent = Agent( name="Learning Assistant", instructions="When users teach you something, save it as a persistent skill using skill_manage.", tools=["skill_manage", "skills_list", "skill_view"])# User teaches the agentresponse = agent.start("Here's how to analyze CSV files: load with pandas, check for nulls, then create summary stats")# Agent automatically calls:# skill_manage(action="create", name="csv-analysis", content="# CSV Analysis\n1. Load with pandas...")# Response: {"success": True, "skill": "csv-analysis", "path": "/path/to/skill"}print("Agent learned and persisted the skill!")
# Typical interaction where agent learns from useragent = Agent( name="Learning Assistant", instructions=""" When users teach you something new, save it as a skill. Use skill_manage to create persistent knowledge. """, tools=["skill_manage", "skills_list", "skill_view"])# User: "Here's how to analyze CSV data: load with pandas, clean nulls, then summarize"# Agent automatically calls:# skill_manage(action="create", name="csv-analysis", # content="# CSV Analysis\n1. Load with pandas\n2. Clean nulls\n3. Summarize data")
ImportError Fix: If you see ImportError: cannot import name 'get_default_skill_directories', upgrade praisonaiagents — this was fixed in MervinPraison/PraisonAI#1687. The function was renamed from get_default_skill_directories to get_default_skill_dirs.
All skill operations are workspace-contained and use atomic writes via temp files. Never bypass name validation or path checks. Skills inherit workspace security automatically.
Progressive Learning
Start with simple skills and let agents enhance them through patch operations. This creates more natural learning patterns than full rewrites.
Skill Organization
Use meaningful categories and names. Skills are stored according to directory precedence (see Storage Location above), with clean directory structure per skill.
Error Handling
All skill operations return detailed JSON results with success flags and error messages. Always check result["success"] before proceeding.