अंतर्निहित सीमाएँ मिलाएँ
status: "stopped" वाली run लौटाती है।
उपलब्ध हेल्पर
कस्टम शर्त जोड़ें
Conditionfalse, true या reason string लौटा सकती है:
Documentation Index
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
Agent work को steps, tokens, cost, duration, tool calls या 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" वाली run लौटाती है।
| सहायक फ़ंक्शन | कब रुकता है |
|---|---|
stepCountIs(limit) | Completed step count limit तक पहुँच जाए |
maxTokensUsed(limit) | Cumulative token usage limit तक पहुँच जाए |
maxCost(limit) | Reported cumulative cost limit तक पहुँच जाए |
maxDuration(ms) | Elapsed runtime duration तक पहुँच जाए |
hasToolCall(name) | किसी step में दिया गया tool call मौजूद हो |
finishReasonIs(reason) | Model step finish reason बताए |
false, true या reason string लौटा सकती है:
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],
});
वाज़ दिस पेज हेल्पफुल