Documentation IndexFetch the complete documentation index at: /docs/llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
Bound agent work by steps, tokens, cost, duration, tool calls, or finish reason.
import { maxCost, maxDuration, maxTokensUsed, stepCountIs, } from "@phaseo/agent-sdk"; const agent = createAgent({ id: "bounded-research", stopWhen: [ stepCountIs(12), maxTokensUsed(40_000), maxCost(2), maxDuration(60_000), ], });
status: "stopped"
stepCountIs(limit)
maxTokensUsed(limit)
maxCost(limit)
maxDuration(ms)
hasToolCall(name)
finishReasonIs(reason)
false
true
const stopAfterRepeatedFailures = ({ steps }) => { const failures = steps.filter((step) => step.status === "failed").length; return failures >= 2 ? "repeated_failures" : false; }; const agent = createAgent({ id: "support-agent", stopWhen: [stepCountIs(10), stopAfterRepeatedFailures], });
Was this page helpful?