Skip to main content
from praisonaiagents import Agent

agent = Agent(name="Skill Author", instructions="Distil reusable skills from source material.")
agent.learn("Create a deploy-flow skill from this repo and runbook.")
Point an agent at real source material and get one grounded 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

1

Agent: learn from sources

from praisonaiagents import Agent

agent = Agent(name="Skill Author", instructions="You learn and write skills.")
agent.learn("Read ./my-repo and the docs in ./docs/*.pdf and make a 'deploy-flow' skill")
2

Bot: /learn slash command

Type /learn in any PraisonAI bot chat (Telegram, Slack, Discord):
/learn deploy steps from this repo and the runbook PDF
/learn is admin-only by default when a CommandAccessPolicy is configured. See Bot Command Access Control.
3

Async and alias variants

# Async variant (event-loop friendly)
await agent.alearn("Read ./my-repo and make a 'ci-deploy' skill")

# Backward-compatible aliases
agent.learn("...")          # alias for learn_skill()
await agent.alearn("...")   # alias for alearn_skill()

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 internal build_learn_prompt function generates a directive with strict house-style rules:
RuleDetail
Gather only named sourcesReads local files/directories, PDFs, fetched URLs, or the current chat — only sources the user named
Verbatim accuracyUses only flags, paths, commands, env vars, and API names that appear verbatim in the gathered sources — never invented
Tight SKILL.mdKeeps the file ~100–200 lines; moves long reference material (large code, full API tables) to supporting files referenced by relative path
YAML frontmatterMust include at least name and description
Single writeAuthors one skill via skill_manage(action="create", name="kebab-case-name", content="...")
Supporting filesLong material goes to separate files via skill_manage(action="write_file", ...)

Configuration

ParameterTypeDefaultDescription
requeststrrequiredDescription of sources to learn from and the skill to produce
**kwargsAnyForwarded 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.
/learn <sources and skill to make>
Example:
/learn deploy steps from this repo and the runbook PDF
Usage hint (when called without arguments):
ℹ️ Usage: /learn <sources and skill to make>
Example: /learn deploy steps from this repo and the runbook PDF

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

from praisonaiagents import Agent

agent = Agent(name="Skill Author", instructions="You learn and write skills.")
agent.learn("Read ./my-repo and make a 'dev-setup' skill covering the full local dev workflow")

Learn from PDFs + Code

agent.learn(
    "Read ./src and the PDF manuals in ./docs/manuals/*.pdf "
    "and make a 'data-ingestion' skill"
)

Learn from the Current Chat

agent.learn("Distil what we just did into a 'feature-branch' skill")

Async in an Event Loop

import asyncio
from praisonaiagents import Agent

async def main():
    agent = Agent(name="Skill Author", instructions="You learn and write skills.")
    await agent.alearn_skill("Read ./docs and make an 'api-reference' skill")

asyncio.run(main())

Best Practices

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.
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.
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.
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).

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)