agentleFS
lauren-frameworklauren-framework/lauren-ai/skills/building-teams/SKILL.md

building-teams

Skill0 starsChanged 6 months agoMITView on GitHub

Builds multi-agent teams in lauren-ai using @team and TeamRunner for coordinator and collaborate modes. Use when implementing a @team() class with multiple workers, running TeamRunner.run() or run_stream(), handling TeamWorkerStarted/Finished/TeamFinalAnswer events, or streaming team progress over SSE in a web controller.

The file

Files
SKILL.md

Use codemap find "SymbolName" to locate any symbol before reading — it gives exact file + line range and is faster than grep across the whole repo.

Building Multi-Agent Teams

Quick start

Define a team and run it:

from __future__ import annotations

from lauren_ai import team, TeamRunner
from .agents import ResearchAgent, WriterAgent

@team(
    name="content-team",
    mode="collaborate",
    model="claude-opus-4-6",
)
class ContentTeam:
    def __init__(self, researcher: ResearchAgent, writer: WriterAgent) -> None:
        self.researcher = researcher
        self.writer = writer


# Run
runner = TeamRunner(
    team_cls=ContentTeam,
    llm=llm_service,
    agent_runner=agent_runner,
)
result = await runner.run("Write a report on quantum computing.")
print(result.final_answer)

Rules:

  • @team() must use parentheses.
  • Worker parameters in __init__ must be type-annotated with their agent class.
  • TeamRunner discovers workers by reading __init__.__annotations__.

Modes

ModeBehaviourUse when
coordinatorLLM coordinator decides after each round: ROUTE: <worker> or DONE: <answer>. Runs up to max_rounds rounds.Tasks need dynamic routing between specialists
collaborateAll workers run sequentially in annotation order, then a synthesis call produces the final answer.Tasks need all workers to contribute in a fixed sequence

Streaming events

TeamRunner.run_stream() yields TeamEvent subclass instances:

Event classFieldsMeaning
TeamWorkerStartedworker_name, task, roundA worker is about to run
TeamWorkerFinishedworker_name, result_content, roundA worker completed
TeamCoordinatorDecisiondecision, roundCoordinator chose next step
TeamFinalAnswercontent, roundsTeam produced its final answer
from lauren_ai import (
    TeamWorkerStarted,
    TeamWorkerFinished,
    TeamCoordinatorDecision,
    TeamFinalAnswer,
)

async for event in runner.run_stream("Research quantum computing"):
    if isinstance(event, TeamWorkerStarted):
        print(f"[Round {event.round}] Starting: {event.worker_name}")
    elif isinstance(event, TeamWorkerFinished):
        print(f"[Round {event.round}] {event.worker_name} done")
    elif isinstance(event, TeamCoordinatorDecision):
        print(f"[Coordinator] {event.decision}")
    elif isinstance(event, TeamFinalAnswer):
        print(f"[Final] {event.content}")

TeamResult fields

FieldTypeDescription
final_answerstrSynthesised final output
worker_outputsdict[str, str]Per-worker outputs keyed by worker name
roundsintNumber of coordinator rounds taken
total_input_tokensintCumulative input tokens (if tracked)
total_output_tokensintCumulative output tokens (if tracked)

Reference

See teams.md for:

  • Full @team() parameter reference (coordinator_prompt, max_rounds)
  • Custom coordinator prompt with {worker_descriptions}, {task}, {prior_outputs} placeholders
  • SSE streaming in a web controller with EventStream and ServerSentEvent
  • collaborate vs coordinator mode detailed behaviour

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.