feat(backend): orchestration foundation — health check, state contracts, traces and LangGraph empty flow (A-10, A-11, A-12, A-13)#36
Open
Andres-Torrez wants to merge 6 commits into
Conversation
added 6 commits
July 18, 2026 22:31
- Implements A-10: Minimal backend with health check - GET / returns API info - GET /salud verifies gateway connectivity - Handles all error cases gracefully - Includes Dockerfile, tests, and env configuration #10
- Implements A-10: Minimal backend with health check - GET / returns API info - GET /salud verifies gateway connectivity - Handles all error cases gracefully - Includes Dockerfile, tests, and env configuration #10
- CampaignState: 8 fields for marketing campaign flow - SupportState: 4 fields for customer support flow - Factory functions with correct defaults - Comprehensive tests validating Contract 1 - TypedDict for static type checking - Spanish field names matching functional document Closes #11
- Contract 3: fixed JSON format with agente, fase, razon, timestamp - ISO 8601 UTC timestamp generated automatically - Input validation with graceful error handling - Works with both CampaignState and SupportState historial - 15+ tests validating format, mutation, validation, integration - No external dependencies (pure Python stdlib) Closes #12
- 4 placeholder nodes: orquestador, contenido, campanas, analitica - Fixed deterministic sequence, no conditional edge yet (#22) - Each node emits inicio/fin traces per Contract 3 - build_graph factory + compiled graph singleton for API layer - Tests validate 8 traces, order, phases and Contract 1 preservation Closes #13
- 4 placeholder nodes: orquestador, contenido, campanas, analitica - Fixed deterministic sequence, no conditional edge yet (#22) - Each node emits inicio/fin traces per Contract 3 - build_graph factory + compiled graph singleton for API layer - Tests validate 8 traces, order, phases and Contract 1 preservation Closes #13
11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes
Closes #10
Closes #11
Closes #12
Closes #13
Summary
Complete orchestration foundation for Aria. This PR delivers the full
backend skeleton so the team can start Phase 3 (agents, SSE, frontend)
on solid contracts. It bundles 4 stacked issues into one PR, as agreed
by the team (exception to the per-PR size guideline: this is foundation
code that only makes sense together).
A-10 — Minimal backend with health check
/docsand/redocGET /returns API infoGET /saludverifies connectivity with the LiteLLM gateway(
GATEWAY_URL/GATEWAY_TIMEOUTenv vars, Docker Compose defaults)backend status regardless
.env.exampleand tests includedA-11 — Shared state contracts (Contract 1)
CampaignState(TypedDict, 8 fields):objetivo,tono_marca,contenido,plan_campana,informe_analitica,campana_ok,iteraciones,historialSupportState(TypedDict, 4 fields):pregunta,respuesta,escalado_humano,historialiteraciones = 0,campana_ok = True,historial = [])A-12 — Trace emission module (Contract 3)
emitir_traza(agente, fase, razon, historial)used by ALL agents — if this breaks, the dashboard breaks
agente,fase,razon,timestamp(UTC ISO 8601)inicio/finphases; on invalidinput it logs and returns history unchanged — never raises
A-13 — LangGraph graph with empty nodes (Phase 2 exit criterion)
orquestador → contenido → campañas → analítica → ENDinicio/fintraces per Contract 3build_graph()factory + compiledgraphsingleton for the APIlayer (SSE endpoint, [Agentes] Real-time SSE trace endpoint #14)
langgraph>=0.2.0added to dependenciestestpathscorrected (tests→test) so pytest discoversthe suite
Out of scope (next issues):
How to test
cd backend && uv sync --extra devuv run pytest— full suite passes (state, traces, graph, main)Dashboard screenshot
N/A — traces will be visible once #14 (SSE) and #16 (frontend) land.
Checklist
docker compose upstill works — no infra changesbackend/README.mdincluded