@permaegis/harness-openai
v0.1.0
Published
PermAegis × OpenAI Agents SDK — a tool-input guardrail (the gate seam) and an output guardrail (the Zoe verify seam) as GuardrailFunctionOutput-shaped callables.
Maintainers
Readme
@permaegis/harness-openai
PermAegis guardrails for the OpenAI Agents SDK — a tool-input guardrail (the OCap gate) and an output guardrail (the Zoe verify).
A thin adapter over @permaegis/harness-core.
Each factory returns an async callable that yields { tripwireTriggered, outputInfo }. The
tripwire fires only on ENFORCE + deny (gate) / refund (verify); in observe it never trips.
npm install @permaegis/harness-openai @permaegis/harness-coreUsage
import { PermAegisHarness } from '@permaegis/harness-core';
import { permaegisToolGuardrail, permaegisOutputGuardrail } from '@permaegis/harness-openai';
const pa = new PermAegisHarness(process.env.PERMAEGIS_API_KEY); // pa_live_…
// Tool-input gate (PreToolCall):
const gate = permaegisToolGuardrail(pa, { grant: MY_GRANT, tier: 'enforce' });
const g = await gate(toolName, toolInput); // { tripwireTriggered, outputInfo }
// Output verify (does the action HONOR the declared want?):
const verify = permaegisOutputGuardrail(
pa,
{ to: TREASURY, outputToken: USDC, outputAtLeast: '1000000' },
{ tier: 'enforce' },
);
const v = await verify(observedActionResult); // { tripwireTriggered, outputInfo }Map the result onto your guardrail return, e.g. new GuardrailFunctionOutput({ tripwireTriggered: g.tripwireTriggered, outputInfo: g.outputInfo }).
The gate guardrail fails closed (synthetic deny → tripwire) in enforce when the API is unreachable. The output guardrail does not fail closed — an unreachable verify rejects, mirroring the reference Python adapter.
License
MIT
