How jaybea/o1agenticplanner works
Project type and purpose
• This is a Python-based, educational command-line tool/library for exploring AI-driven order-fulfillment automation.
• It demonstrates a two-stage AI pipeline (planning with O1-mini and execution with GPT-4), configurable business contexts, scenarios, and pluggable business functions.
File structure
• Top-level files: .env.example, requirements.txt, README.md, LICENSE → configuration, dependency, and documentation.
• src/order_fulfillment: the main package
• config.py → environment and model settings loader
• context.py → business context definitions (inventory, capacity, etc.)
• scenarios.py → predefined test scenarios
• plans.py → plan representation and storage
• executor.py → orchestration of planning + execution pipeline
• functions.py + helper.py + utils.py → business-function implementations and utilities
• registry.py → registry pattern for models, contexts, functions, scenarios
• main.py → CLI entry point
• src/prototype: sandboxed or earlier proof-of-concept versions of similar modules
Key insights from the README
• Separation of “planning” and “execution” phases
• Swappable AI models and contexts
• Educational emphasis: learn clean structure, type hints, testing AI logic
Main components
a. User / CLI (main.py)
b. Configuration Loader (config.py)
c. Registry Service (registry.py)
d. Context Manager (context.py + scenarios.py)
e. Planner Service (plans.py + functions to call O1-mini model)
f. Executor Service (executor.py + calls to GPT-4 + business functions in functions.py)
g. Business Function Library (functions.py + helper.py + utils.py)
h. Plan Store or Cache (persistent plan storage in plans.py)
i. External AI APIs (O1-mini endpoint, OpenAI GPT-4)
j. Virtual environment and environment variables (.env)
Relationships and interactions
• CLI invokes Configuration Loader → Registry Service
• Registry wires up Context Manager & Scenario definitions
• CLI triggers Executor Service:
• Executor requests a plan from Planner Service (via AI model)
• Plan is stored in Plan Store
• Executor retrieves plan → executes step-by-step using Business Function Library, driving calls to GPT-4 or local logic
• Context Manager provides current business state to both Planner and Executor
• All AI calls pass through well-defined interfaces in executor.py and plans.py
Architectural patterns and design principles
• Separation of concerns: planning vs. execution, context vs. functions
• Registry pattern for plug-and-play components (models, contexts, scenarios, functions)
• Pipeline/orchestration pattern in executor.py
• Config-driven behavior (env vars + config.py)