Skip to content

Capabilities

Markdown

A capability is a typed function the model may propose. The bundle declares it; your code implements it.

capabilities:
- method: send_warning
risk: dangerous
approval: human
params_schema:
type: object
properties:
message: { type: string }
required: [message]
additionalProperties: false
handler: "budget_actions:send_warning"
workspace: true
Field What it does
method The name the model proposes.
params_schema JSON Schema the params must match before anything runs.
risk read_only, mutating or dangerous. dangerous allows only human or deny.
approval auto, parent, human or deny.
condition Optional CEL over measures, the proposal and the caller.
handler module:function that implements it. Without one, every proposal is refused.
workspace Give the handler a folder Loom made, instead of letting anyone choose a path.
returns Optional JSON Schema for the result.

Loom calls the handler with the validated params as keyword arguments, plus workspace when the capability asks for one. Return something JSON-serializable: it is recorded as the outcome.

budget_actions.py
from pathlib import Path
def send_warning(*, message: str, workspace: Path) -> dict:
target = workspace / "warning.txt"
target.write_text(message)
return {"path": str(target)}

The model never chooses where a handler writes. A handler is still your code, though: it can open any path its process can, so keep it narrow.

Conditions read measures as m.*, the proposal as action.*, and the caller as actor.*:

condition: "m.disk_pct_avg > 95 && action.params.confirm == true && actor.roles.exists(r, r == 'sre')"

See Safety pipeline for the order these checks run in.