Runtime

Delegate an Agent turn to a registered runtime.

runtime hands the whole turn to a registered runtime instead of running the local chat loop.

Diagram

no

yes

🤖 Agent

⚙️ resolve runtime

capabilities ok?

❌ throws

▶️ run turn on runtime

Quick Start

  1. Use the builtin runtime
    typescript
    import { Agent } from 'praisonai';
    
    const agent = new Agent({ instructions: 'Delegated', runtime: true });
    await agent.chat('Do the work');

    runtime: true selects DEFAULT_RUNTIME_ID ('praisonai').

  2. Name a runtime and require capabilities
    typescript
    import { Agent } from 'praisonai';
    
    const agent = new Agent({
      instructions: 'Streamed',
      runtime: { runtime: 'praisonai', requiredCapabilities: ['streaming'] },
    });

AgentRuntimeConfig

FieldTypeNotes
runtimestringRuntime id. Defaults to DEFAULT_RUNTIME_ID ('praisonai').
requiredCapabilitiesstring[]Checked before the agent is built; a missing capability throws.
configOverridesRecord<string, unknown>Runtime-specific options forwarded on every turn.
metadataRecord<string, unknown>Free-form metadata.

runtime accepts true, a string id, an AgentRuntimeConfig object (snake_case keys accepted), or an object that already satisfies AgentRuntimeProtocol.

When it throws

runtime and backend / runOn answer the same question — where the loop runs — so naming both is rejected as a contradiction.

Reading the resolved runtime

typescript
import { Agent } from 'praisonai';

const agent = new Agent({ instructions: 'x', runtime: true });
console.log(agent.getRuntime()); // the resolved runtime, or undefined

Related