Stream E — Orchestrator
Labels: core, orchestrator
Depends on: GL-6, GL-11, GL-12, GL-13, GL-14, GL-15, GL-16, GL-17
Effort: 8–10 hours
Assign your two most capable contributors to this issue.
Summary
The brain of the system. Aware of every stage. Routes between agents. Enforces the rule that LLMs and agents never communicate directly — all LLM calls flow through the Gateway, all agent invocations flow through the Orchestrator.
Pipeline Inside process()
- Run
InputSanitizer. Unsafe → localized safe fallback. Flagged → log and continue.
- Run
LocationDetector.detect(). Set message.location.
- Run
IntentClassifier.classify(). Determine submission_type and stage.
- Resolve current agent via
AgentRegistry.find_best_agent(stage, language).
- Invoke agent. Agents are stateless functions, not objects with state. They receive
message + session + registry refs and return CanonicalResponse.
- Emit appropriate
LogEvent to session.log_buffer.
- Advance session stage if agent signals completion.
- Return response to worker for delivery.
Stage Transition Map (enforced here, not in agents)
intake → awaiting_evidence (identification agent completes)
awaiting_evidence → pending_score (verification agent emits score)
pending_score → scored (GiveLight confirms — one-way door)
Invalid transitions raise InvalidStageTransitionError.
Human Escalation Path
When verification agent returns recommendation = human_escalate: emit HUMAN_ESCALATION log event with full context. Tell user: 'Your submission has been forwarded to our review team. You will hear from GiveLight directly.' Advance stage to pending_score.
Architecture Rule
Agents do not hold references to LLM adapters. The orchestrator passes a gateway reference to each agent invocation. The agent calls gateway.call(). This chain is structural — enforced in code review.
Acceptance Criteria
- Full pipeline executes for intake message end-to-end.
- Full pipeline executes for evidence submission.
- Stage transitions validated — error on illegal jump.
human_escalate sends correct user message and emits event.
- Agents never hold direct adapter references.
LogEvent emitted for every stage transition.
- Integration test: intake through verification score, end-to-end.
Stream E — Orchestrator
Labels: core, orchestrator
Depends on: GL-6, GL-11, GL-12, GL-13, GL-14, GL-15, GL-16, GL-17
Effort: 8–10 hours
Summary
The brain of the system. Aware of every stage. Routes between agents. Enforces the rule that LLMs and agents never communicate directly — all LLM calls flow through the Gateway, all agent invocations flow through the Orchestrator.
Pipeline Inside process()
InputSanitizer. Unsafe → localized safe fallback. Flagged → log and continue.LocationDetector.detect(). Setmessage.location.IntentClassifier.classify(). Determinesubmission_typeand stage.AgentRegistry.find_best_agent(stage, language).message + session + registry refsand returnCanonicalResponse.LogEventtosession.log_buffer.Stage Transition Map (enforced here, not in agents)
Invalid transitions raise
InvalidStageTransitionError.Human Escalation Path
When verification agent returns
recommendation = human_escalate: emitHUMAN_ESCALATIONlog event with full context. Tell user: 'Your submission has been forwarded to our review team. You will hear from GiveLight directly.' Advance stage topending_score.Architecture Rule
Agents do not hold references to LLM adapters. The orchestrator passes a gateway reference to each agent invocation. The agent calls
gateway.call(). This chain is structural — enforced in code review.Acceptance Criteria
human_escalatesends correct user message and emits event.LogEventemitted for every stage transition.