Skip to content

Function: createAgent()

Prefactor TypeScript SDK


Prefactor TypeScript SDK / @prefactor/openclaw-prefactor-plugin / createAgent

createAgent(config, logger): Agent

Defined in: packages/openclaw-prefactor-plugin/src/agent.ts:873

Creates and returns a fully initialised Agent instance.

On construction the Agent starts a background flush loop (every 30 s) that retries any previously failed network operations. No immediate network calls are made; the first API request occurs when a span is created or an AgentInstance is registered for a session.

AgentConfig

AgentConfig with API URL, token, agent ID, and optional retry/timeout settings.

Logger

Logger instance for structured diagnostic output.

Agent

A new Agent ready to manage sessions and spans.