Turn scripts into reusable components by embracing strict types and stateless design. With Factors 2, 5, 10, and 12, students externalize prompts, unify execution and business state, and build a reducer-style agent that takes state in and returns state out.
Overview
Syllabus
Designing a Stateless Reducer Agent
- Build the Agent Initialization
- Load Tool Schemas from JSON Files
- Connect the Agent to the Model
- Parsing Tool Calls and Detecting Completion
- Execute Tool Calls and Capture Errors
- Complete the Reducer Loop
Taking Ownership of Prompts
- Externalize the System Prompt
- Create a Context Formatting Template and Serializer
- Serialize Completed Tool History
- Connect the Context Serializer to the Agent
Unifying Execution and Business States
- Build a Unified State Model
- Refactor the Agent to Run on Unified State
- Defer Tool Calls Between Agent Steps
- Resume an Agent from Intermediate State