AI
Run AI agents that ask a human before the risky moves, resume after a crash without re-paying the model, and record what every call cost.
A model call is slow, expensive, and can fail halfway. ctx.step.ai makes it a durable step: the
call runs once, its result is recorded under the step id, and a retry after a crash returns the saved
result instead of paying for the model again.
New here? The Quickstart gets you a project, a key, and a connected runner in five steps. The AI quickstart picks up from there.
const { text } = await ctx.step.ai.generate("classify", {
model: "claude-opus-4-8",
prompt: `Classify this ticket: ${subject}`,
});result = await ctx.step.ai.generate("classify", GenerateOptions(
model="claude-opus-4-8",
prompt=f"Classify this ticket: {subject}",
))
result.textres, err := duraton.Generate(c, "classify", duraton.GenerateOptions{
Model: "claude-opus-4-8",
Prompt: "Classify this ticket: " + subject,
})
res.TextYour provider key stays with you
The model call happens in your runner, with your provider SDK and your key. Duraton records the
call's metadata (model, token counts, latency) and never receives your prompt, the response text, or
your API key: apiKey is passed per call into the provider client and is never persisted by the SDK
or sent to Duraton. Omit it and the provider SDK reads its conventional env var
(ANTHROPIC_API_KEY).
export ANTHROPIC_API_KEY="sk-ant-..."Where to go next
AI quickstart
Add your first durable AI step, trigger it, and watch spend land in the console.
AI agents
Durable agent loops, workflow tools, and the classic agent patterns made crash-safe.
Streaming
Stream tokens live from a durable step, replayable from token 0.
Approvals
Park a run on a human decision, then resume it from the checkpoint.
Cost controls
cap, budget, tokenThrottle, the inference cache, and fallback chains.
Evals
Score runs, grade them after the fact, fork-compare a change, and fan a dataset through a workflow.
Docs for AI assistants
Wire these docs into Claude, Cursor, and other tools over llms.txt or MCP.
step.ai reference
Every option and return shape for generate, wrap, embed, and loop.