Skip to main content

A small Python Aglets-inspired mobile object runtime.

Project description

paglets

CI Publish Package Docs Python License

paglets is a compact Python re-imagining of the Java Aglets mobile-agent idea: stateful objects with identity, lifecycle hooks, message passing, proxies, movement between hosts, durable deactivation, resident services, and explicit dataclass state serialization.

Hosts are expected to already have the same paglet code importable. Movement transfers the paglet class name, state class name, and serialized dataclass state; it does not upload code or move Python stacks, threads, sockets, or arbitrary live resources.

Quick Start

Install and run tests from a checkout:

uv run pytest

Build the Python package locally:

uv build

After a tagged release is published, install the package with:

python -m pip install paglets

Start two local hosts:

uv run paglets-host --name alpha --port 8765 --mesh-version dev
uv run paglets-host --name beta --port 8766 --peer http://127.0.0.1:8765 --mesh-version dev

Run a packaged example CLI:

uv run paglets-sysinfo summary
uv run paglets-search grep TODO .
uv run paglets-pi-compute --digits 32

Run a source-tree demo:

uv run python demos/disk_survey_demo.py --hosts alpha beta gamma

Minimal Paglet

from dataclasses import dataclass, field

from paglets.core.agent import Paglet, PagletState
from paglets.core.messages import Message


@dataclass
class CounterState(PagletState):
    count: int = 0
    events: list[str] = field(default_factory=list)


class CounterPaglet(Paglet[CounterState]):
    State = CounterState

    def handle_message(self, message: Message):
        if message.kind == "increment":
            self.state.count += int(message.args.get("by", 1))
            return {"count": self.state.count}
        return self.not_handled()

Public imports are intentionally explicit:

from paglets.runtime.host import Host
from paglets.core.agent import Paglet, PagletState
from paglets.core.messages import Message
from paglets.remote.proxy import PagletProxy

Flat imports such as from paglets import Host are unsupported.

Documentation

The full documentation is published at https://cklukas.github.io/paglets/.

Useful entry points:

Build docs locally:

uv run --extra docs mkdocs build --strict
uv run --extra docs mkdocs serve

Project Layout

src/paglets/core/            paglet model, messages, lifecycle events
src/paglets/runtime/         host facade, child processes, HTTP, relay, storage runtime
src/paglets/remote/          clients, proxies, transfer tickets, mesh, admin API
src/paglets/persistence/     inactive records and managed storage
src/paglets/services/        service contracts and resident services
src/paglets/serialization/   dataclass wire conversion and import resolution
src/paglets/config/          launch config and bundled defaults
src/paglets/tooling/         CLI, discovery, git auto-update
src/paglets/examples/        packaged example agents and CLIs
demos/                       runnable source-tree demo scripts
tests/                       behavior-oriented test suites by topic

Status

paglets is early-stage software for experiments and trusted local/LAN meshes. Use API-key authentication for shared networks and relay deployments.

License

MIT. See LICENSE.

Project details


Download files

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

Source Distribution

paglets-0.1.0.tar.gz (278.3 kB view details)

Uploaded Source

Built Distribution

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

paglets-0.1.0-py3-none-any.whl (183.5 kB view details)

Uploaded Python 3

File details

Details for the file paglets-0.1.0.tar.gz.

File metadata

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

File hashes

Hashes for paglets-0.1.0.tar.gz
Algorithm Hash digest
SHA256 66f62c433291c38ec986e7fb7352152659d93407c9e49bc7ae4aa7215ac80045
MD5 56f15824eefce9da0c8694022324815e
BLAKE2b-256 aab8d8c62839e765644a528c68312116ecabca7eaeff9915e8ecbcdd9670b363

See more details on using hashes here.

Provenance

The following attestation bundles were made for paglets-0.1.0.tar.gz:

Publisher: publish.yml on cklukas/paglets

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

File details

Details for the file paglets-0.1.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for paglets-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3d2923080bb03527868c9222fcbce976ee730466e84c176551eef02790d47f11
MD5 b9ebdc2e9f1ed4c033caf94aa1221363
BLAKE2b-256 1d26e6b9e79362d9526b22aaf035102f11e5345b8d604c91e195100b630a0004

See more details on using hashes here.

Provenance

The following attestation bundles were made for paglets-0.1.0-py3-none-any.whl:

Publisher: publish.yml on cklukas/paglets

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

Supported by

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