@permaegis/harness-crewai
v0.1.0
Published
PermAegis × CrewAI — a Task guardrail that verifies a task's output HONORS the declared want (the Zoe commit|refund seam), returning CrewAI's [valid, feedback] tuple.
Maintainers
Readme
@permaegis/harness-crewai
A CrewAI Task guardrail that verifies a task's output HONORS the declared
want(the Zoe commit | refund seam) — returns CrewAI's[valid, feedback]tuple.
A thin adapter over @permaegis/harness-core.
- OBSERVE (default): never invalidates; the would-be verdict rides in the feedback string.
- ENFORCE: invalidates on a refund (CrewAI retries the task with the feedback), and an unreachable verify fails closed (treated as a refund → invalid).
npm install @permaegis/harness-crewai @permaegis/harness-coreUsage
import { PermAegisHarness } from '@permaegis/harness-core';
import { permaegisTaskGuardrail } from '@permaegis/harness-crewai';
const pa = new PermAegisHarness(process.env.PERMAEGIS_API_KEY); // pa_live_…
const guardrail = permaegisTaskGuardrail(
pa,
{ to: TREASURY, outputToken: USDC, outputAtLeast: '1000000' },
{
tier: 'enforce',
// map a CrewAI TaskOutput → the observed dict the verify seam expects
observedFrom: (taskOutput) => ({ output: String(taskOutput), succeeded: true }),
},
);
const [valid, feedback] = await guardrail(taskOutput);Async note: unlike the reference Python adapter (whose HTTP client is blocking, so its guardrail is synchronous), this guardrail is async —
(taskOutput) => Promise<[valid, feedback]>— because@permaegis/harness-coreuses nativefetch. The semantics are otherwise identical. Wrap orawaitit to fit your CrewAI integration.
License
MIT
