PARACOSM AGENTOS | API Reference v0.9.1202
Home Simulation API Docs GitHub npm
Home Simulation API Docs GitHub npm AgentOS Discord
paracosm - v0.9.1202
    Preparing search index...

    Module paracosm/digital-twin

    Subpath export: paracosm/digital-twin

    Curated entry point for the digital-twin use case. DigitalTwin is an alias for the same WorldModel class exported from paracosm; the alias names the use case the user is modeling rather than the underlying mechanism.

    Use this subpath when:

    • You have a specific subject (person, organism, organization, or system) you want to simulate under counterfactual interventions.
    • You want the most ergonomic surface for intervene().
    • You want type-only access to SubjectConfig and InterventionConfig without importing the root API.

    Use the root paracosm export instead when:

    • You are running civilization simulations or policy comparisons across scenarios.
    • You need access to the full WorldModel.batch, WorldModel.fork, or WorldModel.replay surface (those methods are also available here, since DigitalTwin === WorldModel, but the subpath docstrings focus on the digital-twin case).

    Both entry points back-end to the same class. Choosing one is a positioning decision, not a functional one.

    import { DigitalTwin, type SubjectConfig, type InterventionConfig } from 'paracosm/digital-twin';

    const twin = await DigitalTwin.fromJson(scenarioJson);
    const subject: SubjectConfig = {
    id: 'northwind', name: 'Northwind', profile: { headcount: 100, runwayMonths: 18 },
    };
    const intervention: InterventionConfig = {
    id: 'rif', name: 'Reduction in force',
    description: 'A 25% reduction in force across all departments.',
    category: 'policy', targetBehaviors: ['runway', 'retention'],
    };
    // The run's departments, its actor and its Event Director read both;
    // the artifact records them.
    const artifact = await twin.intervene({ subject, intervention, actor: leader, maxTurns: 4 });
    DigitalTwin → WorldModel
    InterventionConfig → InterventionConfig
    RunArtifact → RunArtifact
    SubjectConfig → SubjectConfig