CHEATSHEET · 01Snap Agentic AI · master cheatsheet
Tools
- ·Idempotent inputs. Same args twice = same result.
- ·Typed JSON outputs. additionalProperties: false.
- ·Description = what + when to call. Never how.
- ·Always have a 'finish' or no-tool-call exit.
- ·Three tools beat fifteen. Add only when a task demands it.
Loops
- ·MAX_STEPS is non-negotiable. First guardrail you write.
- ·Log ACT before dispatch — survives tool hangs.
- ·Append every model + tool message to history.
- ·ReAct = system prompt + parser, not a framework.
- ·Plan-then-execute beats reactive past 5 steps.
Memory
- ·Facts → SQL. Similarity → vector. Conversation → msgs[].
- ·Sliding window of last N turns solves most context bloat.
- ·Similarity floor 0.7-ish. Drop, don't pretend.
- ·Embed at ingest, not query. Cache embeddings.
Cost
- ·Per-session token budget. Cutoff at 90%, warn at 75%.
- ·Cheaper model for routing; expensive only for hard reasoning.
- ·Cache deterministic tool results.
- ·Prom metric for tokens; alert in dollars.
- ·tiktoken pre-call; r.usage post-call.
Safety
- ·Four layers: input filter, sandbox, output judge, audit log.
- ·Output judge runs on a SEPARATE model role.
- ·Docker: cap_drop:[ALL] + read_only + tmpfs.
- ·Audit JSONL append-only, hash-stamped.
- ·Adversarial inputs in CI, not in production.
Ship-list
- ·Tools have schemas, descriptions, idempotency.
- ·Loop has step cap, audit log, budget cutoff.
- ·Plan persisted to disk if > 5 steps.
- ·Vector store has similarity floor.
- ·Prometheus exposes tokens, requests, latency.
- ·Output guard is a different model.