SKILL.md back — ready to reuse immediately.
The user points the agent at repos or docs; it distils a reusable SKILL.md the team can invoke on later runs.
Quick Start
How It Works
Agent.learn_skill() calls build_learn_prompt(request) to build a curated directive, ensures skill_manage (and lightweight file/PDF readers) are available via _ensure_skill_management_tools(), then invokes start() for a single turn.
What the Grounded Prompt Enforces
The internalbuild_learn_prompt function generates a directive with strict house-style rules:
| Rule | Detail |
|---|---|
| Gather only named sources | Reads local files/directories, PDFs, fetched URLs, or the current chat — only sources the user named |
| Verbatim accuracy | Uses only flags, paths, commands, env vars, and API names that appear verbatim in the gathered sources — never invented |
Tight SKILL.md | Keeps the file ~100–200 lines; moves long reference material (large code, full API tables) to supporting files referenced by relative path |
| YAML frontmatter | Must include at least name and description |
| Single write | Authors one skill via skill_manage(action="create", name="kebab-case-name", content="...") |
| Supporting files | Long material goes to separate files via skill_manage(action="write_file", ...) |
Configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
request | str | required | Description of sources to learn from and the skill to produce |
**kwargs | Any | — | Forwarded to start() / astart() |
_ensure_skill_management_tools() adds skill_manage, read_skill_file, and list_skill_scripts to self.tools if they are not already present. This is idempotent — safe to call multiple times.
Bot Usage
All PraisonAI bot adapters (Telegram, Slack, Discord) register/learn via the shared CommandRegistry.
Admin-Only Default
/learn reads host file system sources and authors skills that alter future agent behaviour. It belongs to PRIVILEGED_COMMANDS in CommandAccessPolicy — it is admin-only by default whenever a policy is configured (admin_users or user_allowed_commands set).
Without any policy configured, /learn is available to all users (backward-compatible behaviour).
See Bot Command Access Control to configure admin_users and grant selective access.
Common Patterns
Learn from a Codebase
Learn from PDFs + Code
Learn from the Current Chat
Async in an Event Loop
Best Practices
Name skills explicitly
Name skills explicitly
Include the target skill name in the request (e.g.,
"make a 'deploy-flow' skill") so the agent uses that exact kebab-case name rather than deriving one. Consistent names make it easier to invoke and update skills later.Scope the sources tightly
Scope the sources tightly
List only the directories, files, or PDFs the skill should cover. Broad requests like
"read everything" risk the agent browsing unrelated material or timing out. Narrow sources produce more accurate skills.Use alearn_skill in async code
Use alearn_skill in async code
In async contexts (FastAPI endpoints, bot handlers), call
await agent.alearn_skill(...) instead of agent.learn_skill(...) to avoid blocking the event loop during potentially long source-gathering turns.Check skill_manage availability
Check skill_manage availability
learn_skill auto-adds skill_manage if missing, but if you’ve set tools=[] explicitly on the agent, ensure the agent has read access to the source directories too (the skill_manage file readers need filesystem access).Related
Skill Management
Create, list, read, and delete skills via the skill_manage tool
Skill Lifecycle
How skills are discovered, activated, and applied during agent runs
Bot Commands
Full list of built-in bot commands including /learn
Self Improve
Automatic skill improvement loop (distinct from one-shot learn_skill)

