Tool Config
Govern how a single tool call runs: timeout, retries, output limits.
toolConfig governs how each tool call runs — a timeout, a retry policy, output truncation, and where unknown tool names are resolved.
graph LR
C[🔧 tool call] --> T{timeout?}
T -->|exceeded| F[⏱️ timed out after Ns]
T -->|ok| R{retry policy?}
R -->|error| B[🔁 backoff & retry]
R -->|success| O[✂️ truncate output]
classDef call fill:#8B0000,stroke:#7C90A0,color:#fff
classDef step fill:#189AB4,stroke:#7C90A0,color:#fff
class C call
class T,R,B,O,F stepQuick Start
- Cap a tool and retry it
typescript import { Agent } from 'praisonai'; const agent = new Agent({ instructions: 'Use tools', tools: [search], toolConfig: { timeout: 10, retryPolicy: { maxAttempts: 3, initialDelay: 1, backoffFactor: 2, maxDelay: 30 }, }, }); - Use the defaults
typescript const agent = new Agent({ instructions: 'x', tools: [search], toolConfig: true });
Fields
| Field | Type | Default | Effect | ||
|---|---|---|---|---|---|
timeout | number | none | Seconds a tool may run. On exceed the tool result is Tool "<name>" timed out after Ns. | ||
retryPolicy | { maxAttempts, initialDelay, backoffFactor, maxDelay } | none | Exponential backoff between attempts. Defaults: 3 / 1 / 2 / 30. | ||
outputLimit | number | 16000 | Maximum bytes of tool output kept; extra is dropped with [... N bytes truncated ...]. | ||
outputDirection | `’head’ \ | ‘tail’ \ | ‘both’` | 'both' | Which end(s) survive truncation. |
allowGlobalTools | boolean | false | Resolve a tool name missing from the agent’s tools via the process-global registry (lazily loaded). | ||
parallel | boolean | not set | Run a round’s tool calls concurrently. Forwarded as parallel_tool_calls on the OpenAI-compatible backend; the AI SDK backend emits a notice (partial). |
Observable effects
import { Agent } from 'praisonai';
const slow = () => new Promise((r) => setTimeout(() => r('done'), 60_000));
const agent = new Agent({
instructions: 'Use the slow tool',
tools: [slow],
toolConfig: { timeout: 2, outputLimit: 500, outputDirection: 'tail' },
});
// The slow tool's result becomes: Tool "slow" timed out after 2s