KyroKyro
API Reference

@kyro/actor

Full API reference for the Actor class, connections, and related types.

Actor

new Actor(personalityPath: string, provider: AIProvider)
ParameterTypeDescription
personalityPathstringPath to the personality YAML file
providerAIProviderAI provider for generating actor messages

.run(scenarioPath, connection)

Run the actor scenario against a connection.

async run(
  scenarioPath: string,
  connection: Connection
): Promise<Transcript>

Connection interface

interface Connection {
  send(message: string): Promise<void>;
  waitForMessage(): Promise<string>;
  close(): Promise<void>;
}

WebSocketConnection

new WebSocketConnection(url: string, options?: WebSocketOptions)
interface WebSocketOptions {
  timeout?: number;       // Message wait timeout in ms (default: 30000)
  reconnect?: boolean;    // Auto-reconnect on disconnect (default: false)
}

LangChainConnection

new LangChainConnection(runnable: Runnable, options?: LangChainOptions)

Requires @langchain/core as a peer dependency.

Transcript

interface Transcript {
  messages: Array<{
    role: 'actor' | 'agent';
    content: string;
    timestamp: Date;
  }>;
  turns: number;
  completed: boolean;
  success: boolean;
  exitReason: 'success' | 'failure' | 'exit_condition' | 'max_turns';
  durationMs: number;
}

On this page