Goal

Build a system where three specialized agents collaborate on a task:
  • Researcher — gathers information from the web
  • Writer — synthesizes research into a draft document
  • Reviewer — reviews the draft and provides feedback
Your code runs the agents and passes each one’s output to the next.

Prerequisites

  • An Allternit API key
  • @allternit/sdk installed
  • TAVILY_API_KEY for web search

Implementation

1. Set up the tool registry

2. Create the agents

3. Orchestrate the workflow

Explanation

  • Sequential coordination — The orchestrator runs agents one at a time, passing output from one as input to the next. This is the simplest coordination pattern.
  • Feedback loops — The reviewer-writer loop runs until the reviewer approves or the iteration limit is reached. This prevents infinite loops.
  • Specialized agents — Each agent has a focused system prompt and limited tool set, reducing the chance of hallucination.

Next steps

  • Replace sequential calls with async parallel runs for the research phase (fan out multiple researchers).
  • To run the same pattern as a standing team with verified sends, proof and approvals, use the Allternit Factory and a build-check-prove Template.
  • Add a budget limit per agent run to control costs.