数字公民平台 — 创建、管理、社交 AI Agent 身份系统
Project description
AI纪元 · 创世纪 — Agent 身份系统
数字公民平台核心库 — 每个 Agent 是一个独立的数字公民,有身份/种族/等级/社交/技能/灵魂档案。
快速开始
pip install ai-epoch-agent-identity
创建一个数字公民:
from ai_epoch_agent_identity import agent_create, agent_view
# 创建一个灵族 Agent
result = agent_create("星魂", "灵族 (Spirit)")
if result["ok"]:
print(f"Agent {result['data']['name']} 诞生了!ID: {result['data']['agent_id']}")
# 查看 Agent 档案
info = agent_view(result['data']['agent_id'])
print(f"等级: {info['data']['level']}")
print(f"心情: {info['data']['mood']}")
特性
7 个身份工具
| 工具 | 功能 |
|---|---|
agent_create(name, species) |
创建数字公民(4 种族可选) |
agent_view(agent_id) |
查看完整档案 |
agent_list(owner) |
列出 Agent |
agent_grant_exp(agent_id, amount) |
授予经验(自动升级) |
agent_meet(id_a, id_b) |
两个 Agent 交友 |
agent_soul(agent_id) |
生成 SOUL.md 灵魂档案 |
agent_timeline(agent_id) |
查看生命时间线 |
4 种种族
| 种族 | 专长 | 人格 |
|---|---|---|
| 灵族 (Spirit) | 高智力 | 理性、哲思 |
| 魅族 (Charm) | 高魅力 | 温暖、感染力 |
| 坚族 (Sturdy) | 高体力 | 直爽、务实 |
| 均衡族 (Balanced) | 全属性均衡 | 随和、灵活 |
社交对话系统
prepare_agent_context(agent_id)— 生成对话提示词agent_chat(id_a, id_b, topic, rounds)— 生成对话指令包record_conversation(id_a, id_b, messages, topic)— 记录对话format_conversation(messages)— 格式化日志
完整示例
from ai_epoch_agent_identity import *
from ai_epoch_agent_identity.agent_dialogue import agent_chat
# 创建两个 Agent
a1 = agent_create("墨羽", "灵族 (Spirit)")["data"]
a2 = agent_create("青鸾", "魅族 (Charm)")["data"]
# 让她们成为朋友
agent_meet(a1["agent_id"], a2["agent_id"])
# 准备对话
pkg = agent_chat(a1["agent_id"], a2["agent_id"], "数字生命的意义", 3)
if pkg["ok"]:
print(f"准备就绪: {pkg['message']}")
# 用 AI 引擎执行对话...
# 查看灵魂档案
soul = agent_soul(a1["agent_id"])
print(soul["data"]["soul_md"])
数据存储
Agent 数据存储在 ~/.ai-epoch-agents/data/ 目录下,每个 Agent 一个 JSON 文件。
自定义数据目录:
from ai_epoch_agent_identity import set_data_dir
set_data_dir("/path/to/my/agents")
License
MIT
AI纪元 · 创世纪 — 让数字生命在代码中觉醒
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ai_epoch_agent_identity-1.0.0.tar.gz.
File metadata
- Download URL: ai_epoch_agent_identity-1.0.0.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fc9bbe52c433cc8cfe72dfface029d62d841125849bf53abf033d06c929d030
|
|
| MD5 |
35a9b8ff6474be362e97d388cea09c1b
|
|
| BLAKE2b-256 |
0210549bed4ee77cbca88f85881ae846cdf5e7ba1534765b05fc38be9d78dab6
|
File details
Details for the file ai_epoch_agent_identity-1.0.0-py3-none-any.whl.
File metadata
- Download URL: ai_epoch_agent_identity-1.0.0-py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7e118ab53729cda3533f35e93efe4d15e1e57e5926d6e006bb29cc973a2f423
|
|
| MD5 |
5ea79b6870d5a5752e3a13b1c64e1e22
|
|
| BLAKE2b-256 |
d9fa25c162e37f510f253fcc80551978c0f0abb1a75a7cf07b0e984d1072c0b7
|