A small Python Aglets-inspired mobile object runtime.
Project description
paglets
Introduction / overview paper:
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-artifacts list
uv run paglets-compute-slots status
uv run paglets-compute-groups
uv run paglets-analysis-jobs --tasks 3 --target-runtime 3
uv run paglets-file-grabber push ./data.bin --remote beta --dest /tmp/data.bin --dry
uv run paglets-search grep TODO .
uv run paglets-pi-compute --digits 32
The built-in compute-slots service admits coarse jobs by explicit
cpu_cores, expected RAM, and temp-storage estimates; on Linux and Windows it
can best-effort pin granted jobs to allocated CPU IDs. New compute job paglets
can derive from ComputeJobPaglet so scheduling, wakeup, redirects, affinity
metadata, and lease release stay out of job-specific code.
paglets-compute-slots status --blocked --usage explains blocked queued jobs
and reports active job process-tree memory plus Paglets and application scratch
usage. paglets-compute-slots jobs history shows recent finished job runtime
and peak usage summaries.
For detached multi-job workflows, ResultCollectorPaglet,
CollectingComputeJobPaglet, and submit_compute_job_group(...) provide a
small job-group plus collector layer. Hosts can advertise placement metadata
with paglets-host --tag TAG --property KEY=VALUE, and compute jobs can
require, exclude, or prefer host tags.
Files that belong to a paglet instance can be registered with
register_file(...) and then move naturally with dispatch or clone. Larger
explicit payloads can use ArtifactRef, HostClient.upload_artifact(...),
PagletProxy.send_artifact(...), and the paglets-artifacts CLI.
The paglets-file-grabber example demonstrates this natural file mobility for
one-file push and pull operations between an entry host and one remote host.
Simple request/result paglets can use TaskPaglet and TaskClient from
paglets.patterns.tasks. Paglets with several named operations can use
OperationPaglet and OperationClient; clone fan-out examples can reuse
MeshFanoutMixin and CursorDrainMixin for child bookkeeping and streaming
drains. File-transfer paglets can subclass SingleFileTransferPaglet for the
default workflow or use FileMobilityMixin to keep custom file-transfer code
readable.
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:
- Implementing Paglets
- Examples
- Operations
- Detached Compute With A Collector
- Artifact Transport
- Technical Reference
- Status And Limitations
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/artifacts.py artifact references and host artifact storage
src/paglets/runtime/ host facade, child processes, HTTP, relay, storage runtime
src/paglets/remote/ clients, proxies, transfer tickets, mesh, admin API
src/paglets/patterns/ typed task, operation, coordination, notification, and file mobility helpers
src/paglets/persistence/ inactive records and managed storage
src/paglets/services/ service contracts and resident services
src/paglets/system/ built-in resident service agents
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. Packaged
commands read PAGLETS_API_KEY automatically; pass --api-key-env NAME only
when the key lives in a different environment variable.
License
MIT. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file paglets-1.1.0.tar.gz.
File metadata
- Download URL: paglets-1.1.0.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26bee6c414950b1c21035f58c8a26cad28fbeed51746e4c4d93561099f27ed99
|
|
| MD5 |
4ca26d597a3b9c8d113ffe3e136f7bbc
|
|
| BLAKE2b-256 |
9dd70156a6d805f4f18ff0cf60343e1684188253e1e01a161f97c9bde824a85f
|
Provenance
The following attestation bundles were made for paglets-1.1.0.tar.gz:
Publisher:
publish.yml on cklukas/paglets
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
paglets-1.1.0.tar.gz -
Subject digest:
26bee6c414950b1c21035f58c8a26cad28fbeed51746e4c4d93561099f27ed99 - Sigstore transparency entry: 1965632608
- Sigstore integration time:
-
Permalink:
cklukas/paglets@246164038bee161cec79e0db98d834b4f7a4d217 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/cklukas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@246164038bee161cec79e0db98d834b4f7a4d217 -
Trigger Event:
push
-
Statement type:
File details
Details for the file paglets-1.1.0-py3-none-any.whl.
File metadata
- Download URL: paglets-1.1.0-py3-none-any.whl
- Upload date:
- Size: 260.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2f251e5b487097aa3bd750c2db33d629ad1fe7674f2ee216a49914c47c412d8
|
|
| MD5 |
321b5f0815fe5b028f138984931b4791
|
|
| BLAKE2b-256 |
7ba1799a5c4a31a0a05de72304dc4d8f3b1d44339f51fcf98b4d91be3dc7176e
|
Provenance
The following attestation bundles were made for paglets-1.1.0-py3-none-any.whl:
Publisher:
publish.yml on cklukas/paglets
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
paglets-1.1.0-py3-none-any.whl -
Subject digest:
e2f251e5b487097aa3bd750c2db33d629ad1fe7674f2ee216a49914c47c412d8 - Sigstore transparency entry: 1965632685
- Sigstore integration time:
-
Permalink:
cklukas/paglets@246164038bee161cec79e0db98d834b4f7a4d217 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/cklukas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@246164038bee161cec79e0db98d834b4f7a4d217 -
Trigger Event:
push
-
Statement type: