AIAction

View as MarkdownOpen in Claude

Returned from call.ai(). Tracks an active AI agent session on the call. Terminal states: finished, error.

AI sessions typically end when the call ends or when explicitly stopped. The terminal event may not carry a standard state field like other actions.

Inherits all properties and methods from the base Action interface (controlId, isDone, completed, result, wait()).

Properties

No additional properties beyond the base Action interface.

Methods

Example

import { RelayClient } from '@signalwire/sdk';
const client = new RelayClient({
project: process.env.SIGNALWIRE_PROJECT_ID!,
token: process.env.SIGNALWIRE_API_TOKEN!,
contexts: ['default']
});
client.onCall(async (call) => {
await call.answer();
const action = await call.ai({
prompt: { text: 'You are a helpful assistant.' },
aiParams: { temperature: 0.7 },
});
// Wait for it to complete naturally
const event = await action.wait();
});
await client.run();