Python API Reference

Source-driven signatures for Core primitives, evaluation contracts, runners, and runtime helpers.

On this page

The same contracts the CLI and Studio call. Each page pairs a short choice guide with signatures generated from source. Model-specific code, vendored upstream trees, and benchmark internals stay out of this reference.

Core

Shared attention, I/O, loading, distributed, configuration, and acceleration primitives.

Evaluation

Serializable contracts, runners, metrics, orchestration, evidence, and runtime helpers.

Import policy

Prefer public facades over private modules:

from worldfoundry.evaluation.api import (
    ArtifactRef,
    GenerationRequest,
    GenerationResult,
    Metric,
    WorldModelRunner,
)
from worldfoundry.evaluation.public import WorldFoundryRunRequest, run_worldfoundry
from worldfoundry.evaluation.reporting import build_scorecard
from worldfoundry.core import scaled_dot_product_attention

worldfoundry.core lazily exports shared primitives. Evaluation contracts live in worldfoundry.evaluation.api, orchestration in worldfoundry.evaluation.public, evidence builders in worldfoundry.evaluation.reporting, and path/asset helpers in worldfoundry.runtime.*.

How pages are built

Signatures, parameters, methods, and source links are regenerated from Python AST during the docs build (no Torch/CUDA import). Choice guides and examples are written by hand.

cd docs/fumadocs
npm run api:generate
npm run api:check

For workflows beyond signatures, continue to the design guide, inference guide, or evaluation overview.