philer-onboarding/
│
├── agents/ # Agents package - modular agent components
│ ├── __init__.py # Package initialization and exports
│ ├── agent_definitions.py # Agent class definitions and roles
│ ├── workflow_state.py # Shared workflow state definition
│ ├── recipe_creator_node.py # Recipe creation node function
│ ├── recipe_evaluator_node.py # Recipe evaluation node function
│ └── format_output_node.py # Output formatting node function
├── frontend/ # Frontend web interface
│ ├── frontend.py # FastAPI web server and chat interface
│ └── templates/ # Frontend HTML templates
│ └── chat.html # Main chat interface
├── workflow.py # Main LangGraph workflow orchestration
├── main.py # Main entry point to run the frontend server
├── requirements.txt # Python dependencies
├── .env.example # Environment variables template
├── test_setup.py # Setup validation and testing
├── setup.py # Quick setup automation script
└── README.md # This file
- Role: Creative Recipe Developer
- Purpose: Generate detailed, practical recipes based on user requests
- Capabilities:
- Creates complete recipes with ingredients and instructions
- Considers dietary restrictions and preferences
- Provides cooking tips and variations
- Estimates cooking and prep times
- Role: Recipe Quality Assurance Specialist
- Purpose: Evaluate recipes for logic, safety, and quality
- Capabilities:
- Analyzes cooking procedures for correctness
- Identifies potential food safety issues
- Suggests recipe improvements
- Validates ingredient combinations and cooking methods
This file contains the core agent classes and their configurations:
# Key Components:
- RecipeCreatorAgent class: Handles recipe generation
- RecipeEvaluatorAgent class: Handles recipe evaluation
- AGENT_DEFINITIONS: Registry of all available agentsRole: Defines the "who" - what each agent does and how they behave
This is the main orchestration file that defines how agents work together:
# Key Components:
- WorkflowState: Defines data structure passed between agents
- RecipeWorkflow class: Orchestrates the multi-agent process
- Node functions: Individual steps in the workflow
- Graph building: Defines the flow between agentsRole: Defines the "how" - the sequence and logic of agent interactions
# Create and activate virtual environment
python -m venv venv
venv\Scripts\activate # Windows
source venv/bin/activate # Linux/Mac
# Install Python dependencies
pip install -r requirements.txt
# Set up environment variables
copy .env.example .env
# Edit .env file and add your OpenAI API keyEdit the .env file:
OPENAI_API_KEY=your_openai_api_key_herepython main.pyThen open your browser to: http://localhost:8000
- User Input: User requests a recipe via the chat interface
- Recipe Creation: Recipe Creator Agent generates a detailed recipe
- Recipe Evaluation: Recipe Evaluator Agent reviews and critiques the recipe
- Output Formatting: System combines both outputs into a user-friendly response
- Response Delivery: Final result is displayed in the chat interface
The workflow uses a WorkflowState object that gets passed between nodes (this is easier for keeping track of progress and variables):
WorkflowState:
- user_input: Original user request
- recipe: Generated recipe
- evaluation: Professional evaluation
- final_output: Formatted final response
- step: Current workflow stage- Read the LangGraph documentation
- Make custom agents (e.g. specializing in Chinese cuisine by editing agent role)
- Add more agents (cost calculators)