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.4.0.tar.gz (204.8 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.4.0-py3-none-any.whl (270.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for archetype_ecs-0.4.0.tar.gz
Algorithm Hash digest
SHA256 26a771fdd46e2fb0cf9f53b36883e307dc99bc0c5a23a88ec1704ee30acbe15c
MD5 aa235e08ff8839a8f32de61d78b5af53
BLAKE2b-256 28bbe36b4022d978c4e1068504ef7c160e157a06c5e34f80dfc5e6f52a365ddb

See more details on using hashes here.

Provenance

The following attestation bundles were made for archetype_ecs-0.4.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.4.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for archetype_ecs-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 84f173b07dc53d9c6f6c85dd7824edaf23bc578208a8105f750304ed0ca449d3
MD5 2da463d7f3c3cc13b336d9b346738599
BLAKE2b-256 0fe9cdb218b14772553c5a7bc50fb90984f6dc0a1d311e99f333d6d926abbf42

See more details on using hashes here.

Provenance

The following attestation bundles were made for archetype_ecs-0.4.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

This release

0.4.0 This release

2 files

0.3.0

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