INNER CODE UNIT · TypeScript
promises
Kong/volcano-agent-sdk · src/patterns.ts:17
const promises = keys.map(key => executeStep(stepsOrDict[key]));
const results = await Promise.all(promises);
const parallel: Record<string, StepResult> = {};
keys.forEach((key, idx) => {
parallel[key] = results[idx];
});
return {
parallel,
durationMs: Date.now() - stepStart,
};
}
}
export async function executeBranch(
condition: (history: StepResult[]) => boolean,
branches: { true: (agent: AgentBuilder) => AgentBuilder; false: (agent: AgentBuilder) => AgentBuilder },