Skip to main content

Agent Memory Canonicalization Standard (AMCS) reference package

Project description

AMCS-0.1

Agent Memory Canonicalization Standard (AMCS) reference implementation.

Install

python -m pip install -e ".[dev,api]"

If you only need core library features:

python -m pip install -e ".[dev]"

Adopt In 1 Hour

  1. Create a SQLite store.
  2. Append events through AMCSClient.
  3. Read the memory root.
  4. Verify the chain.
  5. Optionally encrypt payload fields before append.

Minimal Append

from amcs import AMCSClient, SQLiteEventStore

store = SQLiteEventStore("./amcs.db")
client = AMCSClient(store=store, agent_id="agent-1")

result = client.append("interaction.append", {"message": "hello"})
print(result.sequence, result.event_hash, result.memory_root)

Verify Chain

from amcs import verify_chain

result = verify_chain(store, "agent-1")
assert result.ok

External Root Checkpoint (Optional)

Create a signed root receipt for external anchoring (for example: publish to an immutable log).

from amcs import b64encode, generate_keypair

private_key, public_key = generate_keypair()
checkpoint = client.create_root_checkpoint(
    signer_private_key_b64=b64encode(private_key),
    signer_kid="registry-main",
)
assert client.verify_root_checkpoint(
    checkpoint=checkpoint,
    signer_public_key_b64=b64encode(public_key),
)

Verification & Tamper Detection

For a full end-to-end tamper detection scenario, see:

  • tests/test_sdk_append_verify.py

Encrypt Field (Optional)

from amcs import encrypt_field

enc = encrypt_field(
    b"secret",
    key,
    "kid-1",
    {"agent_id": "agent-1", "event_id": "evt-1", "event_type": "interaction.append"},
)

Canonical JSON

from amcs import canonical_bytes, canonical_dumps

event = {"b": 1, "a": 2}
text = canonical_dumps(event)  # {"a":2,"b":1}
data = canonical_bytes(event)  # UTF-8 bytes

Optional API Service

from amcs.api import create_app

app = create_app("./amcs.db")

The API dependencies are installed with:

python -m pip install -e ".[api]"

Examples

  • examples/minimal_append.py
  • examples/action_invoke.py
  • examples/encrypted_interaction.py

Manual Acceptance Test (10 Minutes)

Run the human-legible acceptance test:

./scripts/manual_acceptance_test.sh

Detailed runbook:

  • docs/manual-acceptance-test-10min.md

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

iap_amcs-0.1.0.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

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

iap_amcs-0.1.0-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: iap_amcs-0.1.0.tar.gz
  • Upload date:
  • Size: 19.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for iap_amcs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2dd841445d921cd4c96ea0f248398d28133967e18dd2115a5a1f2f74394e8851
MD5 ce3bd0979d3c5201e463c7b83741ae3f
BLAKE2b-256 557193df48bbb3e14c3325a4cc49cc0336b6e91f97c7e558c8cbb5384efa58f3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iap_amcs-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for iap_amcs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0358a76fdaf28d1d123361009a678f7ce0cb67b836743bdbc908c215c3c83fbd
MD5 fc0d41bbd7caabdd006231bfdc5ce0f3
BLAKE2b-256 810eb0e0b3fc17f74dd4aefaaa6d28062a96742f2b0a575f3edade287483efb9

See more details on using hashes here.

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