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

# Execution

> Control how agents run

Agents can run with different execution settings - timeouts, retries, and parallel processing.

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
graph LR
    subgraph "Execution Control"
        A[📋 Task] --> B{Mode?}
        B -->|Sequential| C[➡️ One by One]
        B -->|Parallel| D[⚡ All at Once]
        B -->|Retry| E[🔄 Auto Retry]
    end

    classDef agent fill:#8B0000,stroke:#7C90A0,color:#fff
    classDef tool fill:#189AB4,stroke:#7C90A0,color:#fff
    class B agent
    class A,C,D,E tool
    classDef agent fill:#8B0000,color:#fff
    classDef tool fill:#189AB4,color:#fff

```

## Quick Start

<Steps>
  <Step title="Simple Usage">
    ```typescript theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    import { Agent } from 'praisonai';

    const agent = new Agent({
      instructions: 'You complete tasks',
      timeout: 30000  // 30 seconds max
    });

    await agent.chat('Analyze this document');
    // Times out after 30 seconds if not complete
    ```
  </Step>

  <Step title="With Configuration">
    ```typescript theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    const agent = new Agent({
      timeout: 30000,
      retries: 3,
      retryDelay: 1000
    });
    ```
  </Step>
</Steps>

***

## User Interaction Flow

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
sequenceDiagram
    participant User
    participant Agent
    participant System
    
    User->>Agent: "Process this"
    Agent->>System: Execute
    alt Timeout
        System-->>Agent: Timeout
        Agent->>System: Retry
    end
    System-->>Agent: Complete
    Agent-->>User: Result
```

***

## Configuration Levels

```typescript theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
// Level 1: Number - Simple timeout
const agent = new Agent({
  timeout: 30000
});

// Level 2: Dict - Multiple options
const agent = new Agent({
  execution: {
    timeout: 30000,
    retries: 3,
    retryDelay: 1000
  }
});

// Level 3: Instance - Full control
const agent = new Agent({
  execution: {
    timeout: 60000,
    retries: 5,
    retryDelay: 2000,
    maxConcurrent: 3,
    onRetry: (attempt) => console.log(`Retry ${attempt}`)
  }
});
```

***

## Execution Options

| Option          | Default | Description           |
| --------------- | ------- | --------------------- |
| `timeout`       | `60000` | Max time in ms        |
| `retries`       | `0`     | Retry attempts        |
| `retryDelay`    | `1000`  | Delay between retries |
| `maxConcurrent` | `5`     | Parallel limit        |

***

## API Reference

<Card title="ExecutionConfig" icon="code" href="/docs/sdk/reference/typescript/classes/ExecutionConfig">
  Complete configuration options
</Card>

***

## Best Practices

<AccordionGroup>
  <Accordion title="Set reasonable timeouts">
    Most tasks complete in 30-60 seconds.
  </Accordion>

  <Accordion title="Use retries for flaky operations">
    Network calls and external APIs benefit from retries.
  </Accordion>

  <Accordion title="Limit concurrency">
    Too many parallel tasks can overwhelm resources.
  </Accordion>
</AccordionGroup>

***

## Related

<CardGroup cols={2}>
  <Card title="Workflows" icon="diagram-project" href="/docs/js/workflows">
    Multi-step workflows
  </Card>

  <Card title="Failover" icon="arrows-rotate" href="/docs/js/failover">
    Automatic backup
  </Card>
</CardGroup>
