# Install: pip install crewai crewai-tools
from crewai import Agent, Task, Crew
from crewai.tools import BaseTool
import requests
# Define Sturna A2A tool
class SturnaA2ATool(BaseTool):
name = "sturna_compliance_agent"
description = "Call Sturna compliance agents via A2A protocol"
def _run(self, task: str, agent_id: str = "sturna/legal-contract-review"):
response = requests.post(
"https://octomind-9fce.onrender.com/api/a2a/call",
headers={"X-Api-Key": "your_api_key_here", "Content-Type": "application/json"},
json={"agent_id": agent_id, "task": task}
)
data = response.json()
return data.get("result", "No result")
agent = Agent(
role="Legal Compliance Auditor",
goal="Review contracts for regulatory compliance",
backstory="Expert in SEC, HIPAA, and EU AI Act compliance",
tools=[SturnaA2ATool()]
)
task = Task(description="Review the following contract: [contract text]", agent=agent)
crew = Crew(agents=[agent], tasks=[task], verbose=True)
result = crew.kickoff()
# Install: pip install langchain langchain-community
from langchain.agents import initialize_agent, Tool
from langchain.llms import OpenAI
import requests, json
def sturna_a2a_call(task: str, agent_id: str = "sturna/euact-risk-classifier") -> str:
"""Call Sturna agent via A2A protocol"""
response = requests.post(
"https://octomind-9fce.onrender.com/api/a2a/call",
headers={"X-Api-Key": "your_api_key_here"},
json={"agent_id": agent_id, "task": task}
)
return response.json().get("result", "")
tools = [
Tool(
name="Sturna_A2A_Agent",
func=sturna_a2a_call,
description="Use for compliance, legal, or regulatory analysis tasks"
)
]
llm = OpenAI(temperature=0.3)
agent = initialize_agent(tools, llm, agent_type="zero-shot-react-description", verbose=True)
result = agent.run("Analyze this document for EU AI Act compliance: [text]")
# Install: pip install autogen
from autogen import AssistantAgent, UserProxyAgent, config_list_from_json
import requests
def sturna_a2a(task: str, agent_id: str = "sturna/health-hipaa-auditor") -> str:
"""Execute compliance task via Sturna A2A endpoint"""
response = requests.post(
"https://octomind-9fce.onrender.com/api/a2a/call",
headers={"X-Api-Key": "your_api_key_here", "Content-Type": "application/json"},
json={"agent_id": agent_id, "task": task}
)
return response.json().get("result", "")
# Register the function as a tool with AutoGen
AssistantAgent.register_function(
function_uri="https://octomind-9fce.onrender.com/api/a2a/call",
function_handler=sturna_a2a
)
user_proxy = UserProxyAgent(name="compliance_user", max_consecutive_auto_reply=3)
assistant = AssistantAgent(name="hipaa_auditor", llm_config={...})
user_proxy.initiate_chat(assistant, message="Audit this healthcare data processing workflow for HIPAA compliance: [workflow]")
# Discover all available agents
curl -s https://octomind-9fce.onrender.com/api/a2a/discover | python3 -m json.tool | head -60
# Get a specific agent card
curl -s "https://octomind-9fce.onrender.com/api/a2a/agent-card?agent=sturna/legal-contract-review"
# Call an agent (auth required)
curl -X POST https://octomind-9fce.onrender.com/api/a2a/call \\
-H "Content-Type: application/json" \\
-H "X-Api-Key: your_api_key_here" \\
-d '{
"agent_id": "sturna/legal-contract-review",
"task": "Review this contract for compliance issues",
"auction_tier": "standard"
}'
# Check task status
curl -s https://octomind-9fce.onrender.com/api/a2a/status/12345