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

# Long Running Calls

> Configure timeouts for long-running converse requests.

Some converse calls may take longer to complete, especially when processing large files, complex prompts, or when the agent performs extensive tool use. By default, SDK requests timeout after 30 minutes. For long-running operations, you can increase the timeout to accommodate these scenarios.

## Configuring Timeouts

Both the [Python](https://github.com/DatagridAI/datagrid-python) and [TypeScript/JavaScript](https://github.com/DatagridAI/datagrid-node) SDKs allow you to configure request timeouts at the client level or per-request.

### Client-Level Configuration

Set a default timeout for all requests when initializing the client:

```python Python theme={null}
from datagrid_ai import Datagrid

# Configure the default timeout for all requests (1 hour)
client = Datagrid(
    timeout=60.0 * 60,  # 1 hour in seconds
)

response = client.converse(prompt="Analyze this large dataset")
```

```javascript JavaScript theme={null}
import Datagrid from "datagrid-ai";

// Configure the default timeout for all requests (1 hour)
const client = new Datagrid({
  timeout: 60 * 60 * 1000, // 1 hour in milliseconds
});

const response = await client.converse({ prompt: "Analyze this large dataset" });
```

### Per-Request Configuration

Override the timeout for individual requests:

```python Python theme={null}
from datagrid_ai import Datagrid

client = Datagrid()

# Override timeout for a specific request (1 hour)
response = client.with_options(timeout=60.0 * 60).converse(
    prompt="Process this complex task",
)
```

```javascript JavaScript theme={null}
import Datagrid from "datagrid-ai";

const client = new Datagrid();

// Override timeout for a specific request (1 hour)
const response = await client.converse(
  { prompt: "Process this complex task" },
  { timeout: 60 * 60 * 1000 }
);
```

## Orchestrator turns

A turn in [orchestrator mode](https://developers.datagrid.com/api-reference/converse/modes.md#agent-routing-agent_routing) can run for several minutes. The orchestrator hands work to specialist agents, and each delegation is a full agent run of its own. Several can run in sequence or in parallel before the orchestrator writes its answer.

What bounds a specialist's run depends on the runtime:

| Runtime | Limits on delegation |
| - | - |
| `magpie-2.5` | Up to 8 delegations per turn. A specialist that produces no output for 230 seconds is stopped and reported with `status: "timed_out"`. |
| `magpie-3.0` | No limit on the number of delegations and no wall-clock limit per delegation. A specialist that produces no output for 4 minutes is stopped. |

These are idle limits, not caps on total duration: a specialist that keeps producing output keeps running, so the turn as a whole has no fixed upper bound.

For orchestrator turns:

* **Stream the response** with `stream: true`. The `start` event arrives as soon as the turn begins, and a [`delegation` event](./streaming#delegation-events) arrives as each specialist starts and finishes, so you can show progress instead of waiting on a silent connection.
* **Keep the SDK timeout at or above the 30 minute default.** Lowering it for orchestrator turns ends the request while specialists are still working.
* **Treat a client timeout as a cancel, not a failure to retry blindly.** Closing the connection cancels the turn and any specialists still running. Credits for work that already ran are still consumed, so an automatic retry pays for the delegations again. Raise the timeout and stream instead.


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