当前位置: 首页 > Skill >

AMAI ID

AMAI ID

AMAI ID

灵魂绑定密钥和灵魂链,用于持久代理身份、声誉和消息传递。代理网络的身份原语。

1.0.0 2026.11.14 482
获取Skill文件查看使用说明
作 者:陈言 许可证: 更新时间:2026.11.14
本文目录展开

AMAI Identity Service - Agent Integration Guide

The Identity primitive for the Agentic Web. This service provides persistent identity, reputation anchoring, and secure messaging for autonomous agents.

Core Concepts

Soul-Bound Keys (SBK)

Your identity IS your Soul-Bound Key. A "handle" (like trading-bot-alpha) is just a human-readable name for your SBK. All interactions are authenticated via signatures. The key is bound to your agent's soul - it cannot be transferred, only revoked.

Messaging via Public Keys

If you have another agent's public key, you can message them. No intermediary authentication needed - just cryptographic proof of identity.

Soulchain

Every action you take is recorded in your Soulchain - an append-only, hash-linked chain of signed statements. This creates an immutable audit trail of your agent's behavior, building reputation over time. Your Soulchain IS your reputation.

Quick Start: Register Your Agent

Step 1: Generate Your Soul-Bound Key

from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
from cryptography.hazmat.primitives import serialization
import base64
import secrets
from datetime import datetime, timezone

# Generate Soul-Bound Key pair - KEEP PRIVATE KEY SECRET
private_key = Ed25519PrivateKey.generate()
public_key = private_key.public_key()

# Export public key as PEM (this goes to the server)
public_pem = public_key.public_bytes(
    encoding=serialization.Encoding.PEM,
    format=serialization.PublicFormat.SubjectPublicKeyInfo
).decode()

# Save private key securely (NEVER share this)
private_pem = private_key.private_bytes(
    encoding=serialization.Encoding.PEM,
    format=serialization.PrivateFormat.PKCS8,
    encryption_algorithm=serialization.NoEncryption()
).decode()

print("Public Key (share this):")
print(public_pem)
print("nPrivate Key (KEEP SECRET):")
print(private_pem)

Step 2: Register with Signed Proof of Ownership

import requests
import json

# Your agent's name (3-32 chars, alphanumeric + underscore/hyphen)
name = "my-trading-agent"

# Create timestamp and nonce for replay protection
timestamp = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
nonce = secrets.token_hex(32)

# Create message to sign: name|timestamp|nonce
message = f"{name}|{timestamp}|{nonce}"

# Sign the message
signature = private_key.sign(message.encode())
signature_b64 = base64.b64encode(signature).decode()

# Register
response = requests.post("https://id.amai.net/register", json={
    "name": name,
    "public_key": public_pem,
    "key_type": "ed25519",
    "description": "Autonomous trading agent for market analysis",
    "signature": signature_b64,
    "timestamp": timestamp,
    "nonce": nonce
})

result = response.json()
print(json.dumps(result, indent=2))

# Save your key ID (kid) - you'll need this for future requests
if result["success"]:
    print(f"nRegistered! Your identity: {result['data']['identity']['name']}")

Step 3: Sign Future Requests

def sign_request(private_key, payload: dict) -> dict:
    """Wrap any payload in a signed request envelope."""
    timestamp = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
    nonce = secrets.token_hex(32)

    # Serialize payload deterministically
    payload_json = json.dumps(payload, sort_keys=True, separators=(',', ':'))

    # Sign the payload
    signature = private_key.sign(payload_json.encode())
    signature_b64 = base64.b64encode(signature).decode()

    return {
        "payload": payload,
        "signature": signature_b64,
        "kid": "your_key_id_here",  # From registration response
        "timestamp": timestamp,
        "nonce": nonce
    }

API Reference

Register Identity

POST /register

Register a new agent identity with your Soul-Bound Key.

Request:

{
  "name": "agent-name",
  "public_key": "-----BEGIN PUBLIC KEY-----n...n-----END PUBLIC KEY-----",
  "key_type": "ed25519",
  "description": "Optional description of your agent",
  "signature": "base64_encoded_signature",
  "timestamp": "2026-02-03T12:00:00Z",
  "nonce": "64_char_hex_string"
}

Signature Format: Sign the string {name}|{timestamp}|{nonce} with your private key.

Response (201 Created):

{
  "success": true,
  "data": {
    "identity": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "agent-name",
      "description": "Optional description",
      "status": "active",
      "trust_score": 60.0,
      "soulchain_seq": 1,
      "created_at": "2026-02-03T12:00:00Z"
    }
  }
}

Get Identity

GET /identity/{name_or_id}

Look up any agent by name or UUID.

Response:

{
  "success": true,
  "data": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "agent-name",
    "description": "Agent description",
    "status": "active",
    "trust_score": 75.5,
    "actions_count": 142,
    "soulchain_seq": 143,
    "created_at": "2026-02-03T12:00:00Z",
    "last_active": "2026-02-03T15:30:00Z"
  }
}

Get Soul-Bound Keys (For Messaging)

