ServerIntelligence
Intelligence Agent
Python cognitive reasoning engine, LangGraph routing, and vector memory.
Intelligence Agent
The ForkFit intelligence core is a Python application executing advanced cognitive agent loops. It acts as the "brain" of ForkFit, handling conversational routing, safety reviews, nutritional evaluations, budget compliance, and personal habits reflection.
Agent Graph Architecture
The orchestrator utilizes LangGraph to execute a cyclic state graph composed of 11 specialized agent nodes. Specialist agents run in parallel to minimize latency, while the remaining pipeline executes sequentially to construct, format, and verify the meal plan.
Core Cognitive Agents
- Planner Agent: Parses the user request and hydrated context to generate a route plan, deciding which specialist agents are required.
- Safety Agent: Cross-references biometrics and medical restrictions (e.g., allergies) against recipes. (Runs in parallel)
- Nutrition Agent: Computes daily targets and scores recipes based on macronutrient/calorie adherence. (Runs in parallel)
- Budget Agent: Evaluates ingredient costs and suggests cheaper substitutions where needed. (Runs in parallel)
- Culture Agent: Enforces regional, cultural, or religious dietary guidelines. (Runs in parallel)
- Recipe Agent: Curates recipe selections, cooking steps, and variations.
- Calendar Agent: Schedules meals chronologically, balancing user activity and sleep cycles.
- Shopping Agent: Generates grocery lists, subtracting items already present in the user's pantry.
- Consensus Agent: Resolves conflicts and aligns multi-agent plan details into a unified plan payload.
- Judge Agent: Validates safety, nutrition, and budget rules, looping back to the Planner if replanning is needed.
- Visualization Agent: Generates JSON spec blueprints for UI rendering (e.g., charts, meal grids, shopping cards).
Technical Stack
The service is configured with the following tech stack:
- LangGraph & LangChain: Structural frameworks for multi-agent loops and conversational history chaining.
- uv: Super-fast Python package and environment manager.
- FastAPI / gRPC: Server interface serving endpoints and gRPC requests on port
50051. - PGVector: Semantic vector search for retrieving user context, memory indexes, and allergen correlations.