Runtime Primitives
Primitives are functions callable from inside execute_code (PyRepl) as runtime.<namespace>.<name>(...). They let tools access agent-level capabilities without breaking the tool boundary.
Concepts
Built-in: SelfRef Pack
The framework ships with one built-in pack — selfref — providing 6 primitives:
Creating a Custom Pack
1. Define a Backend
2. Define Primitives
Primitive docstrings must include a Best Practices section. Registration fails without it.
3. Build the Pack
4. Install in PyRepl
Now the model can call:
Discoverability
The model discovers primitives through built-in meta-primitives:
The spec includes parameter descriptions, return type, and best practices — enough for the model to use the primitive correctly without prior training.
PrimitiveCallContext
Every primitive handler receives a context object:
Use ctx.event_emitter to stream progress from long-running primitives.
→ API Reference: Runtime