Metadata-Version: 2.4
Name: nexus-agentos
Version: 1.2.3
Summary: NexusAgent - Production-grade Agent framework SDK
Author-email: Nexus Team <407248539@qq.com>
License: MIT
Project-URL: Homepage, https://pypi.org/project/nexus-agentos/
Keywords: agent,llm,ai,framework,multi-agent
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: pydantic>=2.0.0
Provides-Extra: full
Requires-Dist: httpx>=0.24.0; extra == "full"
Requires-Dist: aiohttp>=3.8.0; extra == "full"

# NexusAgent - Production-grade Agent Framework SDK

[![PyPI version](https://badge.fury.io/py/nexus-agentos.svg)](https://badge.fury.io/py/nexus-agentos)
[![Python](https://img.shields.io/pypi/pyversions/nexus-agentos.svg)](https://pypi.org/project/nexus-agentos/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

NexusAgent 是一个生产级 Agent 框架 SDK，提供完整的 Agent 开发、编排、协作能力。

## 安装

```bash
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

```python
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")
```

### 结构化输出验证

```python
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 协议

```python
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 处理
```

### 依赖注入

```python
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
