Executive Briefing: Build an enterprise competitive intelligence system. A central
Supervisorcoordinates three specialized worker agents: (1)WebResearcher(gathers news and financial releases), (2)PatentAnalyst(searches patent registries and IP filings), and (3)BriefWriter(synthesizes structured executive intelligence memos). The supervisor dynamically delegates tasks, evaluates worker outputs, and enforces revision limits.
1. Enterprise Scenario & Requirements
Monolithic single-agent prompts degrade in accuracy when loaded with 20+ disparate tools. By decomposing capabilities into a supervisor multi-agent architecture:
- Specialized Workers: Author independent worker agents using
create_react_agent, each equipped strictly with domain-specific tools and persona prompts. - Supervisor Coordination: Implement the supervisor using
langgraph-supervisor(create_supervisor) with explicit delegation instructions. - Automated Handoffs: Leverage dynamic handoff tools (
transfer_to_researcher,transfer_to_writer). - Context Window Management: Configure
output_mode="last_message"to pass synthesized agent responses rather than flooding the main conversation with dozens of raw tool call tokens.
2. Explicit Deliverables
workers.py: Definitions forresearch_agent,patent_agent, andwriter_agent.supervisor.py: Compiled hierarchical multi-agent graph with supervisor routing.test_multi_agent.py: Test suite verifying: (a) task delegation to appropriate worker based on query intent, (b) multi-worker collaboration on complex queries, and (c) token usage comparison betweenlast_messageandfull_history.sample_intelligence_memo.md: Executive memo generated by the system on a real technology company.
3. Starter Code & Scaffold
from langgraph_supervisor import create_supervisor
from langgraph.prebuilt import create_react_agent
from langchain_core.tools import tool
from langchain_openai import ChatOpenAI
@tool
def search_press_releases(company: str) -> str:
'''Search recent corporate press releases and news.'''
return f"Latest news for {company}: Launched cloud AI platform Q2 2026."
@tool
def search_patent_database(technology: str) -> str:
'''Search USPTO and international patent filings.'''
return f"Patent filings for {technology}: 14 new grants in transformer quantization."
model = ChatOpenAI(model="gpt-4o")
# Create specialized worker agents
researcher = create_react_agent(model, [search_press_releases], name="researcher")
patent_analyst = create_react_agent(model, [search_patent_database], name="patent_analyst")
# Create supervisor
workflow = create_supervisor(
agents=[researcher, patent_analyst],
model=model,
prompt=(
"You are an executive intelligence director. Assign market news queries to the 'researcher' "
"and patent/IP questions to the 'patent_analyst'. Synthesize worker findings into a final briefing."
),
output_mode="last_message"
)
app = workflow.compile()
4. 100-Point Grading Rubric
| Criterion | Points | Excellent (25 pts) | Acceptable (15 pts) | Needs Work (5 pts) |
|---|---|---|---|---|
| Worker Specialization & Tool Scoping | 25 pts | Workers have distinct personas, isolated toolsets, and clean separation of concerns. | Workers separated but tools overlap heavily. | Single monolithic agent pretending to be multiple roles. |
| Supervisor Handoff Mechanics | 25 pts | Supervisor correctly identifies appropriate workers and transfers context seamlessly. | Transfers correctly but occasionally loops between workers. | Hardcoded static routing instead of LLM delegation. |
| Context Window Optimization | 25 pts | Uses output_mode='last_message' to suppress raw scratchpads and protect token budgets. | Uses full_history causing token usage to balloon. | Manually wipes conversation history, losing context. |
| Synthesis & Memo Quality | 25 pts | Final output integrates findings from multiple workers into a coherent, cited executive briefing. | Combines text but reads as disconnected paragraphs. | Ignores worker outputs and hallucinates summary. |