feat(core): add multi-agent patterns#10
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds multi-agent pattern helpers to the core module, enabling coordination between multiple AI agents through sequential, parallel, coordinator, and redundant execution patterns.
- Introduces four multi-agent execution patterns: sequential pipeline, parallel pipeline, coordinator pipeline, and parallel redundant
- Creates helper functions for managing agent state and output transformation
- Exports the new multi-agent functionality through the main index file
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/index.ts | Adds export for the new multi-agent module |
| src/core/multi-agent.ts | Implements multi-agent pattern functions with state management and execution logic |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| currentInput = outputToString(result.outcome.output); | ||
| } | ||
|
|
||
| return lastResult!; |
There was a problem hiding this comment.
Using non-null assertion operator (!) without proper guard. If agentNames is empty, lastResult will be undefined and this will throw a runtime error. Add a check for empty agentNames array at the beginning of the function.
| */ | ||
| export async function runParallelPipeline<Ctx>( | ||
| first: string, | ||
| parallel: readonly [string, string], |
There was a problem hiding this comment.
[nitpick] The parallel parameter is hardcoded to exactly 2 agents. Consider using 'readonly string[]' to allow for more flexible parallel execution with any number of agents.
| if (res3.outcome.status === 'error') { | ||
| return res3; | ||
| } | ||
| const combined = `${outputToString(res2.outcome.output)}\n${outputToString(res3.outcome.output)}`; |
There was a problem hiding this comment.
[nitpick] The output combination logic is hardcoded for exactly 2 results. If the parallel parameter is changed to support more agents, this logic will need to be updated accordingly.
|
limitations of current code:
|
7fbbb18 to
e05de49
Compare
Summary
Testing
pnpm test(fails: AggregateError in PostgreSQL Artifact Storage tests)https://chatgpt.com/codex/tasks/task_e_68bea714b4688327820c3eae3b2143ad