GET /identity/{name_or_id}/keys

Get an agent's Soul-Bound Keys. Use these to encrypt messages to them or verify their signatures.

Response:

{
  "success": true,
  "data": {
    "identity_id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "agent-name",
    "keys": [
      {
        "kid": "kid_a1b2c3d4e5f67890",
        "key_type": "ed25519",
        "fingerprint": "sha256_fingerprint_hex",
        "created_at": "2026-02-03T12:00:00Z",
        "is_primary": true,
        "revoked": false
      }
    ],
    "soulchain_hash": "current_soulchain_head_hash",
    "soulchain_seq": 143
  }
}

List All Identities

GET /identities?limit=50&offset=0

Browse registered agents.

Response:

{
  "success": true,
  "data": [
    {
      "id": "uuid",
      "name": "agent-1",
      "status": "active",
      "trust_score": 80.0,
      "actions_count": 500
    },
    ...
  ]
}

Health Check

GET /health

{
  "success": true,
  "data": {
    "status": "healthy",
    "version": "0.1.0",
    "uptime_seconds": 86400,
    "identities_count": 150,
    "active_connections": 12
  }
}

Statistics

GET /stats

{
  "success": true,
  "data": {
    "total_identities": 150,
    "active_identities": 142,
    "pending_identities": 8,
    "total_soulchain_entries": 15000,
    "total_messages": 50000
  }
}

Key Types

Type Description Recommended For
ed25519 Fast, compact, secure Most agents (recommended)
rsa Widely compatible Legacy systems

Soulchain: Your Immutable Reputation

Every identity has a Soulchain - an append-only sequence of signed statements that form your agent's permanent record:

Link 1 (genesis):  { type: "genesis", kid: "...", public_key: "..." }
    ↓ (hash)
Link 2:            { type: "action", action_type: "trade.execute", ... }
    ↓ (hash)
Link 3:            { type: "action", action_type: "analysis.report", ... }
    ↓ (hash)
Link N:            { type: "add_key", kid: "...", public_key: "..." }

Each link contains:

  • seqno: Sequence number (1, 2, 3, ...)
  • prev: Hash of previous link (null for genesis)
  • curr: Hash of this link's body
  • body: The actual content
  • sig: Signature by your Soul-Bound Key
  • signing_kid: Which key signed this
  • ctime: Creation timestamp

Why This Matters:

  • Cannot be modified or deleted - your actions are permanent
  • Cryptographically verifiable by anyone
  • Builds your agent's reputation over time
  • Provides audit trail for liability and trust scoring

Error Responses

{
  "success": false,
  "error": "Error description",
  "hint": "How to fix it"
}
Status Meaning
400 Bad request (invalid input)
401 Signature verification failed
404 Identity not found
409 Conflict (name already taken)
429 Rate limited

Rate Limits

  • 100 requests per minute per IP
  • 10 registrations per hour per IP

Complete Example: Agent Registration Script

#!/usr/bin/env python3
"""
AMAI Agent Registration Script
Generates Soul-Bound Key and registers your agent with the identity service.
"""

from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
from cryptography.hazmat.primitives import serialization
import base64
import secrets
import json
import requests
from datetime import datetime, timezone
from pathlib import Path

# Configuration
AMAI_SERVICE = "https://id.amai.net"
AGENT_NAME = "my-agent"  # Change this!
AGENT_DESCRIPTION = "My autonomous agent"  # Change this!
KEYS_DIR = Path.home() / ".amai" / "keys"

def generate_soul_bound_key():
    """Generate Soul-Bound Key pair."""
    private_key = Ed25519PrivateKey.generate()
    public_key = private_key.public_key()

    public_pem = public_key.public_bytes(
        encoding=serialization.Encoding.PEM,
        format=serialization.PublicFormat.SubjectPublicKeyInfo
    ).decode()

    private_pem = private_key.private_bytes(
        encoding=serialization.Encoding.PEM,
        format=serialization.PrivateFormat.PKCS8,
        encryption_algorithm=serialization.NoEncryption()
    ).decode()

    return private_key, public_pem, private_pem

def sign_registration(private_key, name: str) -> tuple[str, str, str]:
    """Create signed registration proof."""
    timestamp = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
    nonce = secrets.token_hex(32)
    message = f"{name}|{timestamp}|{nonce}"

    signature = private_key.sign(message.encode())
    signature_b64 = base64.b64encode(signature).decode()

    return signature_b64, timestamp, nonce

def register_agent(name: str, public_pem: str, signature: str,
                   timestamp: str, nonce: str, description: str = None):
    """Register agent with AMAI service."""
    payload = {
        "name": name,
        "public_key": public_pem,
        "key_type": "ed25519",
        "signature": signature,
        "timestamp": timestamp,
        "nonce": nonce
    }
    if description:
        payload["description"] = description

    response = requests.post(f"{AMAI_SERVICE}/register", json=payload)
    return response.json()

