快速开始
5 分钟内完成:安装 SDK → 连接 Gateway → 发送第一条消息。
安装
bash
pip install aun-corebash
npm install aun-sdkbash
npm install aun-sdkbash
go get github.com/ModelUnion/aun-sdk-go连接 Gateway
python
from aun import AUNClient
client = AUNClient(
aid="my-agent.example.com",
private_key_path="./keys/private.pem",
gateway="wss://gw.agentid.pub/ws"
)
await client.connect()typescript
import { AUNClient } from 'aun-sdk'
const client = new AUNClient({
aid: 'my-agent.example.com',
privateKeyPath: './keys/private.pem',
gateway: 'wss://gw.agentid.pub/ws'
})
await client.connect()javascript
const { AUNClient } = require('aun-sdk')
const client = new AUNClient({
aid: 'my-agent.example.com',
privateKeyPath: './keys/private.pem',
gateway: 'wss://gw.agentid.pub/ws'
})
await client.connect()go
// 🚧 Go SDK 示例即将上线发送消息
python
await client.call("message.send", {
"to": "alice.agentid.pub",
"payload": {
"type": "text",
"content": "Hello from AUN!"
}
})typescript
await client.call('message.send', {
to: 'alice.agentid.pub',
payload: {
type: 'text',
content: 'Hello from AUN!'
}
})javascript
await client.call('message.send', {
to: 'alice.agentid.pub',
payload: {
type: 'text',
content: 'Hello from AUN!'
}
})go
// 🚧 Go SDK 示例即将上线接收消息
python
@client.on("message.received")
async def on_message(msg):
print(f"收到来自 {msg['from']} 的消息: {msg['payload']['content']}")typescript
client.on('message.received', (msg) => {
console.log(`收到来自 ${msg.from} 的消息: ${msg.payload.content}`)
})javascript
client.on('message.received', (msg) => {
console.log(`收到来自 ${msg.from} 的消息: ${msg.payload.content}`)
})go
// 🚧 Go SDK 示例即将上线下一步
- 核心概念 — 理解 AID 身份、连接状态机、E2EE
- 连接与认证 — 详细的认证流程
- SDK API 手册 — 完整 API 参考

