> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 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.

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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 step
```

## Quick Start

**1. Cap a tool and retry it**

```typescript theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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 },
  },
});
```

**2. Use the defaults**

```typescript theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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

```typescript theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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
```

> [!WARNING]
>
> Invalid values throw at construction:
>
> ```text theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
> Error: toolConfig.outputDirection must be "head", "tail" or "both" (got "...")
> Error: toolConfig.timeout must be a positive number of seconds
> Error: toolConfig.outputLimit must be positive
> ```

## Related

> [card] [Agent](https://praison.ai/docs/js/agent.md)
>
> Constructor options

> [card] [Tools](https://praison.ai/docs/js/tools.md)
>
> Custom tools


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.