Skip to main content

Integrations

BRIK-64 integrates with AI frameworks at two levels: monomers as tools (use verified operations inside your agents) and policy circuits as guardrails (enforce safety constraints on agent actions).

LangChain

Use BRIK-64 monomers as LangChain tools. Each monomer is a formally verified atomic operation that your agent can call.
from brik64 import BrikToolkit
from langchain.agents import AgentExecutor, create_openai_tools_agent
from langchain.chat_models import ChatOpenAI

# Load monomer families as LangChain tools
toolkit = BrikToolkit(
    families=["arithmetic", "string", "crypto"],
    certified=True  # only verified operations
)

llm = ChatOpenAI(model="gpt-4")
agent = create_openai_tools_agent(llm, toolkit.get_tools(), prompt)
executor = AgentExecutor(agent=agent, tools=toolkit.get_tools())

result = executor.invoke({"input": "Hash the string 'hello world' with SHA256"})

CrewAI

Use policy circuits as agent guardrails in CrewAI. Each agent can have its own policy that restricts which tools and actions it can perform.
from brik64 import load_policy, BrikToolkit
from crewai import Agent, Task, Crew

# Policy: no network, no filesystem
policy = load_policy("sandbox.pcd.compiled")

# Verified tools from BRIK-64
toolkit = BrikToolkit(families=["arithmetic", "string", "logic"])

def brik_guard(action_name: str, action_input: str) -> bool:
    verdict = policy.check({
        "category": action_name,
        "params": {"input": action_input}
    })
    return verdict == "ALLOW"

analyst = Agent(
    role="Data Analyst",
    goal="Process data using verified operations only",
    tools=toolkit.get_tools(),
    before_tool_callback=brik_guard
)

task = Task(description="Calculate the factorial of 12", agent=analyst)
crew = Crew(agents=[analyst], tasks=[task])
result = crew.kickoff()

AutoGen

Use PCD-verified code generation with AutoGen. The Lifter converts generated code to PCD, verifies it, and compiles it back to the target language.
from brik64 import lift_and_verify

def verified_code_run(code: str, language: str = "python") -> dict:
    """Lift generated code to PCD, verify, and compile back."""
    result = lift_and_verify(
        source=code,
        language=language,
        target="python"
    )

    if result.certified:
        return {"status": "ok", "phi_c": result.phi_c, "code": result.compiled_code}
    else:
        return {"status": "rejected", "errors": result.errors}
The lift-verify-compile loop adds latency but guarantees that only formally verified code runs. For latency-sensitive applications, pre-verify common patterns and cache the results.

Claude Code (MCP Server)

BRIK-64 provides an MCP (Model Context Protocol) server that integrates directly with Claude Code and other MCP-compatible clients.
# Start the MCP server
brikc mcp serve
Configuration in ~/.claude.json:
{
  "mcpServers": {
    "brik64": {
      "command": "brikc",
      "args": ["mcp", "serve"],
      "env": {
        "BRIK64_API_KEY": "your-api-key"
      }
    }
  }
}
Available MCP tools:
ToolDescription
brik64_compileCompile a PCD file to target language
brik64_verifyVerify Phi_c = 1 for a PCD circuit
brik64_liftLift source code to PCD
brik64_policy_checkEvaluate an action against a policy circuit
brik64_registry_searchSearch the PCD registry
See the MCP Integration docs for full configuration details and advanced usage.

Generic: REST API

For any framework not listed above, use the BRIK-64 REST API directly.
# Compile PCD to JavaScript
curl -X POST https://api.brik64.dev/v1/compile \
  -H "Authorization: Bearer $BRIK64_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "source": "PC hello { OUTPUT 42; }",
    "target": "js"
  }'

# Evaluate an action against a policy
curl -X POST https://api.brik64.dev/v1/policy/check \
  -H "Authorization: Bearer $BRIK64_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "policy_id": "pol_abc123",
    "action": {
      "category": "net_connect",
      "params": {"host": "example.com", "port": 443}
    }
  }'
See the API Reference for the complete list of endpoints, authentication details, and rate limits.