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.1.tar.gz (219.9 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.1-py3-none-any.whl (286.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: archetype_ecs-0.4.1.tar.gz
  • Upload date:
  • Size: 219.9 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.1.tar.gz
Algorithm Hash digest
SHA256 c604c5075efce59b9d4263131f7e92289315303a35158ea28900b04ad9f4a6b1
MD5 38727c168bc8eeecfd467a2729b4a4bc
BLAKE2b-256 3f9ef7d559b1ad018dbb65c0930b7a7946ac6e9ab25699ff1e054174bfaa5843

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: archetype_ecs-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 286.0 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0d2cf699cd95378fac9a64baab8941c16eee42c5bbbe8ef3cce7cf69c5916181
MD5 bf04f12cbb2518f573e99cfbe687acbc
BLAKE2b-256 d19e194b379c73ebd337c5fcb1b44a7c86b827fe8148286ee433889a103a2550

See more details on using hashes here.

Provenance

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

This release

0.4.1 This release

2 files

0.4.0

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