Playing Zork has never been so boring

Build AI agents to play classic text adventure games (Zork, Colossal Cave, Enchanter, etc.) using the Model Context Protocol (MCP) and HuggingFace models.

This project provides:

  • MCP Server - Exposes text adventure games as MCP tools using FastMCP
  • ReAct Agent - An agent that uses MCP tools to play games with reasoning
  • Submission Template - Starter code for students to implement their own solutions
  • Evaluation System - Deterministic evaluation with seeded runs
  • 57 Games - Zork trilogy, Infocom classics, and many more Z-machine games

Getting Started

0. Clone this space

git clone https://huggingface.co/spaces/LLM-course/Agentic-zork

This includes:

  • run_agent.py: Script to run agents on text adventure games
  • evaluation/: Evaluation scripts and utilities
  • games/: Text adventure game environments
  • submission_template/: Template for your agent submission

1. Fork the template space

Fork the template space on Hugging Face:

https://huggingface.co/spaces/LLM-course/text-adventure-template

2. Clone your fork locally

git clone https://huggingface.co/spaces/YOUR_USERNAME/text-adventure-agent

3. Implement your agent

Edit these files:

  • agent.py - Your ReAct agent implementation (implement the StudentAgent class)
  • mcp_server.py - Your MCP server implementation (add tools like play_action, memory, etc.)

4. Test locally

# Test MCP server interactively
fastmcp dev mcp_server.py

# Run your agent
python run_agent.py --agent . --game lostpig -v -n 20

5. Push to your space

6. Submit your space URL