Skip to main content

Archetype

CI Python 3.12+ License: Apache 2.0

Archetype is a dataframe-first ECS runtime for simulations and agent workflows. Define state with components, transform populations with processors, and keep each tick as queryable history. Use a fork to continue from an earlier state without overwriting the original run.

It is built on Daft and LanceDB. The default Python entry point is ArchetypeRuntime; HTTP services and the CLI use the same command layer when you need a multi-user host.

Install

pip install archetype-ecs

For a checkout, install the development environment with make sync-dev.

Run a simulation

import asyncio

from daft import DataFrame, col

from archetype import ArchetypeRuntime, AsyncProcessor, Component


class Position(Component):
    x: float = 0.0
    y: float = 0.0


class Velocity(Component):
    dx: float = 0.0
    dy: float = 0.0


class Move(AsyncProcessor):
    components = (Position, Velocity)

    async def process(self, df: DataFrame, **_) -> DataFrame:
        return df.with_columns(
            {
                "position__x": col("position__x") + col("velocity__dx"),
                "position__y": col("position__y") + col("velocity__dy"),
            }
        )


async def main() -> None:
    async with ArchetypeRuntime() as runtime:
        world = runtime.world("demo", processors=[Move()])
        await world.spawn(Position(), Velocity(dx=1, dy=2))
        await world.run(steps=3)

        history = await world.query(Position)
        print(history.collect().to_pylist())


asyncio.run(main())

For a regular script without async, use with ArchetypeRuntime.sync() as runtime: and omit await.

What it gives you

  • Columnar processors run one DataFrame transform over every matching entity.
  • Every tick is append-only, so historical reads are ordinary queries.
  • Forks inherit source history and create an independent future.
  • The service layer can authorize and audit mutations before a tick applies them.

Documentation

Start with the quickstart, then use the guides for components, processors, and worlds.

The site also includes the current Python API, CLI, and REST API references.

Runnable examples live in examples/. Most run without credentials:

uv run python examples/01_world_mutations.py
uv run python examples/02_fork_counterfactual.py
uv run python examples/03_time_travel.py
uv run python examples/04_messaging.py
uv run python examples/07_hooks.py

examples/05_llm_agents.py and parts of examples/06_trajectory_analysis.py require OPENAI_API_KEY.

Development

make sync-dev  # install development dependencies
make test      # run the fast test suite
make check     # format and lint
make docs      # generate references and build the docs site
make ci        # run the merge gate

Read CONTRIBUTING.md before changing the engine. The normative contracts are under docs/guide/.

Status

Archetype is alpha software. The append-only world, history, and fork paths are the most mature parts of the project. The HTTP layer uses development-mode authentication by default; supply your own authentication before exposing it to untrusted users.

License

Apache-2.0. See LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

archetype_ecs-0.3.0.tar.gz (187.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

archetype_ecs-0.3.0-py3-none-any.whl (248.4 kB view details)

Uploaded Python 3

File details

Details for the file archetype_ecs-0.3.0.tar.gz.

File metadata

  • Download URL: archetype_ecs-0.3.0.tar.gz
  • Upload date:
  • Size: 187.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for archetype_ecs-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4198148bdbbabf68b0f71780a6776a692cfc66b40c077053a5345cb71d84a2bd
MD5 19ee3a4fdc12ec25e67ffbcdf9bc6129
BLAKE2b-256 6f6ce53a2e62b53949433eb2ab6e2cdea18225f84e06a5ffcefd4cd9778f9d54

See more details on using hashes here.

Provenance

The following attestation bundles were made for archetype_ecs-0.3.0.tar.gz:

Publisher: release.yml on VangelisTech/archetype

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file archetype_ecs-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: archetype_ecs-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 248.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for archetype_ecs-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ebbbe15a2f02a791e4275bbc3ae47fc3a764f35a39e4656d37ba6b7b2cfbc9d0
MD5 cc09f79ab0c7e2893b6a4a0fd6ecfbbc
BLAKE2b-256 a3259daf043811741e9c2da7b9154c174012dbd5d87b5f08f05ea5364d133108

See more details on using hashes here.

Provenance

The following attestation bundles were made for archetype_ecs-0.3.0-py3-none-any.whl:

Publisher: release.yml on VangelisTech/archetype

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.6.3

2 files

0.6.1

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

This release

0.3.0 This release

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page