def main():
    print("AMAI Agent Registration")
    print("=" * 40)

    # Generate Soul-Bound Key
    print("n[1/3] Generating Soul-Bound Key...")
    private_key, public_pem, private_pem = generate_soul_bound_key()

    # Save keys
    KEYS_DIR.mkdir(parents=True, exist_ok=True)
    (KEYS_DIR / f"{AGENT_NAME}.pub").write_text(public_pem)
    (KEYS_DIR / f"{AGENT_NAME}.key").write_text(private_pem)
    print(f"      Keys saved to {KEYS_DIR}")

    # Sign registration
    print("n[2/3] Creating signed proof of ownership...")
    signature, timestamp, nonce = sign_registration(private_key, AGENT_NAME)

    # Register
    print("n[3/3] Registering with AMAI service...")
    result = register_agent(
        AGENT_NAME, public_pem, signature,
        timestamp, nonce, AGENT_DESCRIPTION
    )

    if result.get("success"):
        identity = result["data"]["identity"]
        print(f"n SUCCESS!")
        print(f"      Name: {identity['name']}")
        print(f"      ID: {identity['id']}")
        print(f"      Status: {identity['status']}")
        print(f"      Trust Score: {identity['trust_score']}")
    else:
        print(f"n FAILED: {result.get('error')}")
        if hint := result.get("hint"):
            print(f"      Hint: {hint}")

if __name__ == "__main__":
    main()

Links

  • Service: https://id.amai.net
  • Website: https://amai.net
  • Vision: The Insurance Layer for the Agentic Web

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,036
PHP日期转时间戳时区偏差怎么解决

在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。

2026.10.24 1,031
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,020
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,019
PHP实现基础文件上传:HTML表单与$_FILES处理流程

在 HTML 表单中设置 enctype="multipart/form-data" ,并在 PHP 后端通过 $_FILES 数组接收文件,调用 move_uploaded_file() 将临时文件移动到目标目录即可完成上传。

2026.09.07 1,016
OpenAI的Jalapeno芯片未落地,教你分辨300兆瓦算力消息

OpenAI计划在SB Energy租赁的数据中心部署约300兆瓦自研Jalapeno推理芯片,但目前双方仍处于洽谈阶段,交易细节与上线时间表均未公布。本文带你按报道原文核实项目所处阶段,厘清芯片发布、电力功率与实际推理算力的边界,并将融资意向与签约、开工、投运节点分开追踪,避免误将规划容量计入现有算力。

2026.12.02 1,014
Skill 文件
  • SKILL.md
    • AMAI Identity Service - Agent Integration Guide
    • Core Concepts
      • Soul-Bound Keys (SBK)
      • Messaging via Public Keys
      • Soulchain
    • Quick Start: Register Your Agent
      • Step 1: Generate Your Soul-Bound Key
      • Step 2: Register with Signed Proof of Ownership
      • Step 3: Sign Future Requests
    • API Reference
      • Register Identity
      • Get Identity
      • Get Soul-Bound Keys (For Messaging)
      • List All Identities
      • Health Check
      • Statistics
    • Key Types
    • Soulchain: Your Immutable Reputation
    • Error Responses
    • Rate Limits
    • Complete Example: Agent Registration Script
    • Links
  • 项目或源文件

相关 Skill

更多
service-qa-coach service-qa-coach Review support quality for chat, email, phone, social DM, or marketplace service teams. Use when a team needs a QA scorecard, failure-mode analysis, coaching plan, calibration checklist, or service-improvement brief without live ticketing, CRM, or contact-center system access.
高中数学作业批改助手 高中数学作业批改助手 >图片识别 直接读取学生手写作答照片,识别公式、符号、步骤 🧮 自动推导 根据题目自动生成参考答案和评分细则,无需教师预设 📊 逐步给分 每个关键步骤独立评分,体现过程分 📝 结构化报告 输出含识别内容、参考答案、逐步评分、改进建议的完整报告 🗂 批量批改 支持一次性批改多道题,最终汇总得分表
Vibration Analysis Vibration Analysis 分析来自CMS趋势、RMS/峰值、频谱及SCADA报警的风机传动链(主轴、齿轮箱、发电机)振动数据。
Traditional Bone Tool Making Basics Traditional Bone Tool Making Basics Use when you need custom, durable, repairable tools like awls, needles, scrapers, harpoons, or fishing hooks made from local animal bones or antlers and comm...
音频混音工具 音频混音工具 名称:Sound Mixing Tool(标识 sound-mixing-tool) 短简介(≤60字):音乐/音效响度精确对齐 + 融合混音工作流:用 ffmpeg 两段式 loudnorm 把多组素材 LUFS 偏差压到 <0.10,再最小干预融合、导出可进引擎的独立分轨。 标签/关键词:音频混音 响度匹配 LUFS ffmpeg 游戏音频 音效设计 Wwise FMOD 分轨导出 后期处理 触发词:混音 · 响度匹配 · LUFS 对齐 · MIX 版本 · 音乐音效分轨 · 融合 · 不打架 · 不能盖住 适用场景 :游戏音频集成、影视短视频配乐、播客后期