Skip to main content

Securing AI Agents with Parse

AI agents are risky because they convert text into action. A prompt, document, browser page, API response, or peer-agent message can become a tool call, memory write, payment, code execution, or user-visible answer.

Parse gives agents a machine-readable screening decision at those trust boundaries.

Core rule

Screen text when both conditions are true:

  1. The text was not generated by the agent's own model in this turn.
  2. The text will influence an LLM prompt, tool action, memory write, credential use, payment, code execution, external message, or user-visible output.

Generated output is handled separately: use POST /v1/screen-output before forwarding it.

Trust boundaries

BoundaryEndpointDefault behavior
User inputPOST /v1/parseBlock high-risk input
RAG documentsPOST /v1/parseDrop blocked chunks
Browser/email/file/tool outputPOST /v1/parseScreen before inserting into context
Peer-agent messagePOST /v1/agent/trust/verifyReject suspicious delegation
Generated responsePOST /v1/screen-outputScreen before forwarding
Unknown auth contextGET /v1/pricing then x402 flowPay per call or provision key

Minimal integration

async function guardedToolBoundary(text: string, source: string) {
  const res = await fetch("https://parsethis.ai/v1/parse", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.PARSE_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ prompt: text, metadata: { source } }),
  });

  if (!res.ok) {
    // High-impact paths should fail closed.
    throw new Error(`Parse unavailable: ${res.status}`);
  }

  const decision = await res.json();
  if (decision.suggested_action === "block" || decision.risk_score >= 7) {
    throw new Error("Blocked by Parse");
  }
  return decision;
}

High-impact actions

Fail closed or require human review before:

Low-impact drafts and summaries can fail open only when the operator explicitly accepts the risk and logs the bypass.

MCP integration

The hosted MCP endpoint is POST /mcp. It exposes:

The manifest is available at /mcp.json.

x402 integration

For agents with wallets, x402 removes signup friction:

  1. Call a billable endpoint with no bearer key.
  2. Receive 402 Payment Required.
  3. Sign the advertised USDC payment on Base mainnet.
  4. Retry with payment-signature.

Use x402 for autonomous first calls and metered workflows. Use bearer keys for sustained production volume.

Operational checklist

Limitations

Parse reduces risk but does not guarantee protection. It is not a substitute for scoped credentials, allowlisted tools, output validation, human review for high-impact actions, or incident response.