ONE AI
An AI agent platform built around FastAPI, MongoDB, Redis, Celery, LangGraph, custom Python orchestration, and human-in-the-loop workflows.
The Problem Context
Most AI applications are architected as static, single-track pipelines (Prompt → Agent → Tool → Response). This brittle approach collapses when business requirements demand multi-step reasoning, conditional routing based on dynamic intermediate states, parallel branch execution, or human sign-off before committing state changes.
- ›Static workflows cannot adapt when intermediate tools yield unexpected data formats or require alternate reasoning strategies.
- ›Managing workflow state across asynchronous background workers (Celery) and real-time API clients requires rigorous persistence and state hydration.
- ›Parallel branch execution introduces race conditions and complex merge semantics when multiple agents produce interdependent context.
- ›Human-in-the-loop (HITL) checkpoints require pausing execution indefinitely without blocking thread pools or losing execution state.
Engineering Architecture
Engineered a proprietary Python-based dynamic orchestration layer where workflow routing logic is decoupled from individual agent definitions and persisted in MongoDB. Instead of relying solely on LangGraph for full-pipeline coordination, the custom engine evaluates runtime execution state, selects appropriate agent combinations dynamically, branches into parallel workers when appropriate, and halts for human approval before critical operations.
Execution Sequence:
Interactive Architecture & Data Flow
The custom Python Orchestration Engine coordinates database-backed workflow state, dynamic agent transitions, parallel branches, and human approvals.
Decoupled transition evaluator reads dynamic step metadata from MongoDB, resolves next-hop agent dependencies, and dispatches asynchronous tasks.
FastAPI endpoint captures request and initializes workflow session.
Custom Python routing engine inspects current task state and selects required agents.
MongoDB stores graph state, execution histories, and branch dependencies.
Agents A, B, and C execute in sequence or parallel depending on state evaluation.
Celery-backed workers run independent sub-graphs simultaneously and reconcile outputs.
Optional HITL suspension node pauses execution until authorized via API.
Key Technical Challenges
Static Workflows Are Too Restrictive
Problem:Hardcoded agent graphs cannot reconfigure themselves when real-world API responses require detour strategies.
Dynamic Multi-Agent Routing
Problem:Determining whether one or multiple specialized agents must handle a step without cascading latency.
Multi-Branch & Parallel Execution
Problem:Allowing independent task components to execute simultaneously without data races.
Resilient Human-in-the-Loop (HITL)
Problem:Pausing workflows awaiting human review without keeping open socket connections or consuming active worker threads.
Verified Technology Stack
Design Decisions & Rationales
Custom Python Orchestration alongside LangGraph
LangGraph provides strong primitives for localized graph execution, but high-level enterprise state management, multi-agent dispatch, and distributed worker queues required custom business logic.
FastAPI + Celery + Redis separation of concerns
FastAPI handles rapid request validation and response delivery, while Celery handles resource-intensive LLM tool iterations asynchronously.
Technical Results
- ✓Engineered an end-to-end multi-agent orchestration platform with dynamic agent sequencing.
- ✓Implemented database-driven routing with persistent workflow state.
- ✓Delivered parallel branch execution with reliable barrier synchronization.
- ✓Integrated asynchronous human-in-the-loop review nodes with webhook triggers.
Lessons Learned
- •State persistence and serialization discipline are far more important in multi-agent systems than prompt tweaking.
- •Separating agent reasoning from orchestrator routing prevents prompt degradation as workflows scale in complexity.
Future Improvements
- •Add interactive visual workflow canvas for non-technical operators to build custom branch rules.
- •Implement automatic checkpoint replay for single-node failure recovery without re-running parent nodes.