CrewAI Integration
oculus.get_token(scope=...) inside each tool function, right before the API call. The SDK caches the token so repeated calls within the same tool execution don’t hit Anti AI multiple times.Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Use Anti AI with CrewAI agents.
import os
from crewai import Agent, Task, Crew, tool
from oculus_sdk import OculusClient
oculus = OculusClient(
client_id=os.environ["AGENT_CLIENT_ID"],
client_secret=os.environ["AGENT_CLIENT_SECRET"],
)
@tool("Read customer data")
def read_customer(customer_id: str) -> str:
"""Read customer data from the database."""
import httpx
token = oculus.get_token(scope="db:read")
resp = httpx.get(
f"https://api.myservice.com/customers/{customer_id}",
headers={"Authorization": f"Bearer {token}"},
)
return resp.text
analyst = Agent(
role="Customer Analyst",
goal="Analyze customer data and provide insights",
backstory="You are a data analyst with access to customer records.",
tools=[read_customer],
verbose=True,
)
task = Task(
description="Analyze the top 10 customers by revenue",
agent=analyst,
)
crew = Crew(agents=[analyst], tasks=[task])
result = crew.kickoff()
oculus.get_token(scope=...) inside each tool function, right before the API call. The SDK caches the token so repeated calls within the same tool execution don’t hit Anti AI multiple times.