Skip to content

feat(core): add multi-agent patterns#10

Draft
sharananurag998 wants to merge 1 commit into
mainfrom
codex/add-multi-agent-patterns-in-core
Draft

feat(core): add multi-agent patterns#10
sharananurag998 wants to merge 1 commit into
mainfrom
codex/add-multi-agent-patterns-in-core

Conversation

@sharananurag998
Copy link
Copy Markdown
Collaborator

Summary

  • add multi-agent helpers for sequential, parallel, coordinator, and redundant pipelines
  • re-export new helpers from core index for external use

Testing

  • pnpm test (fails: AggregateError in PostgreSQL Artifact Storage tests)

https://chatgpt.com/codex/tasks/task_e_68bea714b4688327820c3eae3b2143ad

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/core/multi-agent.ts
currentInput = outputToString(result.outcome.output);
}

return lastResult!;
Copy link

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread src/core/multi-agent.ts
*/
export async function runParallelPipeline<Ctx>(
first: string,
parallel: readonly [string, string],
Copy link

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Copilot uses AI. Check for mistakes.
Comment thread src/core/multi-agent.ts
if (res3.outcome.status === 'error') {
return res3;
}
const combined = `${outputToString(res2.outcome.output)}\n${outputToString(res3.outcome.output)}`;
Copy link

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Copilot uses AI. Check for mistakes.
@harshpreet931
Copy link
Copy Markdown
Collaborator

limitations of current code:

  • Number of parallel agents (always 2 in parallel pattern)
  • Pipeline topology (sequential vs parallel vs branching)
  • Number of stages
  • Where branches occur
  • Hardcoded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants