CrewAI
This repo supports CrewAI in two ways:
- CrewAI tools package (recommended): install
crewai-ap3-toolsand attach AP3 tools directly to your CrewAI agents. - AP3 CrewAI integration classes: create CrewAI agents (and expose them over A2A) via
ap3.integrations.crewai.
Option 1: Use the CrewAI tools package (recommended)
The package lives in this repo at tools/crewai-ap3-tools/ and is designed to be discoverable by the CrewAI tool ecosystem.
Install
# Recommended (CrewAI tool ecosystem)
crewai tool install crewai-ap3-tools
Or install from source (dev):
pip install -e tools/crewai-ap3-tools
Use in a CrewAI agent
from crewai import Agent
from crewai_ap3_tools import SecureDotProductTool, PrivateSetIntersectionTool, CompatibilityCheckTool
dp_tool = SecureDotProductTool(
agent_id="my_agent",
role="OB", # initiator role for dot product
partner_agent_url="http://localhost:10001" # optional: used for message forwarding
)
psi_tool = PrivateSetIntersectionTool(
agent_id="my_agent",
role="initiator"
)
compat_tool = CompatibilityCheckTool(
agent_id="my_agent",
my_url="http://localhost:10001"
)
agent = Agent(
role="Privacy-Aware Data Analyst",
goal="Perform secure computations with partner agents",
backstory="An expert in privacy-preserving data analysis",
tools=[dp_tool, psi_tool, compat_tool],
verbose=True,
)
What tools you get
- Secure Dot Product:
SecureDotProductTool - Private Set Intersection (PSI):
PrivateSetIntersectionTool - Compatibility check (A2A + AP3):
CompatibilityCheckTool
Option 2: Use the AP3 CrewAI integration classes
If you want AP3 to help you construct a CrewAI agent (and optionally run it behind an A2A server), use:
ap3.integrations.crewai.CrewAIIntegration(agent factory)ap3.integrations.crewai.CrewAIExecutor(A2A executor bridge)ap3.integrations.crewai.AP3Tool(legacy tool factory; returns the tool list)
Create a CrewAI agent via CrewAIIntegration
from ap3.integrations.crewai import CrewAIIntegration
from crewai_ap3_tools import SecureDotProductTool
integration = CrewAIIntegration(
name="privacy_agent",
description="Privacy-aware agent",
instruction="Use AP3 tools to compute without revealing private inputs.",
tools=[
SecureDotProductTool(agent_id="privacy_agent", role="OB", partner_agent_url="http://localhost:10001")
],
)
agent = integration.create_agent(
role="Privacy Analyst",
goal="Compute securely with partners",
backstory="Specialist in privacy-preserving computation",
verbose=True,
)
Notes
- Message forwarding:
SecureDotProductToolcan optionally forward protocol messages to a partner agent URL using A2Amessage/sendJSON-RPC. - Compatibility checks: use
CompatibilityCheckToolearly to verify a partner endpoint supports AP3 roles/operations.