Skip to content

Function: recoverAgent()

Makaio Framework


Makaio Framework / services-core / recoverAgent

recoverAgent(bus, deadAgent, recoveryConfig): Promise<{ adapterId: string; adapterName: string; adapterSessionId?: string; agentId: string; clientId?: string; compressionMode?: "manual" | "auto" | "off"; createdAt: number; cwd?: string; harnessId?: string; lastActivityAt: number; model?: string; personaId?: string; profileId?: string; providerConfigId?: string; role: "lead" | "member"; sessionId: string; status: "active" | "idle" | "dead" | "disposed"; }>

Defined in: ../../../packages/services/core/src/session/utils/agent-recovery.ts:197

Recover a dead agent by triggering connector swap via the adapter. The agent keeps its identity — no session mutation needed.

Context delivery happens via the normal sendMessage path that follows recovery (same handler invocation). No staging needed.

IMakaioBus

Bus instance

The dead agent to recover

string = ...

Adapter instance that owns this agent

string = ...

Adapter type name (e.g., ‘claude-code’, ‘copilot’)

string = ...

Provider’s session ID for native resume support

string = ...

Unique agent execution unit ID (stable across connector swaps and restarts)

string = ...

Client identifier for the client application this agent runs under (e.g., ‘claude-code’, ‘codex’). Omit for API-only adapters.

"manual" | "auto" | "off" = ...

Compression mode for session context management.

number = ...

Timestamp when agent was created (= when added to session)

string = ...

Current working directory

string = ...

Resolved harness ID for this agent.

number = ...

Timestamp of last activity (message sent/received)

string = ...

Current model identifier

string = ...

Persona used to configure this agent (if any).

string = ...

Profile used to configure this agent (if any).

string = ...

Provider config UUID for credential/endpoint resolution

"lead" | "member" = AgentRoleSchema

Agent’s role in the session

string = ...

Makaio session this agent belongs to

"active" | "idle" | "dead" | "disposed" = AgentStatusSchema

Agent lifecycle status

RecoveryConfig

Configuration for the recovered connector

Promise<{ adapterId: string; adapterName: string; adapterSessionId?: string; agentId: string; clientId?: string; compressionMode?: "manual" | "auto" | "off"; createdAt: number; cwd?: string; harnessId?: string; lastActivityAt: number; model?: string; personaId?: string; profileId?: string; providerConfigId?: string; role: "lead" | "member"; sessionId: string; status: "active" | "idle" | "dead" | "disposed"; }>

Same agent reference — identity preserved