Skip to content

Commit 1a6f2fc

Browse files
committed
exit if no runId
1 parent 4691ec5 commit 1a6f2fc

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packages/agent-runtime/src/run-agent-step.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -480,14 +480,15 @@ export async function loopAgentSteps(
480480
throw new Error(`Agent template not found for type: ${agentType}`)
481481
}
482482

483-
const runId = crypto.randomUUID()
484-
agentState.runId = runId
485-
await startAgentRun({
483+
const runId = await startAgentRun({
486484
...params,
487-
runId,
488485
agentId: agentTemplate.id,
489486
ancestorRunIds: agentState.ancestorRunIds,
490487
})
488+
if (!runId) {
489+
throw new Error('Failed to start agent run')
490+
}
491+
agentState.runId = runId
491492

492493
// Initialize message history with user prompt and instructions on first iteration
493494
const instructionsPrompt = await getAgentPrompt({

0 commit comments

Comments
 (0)