Reference
Composables
Nuxt composables for durable agents, runs, automations, the workspace and the API client.
Use these in Nuxt app/ code; the layer auto-imports them. They are typed from your agents and
models and act in the current workspace.
useDurableAgent
const { agent, run, status, output, error, start, cancel, refresh } = useDurableAgent('support')
await start({ question: 'Where is my invoice?' }, { instructions: 'Answer in German.' })
Use useDurableAgent to load an agent and follow its latest run. Pass an ID or a slug from
server/agents/<slug>.md. Runs continue after the tab closes and pause for tool approvals.
When the selected agent or workspace changes, call refresh() from that event handler. Pass refs
or getters when you need the composable to read the current selection.
| Returns | Description |
|---|---|
agent | The agent record |
run | The latest run, updated live |
status | idle, queued, running, waiting, succeeded, failed or cancelled |
output | The run's text output so far |
error | A load or run error, or null |
start(payload, { instructions? }) | Starts a run; resolves once it is accepted |
cancel() | Cancels the current run |
refresh() | Reloads the agent |
useAgentRun
const { run, status, output, error, follow, cancel, stop } = useAgentRun(agentId, runId)
function selectRun(runId: string) {
void follow({ agentId: 42, runId })
}
Use useAgentRun to follow a run by ID, including one opened from ?run=<id>. Call
follow({ agentId, runId }) when a user selects another run. stop() closes the event stream
without cancelling the run; cancel() requests cancellation. Unmounting also closes the stream.
useAutomation
const { automation, runs, error, run, refresh, refreshRuns } = useAutomation(automationId)
await run({ record: { model: 'customer', id: 42 } })
Loads an automation and its 20 most recent runs. run(payload) starts it now.
Call refresh() after changing the selected automation or workspace in an event handler; it
reloads both the automation and its recent runs. refreshRuns() reloads only its history.
useWorkspace
const workspace = useWorkspace() // Ref<string>, default 'personal'
The workspace your own pages act in, stored in the agentic-workspace cookie. Set it to a team
workspace ID in your selection handler, then explicitly refresh the data your page uses:
const { refresh } = useDurableAgent('support')
async function selectWorkspace(id: string) {
workspace.value = id
await refresh()
}
useAgenticClient
const client = useAgenticClient()
const customers = await client('/api/agentic/models/customer', { query: { search: 'acme' } })
A typed $fetch for the Agentic API. It sends the X-Agentic-Workspace header and forwards the
session cookie during SSR.
useAgent (free module)
useAgent(name) from @nuxtagentic/nuxt runs an agent inside one request and streams its steps.
Under Pro it requires a signed-in user. See Free module.