Experts
Experts are the core building block of Perstack β modular micro-agents designed for reuse.
The term βExpertβ is familiar in AI (e.g., Mixture of Experts), but here it means something specific: a specialist component with a single, well-defined role.
Why Experts?
Traditional agent development produces monolithic agents optimized for specific use cases. They work, but they donβt transfer. You canβt take a βresearch agentβ from one project and reuse it in another without significant rework.
Experts solve this by inverting the design:
| Traditional Agent | Expert |
|---|---|
| Represents a user | Serves an application |
| Does many things | Does one thing well |
| Application-specific | Purpose-specific, context-independent |
| Hard to reuse | Designed for reuse |
An agent represents a user β it acts on their behalf across many tasks. An Expert is a specialist component β it helps an application achieve a specific goal.
This distinction matters. When you build an Expert, youβre not building an application. Youβre building a reusable capability that any application can leverage.
What is an Expert?
An Expert is defined by three things:
1. Purpose (description)
A clear statement of what the Expert does. Unlike instruction (which is private to the Expert), description is exposed to other Experts as a tool description when delegating.
When Expert A can delegate to Expert B, the runtime presents Expert B as a callable tool to Expert A β with description as the toolβs description. This is how Expert A decides:
- Which delegate to call
- What query to write
A good description tells potential callers what this Expert can do, when to use it, and what to include in the query.
[experts."code-reviewer"]
description = """
Reviews TypeScript code for type safety, error handling, and security issues.
Provide the file path to review. Returns actionable feedback with code examples.
"""2. Domain knowledge (instruction)
The knowledge that transforms a general-purpose LLM into a specialist. This includes:
- What the Expert is expected to achieve
- Domain-specific concepts, rules, and constraints
- Completion criteria and priority tradeoffs
- Guidelines for using assigned skills
instruction = """
You are a TypeScript code reviewer for production systems.
Review criteria:
- Type safety: No `any` types, all types explicitly defined
- Error handling: All errors must use codes from `error-codes.ts`
- Security: Flag even minor risks
Provide actionable feedback with code examples.
"""3. Capabilities (skills, delegates)
What the Expert can do:
- Skills: Tools available through MCP (file access, web search, APIs)
- Delegates: Other Experts this Expert can call
delegates = ["security-analyst"]
[experts."code-reviewer".skills."static-analysis"]
type = "mcpStdioSkill"
command = "npx"
packageName = "@eslint/mcp"How Experts work
Execution model
When you run an Expert:
- The runtime loads the Expert definition from
perstack.tomlor Registry - The instruction becomes the system prompt (with runtime meta-instructionsΒ )
- Your query becomes the user message
- The LLM reasons and calls tools (skills) as needed
- Each step produces a checkpoint β a complete snapshot of the execution state
The runtime manages the execution loop. The Expert definition declares what to achieve; the runtime handles how.
Delegation
Experts collaborate through delegation, not shared context.
Expert A Expert B
β
ββ sees delegates as tools
β (description β tool description)
β
ββ calls delegate βββββββββββββββββββ starts fresh
β (writes query) (empty history, own instruction)
β β
β [checkpoint saved] ββ executes task
β β
ββ resumes ββββββββββββββββββββββββββββ returns result
β (receives result)
βΌ Note the asymmetry: Expert A sees Expert Bβs description (public interface), but never its instruction (private implementation). This is what makes Experts composable β the caller only needs to know what a delegate does, not how it does it.
Key design decisions:
| Aspect | Design | Rationale |
|---|---|---|
| Message history | Not shared | Each Expert has a single responsibility; mixing contexts breaks focus |
| Communication | Natural language | No schema versioning, maximum flexibility, humans and Experts use the same interface |
| State exchange | Workspace files | Persistent, inspectable, works across restarts |
This is intentional. Shared context leads to prompt bloat, context window exhaustion, and confused LLM reasoning. Isolated Experts stay focused.
Workspace
The workspace is a shared filesystem where Experts read and write files. Unlike message history, the workspace persists across Expert boundaries β this is how Experts exchange complex data.
How you organize workspace files is up to you. The runtime reserves perstack/ for execution history β see Runtime for details.
Whatβs next
Ready to build Experts? See the Making Experts guide:
- Making Experts β defining Experts in
perstack.toml - Best Practices β design guidelines for effective Experts
- Skills β adding MCP tools to your Experts