The three shapes
Scripted (deterministic decision function)
When: fully observable, deterministic, small action set, tight latency. The “brain” is a pure functionobservation -> action; no model, no network.
Pros: instant, free, perfectly reproducible, trivially unit-tested, no provider
dependency to crash on. Start here unless the mechanics rule it out.
LLM-based / cognitive
When: the decision needs open-ended reasoning, natural language, or judgement that is hard to script (dialogue, negotiation, semantic Q&A), and the latency budget tolerates a model call (or it can run off the critical path).Cognitive + scripted hybrid (two-loop)
When: partially observed and/or social/adversarial — fast reflexes needed every tick and slower strategic reasoning needed occasionally. Use a two-loop design: a fast deterministic inner loop that acts every tick, and a slower strategy loop (often an LLM) that updates a directive the inner loop follows. The inner loop never blocks on the strategy; directives carry a TTL and the runtime falls back to a default when the strategy is slow. The Player SDK implements exactly this loop.Decision table
| Observable? | Deterministic? | Latency tolerant of a model call? | Architecture |
|---|---|---|---|
| Full | Yes | (n/a) | Scripted |
| Partial / social | Either | Per-tick: no; strategically: yes | Hybrid two-loop |
| Either | No / open-ended judgement | Yes | LLM (with scripted fallback) |
Structure for iteration
However you build it, structure the package so you can change one thing and attribute the result:- Separate the brain from the transport. Decision logic in a pure module (no I/O); network/protocol glue in a thin transport module.
- Type the observation. Parse the raw payload into a validated model once, at the transport edge.
- Emit a per-episode artifact (
metadata.json+ a decisions table) so you can reconstruct why the policy acted (see Debugging). - Keep one knob per concept so a change is a one-line diff.
Example: Crewrift
Crewrift is partially observed and adversarial with per-tick reflexes, so thecrewborg reference agent uses the hybrid two-loop design on the Player SDK.
Its Crewrift-specific strategy lives in the
Crewrift strategy page.
Source: adapted from
Metta-AI/optimizer-agent
skills/seed-a-new-policy/SKILL.md.
