Skip to content
LogoLogo

Caps

Caps (Composable Agent Primitives) are reusable components that extend agents with behavior, knowledge, tools, and prompts.

Toolang supports four kinds of caps:

KindDescription
PsychePersistent instructions that shape agent behavior.
SkillTask-specific knowledge and guidance, optionally with supporting files.
ServiceExternal tools and services, with optional usage guidance.
PromptReusable 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:

FormDescription
InlineDefined directly in a .too program.
ReferencedReferenced from a .too program using remote sources.
ConfiguredReferenced through config.toml.
AuthoredStored 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:

ScopeDescription
RootShared across agents under the same Toolang root.
HomeAvailable to a specific agent.
HereDefined 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.