Caps
Caps (Composable Agent Primitives) are reusable components that extend agents with behavior, knowledge, tools, and prompts.
Toolang supports four kinds of caps:
| Kind | Description |
|---|---|
| Psyche | Persistent instructions that shape agent behavior. |
| Skill | Task-specific knowledge and guidance, optionally with supporting files. |
| Service | External tools and services, with optional usage guidance. |
| Prompt | Reusable input templates with parameters. |
Each kind is used differently at runtime:
- Psyches are included in system instructions for every model call while selected.
- Skills are discovered through descriptions, with full guidance loaded on demand.
- Services expose tools through MCP, with optional guidance loaded on demand.
- Prompts expand templates to prepare inputs for runnables.
Cap forms
Caps can be defined or introduced in four ways:
| Form | Description |
|---|---|
| Inline | Defined directly in a .too program. |
| Referenced | Referenced from a .too program using remote sources. |
| Configured | Referenced through config.toml. |
| Authored | Stored as Markdown files in an agent's filesystem. |
These forms allow caps to be defined alongside runnables, shared across programs, or maintained independently.
Scope and resolution
Caps are available at three scopes:
| Scope | Description |
|---|---|
| Root | Shared across agents under the same Toolang root. |
| Home | Available to a specific agent. |
| Here | Defined or attached to the current source. |
Caps are identified by kind and name, such as skill/review. When multiple caps share the same identity, Toolang resolves them in this order:
here → home → root
Using caps
An agic can use directives to select which caps take effect, controlling how model calls are composed and inputs are processed.
For example:
psyche concise:
Prefer short, direct answers.
agic explain(_) -> Text:
psyches = psyche/concise
Explain {{_}}.The explain agic uses only the concise psyche, excluding other psyches. Since no skills directive is specified, all available skills remain discoverable and can be loaded on demand.
By default, each cap kind is unrestricted unless the agic explicitly selects a subset through its directives.
Runtime configuration and CLI options define which caps are allowed. Agic directives can select from these allowed caps but cannot expand beyond them.
See Extend agents with caps for creating and managing caps, and File formats for their definitions.