Metadata-Version: 2.4
Name: computenest-agent-integrations
Version: 0.1.12
Summary: 计算巢Agent部署集成库，基于 Google ADK 架构对接云上 Agent 能力
Author-email: Bali <zhaoyu.zhaoyu@alibaba-inc.com>, Yunyao <ziqiao.lzq@alibaba-inc.com>, Zhongsi <zhongsi.lz@alibaba-inc.com>
Project-URL: Homepage, https://computenest.console.aliyun.com/agent/market/cn-hangzhou/overview
Requires-Python: >=3.12
Description-Content-Type: text/markdown
Requires-Dist: aiohttp>=3.9.0
Requires-Dist: alibabacloud-bailian20231229>=1.0.0
Requires-Dist: google-adk[a2a]<3.0.0,>=2.5.0
Requires-Dist: httpx>=0.27.0
Requires-Dist: mcp<2.0.0,>=1.24.0
Requires-Dist: PyYAML>=6.0
Requires-Dist: typing-extensions>=4.12.0
Provides-Extra: app
Requires-Dist: circus==0.19.0; extra == "app"
Requires-Dist: uvicorn[standard]==0.34.3; extra == "app"
Requires-Dist: python-dotenv>=1.2.1; extra == "app"
Requires-Dist: fastapi>=0.124.1; extra == "app"
Requires-Dist: sse-starlette==2.1.3; extra == "app"
Requires-Dist: pydantic-settings<3.0.0,>=2.2.1; extra == "app"
Provides-Extra: e2b
Requires-Dist: e2b-code-interpreter>=1.0.0; extra == "e2b"
Provides-Extra: browser
Requires-Dist: e2b>=1.0.0; extra == "browser"
Requires-Dist: playwright>=1.40; extra == "browser"
Requires-Dist: requests>=2.28.0; extra == "browser"
Provides-Extra: agentrun
Requires-Dist: agentrun-sdk>=0.0.50; extra == "agentrun"
Provides-Extra: ragflow
Requires-Dist: ragflow-sdk; extra == "ragflow"

# computenest-agent-integrations

基于 Google ADK 的 Agent 能力集成库。

## 环境要求

- Python 3.12 或更高版本

## 安装

```bash
pip install computenest-agent-integrations
```

按需安装可选依赖：

```bash
# RAGFlow 知识库检索
pip install "computenest-agent-integrations[ragflow]"

# E2B 沙箱与代码解释器
pip install "computenest-agent-integrations[e2b]"

# AgentRun 沙箱
pip install "computenest-agent-integrations[agentrun]"
```

## 当前公共 API

以下组件由 `computenest.integrations.adk` 直接导出：

| 类别 | API | 说明 |
|------|-----|------|
| Memory | `BailianLongTermMemoryService` | 百炼长期记忆的 ADK `BaseMemoryService` 实现 |
| Memory | `Mem0SelfHostingMemoryService` | Self-host Mem0 REST 服务的 ADK `BaseMemoryService` 实现 |
| Knowledge Base | `BailianKnowledgeBaseTool` | 百炼知识库检索工具 |
| Knowledge Base | `RagflowKnowledgeBaseTool` | RAGFlow Dataset 知识库检索工具 |
| Knowledge Base | `KnowledgeProvider` | 知识库 Provider 枚举 |
| MCP | `McpTool` | 将 MCP JSON 配置转换为 ADK `McpToolset` |
| A2A | `load_remote_a2a_agents` | 从 `A2A_CONNECTIONS` 批量创建带认证的 ADK `RemoteA2aAgent` |
| A2A | `create_a2a_client_factory` | 创建按 Agent Card 安全声明注入凭证的 A2A ClientFactory |
| A2A | `A2AClientCleanupPlugin` | 在 ADK App 关闭时回收 A2A HTTP Client |
| Sandbox | `E2bSandboxToolset` | E2B 文件系统与 Shell 工具集 |
| Sandbox | `E2bCodeInterpreterToolset` | E2B Python/JavaScript 代码执行工具集 |
| Plugin | `ImageUrlInlinePlugin` | 将用户消息中的 HTTP(S) 图片转换为内联图片数据 |

```python
from computenest.integrations.adk import (
    A2AClientCleanupPlugin,
    BailianKnowledgeBaseTool,
    BailianLongTermMemoryService,
    E2bCodeInterpreterToolset,
    E2bSandboxToolset,
    ImageUrlInlinePlugin,
    KnowledgeProvider,
    load_remote_a2a_agents,
    McpTool,
    Mem0SelfHostingMemoryService,
    RagflowKnowledgeBaseTool,
)
```

计算巢会将绑定的多个 Agent Connection 以 JSON 或 Base64 JSON 注入
`A2A_CONNECTIONS`。Sample 只需将公共工厂的返回值交给 ADK：

```python
from computenest.integrations.adk import A2AClientCleanupPlugin
from computenest.integrations.adk import load_remote_a2a_agents
from google.adk.agents import Agent
from google.adk.apps import App

root_agent = Agent(
    name="root",
    model="gemini-2.5-flash",
    sub_agents=load_remote_a2a_agents(),
)
app = App(
    name="root",
    root_agent=root_agent,
    plugins=[A2AClientCleanupPlugin()],
)
```

每条连接使用 `A2A_AGENT_CARD_URL` 发现远程 Agent；存在
`A2A_AUTH_TOKEN` 时，客户端依据 Agent Card 的 `securitySchemes` 和
`securityRequirements` 在实际调用中注入认证信息。

工厂启用 ADK 新版 A2A 集成，并沿用 `RemoteA2aAgent` 默认的会话事件与
`contextId` 管理，不重写 A2A 请求内容。

各组件的初始化参数和行为以源码及测试用例为准。

## 相关链接

- [计算巢 Agent 市场](https://computenest.console.aliyun.com/agent/market/cn-hangzhou/overview)
- [Google ADK 文档](https://google.github.io/adk-docs/)
