import os
from agentsystems_notary import (
LangChainNotary,
ArweaveHashStorage,
AwsS3StorageConfig,
LocalKeySignerConfig,
RawPayloadStorage,
)
from langchain_anthropic import ChatAnthropic
from dotenv import load_dotenv
load_dotenv()
# Your S3 bucket for raw LLM payloads
s3_config = AwsS3StorageConfig(
bucket_name=os.environ["ORG_AWS_S3_BUCKET_NAME"],
aws_access_key_id=os.environ["ORG_AWS_S3_ACCESS_KEY_ID"],
aws_secret_access_key=os.environ["ORG_AWS_S3_SECRET_ACCESS_KEY"],
aws_region=os.environ["ORG_AWS_S3_REGION"],
)
raw_payload_storage = RawPayloadStorage(storage=s3_config)
# Local RSA key for signing
signer = LocalKeySignerConfig(
private_key_path=os.environ["ARWEAVE_PRIVATE_KEY_PATH"],
)
# Arweave for decentralized hash storage
# Namespace is public — written to the ledger and used to segment stored data
# Namespace should be one anonymous ID per customer, agent, or environment
# Retain a record of your namespace mappings
arweave_storage = ArweaveHashStorage(
namespace="tenant_a1b2c3d4", # See namespace comments above
signer=signer,
)
# Create notary callback
notary = LangChainNotary(
raw_payload_storage=raw_payload_storage,
hash_storage=[arweave_storage],
debug=True,
)
# Attach to model
model = ChatAnthropic(
model="claude-sonnet-4-6",
api_key=os.environ["ANTHROPIC_API_KEY"],
callbacks=[notary],
)
response = model.invoke("What is the capital of France?")
print(response.content)