Skip to main content

The Environment

Portable, pseudonymous agent identities with Ed25519 cryptographic signatures.

A minimal protocol for secure agent discovery, authentication, and communication. Perfect for multi-agent systems, AI agents, and decentralized applications.

Why The Environment?

  • Secure - Ed25519 signatures, AES-GCM encryption, Scrypt KDF
  • Simple - Small core with one cryptography dependency
  • Portable - Export/import identities as bundles
  • Flexible - Support any serializable Python data
  • Fast - In-memory environment for real-time discovery

Quick Start

pip install the-ment

Create an Identity

from ment import create_identity

identity = create_identity("my-password")
print(f"Agent ID: {identity.id}")
unlocked = identity.unlock("my-password")

Sign and Verify

from ment import create_identity, verify_signature

identity = create_identity("my-password")
unlocked = identity.unlock("my-password")
signature = unlocked.sign({"action": "transfer"})

is_valid = verify_signature(identity.public_key, {"action": "transfer"}, signature)
print(f"Valid: {is_valid}")  # True

Multi-Agent Communication

from ment import create_identity, Environment

agent_a = create_identity("password-a")
agent_b = create_identity("password-b")

env = Environment()
env.join(agent_a.id, capabilities=["code"])
env.join(agent_b.id, capabilities=["search"])

env.send(agent_a.id, {"text": "Hello!"}, target_id=agent_b.id)
messages = env.receive(agent_b.id)
print(messages[0].content)  # {"text": "Hello!"}

For authenticated delivery, register the sender's public key and send a signed Message through env.send_message(...). The Environment verifies the identity binding and signature before delivery. Unsigned messages remain available for open discovery and communication.

Examples

python examples/basic_usage.py
python examples/multi_agent_chat.py
python examples/signed_messages.py

Minimal API

The Environment can also run as a small in-memory HTTP service:

from ment import serve

serve(host="127.0.0.1", port=8765)

Available endpoints:

POST /join
GET  /discover
POST /send
GET  /receive
POST /heartbeat
POST /leave

The API has no database or graphical interface. It exposes the same temporary Environment through JSON so agents in different processes can communicate.

Architecture

  • Identity: Random Ed25519 key pair, password-protected via AES-GCM
  • Signatures: Ed25519 for message authentication
  • Environment: In-memory agent discovery and messaging with automatic verification of supplied signatures
  • Bundles: Portable export/import of full identity

Security

  • Ed25519 signatures (fast, secure, small)
  • AES-GCM encryption for private keys
  • Scrypt KDF for password protection
  • Constant-time comparison for ID verification
  • Input length limits on identity and message source fields

Testing

python -m pytest tests/ -v

20/20 tests passing

License

MIT

Release files for the-ment 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for the-ment 0.1.0
File Size Uploaded
the_ment-0.1.0.tar.gz 13.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for the-ment 0.1.0
File Interpreter ABI Platform
the_ment-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 24.9 kB

Release files / the_ment-0.1.0.tar.gz

Download URL the_ment-0.1.0.tar.gz
Size 13.4 kB
Tags Source
SHA-256 checksum
How to use checksums
fb274a707046d86cc043ca55fd8203cce9174738aa9bf9a274172d0916996f91
BLAKE2b-256 checksum
How to use checksums
21d3c7ddb102b8233db258143a8a52f7f77130a7ad2fd8bc6f555e446ea6a3b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / the_ment-0.1.0-py3-none-any.whl

Download URL the_ment-0.1.0-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b1269f19aef7a5ee052177988675ddffa9a4744afa11f100a1afd0ab3702c0d8
BLAKE2b-256 checksum
How to use checksums
47a989064cf833d61f4b1553cd1ef4c26ff370bbb99dd5f3b788424f3d01ccc4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page