Threads
A thread is an isolated context. Calls to the same thread share full history; calls to different threads share nothing. Underneath, the runtime manages a separate agent instance per thread — spun up on demand, context loaded, entirely behind the scenes.
This is the tool for structuring multi-step work: once you can address more than one context, you can compose any workflow — agent A researches while agent B audits, and their results meet in a third.
The default: one shared context
Calls with no thread share the script's own context automatically. The agent carries
history across them with no management from you:
const r1 = await axon.request("what's the current sprint status?")
const r2 = await axon.request("which issues are blocking the release?")
const r3 = await axon.request("draft a status update for the team")
// the agent sees r1 and r2 when producing r3
For a script doing one coherent piece of work, this is all you need.
Side threads: isolate the noisy work
Pass a thread name to run a sub-task in private. The side thread has no context from
the main conversation, and the main conversation never sees the side thread's working:
const research = await axon.request({
prompt: "analyse the error in this stack trace: ...",
thread: "sentry-debug",
})
// bring back only the conclusion
await axon.request(
`debug analysis found: ${research.text}. incorporate this into the review.`
)
Use this for anything that would pollute the main context — research, debugging, digesting
reference material. Fifty entries of stack-trace spelunking stay in sentry-debug; one
conclusion crosses over, because you injected it.
Parallel branches
Threads are independent agents, so independent work runs concurrently:
const [security, perf] = await Promise.all([
axon.request({ prompt: "audit for security vulnerabilities", thread: "audit-security" }),
axon.request({ prompt: "profile hot paths for bottlenecks", thread: "audit-perf" }),
])
const summary = await axon.request(
`two audits completed.\n\nSecurity: ${security.text}\n\nPerformance: ${perf.text}\n\n` +
`Write an executive summary with prioritised recommendations.`
)
Each branch runs a full agent loop. The synthesis call sees only what you inject — results cross thread boundaries through prompts, never implicitly.
Named threads persist
A thread name is stable: any later call with the same name continues the same
conversation, including across script runs. "project-alpha" on Monday is still
"project-alpha" on Tuesday, full history intact. Keep names specific enough not to
collide with unrelated work.
What a thread is not
Not a record of external events. A webhook's issue content goes in the prompt; the thread holds the agent's reasoning about it.
Not a global log. Twenty threads on twenty topics isn't one tangled context — it's twenty clean ones. That's the point.
Next: Routes & Hooks — letting the world trigger your agent.