Urgent.News

650+ sources. One page. See who else covered it.

Editions

AI

Building a Multi-Agent System in TypeScript

Single agents hit real limits in production. Long tasks exceed context windows. Complex goals need different tools at different stages. Sequential reasoning is slow when subtasks are independent. Multi-agent systems solve these problems by decomposing work across specialized agents that can run in parallel. This article walks through two patterns — Orchestrator/Subagent and Pipeline — implemented…

Multi-agent systems offer a practical solution to the limitations encountered with single agents in production environments. One prominent example is analyzing competitors' pricing pages to summarize key differences. A single agent attempting this task would have to sequentially fetch, process, and analyze each competitor's page, leading to excessive use of context windows and increased total time.

In contrast, an orchestrator-based approach involves spawning multiple specialized agents in parallel, each handling the fetching and processing of a single competitor's page. This parallel execution reduces the total time required, as it only takes the time of the slowest agent rather than the sum of all individual tasks.

The Orchestrator/Subagent pattern consists of three main phases:

1. Decomposition: The orchestrator breaks down the overall goal into subtasks, defines the data structures for communication between the orchestrator and subagents, and uses an LLM to generate a structured plan based on the natural-language goal. The SubTask interface includes properties such as ID, title, description, toolSet (defining the capabilities of the subagent), dependencies, priority, and timeout.

The SubTaskResult interface captures the outcome of each subtask, including status, output, duration, and other relevant information. The OrchestratorPlan interface defines the overall goal, the list of tasks, and possible concurrency groups for parallel execution.

2. Parallel Execution with Concurrency Control: In this phase, the orchestrator executes the subtasks in parallel while respecting the defined dependencies and concurrency limits. The maximum number of concurrent tasks is controlled using the maxConcurrency parameter. The execution process iterates through each concurrency group, runs the tasks that have completed their dependencies successfully, and collects their results.

The orchestrator maintains separate sets to track completed tasks, failed tasks, and any potential conflicts that may arise due to dependencies.

3. Synthesis: After the subtasks have been executed, the orchestrator combines the individual results into a coherent final output. This step typically involves analyzing the aggregated data and generating a synthesized result that addresses the original goal.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in AI

In the Beginning...

Working with Modern AIs The day I met Claude was a dark day It was a full-stack project that I wasn't familiar with any of the tools being used.

  • Met Claude during challenging full-stack project
  • Grok proved more helpful assistant
  • Worked on Packet Sender project in advanced C++

Stop Sending Your Vitals to the Cloud: Running Llama-3 Locally in the Browser with WebLLM & WebGPU 🥑

Privacy is the ultimate "final boss" in HealthTech. When users record sensitive medical logs, the last thing they want is their data being used to train a massive corporate model.

  • Developers run Llama-3 model locally in web browsers using WebGPU.
  • Privacy-first health apps process user inputs without transmitting PHI.
  • System stores structured health data locally in browser's IndexedDB.

More from Sunday 16 August →