
AI Agent Design Patterns: ReAct, CodeAct & More
Michael Ryan, a Stanford CS PhD student and contributor to the DSPy project, lectures on how to structure AI agent systems. This is lecture six of CS329Z: Engineering AI Agents, a graduate course at Stanford taught by Diyi Yang, Michael Ryan, and John Yang. Ryan opens with the question of when to build a fixed workflow versus a flexible agent, then walks through Anthropic's five workflow patterns before covering reasoning-and-acting approaches including ReAct, Reflexion, CodeAct, and ReWOO. He spends significant time on context-management techniques that keep long-running agents functional, including event logs, compaction, observation masking, subagents, and modular skills. The lecture closes with a case study of the Pi harness, a minimal agent implementation used to illustrate the patterns in practice. The talk is technical and example-driven, aimed at students building production agent systems rather than casual AI users.