Works with the agent stack you already use
One SDK, no architectural changes. Your workflow engine remains the system of record.
Integrate in 3 steps
Generate agent credentials, install the SDK, configure governance rules.
- CrewAI (Python)
- CopilotKit (TypeScript)
- Deep Agents (Python)
- LangChain (Python)
- LangGraph (Python)
- Mastra (TypeScript)
- Temporal (Python)
crew.py
from crewai import Crew, Process
from openbox import OpenBoxAgent, OpenBoxTask, create_openbox_engine
researcher = OpenBoxAgent(
role="Researcher",
goal="Find information",
# Reads OPENBOX_RESEARCHER_API_KEY, _DID, _PRIVATE_KEY
env_prefix="OPENBOX_RESEARCHER",
)
task = OpenBoxTask(
description="Research AI governance patterns.",
expected_output="A short summary.",
agent=researcher,
activity_type="research",
)
crew = Crew(
agents=[researcher],
tasks=[task],
process=Process.sequential,
)
with create_openbox_engine() as engine:
result = engine.govern(crew).kickoff()
route.ts
import {
CopilotRuntime,
createCopilotRuntimeHandler,
InMemoryAgentRunner,
} from "@copilotkit/runtime/v2";
import { LangGraphAgent } from "@copilotkit/runtime/langgraph";
import {
createOpenBoxCopilotKitAdapter,
createOpenBoxCopilotRuntime,
} from "openbox-sdk/copilotkit";
const runner = new InMemoryAgentRunner();
const runtime = new CopilotRuntime({
agents: {
default: new LangGraphAgent({
deploymentUrl: process.env.AGENT_URL ?? "http://localhost:8123",
graphId: "openbox_copilotkit_agent",
langsmithApiKey: process.env.LANGSMITH_API_KEY ?? "",
}),
},
runner,
});
const openboxRuntime = createOpenBoxCopilotRuntime({
runtime,
runner,
agents: ["default"],
adapter: createOpenBoxCopilotKitAdapter({
agentWorkflowType: "CopilotKitRuntime",
taskQueue: "copilotkit-runtime",
}),
});
const handler = createCopilotRuntimeHandler({
runtime: openboxRuntime.runtime,
basePath: "/api/copilotkit",
hooks: openboxRuntime.hooks,
});
export const GET = handler;
export const POST = handler;
agent.py
import os
from deepagents import create_deep_agent
from langchain.chat_models import init_chat_model
from openbox_deepagent import create_openbox_middleware # Added import
# Create OpenBox middleware
middleware = create_openbox_middleware(
api_url=os.getenv("OPENBOX_URL"),
api_key=os.getenv("OPENBOX_API_KEY"),
agent_did=os.getenv("OPENBOX_AGENT_DID"),
agent_private_key=os.getenv("OPENBOX_AGENT_PRIVATE_KEY"),
agent_name="ResearchBot",
known_subagents=["researcher", "writer", "general-purpose"],
)
agent = create_deep_agent(
model=init_chat_model("openai:gpt-4o-mini"),
tools=[search_web, write_report, export_data],
subagents=[
{"name": "researcher", "tools": [search_web]},
{"name": "writer", "tools": [write_report]},
],
middleware=[middleware], # Added middleware
)
result = await agent.ainvoke(
{"messages": [{"role": "user", "content": "Research AI safety"}]},
config={"configurable": {"thread_id": "session-001"}},
)
agent.py
import os
from langchain.agents import create_agent
from openbox_langchain import create_openbox_langchain_middleware
middleware = create_openbox_langchain_middleware(
api_url=os.environ["OPENBOX_URL"],
api_key=os.environ["OPENBOX_API_KEY"],
agent_did=os.environ["OPENBOX_AGENT_DID"],
agent_private_key=os.environ["OPENBOX_AGENT_PRIVATE_KEY"],
agent_name="SupportAgent",
)
agent = create_agent(
model="openai:gpt-4o",
tools=[search_web, lookup_customer],
middleware=[middleware],
)
result = agent.invoke({"messages": [("user", "Check this customer issue")]})
agent.py
import os
from langgraph.graph import StateGraph, START, END, MessagesState
from openbox_langgraph import create_openbox_graph_handler # Added import
graph = StateGraph(MessagesState)
graph.add_node("agent", call_model)
graph.add_node("tools", tool_node)
graph.add_edge(START, "agent")
graph.add_conditional_edges("agent", should_continue, {"tools": "tools", END: END})
graph.add_edge("tools", "agent")
app = graph.compile()
# Wrap with OpenBox governance
governed = create_openbox_graph_handler(
graph=app,
api_url=os.getenv("OPENBOX_URL"),
api_key=os.getenv("OPENBOX_API_KEY"),
agent_did=os.getenv("OPENBOX_AGENT_DID"),
agent_private_key=os.getenv("OPENBOX_AGENT_PRIVATE_KEY"),
agent_name="MyAgent",
)
result = await governed.ainvoke({"messages": [("user", "Hello")]})
src/mastra/index.ts
import { Mastra } from "@mastra/core/mastra";
import { getOpenBoxRuntime, withOpenBox } from "@openbox-ai/openbox-mastra-sdk";
import { myAgent } from "./agents/my-agent";
import { myWorkflow } from "./workflows/my-workflow";
import { myTool } from "./tools/my-tool";
const mastra = new Mastra({
agents: { myAgent },
workflows: { myWorkflow },
tools: { myTool }
});
export const governedMastra = await withOpenBox(mastra, {
apiKey: process.env.OPENBOX_API_KEY,
apiUrl: process.env.OPENBOX_URL,
agentDid: process.env.OPENBOX_AGENT_DID,
agentPrivateKey: process.env.OPENBOX_AGENT_PRIVATE_KEY
});
process.on("SIGTERM", async () => {
await getOpenBoxRuntime(governedMastra)?.shutdown();
});
worker.py
import os
import asyncio
from temporalio.client import Client
from temporalio.worker import Worker
from openbox.plugin import OpenBoxPlugin # Add OpenBox
from your_workflows import YourWorkflow
from your_activities import your_activity
async def main():
client = await Client.connect("localhost:7233")
worker = Worker(
client,
task_queue="agent-task-queue",
workflows=[YourWorkflow],
activities=[your_activity],
# Add OpenBox plugin
plugins=[OpenBoxPlugin(
openbox_url=os.getenv("OPENBOX_URL"),
openbox_api_key=os.getenv("OPENBOX_API_KEY"),
)],
)
await worker.run()
asyncio.run(main())
The Trust Lifecycle
Five continuous phases that mirror the dashboard you operate every day.
Need help with the docs? Email support
Join our community: Discord
Talk to us: Email sales
For agents: Docs sitemap (llms.txt)