NexusAgent - Production-grade Agent framework SDK
Project description
NexusAgent - Production-grade Agent Framework SDK
NexusAgent 是一个生产级 Agent 框架 SDK,提供完整的 Agent 开发、编排、协作能力。
安装
pip install nexus-agentos
核心特性
v1.1.2 新增
- 结构化输出验证: Pydantic 风格强制 Agent 输出格式
- Handoff 协议: Swarm 风格 Agent 间任务移交
- Agent 泛型基类:
Agent[Deps, Out]类型安全 - 依赖注入:
RunContext+Depends自动注入 - 记忆金字塔: 多层记忆管理(工作/情景/语义/程序性)
- 进化引擎: 审批式自我进化
- 融合工具包: 多工具协同
- Swarm 协调器: 多 Agent 协作
- 通信层: Blackboard/EventBus/Mailbox
- 图编排: DAG 工作流
快速开始
基础 Agent
from agentos import Agent, RunContext
class MyAgent(Agent[str, str]):
async def run(self, ctx: RunContext[str]) -> str:
return f"Hello, {ctx.deps}!"
agent = MyAgent()
result = await agent.invoke("World")
结构化输出验证
from pydantic import BaseModel
from agentos import Agent, RunContext
class MyOutput(BaseModel):
answer: str
confidence: float
sources: list[str]
class SmartAgent(Agent[str, MyOutput]):
async def run(self, ctx: RunContext[str]) -> MyOutput:
return MyOutput(
answer="The answer",
confidence=0.95,
sources=["source1", "source2"]
)
agent = SmartAgent()
result = await agent.invoke("question")
# result 自动验证为 MyOutput 类型
Handoff 协议
from agentos import Agent, RunContext, Handoff, transfer_to
class BillingAgent(Agent[str, str]):
async def run(self, ctx: RunContext[str]) -> str:
return f"Billing info for: {ctx.deps}"
class SupportAgent(Agent[str, str]):
async def run(self, ctx: RunContext[str]) -> str | Handoff:
if "billing" in ctx.deps.lower():
return transfer_to(BillingAgent(), ctx.deps)
return "General support"
agent = SupportAgent()
result = await agent.invoke("I have a billing question")
# 自动转移到 BillingAgent 处理
依赖注入
from dataclasses import dataclass
from agentos import Agent, RunContext, Depends
@dataclass
class Config:
api_key: str
model: str
class ConfiguredAgent(Agent[Config, str]):
async def run(self, ctx: RunContext[Config]) -> str:
return f"Using {ctx.deps.model} with key {ctx.deps.api_key[:8]}..."
agent = ConfiguredAgent()
result = await agent.invoke(Config(api_key="sk-xxx", model="gpt-4"))
架构
agentos/
├── core/ # 核心模块
│ ├── di.py # 依赖注入 (Agent, RunContext, Depends)
│ ├── handoff.py # Handoff 协议
│ └── loop.py # Agent 循环
├── protocols/ # 协议
│ └── output.py # 结构化输出验证
├── memory/ # 记忆金字塔
├── evolution/ # 进化引擎
├── tools/ # 融合工具包
├── swarm/ # Swarm 协调器
├── comm/ # 通信层
└── orchestration/ # 图编排
版本历史
v1.1.2 (2026-06-29)
- ✨ 新增结构化输出验证
- ✨ 新增 Handoff 协议
- 🔧 优化 Agent 泛型基类
- 📦 首次发布到 PyPI
v1.1.1 (2026-06-28)
- 整合 memory-pyramid
- 整合 evolution-v2
- 整合 fusion-toolkit
- 整合 M4-M11 模块
许可证
MIT License
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
nexus_agentos-1.2.3.tar.gz
(26.3 kB
view details)
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 nexus_agentos-1.2.3.tar.gz.
File metadata
- Download URL: nexus_agentos-1.2.3.tar.gz
- Upload date:
- Size: 26.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f4f1382a7232a14ed7d9d4c84b1c5c4c013039f7f076bf4a81ead062fb23e51
|
|
| MD5 |
f2c0fcda70ddb9d0e995c85eb1eb457e
|
|
| BLAKE2b-256 |
7d40913c77bc37d334ed97519fd6bf11f476ab21aa31820d90d5ca4aeb2b0f96
|
File details
Details for the file nexus_agentos-1.2.3-py3-none-any.whl.
File metadata
- Download URL: nexus_agentos-1.2.3-py3-none-any.whl
- Upload date:
- Size: 28.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32599b699489a3efd004c0ad03fc2ed77dd4aa8a669f1a666bd49fa2dd3e029f
|
|
| MD5 |
15799ded4b9170ada777b37cd7a88d51
|
|
| BLAKE2b-256 |
308402d5724cc2b57f99a7b43497febb9f3920269e146ec12a50463bb33b03f6
|