Skip to content

feat: agent orchestration pipeline with guaranteed 3-card fallback (Phase 4)#33

Merged
Dynamic-ctrl merged 4 commits into
Life-Atlas:stagingfrom
thedgarg31:daksh-phase-4
Jun 22, 2026
Merged

feat: agent orchestration pipeline with guaranteed 3-card fallback (Phase 4)#33
Dynamic-ctrl merged 4 commits into
Life-Atlas:stagingfrom
thedgarg31:daksh-phase-4

Conversation

@thedgarg31

@thedgarg31 thedgarg31 commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

What I Verified

✅ Introduces a dedicated agent_pipeline.py implementing a clear 7-node LangGraph orchestration workflow (fetch → classify → reason → validate → enrich → fallback → finalise).

✅ Maintains proper separation of concerns by reusing the existing reasoning components (run_agent() and recommendation_engine.py) without modifying their internal implementation.

✅ The multi-layer fallback strategy is well designed:

  • Validation retry for malformed LLM output
  • Deterministic recommendation fallback through the existing engine
  • Guaranteed cold-start card generation

This ensures the demo-safe requirement of always returning exactly n_cards recommendations is satisfied even during database or LLM failures.

✅ New endpoint POST /api/v1/recommendations/{user_id}/run is additive and does not introduce regression risk to the existing GET endpoint.

Additional Fixes

The fixes in:

  • routers/goals.py
  • tests/conftest.py

appear justified and resolve pre-existing issues uncovered once the full test suite executed against a live Supabase environment.

Testing

Test progression demonstrates good validation of the implementation:

  • Final result: 164 passed, 0 failed

This provides strong confidence in the stability of the orchestration pipeline and related fixes.

Architecture Assessment

The producer-consumer relationship between the orchestration layer and the reasoning layer is clean:

agent_pipeline.py → run_agent() / recommendation_engine.py

This avoids overlap with parallel Phase 4 work while preserving modularity and future extensibility.

- Add src/lpi/agent_pipeline.py: 7-node LangGraph orchestration pipeline
  (fetch -> classify -> reason -> validate -> enrich -> fallback -> finalise)
  run_pipeline() never raises, always returns exactly n_cards recommendations

- Add POST /api/v1/recommendations/{user_id}/run endpoint (demo-safe,
  guaranteed 3 cards regardless of LLM or DB availability)

- Fix HTTP_422_UNPROCESSABLE_CONTENT -> HTTP_422_UNPROCESSABLE_ENTITY
  in routers/goals.py (wrong Starlette constant, caused 500 on invalid
  SMILE phase transition)

- Fix tests/conftest.py: clear rate limit store between tests to prevent
  429s mid-suite when running all 164 tests against cloud Supabase

All 164 tests passing.
@Dynamic-ctrl Dynamic-ctrl merged commit 9f9e63c into Life-Atlas:staging Jun 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants