Hi Qingyu! 
First off — we absolutely love Truman World.
The “director, not scriptwriter” framing (intervene by creating conditions, not commands) is exactly the kind of emergent, non-chatbot-primary experience we hoped people would build on Anna. The architecture you sketched (Executa world engine + sampling for cognition + SKILL.md director coach + custom bundle panel) maps onto the platform so naturally it almost feels like the platform was designed for it. This is genuinely one of the most exciting porting projects we’ve seen on this forum.
And let us say this upfront: we’d love to actively support you through the entire launch
— architecture/manifest reviews, debugging help during the hackathon, fast-tracked answers here on the forum, and yes, platform-level upgrades where Truman World hits a real limitation. Several recent platform features (token renewal, responseFormat — see below) came directly from developer threads like this one. If your sim needs something the platform doesn’t do yet, tell us — multi-agent simulation is a direction we want the platform to grow toward, and you’re the perfect design partner for it. 
Now, your questions one by one:
1. Sampling stability 
Q1 (token expiry / retry) —
Solved. Token expiry inside long invokes was a real bug and it’s fixed end-to-end with automatic token renewal:
- The host now proactively renews the sampling token when it has <90s of life left, and reactively renews + retries once if a call hits
SAMPLING_TOKEN_EXPIRED.
- This is entirely host-side — your plugin doesn’t need any token-handling code. You should never see expiry errors anymore, even in invokes that make many sequential sampling calls.
- Recommended plugin-side retry: only retry on
-32003 (provider error) / -32005 (timeout) with bounded backoff (e.g. 2 attempts). Don’t retry -32001/-32002/-32006/-32007 — those are auth/quota and won’t heal.
Q2 (hackathon stability) —
Solved, with a caveat. The two root causes behind the “sampling unstable” reports (#83) — missing token minting on the iframe tools.invoke path, and the expiry issue above — are both fixed in the current runtime. That said, your rule-based fallback is still a great idea
— not for platform stability, but because users can decline the sampling grant or hit their quota. Graceful degradation to rule-based actions makes your sim resilient and demos well. (And if you hit any sampling flakiness during the hackathon, ping us directly — we’ll prioritize it.)
Q3 (JSON Schema / response_format) —
Shipped!
This was forum request #63 and it’s live — a perfect example of forum-driven platform upgrades. sampling/createMessage now accepts an optional responseFormat:
{
"responseFormat": {
"type": "json_schema",
"json_schema": {
"name": "agent_action",
"strict": true,
"schema": { "type": "object", "properties": { "action": {"type": "string"} }, "required": ["action"], "additionalProperties": false }
}
},
"onUnsupported": "json_object"
}
- L1
json_object (JSON mode, broadly compatible) and L2 json_schema (strict schema).
- Capability negotiation instead of silent downgrade: if the selected model doesn’t support the requested level you get an explicit
-32010, unless you opt into onUnsupported: "json_object" / "text".
- The response is still
content.text (parse it yourself); the host adds _meta.responseFormat.structuredValid so you know whether it parsed.
- Schema limits: ≤32KB serialized, depth ≤8, ≤512 nodes.
- Supported in all three SDKs (Python/Node/Go) and the local
anna-app dev harness (CLI ≥ v0.1.29 includes structured-output emulation, plus a flag to simulate an unsupported model so you can test your fallback branches locally).
For structured agent actions this should remove your prompt-only retry overhead entirely. Perfect timing for your use case! 
2. UI Bundle & CSP 
Q4 — Here’s the full default CSP for bundle iframes (the iframe runs with an opaque origin, so 'self' means the bundle’s own origin):
| Directive |
Default |
default-src |
'none' |
script-src |
'self' |
style-src |
'self' 'unsafe-inline' |
img-src |
'self' data: blob: |
font-src |
'self' data: |
media-src |
'self' blob: |
connect-src |
'self' |
worker-src |
'self' blob: |
frame-ancestors |
'self' |
base-uri / form-action |
'self' |
Overridable via ui.csp_overrides: connect-src, img-src, media-src, font-src, style-src, script-src. (frame-src/child-src are not overridable — nested iframes aren’t supported by design.) Also note: declaring ui.host_api.image or upload auto-injects the object-storage origins into img-src/connect-src for you.
Q5 (CDN libs) — possible, but vendor locally instead. external_origins auto-extends connect-src + img-src (data fetching / images), and you can whitelist a CDN in script-src via csp_overrides (https-only, no wildcards). But our strong recommendation: bundle Phaser/Chart.js locally. The bundle limit is generous (see Q7), local assets are faster, work offline, and make review much smoother. 
Q6 (canvas / WebGL / Workers) —
all supported. The bundle is a real iframe — <canvas> 2D and WebGL just work, Web Workers are allowed by the default CSP (worker-src 'self' blob:), and even WASM is an allowed content type. A 2D canvas world view sounds perfect for Truman World — go for it! 
Q7 (size limits) — current limits:
- Bundle: 50 MB total, 2,000 files, 10 MB per file.
- KV storage (
storage/*): 256 KB per value — so don’t store the whole world state in one key. Shard it: world:meta, tick:{n}, agent:{id}:state. Tick-per-key also gives you free timeline scrubbing. 
- Larger blobs: the storage files API handles multi-MB payloads (init/finalize upload flow) — good for full world-state snapshots/exports.
- Stdio frames between host and plugin auto-switch to file transport above 512 KB, so big invoke results won’t break, but keeping per-invoke payloads lean (send tick deltas to the UI, not full state) is the best practice.
…and if your world state outgrows these limits in practice, that’s exactly the kind of platform-level adaptation we’re open to discussing. Tell us what you need. 
3. Multi-agent tick architecture 
Q8 — recommended: (a) one invoke per tick, with the internal per-agent loop. This is now the sweet spot because:
- Token renewal (Q1) removed the long-invoke failure mode.
- Each invoke has a sampling budget of
max_calls (default 8) sequential LLM calls — 5 agents/tick fits comfortably. Going much above that per invoke, split into batches. (If Truman World eventually needs more agents per tick, raising this budget for your use case is a conversation we’re happy to have — this is precisely the “platform upgrade” territory we mean.
)
- One tick = one invoke also gives you atomic state transitions: read state → 5 decisions → resolve → write state with etag (use the storage etag for optimistic concurrency).
(c) agent.session with streaming is great for the director chat layer (narrating what happened, suggesting interventions), but for deterministic tick resolution the explicit per-tick invoke keeps you in control.
Q9 — drive the loop from the bundle, not the plugin. Plugin work doesn’t survive beyond an invoke (by design — no cron yet, and a background sim burning sampling quota unattended isn’t something we’d auto-grant
). The pattern that works beautifully:
// bundle/app.js — director console
async function runTicks(n) {
for (let i = 0; i < n && !paused; i++) {
const result = await anna.tools.invoke(TOOL_ID, "advance_tick", { ticks: 1 });
renderTick(result); // stream progress into the world view
await sleep(300); // pacing, keeps UI responsive
}
}
The iframe is alive the whole session, so “run 20 ticks” is just a JS loop with play/pause — which doubles as your director console UX. Each tick renders as it lands, which honestly demos better than a fire-and-forget batch.
Longer-horizon “background simulation” is on our radar as a future platform capability — your use case is a strong data point for prioritizing it.
4. Tool IDs & local dev 
Q10 —
Yes, exactly as you hoped. During anna-app dev the tool_id in your local executa.json is just a local identifier — pick anything (truman-sim is fine). Dev mode auto-registers the executa with your account (with sampling/image/upload dev grants seeded automatically), so login → dev works end-to-end with zero pre-minting. You mint the real tool-{handle}-{slug}-{uniq} ID only when you publish.
Q11 — you’ve got it right, and here’s the rule of thumb:
bundled:<handle> — for executas that ship inside your app repo (declared in app.json bundled_executas). At publish, the CLI auto-publishes them and substitutes real tool IDs into the manifest; it also emits a bundle/anna-tool-ids.js sidecar exposing window.__ANNA_TOOL_IDS__ so your bundle JS never hardcodes minted IDs. This resolution also runs in anna-app dev now, so dev and prod behave identically.
tool-{handle}-{slug}-{uniq} — only for referencing an already-published standalone executa (yours or someone else’s).
For Truman World: your world engine ships with the app → use bundled:truman-sim. One repo, one anna-app apps publish, done. 
5. References 
The closest existing pattern to “rich dashboard + persistent state + non-chatbot-primary” is Focus Flow (anna-app-focus-flow in the anna-executa-examples repo): custom bundle panel + bundled Python executa + KV-persisted session state + chat as a secondary control layer. Also worth a look:
anna-app-llm-demo — sampling patterns incl. multi-call chains (very relevant for your tick loop)
anna-app-executa-showcase — broad host-API coverage
anna-app-aps-files-demo — files/storage patterns for bigger payloads
You’d honestly be pushing this pattern further than anything published so far — which is exactly why we’re so excited about it. Truman World launching on Anna would set the bar for what a “rich sim” app looks like on the platform. 
TL;DR
| # |
Status |
| Q1 token expiry |
Fixed — automatic host-side renewal |
| Q2 sampling stability |
Fixed — keep rule-based fallback for grants/quota |
| Q3 response_format |
Shipped — json_object + json_schema + local emulation |
| Q4 CSP |
Full policy above |
| Q5 CDN libs |
Possible via overrides — vendor locally instead |
| Q6 canvas/WebGL/Workers |
Supported |
| Q7 limits |
50MB bundle / 256KB per KV value — shard state per tick/agent |
| Q8 tick arch |
One invoke per tick, ≤8 sampling calls each |
| Q9 N-tick runs |
Bundle-driven loop = your director console |
| Q10 dev IDs |
Local IDs fine, mint at publish |
| Q11 bundled: vs tool- |
bundled: for in-repo, tool-… for published |
| Q12 references |
Focus Flow + examples repo |
One more time because we mean it: we really want Truman World on Anna, and we’ll be hands-on in getting it there — design review before submission, debugging during the hackathon, and platform-side changes where the sim genuinely needs them (sampling budgets, state limits, longer-horizon execution — all on the table). Share the repo whenever you’re ready and let’s make this happen. Can’t wait to direct some Truman World agents ourselves! 
