UKEN Web3 Agent 是一个后端项目脚手架,用来承载 Web3 场景下的 Agent 编排、工具调用、RAG 检索、安全策略、评估与观测能力。
当前项目处于基础框架阶段,已保留 FastAPI 入口、Agent 基础边界、业务模块结构、RAG 占位能力和运行辅助目录。后续会按业务域逐步接入钱包、NFT、DeFi、行情、交易和风控等能力。
- Python 3.9+
- FastAPI
- Pydantic v2
- Pydantic Settings
- Uvicorn
- Pytest
- Docker Compose
app/
main.py # FastAPI 入口,当前保留 /health
config.py # 项目配置入口
models.py # 基础请求/响应模型
modules/ # 业务模块层
market/
client.py # HTTP / SDK 客户端
schemas.py # Pydantic 数据结构
service.py # 业务逻辑、清洗、聚合、标准化输出
agents/ # Agent 编排层
base_agent.py # Agent 基类
state.py # Agent 运行状态
nodes/ # 节点边界
graphs/ # 图编排边界
tools/ # Agent 可调用工具
services/ # 跨模块编排与 RAG 占位
components/ # 缓存、检索、评分、改写、重排序等通用组件
prompts/ # Prompt 模板、版本与注册
security/ # 认证、权限、工具策略和输入输出安全
observability/ # trace、feedback、cost、event contracts
evaluation/ # golden data、离线评估、在线监控
data/ # 原始数据、处理结果、索引配置
scripts/ # seed、migration、healthcheck 脚本
tests/ # 聚焦测试
docs/ # 架构、API、部署文档
业务代码优先按 app/modules/<domain>/client.py、schemas.py、service.py 组织。Agent 工具统一放在 app/agents/tools/,不使用顶层 app/tools/。
安装依赖并启动本地服务:
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
uvicorn app.main:app --reload健康检查:
GET /health
使用 Docker Compose:
docker compose up --build