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.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 drama-forge 0.2.0
File Size Uploaded Provenance Actions
drama_forge-0.2.0.tar.gz 168.3 kB With provenance Details for drama_forge-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 321.7 kB

Release files / drama_forge-0.2.0.tar.gz

Download URL drama_forge-0.2.0.tar.gz
Size 168.3 kB
Tags Source
SHA-256 checksum
How to use checksums
92e7f3e7abc892405797039911f78fca088945641dd665d71d2f8ba9887316a3
BLAKE2b-256 checksum
How to use checksums
e46a796e66ddf0dd5fa731bfeb8ff7ea330f19a151f01e495ee863eef34391b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 22, 2026.

Transparency log

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

Download URL drama_forge-0.2.0-py3-none-any.whl
Size 153.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c86ac514a44c74f152e2d5d185ba158527fb327d17ca06fd6babce86ccdbc87d
BLAKE2b-256 checksum
How to use checksums
5565117b2803b6488ce6c46190a7d4fcfa707d78573997f874a4e103fce1cbf2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 22, 2026.

Transparency log

Security for drama-forge 0.2.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for drama_forge-0.2.0.tar.gz

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 Sep 22, 2026.

Transparency log

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