🚀 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.
Metadata
Release files for story-builder-sdk 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| story_builder_sdk-0.1.3.tar.gz | 24.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| story_builder_sdk-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 44.5 kB
Release files / story_builder_sdk-0.1.3.tar.gz
| Download URL | story_builder_sdk-0.1.3.tar.gz |
|---|---|
| Size | 24.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a083972bcc1b1ebca49df1f9d4a2706d6db63a90b200efdcfc6b47e509d19aad
|
|
BLAKE2b-256 checksum How to use checksums |
bbb2d98f1214483072a5ff267c99bf7067c4b446b79686a06e6ee4787b981d53
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / story_builder_sdk-0.1.3-py3-none-any.whl
| Download URL | story_builder_sdk-0.1.3-py3-none-any.whl |
|---|---|
| Size | 20.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f35b2d8c7f1206f6efd093eae9544db86b4da1f1e10d77e82948dc54f1752c26
|
|
BLAKE2b-256 checksum How to use checksums |
2cbba8457aae177df1de1d58cf15b5eb3a50fe549f914093cf536be4d9345b4b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Security for story-builder-sdk 0.1.3
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.