Skip to main content

pyrct2-agent

LLM agent that plays RollerCoaster Tycoon 2 via pyrct2. Give it a scenario and an LLM — it builds rides, places paths, and tries to meet the objective.

Install

pip install pyrct2-agent
pyrct2 setup        # finds OpenRCT2, installs the bridge plugin

Quick start

from pyrct2_agent import Agent
from pyrct2.scenarios import Scenario
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="gpt-5",
    model_kwargs={"parallel_tool_calls": False}, # If you don't disable this, it can result in weird or incoherent map states (sometimes)
)
result = Agent(Scenario.CRAZY_CASTLE, llm=llm, max_actions=50).run()
print(result)

Modes

The agent loop supports three timing strategies:

Mode Behavior
TickPerAction() Game advances N ticks per tool call. Ticks run in background while LLM thinks. (default)
PauseAndAct() Game paused during thinking. N actions per turn, then M ticks advance.
RealTime() Game runs continuously. LLM latency = real game time passing.
from pyrct2_agent import Agent, PauseAndAct

result = Agent(
    Scenario.TEST_PARK,
    llm=llm,
    mode=PauseAndAct(ticks_per_turn=2000, actions_per_turn=10),
).run()

Tools

12 builtin tools across three categories:

Category Tools
Observe get_park_status, show_map
Paths place_path, place_path_line, remove_path
Rides list_available_rides, place_ride, place_stall, set_ride_price, get_rides, check_ride_connectivity, demolish_ride

Custom tools

from langchain_core.tools import tool

def my_tools(game):
    @tool
    def hire_handyman() -> str:
        """Hire a handyman."""
        game.park.staff.hire(StaffType.HANDYMAN)
        return "Hired"
    return [hire_handyman]

# Add alongside builtins
Agent(scenario, llm=llm, extra_tools=my_tools)

# Or replace all builtins
Agent(scenario, llm=llm, tools=my_tools)

Configuration

Agent(
    scenario,
    llm=llm,
    mode=TickPerAction(ticks_per_action=200),   # timing strategy
    system_prompt="custom prompt here",         # override default
    game_speed=4,                               # 0-7
    headless=True,                              # hide game window
    end_on_scenario_complete=True,              # stop when objective met
    max_ticks=100_000,                          # tick limit
    max_actions=200,                            # action limit
)

Requirements

Release files for pyrct2-agent 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyrct2-agent 0.2.0
File Size Uploaded
pyrct2_agent-0.2.0.tar.gz 87.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyrct2-agent 0.2.0
File Interpreter ABI Platform
pyrct2_agent-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 108.5 kB

Release files / pyrct2_agent-0.2.0.tar.gz

Download URL pyrct2_agent-0.2.0.tar.gz
Size 87.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a1f5245aadcc08a08e67300c4b0b3be8736008c8a270d3429b10b898010a04e9
BLAKE2b-256 checksum
How to use checksums
e6e0ad38899813b0b346a6c3150e155120ab899d3278e1158be7035098ef8a9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 3, 2026.

Transparency log

Release files / pyrct2_agent-0.2.0-py3-none-any.whl

Download URL pyrct2_agent-0.2.0-py3-none-any.whl
Size 21.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4cf558ce5cbb936d830df98fb2c67f393fda3c0c97b49f4d8760a0663e285405
BLAKE2b-256 checksum
How to use checksums
5f78e42a48e74ad722a7117d3614d841ee0b57dac60bb752cb3305159f727190
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 3, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page