Deterministic State-Driven Interactive Narrative Engine SDK
Project description
🚀 Story Builder
⭐ Star this repo if you find it useful!
AI-powered branching narrative engine for games and interactive fiction
Story Builder is a deterministic Python engine for building, validating, and executing branching story graphs.
Generate stories with AI, validate them with a strict schema, and run them with a reliable state engine.
⚡ Install
pip install story-builder-sdk
Verify installation:
story-builder --help
🎬 Demo
Generate a story with one command:
story-builder generate "Cyberpunk detective story"
Output:
story.json
story_graph.dot
Visualize the graph:
story-builder visualize story.json --dot-only
🚀 Quickstart (1 minute)
Generate a branching story:
story-builder generate "A haunted mansion mystery"
Play the story:
story-builder play story.json
Visualize the graph:
story-builder visualize story.json --dot-only
🧠 AI Story Generation
Story Builder can generate complex story graphs using AI.
Set your API key:
**Windows**
```powershell
$env:OPENROUTER_API_KEY="YOUR_KEY"
macOS / Linux
export OPENROUTER_API_KEY="YOUR_KEY"
Advanced Generation
Control the graph size and structure with flags:
story-builder generate "Cyberpunk detective story" --nodes 12 --branching 3 --depth 4
--nodes N: Total target nodes (default 6)--branching K: Average branching factor (default 2)--depth D: Maximum depth from start (default 3)--mock: Force mock mode even if API key is available--seed S: Seed for deterministic generation
If no API key is provided OR --mock is used, Story Builder runs in a deterministic mock mode.
[!NOTE] GraphViz binaries are required only for rendering images (PNG/SVG). Generating
.dotfiles and.jsongraphs works without any external dependencies.
🕹 CLI Commands story-builder init story-builder generate story-builder play story-builder visualize story-builder validate story-builder export story-builder demo-ai 🏗 Features
• AI-powered story generation • Deterministic branching engine • Graph validation with schema enforcement • Stateful narrative execution • Graph visualization • Ink export support • CLI-first developer workflow
💎 Pro Version
Advanced AI branch generation is available in Story Builder Pro.
Install Lite SDK first:
pip install story-builder-sdk
Then install Pro:
pip install story_builder_pro-0.1.2-py3-none-any.whl 📚 Examples
Example story graphs are available in the /examples directory.
Visualize one with:
story-builder visualize examples/cyberpunk_detective.json 📜 License
MIT License
Structure Your Story. Control Your World.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file story_builder_sdk-0.1.3.tar.gz.
File metadata
- Download URL: story_builder_sdk-0.1.3.tar.gz
- Upload date:
- Size: 24.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a083972bcc1b1ebca49df1f9d4a2706d6db63a90b200efdcfc6b47e509d19aad
|
|
| MD5 |
b856e223375175768ee927b0c15e7486
|
|
| BLAKE2b-256 |
bbb2d98f1214483072a5ff267c99bf7067c4b446b79686a06e6ee4787b981d53
|
File details
Details for the file story_builder_sdk-0.1.3-py3-none-any.whl.
File metadata
- Download URL: story_builder_sdk-0.1.3-py3-none-any.whl
- Upload date:
- Size: 20.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f35b2d8c7f1206f6efd093eae9544db86b4da1f1e10d77e82948dc54f1752c26
|
|
| MD5 |
7fd3e580709b203ad87048b8474fa912
|
|
| BLAKE2b-256 |
2cbba8457aae177df1de1d58cf15b5eb3a50fe549f914093cf536be4d9345b4b
|