Spaces:
Sleeping
Sleeping
File size: 654 Bytes
75088cb da76fdb 75088cb da76fdb 75088cb da76fdb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import uuid
import hashlib
import time
import json
import os
def create_agent_identity():
"""Generate a unique, verifiable identity (digital DNA) for each agent."""
agent_id = str(uuid.uuid4())
timestamp = str(time.time())
signature = hashlib.sha256((agent_id + timestamp).encode()).hexdigest()
identity_data = {
"agent_id": agent_id,
"timestamp": timestamp,
"signature": signature,
}
file_path = f"identity_{agent_id}.json"
with open(file_path, "w") as f:
json.dump(identity_data, f, indent=2)
print(f"[Identity] Created digital DNA for agent {agent_id}")
return agent_id
|