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.
In this repository65 other files it gives its agents.
- AGENTS.mdAGENTS.md
- skills/building-agents/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- llms-full.txtllms.txt
- llms.txtllms.txt
- adding-guardrailsSkill
- agent-health-timeoutSkill
- agent-permission-scopingSkill
- agent-session-isolationSkill
- agent-step-loggingSkill
- agent-supervisor-routerSkill
- agent-telemetrySkill
- async-agent-backgroundSkill
- building-agentsSkill
- building-toolsSkill
- calendar-scheduling-toolSkill
- callback-tracing-handlerSkill
- chain-of-thought-promptingSkill
- chat-model-configurationSkill
- code-execution-sandboxSkill
- common-agent-patternsSkill
- context-window-managementSkill
- conversation-memorySkill
- conversation-state-dbSkill
- database-query-toolSkill
- document-loadersSkill
- document-rerankingSkill
- email-notification-toolSkill
- embedding-model-ingestionSkill
- fallback-model-chainSkill
- few-shot-injectionSkill
- filesystem-toolSkill
- human-in-the-loopSkill
- hybrid-searchSkill
- inspecting-streamsSkill
- integrating-with-laurenSkill
- json-schema-enforcementSkill
- llm-provider-connectionSkill
- llm-rate-limitingSkill
- long-term-vector-memorySkill
- managing-memorySkill
- migrating-to-lauren-aiSkill
- multi-agent-delegationSkill
- multi-tool-orchestrationSkill
- multi-turn-tool-stateSkill
- output-guardrailsSkill
- plan-and-execute-agentSkill
- prompt-injection-defenseSkill
- prompt-versioningSkill
- rag-pipelineSkill
- react-agent-loopSkill
- response-validation-retrySkill
- rest-api-toolSkill
- securing-agentsSkill
- semantic-cacheSkill
- streaming-response-handlerSkill
- structured-output-parsingSkill
- sub-agent-spawningSkill
- system-prompt-templatingSkill
- testing-agentsSkill
- The first 60 shown.
The file
Files
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. TeamRunnerdiscovers workers by reading__init__.__annotations__.
Modes
| Mode | Behaviour | Use when |
coordinator | LLM coordinator decides after each round: ROUTE: <worker> or DONE: <answer>. Runs up to max_rounds rounds. | Tasks need dynamic routing between specialists |
collaborate | All 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 class | Fields | Meaning |
TeamWorkerStarted | worker_name, task, round | A worker is about to run |
TeamWorkerFinished | worker_name, result_content, round | A worker completed |
TeamCoordinatorDecision | decision, round | Coordinator chose next step |
TeamFinalAnswer | content, rounds | Team 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
| Field | Type | Description |
final_answer | str | Synthesised final output |
worker_outputs | dict[str, str] | Per-worker outputs keyed by worker name |
rounds | int | Number of coordinator rounds taken |
total_input_tokens | int | Cumulative input tokens (if tracked) |
total_output_tokens | int | Cumulative 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
EventStreamandServerSentEvent collaboratevscoordinatormode detailed behaviour
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
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.

