Tier 3 agent lifecycle — ratatoskr.tier3 module + CLI #15
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Worldtree Phase 2.0 ships Tier 3 — consumer-defined agents owned by the caller's
user_id, addressed as<user_id>:<agent_name>. The lifecycle endpoints are:POST/agents/defineDELETE/agents/<user_id>:<agent_name>PATCH/agents/<user_id>:<agent_name>system_promptand/ormodel.Ratatoskr's picker already handles Tier 3 agents generically per issue #8 (they appear in
GET /agentsif defined; the picker shows them like any other). What's missing: lifecycle management. Without a way to define / patch / delete Tier 3 agents from ratatoskr, the only Tier 3 flow operators can exercise is "use whatever Tier 3 agents already exist on the server" — which doesn't help observe how Tier 3 agents are HANDLED by the API.Live verification against personal Worldtree (v0.16.2):
Tier 3 is live; ratatoskr needs to expose it.
Solution
New module
src/ratatoskr/tier3.pyfollowing the same caller-owned-AsyncClient posture asratatoskr.sessions:Errors mirror
ratatoskr.sessionspatterns — exceptions with[:1024]body truncation:Tier3QuotaExceeded— 429agent_quota_exceeded(50-agent cap per Heimdall key).Tier3UserIdUnsupported— 403tier3_user_id_unsupported(non-slug user_id).Tier3FieldNotMutable— 422field_not_mutableon PATCH with an immutable key.Tier3LayerDeferred— 422layer_deferredifpersona/motivational/valence/memorycarry non-null.Tier3AgentNotFound— 404 (delete on non-existent / patch on non-existent).SessionApiFailed(reused from sessions) — other non-2xx responses.CLI entry point:
python -m ratatoskr.tier3 <subcommand>:Auth via the same env vars as the main ratatoskr CLI (
WORLDTREE_API_URL,WORLDTREE_API_KEY). No new flags; shareUSER_AGENTfromratatoskr.cli.Out of scope (this issue)
agent_quota_exceededbecomes a frequent pain.null. If a future Phase enables them, amend this module.agents.cascade_deleteevent visibility.:in id show with their full id like any other.Acceptance
docs/contracts/issues/15.contract.md(new module) drift-checks clean.uv run ruff check src/ tests/clean.python -m ratatoskr.tier3 define --name smoke-1 --system-prompt "..." --model qwen3.6-35-a3b→ 201 with agent_idratatoskr:smoke-1ratatoskr --new --agent ratatoskr:smoke-1→ picker fetches GET /agents (the new tier-3 agent should appear in the list), or--new --agent ratatoskr:smoke-1directly creates a sessionpython -m ratatoskr.tier3 delete ratatoskr:smoke-1→ 204Dependencies
ratatoskr.tui) — landed; picker already accepts colon-containing agent_ids.--end-user-id) — landed; Tier 3 session-create requiresend_user_id(same as lofn).docs/conversation-api-spec.md(v0.19.0 pin). No spec-pin refresh needed for this issue.Closed — shipped. ratatoskr.tier3 module + CLI implemented; tier3.py exposes define/patch/delete subcommands following the caller-owned-AsyncClient posture. Actively used to manage the Sindra Tier 3 agent (model migration + FORM ASSUMPTION patches). Tests in test_tier3.py + test_local_agents.py.