OpenAI Assistants

Intercept OpenAI Assistants tool calls and route them through Cheqpoint for human review before execution.

Prerequisites

  • OpenAI API Key and an active Assistant.
  • Server-side environment to manage the run loop.
  • Cheqpoint Connection Key.

Steps

  1. In your application's run loop, monitor for the requires_action status from the OpenAI Run.
  2. Iterate through the tool_calls in the required_action object.
  3. For each tool call identified as high-risk, send a POST request to the Cheqpoint inbound webhook.
  4. Pause the run loop until a decision is received from Cheqpoint.
  5. If approved, submit the tool outputs to OpenAI as usual.
  6. If rejected, submit a tool output to OpenAI explaining that the “Security system denied this specific action,” allowing the Assistant to pivot.

Installation

bash
npm install @cheqpoint/sdk openai

Sample request payload

json
{
  "action": "send_email_blast",
  "summary": "Assistant wants to send an email to 500 recipients",
  "details": {
    "template": "weekly_update",
    "recipient_count": 500,
    "subject": "System Maintenance"
  },
  "justification": "Requested by user to notify customers of downtime."
}

Sample Cheqpoint response

json
{
  "status": "approved",
  "modifiedDetails": null,
  "decisionNote": "Verified maintenance window scheduled."
}

Node.js — requestSync() in the run loop

javascript
import { CheqpointClient } from "@cheqpoint/sdk";

const cheq = new CheqpointClient({ apiKey: "cq_live_..." });

// Inside your OpenAI Assistants run loop, when status === "requires_action":
for (const toolCall of run.required_action.submit_tool_outputs.tool_calls) {
  if (toolCall.function.name === "send_email_blast") {
    const args = JSON.parse(toolCall.function.arguments);

    const result = await cheq.requestSync({
      action: "send_email_blast",
      summary: "Assistant wants to send an email to 500 recipients",
      details: args,
      justification: "Requested by user to notify customers of downtime.",
      timeoutMs: 30_000,  // poll up to 30 s
    });

    toolOutputs.push({
      tool_call_id: toolCall.id,
      output: result.status === "approved"
        ? JSON.stringify({ success: true, ...result.modifiedDetails })
        : "Security system denied this specific action.",
    });
  }
}

Notes

You have full control over what data is passed into the details object to provide human reviewers with sufficient context.

Tips

Start by routing only high-risk or high-value actions to minimize friction while maintaining oversight.

Get your Connection Key at cheqpoint.co/signup.