Skip to main content
Agents can run with different execution settings - timeouts, retries, and parallel processing.

Quick Start

1

Set Timeout

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
2

With Retries

const agent = new Agent({
  timeout: 30000,
  retries: 3,
  retryDelay: 1000
});

User Interaction Flow


Configuration Levels

// 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

OptionDefaultDescription
timeout60000Max time in ms
retries0Retry attempts
retryDelay1000Delay between retries
maxConcurrent5Parallel limit

API Reference

ExecutionConfig

Complete configuration options

Best Practices

Most tasks complete in 30-60 seconds.
Network calls and external APIs benefit from retries.
Too many parallel tasks can overwhelm resources.