Can you implement: Build Spec — AI Agent Orchestration Platform (agentlab Challenge)…
- User
Can you implement:
Build Spec — AI Agent Orchestration Platform (agentlab Challenge)
Audience: the coding agent. This is an executable build brief. Follow the milestones in order; each ends in a runnable, demoable state. Do not skip the persistence or messaging layers — they are graded.
What we’re building: a platform to create/configure AI agents and wire them into collaborative workflows on a real runtime. The flagship demo is a two-agent payment-ops loop modeled on agentlab’s own NOC + Reporting functions: a Monitor agent detects payment anomalies in a transaction stream, then hands off asynchronously to a Comms agent that summarizes the incident, posts it to a human over Telegram, and answers follow-up questions.
0. Why this design (for the README — keep this reasoning)
- Domain grounding: agentlab hires a 24/7 Technical Support / NOC team to “proactively identify and address potential incidents before they escalate” and provide L1/L2 support, plus GTM/ops analysts who compile reports. Our two agents automate exactly that loop, mirroring agentlab’s own Payments Concierge (ops monitoring) and NOVA (customer comms) products. This is the “we understand your business” signal for the live review.
- Runtime = LangGraph: native conditional edges + cycles (feedback loops), built-in checkpointer for persisted state, async-first. Justify in README vs. CrewAI/AutoGen (weaker loop/condition modeling) and openclaw (less control over the graph).
- Async agent comms: agents do not call each other directly. They publish to a Postgres-backed message bus and are triggered off it. This satisfies “communicate asynchronously” + “message history persisted and visible in the UI” with one mechanism.
1. Tech stack (fixed — do not substitute without flagging)
Layer Choice Notes Agent runtime LangGraph (Python) graphs, conditional edges, cycles, checkpointing Backend/API FastAPI (Python) same language as runtime; serves REST + WebSocket Frontend React + Vite + TypeScript + Tailwind Workflow builder UI React Flow () Assistant
Let me look at the existing codebase before deciding on approach, since there's already a project here with different tech choices than the spec requires.
Assistant
The existing project already has significant implementation (Temporal + Pydantic AI + Next.js + OpenRouter), but the spec mandates a different tech stack (LangGraph + Vite/React + Anthropic Claude). This is a genuine fork-in-the-road decision before spending significant time:
Assistant
Good call. I'll keep the existing stack and fill the gaps. Let me audit what's implemented vs what the spec requires.
Assistant
Let me read the key files to understand what's implemented vs what's missing.
Assistant
Let me check the existing tests and runtime to understand what gaps exist.
Assistant
Now I have a clear picture. Let me check the remaining gaps quickly.
Assistant
Let me read the full agent factory to understand how tools are bound.
Assistant
Now I have a full picture of what needs to be added. Let me implement all the gaps systematically. I'll work in parallel where possible.
Assistant
Now let me implement all the changes. Starting with the data model:
Assistant
Now add
IncidentandAgentMessagemodels to the bottom of models.py:Assistant
Now add PSP health data to payments_mock.py and helper functions for the NOC Monitor tools:
Assistant
Now add the 8 new tools to tools.py:
Assistant
Now append the 8 new tool functions to the end of tools.py:
Assistant
Now bind the 8 new tools in agent_factory.py and add temperature support:
Assistant
Now add the new tool names to schemas.py and add
temperature:Assistant
Now add the
AgentMessageReadschema to schemas.py:Assistant
Now add a cost-cap guardrail kind to guardrails.py:
Assistant
Now let me check how run_agent_step calls guardrails to add cost cap enforcement there:
Assistant
I need to add cost cap enforcement in
run_agent_step. Let me update activities.py:Assistant
Now add the NOC Monitor and Comms agents to the seeds. Let me update seeds/run.py:
Assistant
Now I'll add the NOC Monitor and Comms agents plus two new templates to the seeds file:
Assistant
Now update the
seed()function to also seed these two new agents and templates:Assistant
Now add the
test_guardrail_cost_captest. Let me read the existing test file first:Assistant
Now add an API endpoint for querying agent_messages. Let me check what's in the messages API first:
Assistant
Now let's run the tests to see what passes and what needs fixing:
Assistant
All guardrail tests pass. Let's run the full test suite:
Assistant
58/58 tests pass. Now let me check if the seeds test still validates the right agents and templates, and if the new tools are tested:
Assistant
Let me check what
test_payment_tools_are_acceptedandtest_settings_exposes_payment_toolsactually assert:Assistant
Good, these tests check that the existing tools are present, and they still pass since I only added to the list. Now let me also run the new tools tests to ensure the PSP health tools work:
Assistant
PSP_B correctly shows degraded (61.2% vs 92% baseline — a 33.5% drop → medium severity). Now let me update the README with all the required sections:
Assistant
Now create UX.md:
Assistant
Now let me run the full test suite one more time to make sure everything still passes:
Assistant
58/58. Let me also verify the seeds work end-to-end including the new agents and templates:
Assistant
The existing app DB has the
agentstable but lacks the newtemperaturecolumn. I need to add a migration step sincecreate_alldoesn't alter existing tables. Let me checkinit_db.py:Assistant
Both agents seeded with correct temperatures and tools. All 4 templates including the two new spec-required ones are present. Let me do a final full test run to confirm nothing broke:
Assistant
58/58. Let me also save memory about this work:
Assistant
Here's a summary of everything implemented to fill the spec gaps:
What was added
Data model (
db/models.py)temperaturecolumn onagents(with additive migration ininit_db.pyfor existing DBs)Incidenttable — domain object for the NOC Monitor → Comms handoffAgentMessagetable — the persistent async bus (topic,status,payload)
Tools (
runtime/tools.py+agent_factory.py)- NOC Monitor:
get_psp_health,get_transaction_window,detect_anomaly,raise_incident - Comms:
get_incident,draft_client_update, ,