Skip to main content

English 简体中文

Drama Forge

Python License CI PyPI

Core Engine for productized AI drama production

Drama Forge turns story content into a repeatable, recoverable, repairable production graph. It is not a Studio UI, SaaS layer, or prompt library.

Story → Compiler → Production Spec / Manifest → Production Graph
  → Execution Runtime → Capability / Provider
  → Artifact / Candidate → Quality Gate → Select / Repair
  → Canonical Timeline → Provenance → Production History (SQLite)

Features

  • Domain kernel: Story / Character / Scene / Shot / Asset / Artifact / Production Graph / Fingerprint
  • Story compiler and production-spec planner
  • Execution runtime with checkpoint, retry, parallel scheduler, cooperative cancel
  • Provider decoupling: mock, OpenAI-compatible HTTP, DeepSeek, SiliconFlow, Agnes
  • Per-capability routing via provider_policy["by_capability"]
  • Typed artifact store with provenance and fingerprint cache
  • Quality runtime: validators, evaluators, gates, repair planner
  • Production Knowledge harvest / merge / continuity injection
  • Canonical timeline model and renderer
  • SQLite persistence (schema v2) and verification CLI
  • Nine core engineering validations covered by tests

Requirements

  • Python 3.11+

Install

From PyPI

pip install drama-forge

From source

git clone https://github.com/zcbacxc/drama-forge.git
cd drama-forge
pip install -e ".[dev]"

Quick start

Programmatic API

from drama_forge import Engine

engine = Engine(db_path="production.db")  # optional SQLite history
story = engine.compile("examples/story_sample.json")
result = engine.run(story, candidate_count=2)
print(result.status, result.timeline_artifact.id)
print(engine.inspect(result.timeline_artifact.id))

CLI

drama-forge version
drama-forge doctor
drama-forge compile examples/story_sample.json
drama-forge run examples/story_sample.json
drama-forge status <execution-id>
drama-forge inspect <artifact-id>
drama-forge validate <execution-id>
drama-forge repair <execution-id> examples/story_sample.json

Installed console script drama-forge is equivalent to python -m drama_forge.cli.main.

Provider configuration

Local mock providers work with zero config. Configuration is loaded from DRAMA_FORGE_* environment variables, project .env, and user-level ~/.drama-forge/.env (auto-created from .env.example on first run).

cp .env.example .env   # or edit ~/.drama-forge/.env
# then set keys / DRAMA_FORGE_PROVIDER

OpenAI-compatible HTTP provider:

export DRAMA_FORGE_PROVIDER=openai_compatible
export DRAMA_FORGE_PROVIDER_BASE_URL=https://api.openai.com
export DRAMA_FORGE_PROVIDER_API_KEY=sk-...
export DRAMA_FORGE_PROVIDER_MODEL=gpt-4o-mini
export DRAMA_FORGE_PROVIDER_DRY_RUN=1   # offline fallback, no network

Production providers (Stage C/F):

export DRAMA_FORGE_PROVIDER=production          # or deepseek+siliconflow
export DRAMA_FORGE_DEEPSEEK_API_KEY=sk-...
export DRAMA_FORGE_SILICONFLOW_API_KEY=sk-...
# optional: export DRAMA_FORGE_PROVIDER_DRY_RUN=1  # force offline fallbacks

Pin providers per capability without changing the production graph:

policy = {
    "strategy": "balanced",
    "by_capability": {
        "text_generation": {"provider_id": "deepseek"},
        "image_generation": {"provider_id": "siliconflow-image"},
    },
}
result = engine.run(story, provider_policy=policy)

Package layout

src/drama_forge/
  domain/         # story, asset, production, quality, continuity, knowledge
  compiler/       # parser, story graph, production spec, manifest
  runtime/        # scheduler, worker, checkpoint, events, cancellation
  providers/      # registry, router, factory, mock + HTTP adapters
  capabilities/   # capability registry, character/scene consistency, audio
  timeline/       # canonical timeline model + renderer
  artifacts/      # typed artifact store + provenance
  quality/        # validators, evaluators, gates, repair
  persistence/    # SQLite database + repositories
  engine.py       # programmatic facade
  cli/            # verification CLI

Documentation

Development

pip install -e ".[dev]"
python -m pytest -v
ruff check src tests
mypy src

Security

See SECURITY.md. Please report vulnerabilities privately via GitHub Security Advisories.

License

AGPL-3.0-or-later

Changelog

See CHANGELOG.md.

Metadata

Release files for drama-forge 0.1.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 drama-forge 0.1.0
File Size Uploaded Provenance Actions
drama_forge-0.1.0.tar.gz 131.9 kB Without provenance Details for drama_forge-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for drama-forge 0.1.0
File Interpreter ABI Platform Actions
drama_forge-0.1.0-py3-none-any.whl Python 3 none any Details for drama_forge-0.1.0-py3-none-any.whl

Total release size: 263.3 kB

Release files / drama_forge-0.1.0.tar.gz

Download URL drama_forge-0.1.0.tar.gz
Size 131.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c04b99dc72ad6b175749c8d991b8d33831c54f4e77501e122f8f09e7f533f86a
BLAKE2b-256 checksum
How to use checksums
71653a191a80e617eaba4a62681795f6d3059a5ee91cb9af36c9ccad3f9c1628
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Release files / drama_forge-0.1.0-py3-none-any.whl

Download URL drama_forge-0.1.0-py3-none-any.whl
Size 131.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f4b2b78970865f6a8c050ea5c1eacbebf574a79cf49dff00bd23d5dc7186ac6f
BLAKE2b-256 checksum
How to use checksums
05476ca9d315c7d474741c6a741b14a8dce7aaac69c4d8531688c0d8bfd42afa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Security for drama-forge 0.1.0

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.

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