HomeConnectOpenAI Agents SDK

Integration Guide

OpenAI Agents SDK

Connect OpenAI Agents SDK to DashClaw and get your first governed action into /decisions in under 20 minutes.

Instance URL detected: https://your-dashclaw-instance.example.com

1

Deploy DashClaw

Get a running instance. Click the Vercel deploy button or run locally.

Already have an instance? Skip to Step 2.

2

Install the DashClaw SDK

Add the DashClaw Node.js SDK to your agent project.

Terminal

npm install dashclaw dotenv
3

Set environment variables

Create a .env file in your agent project root.

.env

DASHCLAW_BASE_URL=https://your-dashclaw-instance.example.com
DASHCLAW_API_KEY=oc_live_...
4

Put the export callback behind runGoverned

Pass the exact export act and callback to runGoverned. It binds current policy, one persisted action, approval, one execution claim, and outcome reporting.

governed-agent.js

import 'dotenv/config';
import { DashClaw } from 'dashclaw';

process.on('unhandledRejection', (reason) => {
  console.error('Unhandled Rejection:', reason);
  process.exit(1);
});

const claw = new DashClaw({
  baseUrl: process.env.DASHCLAW_BASE_URL,
  apiKey: process.env.DASHCLAW_API_KEY,
  agentId: 'my-openai-agent',
});

const result = await claw.runGoverned(
  { kind: 'file', file: { path: 'report.csv' } },
  {
    action_type: 'data_export',
    declared_goal: 'Export customer report to CSV',
    risk_score: 45,
    systems_touched: ['customer_database'],
  },
  async () => 'Exported 150 customer records to report.csv',
);

console.log(result);

The repository OpenAI Agents example uses an older cooperative guard-and-record loop around simulated data. Use this runGoverned pattern when the callback can cause a real effect.

5

Run the governed agent

Execute your agent and watch the governance flow.

Terminal

node --env-file=.env governed-agent.js
6

See the result in DashClaw

Open your DashClaw dashboard to confirm the action was recorded.

Go to /decisions: you should see your action in the ledger with action_type 'data_export', status 'completed', and the output summary you provided.

What success looks like

Go to /decisions: you should see your action in the ledger with action_type 'data_export', agent_id 'my-openai-agent', and status 'completed'.

Navigate to /decisions in your DashClaw instance. Your action should appear in the ledger within seconds of the agent run.

Governance as Code

guardrails.yml is a policy-as-code template. Import it into your instance — POST the YAML to /api/policies/import or call the Python SDK's import_policies — and DashClaw evaluates these rules at the guard step before any action executes.

guardrails.yml

version: 1
project: my-openai-agent
description: >
  Governance policy for an OpenAI Agents SDK data agent.
  High-risk deletions require approval. Reads are auto-allowed.

policies:
  - id: approve_deletions
    description: Require human approval for any delete operation
    applies_to:
      tools:
        - delete_records
        - drop_table
    rule:
      require: approval

  - id: auto_allow_reads
    description: Read operations are low risk
    applies_to:
      tools:
        - scan_for_pii
        - list_records
    rule:
      allow: true