Offered By: IBMSkillsNetwork

Create an Adaptive Pick-Your-Path Game with LangGraph

Build an AI game agent to tell any story. Using LangGraph, OpenAI's GPT-5.4, and Pydantic for structured output, create an agent that interprets natural-language commands, renders scenes, transitions through a branching scene graph, and detects narrative endings — all without rigid menus or keyword matching. Learn the agentic AI patterns behind interactive fiction systems while building a stateful game loop you can adapt to any story you can imagine.

Continue reading
New

Guided Project

Artificial Intelligence

At a Glance

Build an AI game agent to tell any story. Using LangGraph, OpenAI's GPT-5.4, and Pydantic for structured output, create an agent that interprets natural-language commands, renders scenes, transitions through a branching scene graph, and detects narrative endings — all without rigid menus or keyword matching. Learn the agentic AI patterns behind interactive fiction systems while building a stateful game loop you can adapt to any story you can imagine.

At a Glance

Build an AI game agent to tell any story. Using LangGraph, OpenAI's GPT-5.4, and Pydantic for structured output, create an agent that interprets natural-language commands, renders scenes, transitions through a branching scene graph, and detects narrative endings — all without rigid menus or keyword matching. Learn the agentic AI patterns behind interactive fiction systems while building a stateful game loop you can adapt to any story you can imagine.

The old "press A, B, or C" model of choose-your-own-adventure games is restrictive, outdated, and boring. Today's most immersive interactive fiction lets players type whatever they want  and uses LLMs to figure out what they actually meant. This guided project teaches you to build a pick-your-path game agent from scratch using LangGraph, GPT, and Pydantic. You won't just hard-code a story tree — you'll design a stateful workflow where specialized nodes handle scene rendering, intent classification, scene transitions, and ending detection, each passing structured data to the next through a shared state graph.

What You'll Learn

By the end of this project, you will be able to:
  • Design stateful agent workflows with LangGraph: Understand how to define typed state schemas, build processing nodes, and wire them into directed graphs with conditional edges — the architecture pattern behind production AI agents.
  • Use structured LLM outputs for reliable intent classification: Combine OpenAI's GPT models with Pydantic schemas to force the LLM into predictable, parseable output, so your agent can confidently route free-form player input to valid story actions.
  • Build a branching story graph with dynamic routing: Design scenes, actions, and endings as a connected data structure, and use LangGraph's conditional edges to loop through gameplay until a terminal scene is reached.

Who Should Enroll

  • Beginner to intermediate Python developers who have used LLM APIs for basic tasks and want hands-on experience building stateful, multi-step agent systems with real game logic.
  • Software engineers and indie game developers curious about how AI can power interactive fiction, dialogue systems, or natural-language game interfaces without giving up authored narrative control.
  • Aspiring AI agent builders who want to learn LangGraph's state management and graph orchestration through a fun, creative project before applying the same patterns to research agents, chatbots, or workflow automation.

Why Enroll

AI agents are the fastest-growing category in applied AI, and LangGraph is quickly becoming the go-to framework for building them. This project gives you practical experience with the core patterns — state management, node specialization, structured LLM outputs, and conditional routing — that apply whether you're building games, chatbots, or research assistants. Pick-your-path games are the perfect sandbox for these ideas: they're small enough to grasp end-to-end, but rich enough to expose the real challenges of multi-step agent design. You'll finish with a playable, AI-driven adventure of your own creation, plus the architectural intuition to design any stateful agent workflow from scratch.

What You'll Need

You should be comfortable with Python and have basic familiarity with APIs (making HTTP requests, using API keys) and dictionaries. No prior experience with LangChain, LangGraph, Pydantic, or agent frameworks is required — the project covers everything from the ground up. A spark of creativity helps too, since you'll be writing your own story scenes and endings. All dependencies are pre-configured in the environment, and the project runs best on current versions of Chrome, Edge, Firefox, or Safari.

Certificate

No Certificate Offered

Estimated Effort

60 Minutes

Level

Intermediate

Skills You Will Learn

Artificial Intelligence, LLM, Generative AI, NLP, Python

Language

English

Course Code

GPXX0Q2MEN

Released

May 25, 2026

Tell Your Friends!

Saved this page to your clipboard!

Have questions or need support? Chat with me 😊