Skip to main content

Function: spawnAgentWithRevival()

spawnAgentWithRevival(request, invoke, config?): Promise<string>

Defined in: chat/src/spawn-agent.ts:151

Spawn or revive a child agent with persistent conversation history

Parameters

request

SpawnAgentRevivalRequest

Spawn/revival request with id for persistence

invoke

(config) => Promise<string>

Function to invoke the actual child agent

config?

SpawnAgentRevivalConfig = DEFAULT_CONFIG

Optional configuration for context management

Returns

Promise<string>

Agent response text

Example

// First call: create new agent
const response1 = await spawnAgentWithRevival(
{
id: 'reviewer-001',
name: 'Code Reviewer',
goal: 'Review architecture',
systemPrompt: 'You are a code expert',
tools: ['read_file'],
},
invokeChildAgent
);

// Second call: revive same agent
const response2 = await spawnAgentWithRevival(
{
id: 'reviewer-001', // Same ID
message: 'Now check security', // New message
},
invokeChildAgent
);