Skip to main content

a2a_auto_wrapper

将 CrewAI Agent 一行命令转为 A2A 服务 — 开源替代 CrewAI AMP 的本地开发方案。

基于 AutoA2A (NapthaAI) 和 Google A2A Protocol。

安装

pip install a2a_auto_wrapper

同时需要安装 CrewAI:

pip install crewai

快速开始

服务端 — 一行启动 CrewAI A2A 服务

# crewai_a2a_server.py
from crewai import Agent, LLM
from crewai.a2a import A2AServerConfig
from a2a_auto_wrapper import serve_crewai_agent

analyst = Agent(
    role="数据分析师",
    goal="对数据进行深度分析并生成结构化报告",
    backstory="你是资深数据分析师,擅长数据洞察和趋势预测。",
    llm=LLM(model="deepseek-chat", base_url="https://api.deepseek.com/v1", api_key="..."),
    a2a=A2AServerConfig(url="http://localhost:2025"),
)

if __name__ == "__main__":
    serve_crewai_agent(analyst, port=2025)
python crewai_a2a_server.py
# ✅ 服务运行在 http://localhost:2025

客户端 — 调用 A2A 服务

import asyncio
from a2a_auto_wrapper import A2AClient

async def main():
    client = A2AClient("http://localhost:2025/")
    result = await client.send_message("分析销售数据:1月100万 2月120万 3月90万")
    print(result)

asyncio.run(main())

DeepAgents 调用 CrewAI(A2A 互调)

# deepagent_a2a.py
from a2a_auto_wrapper import A2AClient
from langchain_openai import ChatOpenAI
from langchain_core.tools import tool
from deepagents import create_deep_agent

crewai_client = A2AClient(base_url="http://localhost:2025/")

@tool
async def call_crewai_analyst(query: str) -> str:
    """需要数据分析时调用 CrewAI 分析师。"""
    return await crewai_client.send_message(query)

agent = create_deep_agent(
    model=ChatOpenAI(model="deepseek-chat", ...),
    tools=[call_crewai_analyst],
)
graph = agent  # langgraph dev 加载入口

API 参考

serve_crewai_agent(agent, port=2025)

启动 CrewAI Agent 为 A2A HTTP 服务。

参数 类型 默认值 说明
agent crewai.Agent 必填 已配置 A2AServerConfig 的 CrewAI Agent
port int 2025 监听端口

A2AClient

A2A 客户端,调用远程 A2A 服务。

client = A2AClient(base_url: str, timeout: int = 120)
result = await client.send_message(text: str) -> str
方法 参数 返回值 说明
__init__ base_url, timeout=120 — 构造客户端
send_message text str 发送消息,返回结果文本

通信流程

用户 → langgraph_sdk → DeepAgents (:2024) → A2A → CrewAI (:2025)

依赖

  • Python >= 3.12
  • crewai (安装本包后需单独安装)
  • httpx, starlette, uvicorn, pydantic

License

MIT

Metadata

Release files for a2a-auto-wrapper 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for a2a-auto-wrapper 1.0.0
File Size Uploaded Provenance Actions
a2a_auto_wrapper-1.0.0.tar.gz 12.6 kB Without provenance Details for a2a_auto_wrapper-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for a2a-auto-wrapper 1.0.0
File Interpreter ABI Platform Actions
a2a_auto_wrapper-1.0.0-py3-none-any.whl Python 3 none any Details for a2a_auto_wrapper-1.0.0-py3-none-any.whl

Total release size: 29.8 kB

Release files / a2a_auto_wrapper-1.0.0.tar.gz

Download URL a2a_auto_wrapper-1.0.0.tar.gz
Size 12.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e4def1ae2316615094138763af11170174da38f7a8183d5a302c00de27b828a2
BLAKE2b-256 checksum
How to use checksums
8cfe6e64283e86a70f48de9fd18737777fe13f787a756e86da2c4eb48d5b826f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release files / a2a_auto_wrapper-1.0.0-py3-none-any.whl

Download URL a2a_auto_wrapper-1.0.0-py3-none-any.whl
Size 17.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae686510ebcc651bb9b14ea8072a0f19b8f28928627597060005d1bed1b88323
BLAKE2b-256 checksum
How to use checksums
e810bb030962e1c2f4f84443ffe42c4512c5e148dfeff56d19e108e00f787ee9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Security for a2a-auto-wrapper 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page