Skill Management
The Perstack runtime manages three types of skills through specialized Skill Managers. Each type has different initialization behavior and security implications.
Skill Types
| Type | Manager Class | Purpose | Connection |
|---|---|---|---|
| MCP | McpSkillManager | External tools via MCP protocol | stdio or SSE |
| Interactive | InteractiveSkillManager | User input tools | None (definitions only) |
| Delegate | DelegateSkillManager | Expert-to-Expert calls | None (definitions only) |
Architecture
βββββββββββββββββββββββ
β BaseSkillManager β (abstract)
β βββββββββββββββββ β
β - init() β
β - close() β
β - getToolDefs() β
β - callTool() β
βββββββββββ¬ββββββββββββ
β
βββββββββββββββββββββΌββββββββββββββββββββ
βΌ βΌ βΌ
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β McpSkillManager β β Interactive β β Delegate β
β β β SkillManager β β SkillManager β
β - MCP stdio/SSE β β - User input β β - Expert calls β
β - Tool executionβ β definitions β β definitions β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββInitialization Flow
When an Expert starts, the runtime initializes skills in order:
1. MCP Skills
ββ Create McpSkillManager for each MCP skill
ββ Connect to MCP servers (stdio or SSE)
ββ Fetch tool definitions from servers
2. Interactive Skills
ββ Create InteractiveSkillManager for each
ββ Parse tool definitions from config
3. Delegate Skills
ββ Create DelegateSkillManager for each delegate
ββ Generate tool definition for Expert callIf any skill fails to initialize, all previously initialized skills are cleaned up before the error is thrown.
MCP Skill Manager
The McpSkillManager handles communication with MCP servers.
Connection Types
stdio (recommended for local tools):
[experts."my-expert".skills."file-ops"]
type = "mcpStdioSkill"
command = "npx"
packageName = "@perstack/base"SSE (for remote services):
[experts."my-expert".skills."remote-api"]
type = "mcpSseSkill"
endpoint = "https://api.example.com/mcp"Tool Filtering
Control which tools are available to the Expert:
[experts."my-expert".skills."file-ops"]
type = "mcpStdioSkill"
command = "npx"
packageName = "@perstack/base"
pick = ["readFile", "writeFile"] # Only these tools
omit = ["deleteFile"] # Exclude these toolsEnvironment Variables
Only specified environment variables are passed to MCP servers:
[experts."my-expert".skills."db"]
type = "mcpStdioSkill"
command = "npx"
packageName = "@example/db-mcp"
requiredEnv = ["DATABASE_URL", "DB_PASSWORD"]This prevents accidental exposure of sensitive environment variables.
Interactive Skill Manager
Interactive skills define tools that pause execution and wait for user input.
[experts."my-expert".skills."user-input"]
type = "interactiveSkill"
description = "Tools for user interaction"
[experts."my-expert".skills."user-input".tools.confirm]
name = "confirm"
description = "Ask user for confirmation"
inputJsonSchema = '{"type":"object","properties":{"message":{"type":"string"}}}'When an interactive tool is called:
- The runtime emits a
stopRunByInteractiveToolevent - Execution pauses with a checkpoint
- Your application collects user input
- Resume execution with the userβs response
Delegate Skill Manager
Delegate skills enable Expert-to-Expert calls.
[experts."orchestrator"]
delegates = ["researcher", "writer"]Each delegate becomes a callable tool:
- Tool name: Expert name (e.g.,
researcher) - Input:
{ query: string } - Execution: Spawns a sub-run of the delegated Expert
Lifecycle
Expert Start
β
βΌ
βββββββββββββββββββ
β Initialize all β β Connect MCP servers, parse definitions
β Skill Managers β
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ
β Agent Loop β β Tools available for LLM to call
β (Steps 1..N) β
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ
β Close all β β Disconnect MCP servers
β Skill Managers β
βββββββββββββββββββSecurity Considerations
Process Isolation
Each MCP server runs as a separate process:
- Crashed servers donβt affect the runtime
- Resource limits can be applied per-server
- Clean shutdown on Expert completion
Minimal Privilege
Skills receive only what they need:
- Environment: Only
requiredEnvvariables - Tools: Filtered by
pick/omit - Filesystem: Limited by MCP server implementation
Connection Security
- stdio: Local process, no network exposure
- SSE: Use HTTPS for remote connections
For more on isolation, see Isolation by Design.
Whatβs Next
- Isolation by Design β security boundaries
- Skills β defining skills in perstack.toml
- Base Skill β built-in tools