Chat Options

Per-call options for Agent.chat: attachments, reasoning, task metadata.

AgentChatOptions is the optional second argument to agent.chat() — settings that apply to one turn only.

Diagram

💬 prompt

⚙️ chat options

🤖 Agent turn

Response

Quick Start

typescript
import { Agent } from 'praisonai';

const agent = new Agent({ instructions: 'You are helpful' });
await agent.chat('Summarise this', { reasoningSteps: true });

Options

OptionTypeNotes
attachmentsreadonly string[]Image paths, http(s):// or data: URIs. Images only; other inputs warn-and-skip. Ephemeral (never enters history).
reasoningStepsbooleanForces a single non-streaming completion; beats agent.stream and per-call stream: true.
taskNamestringMerged into agent_start / agent_complete hook contexts; read via agent.getTaskContext().
taskDescriptionstringAs taskName.
taskIdstringAs taskName.
configRecord<string, unknown>Forwarded verbatim to a managed backend’s execute().
errorsAsNullbooleanchat() only (AgentChatCallOptions). Resolve with null instead of rejecting; widens the return to `Promise<string \null>`.

Examples

typescript
import { Agent } from 'praisonai';

const agent = new Agent({ instructions: 'Describe and reason' });

// attachments — an image for this turn only
await agent.chat('What is in this picture?', {
  attachments: ['./photo.png', 'https://example.com/chart.png'],
});

// reasoningSteps — one non-streaming reasoning completion
await agent.chat('Prove that sqrt(2) is irrational', { reasoningSteps: true });

// task metadata — travels on the hook contexts, readable afterwards
await agent.chat('Ingest the file', {
  taskName: 'ingest',
  taskDescription: 'load the CSV',
  taskId: 'run-42',
});
console.log(agent.getTaskContext()); // { name: 'ingest', description: 'load the CSV', id: 'run-42' }

// config — forwarded to a managed backend's execute()
await agent.chat('Run this remotely', { config: { region: 'eu-west-1' } });

Related