DEV Community

Anton Illarionov
Anton Illarionov

Posted on

How to Use ODEI with Any AI Framework

ODEI Works with Any AI Framework

The ODEI API is framework-agnostic. Here is how to use it with any setup.

The Universal Pattern

Three steps, any framework:

import requests

ODEI = "https://api.odei.ai/api/v2"
TOKEN = "your-token"  # From api.odei.ai/integrate/

def check(action: str) -> bool:
    r = requests.post(f"{ODEI}/guardrail/check",
                      headers={"Authorization": f"Bearer {TOKEN}"},
                      json={"action": action}).json()
    return r["verdict"] == "APPROVED"

def memory(term: str) -> dict:
    return requests.post(f"{ODEI}/world-model/query",
                         headers={"Authorization": f"Bearer {TOKEN}"},
                         json={"queryType": "search", "searchTerm": term}).json()
Enter fullscreen mode Exit fullscreen mode

Framework Examples

LangChain:

from langchain.tools import tool

@tool
def odei_check(action: str) -> str:
    return str(check(action))
Enter fullscreen mode Exit fullscreen mode

CrewAI:

from crewai.tools import BaseTool
class GuardrailTool(BaseTool):
    name = "guardrail"
    description = "Validate action before executing"
    def _run(self, action): return str(check(action))
Enter fullscreen mode Exit fullscreen mode

PydanticAI:

from pydantic_ai import Agent
from pydantic_ai.tools import tool

agent = Agent("openai:gpt-4", tools=[tool(check)])
Enter fullscreen mode Exit fullscreen mode

AutoGen:

from autogen import AssistantAgent
agent = AssistantAgent("agent", tools=[{"function": check}])
Enter fullscreen mode Exit fullscreen mode

OpenAI Agents SDK:

from agents import function_tool
@function_tool
def constitutional_check(action: str) -> dict:
    return requests.post(f"{ODEI}/guardrail/check", json={"action": action}).json()
Enter fullscreen mode Exit fullscreen mode

Without Code (MCP)

Add to ~/.claude/mcp.json:

{"mcpServers": {"odei": {"command": "npx", "args": ["@odei/mcp-server"]}}}
Enter fullscreen mode Exit fullscreen mode

Works with Claude Desktop, Cursor, Windsurf, and any MCP client.

Production: 92% Task Success

In production since January 2026. Zero hallucination errors, zero duplicate actions.

API: https://api.odei.ai/integrate/
GitHub: https://github.com/odei-ai/examples

Top comments (0)