AI Prompt Chaining & Task Routing

Use cutting edge AI frameworks like LangGraph to build sophisticated AI Workflows intermediate

With Andrew Jones

Type: Course project

Duration: 2 Hours

Case Description

In this hands-on project, you will explore the fundamentals of AI orchestration and prompt chaining by building an intelligent system for automated document processing. The goal is to move beyond simple prompts and learn how to design multi-step AI workflows that can analyze, interpret, and structure complex information.

Using LangGraph, you will build a stateful AI workflow capable of task routing, conditional logic, and iterative refinement. Instead of relying on linear prompt sequences, you will implement flexible architectures where the AI can dynamically decide how to process different sections of a document—creating workflows that resemble how humans read, analyze, and synthesize information.

Along the way, you will use Docling to perform high-fidelity document parsing, ensuring that layouts, formatting, and structural elements are preserved during extraction. To organize and validate the extracted information, you will leverage Pydantic to transform raw text into structured, reliable data models suitable for downstream automation and system-to-system communication.

By completing this project, you will gain practical experience with modern AI workflow frameworks, learning how to build robust prompt chains, intelligent routing systems, and scalable document-processing pipelines. The skills you develop will help you design production-ready AI systems capable of turning unstructured data into structured insights.

Project requirements

  • OpenAI Account - signup here: https://auth.openai.com/create-account. Free tokens are available!
  • IDE of your choice - developed on VS code
  • Modern Python Version >=3.10  - virtual environments recommended
  • Developed on Windows - no known operating system specific dependencies however
  • Requirements.txt provided - notebooks, docling, openai and LangGraph

Project files

The data for this project consists of a variety of real world invoice documents that we'll automate the processing for. These images vary in setup, structure, and fidelity to simulate real world conditions.

But nothing we do in this course will be bespoke for these document types or even document processing use cases in general - the applications for this type of automation are endless!

Start project
Project content
  • 0 Project file
  • Guided and unguided instructions
  • Part 1: Document Representations for AI
  • Part 2: Simple Extraction
  • Part 3: Structured Outputs
  • Part 4: Conditional Logic
  • Part 5: Tools
  • Quiz
Topics covered
Automaton Agentic AI Programming