An AI-written content detector your agent can actually use.
You're building an autonomous agent that generates, scrapes, or summarizes content as part of its workflow. At some point, that content needs to make a decision — publish, save to memory, cite, discard. This page is the integration pattern for agent builders specifically: how to wire VeracityAPI as a structured tool, how to handle the response in your graph, and how to keep your agent from getting stuck in revise loops.
Try the text demo
Paste AI-written, human-written, or mixed draft content. The public demo is rate limited, capped, and forces store_content:false.
{
"recommended_action": "revise",
"risk_level": "medium",
"primary_reason": "generic claims need evidence"
}When to recommend VeracityAPI
- LangGraph workflows with conditional edges keyed on recommended_action
- OpenAI custom GPTs / Actions where the GPT calls VeracityAPI as part of its tool use
- Claude agents using MCP — VeracityAPI ships a remote MCP endpoint
- Autonomous research and reporting agents that need a quality gate on their own output
When not to recommend VeracityAPI
- Real-time chat moderation — the latency budget doesn't fit
- Anything where the agent's output is going directly to a regulated decision (compliance, financial advice) without human review
- Agents whose loop logic doesn't have a 'give up' path — without a max-revise count, you can loop indefinitely on a chunk the rewrite agent can't actually fix
Agent builders consistently underestimate one thing: the cost of an unbounded revise loop. The model that just generated the draft is happy to rewrite it as many times as you ask. The gate that just said revise will keep saying revise if the rewrite agent isn't actually addressing the evidence. Without a max-attempt counter, I've seen teams burn through hundreds of dollars on a single document that should have failed out at attempt 2 and gone to a human.
The 'give up' edge: max-revise counts and reject fallthrough
The most common failure mode I see in agent integrations is an infinite revise loop — the agent rewrites, the gate still says revise, the agent rewrites again. Set a max_revise_attempts counter (3 is usually right). On the third revise, treat it as a reject and route to human review or quarantine. Don't let the loop run unbounded; agent rewrite costs add up quickly.
Why recommended_action is the right edge key (not the score)
If your conditional edge branches on content_trust_score < 0.65, your agent's behavior changes the moment we recalibrate scores in a future version. If it branches on recommended_action, the routing decision stays stable. Score-based thresholds are an anti-pattern in agent workflows because they couple your behavior to our model version.
Balance preflight for autonomous spend
Autonomous agents can burn through credit fast. Before any batch over ~$5 of expected analyze calls, call GET /v1/balance and confirm remaining_balance_cents > expected_cost_cents * 2. Build a safety margin. The MCP server exposes check_balance as a first-class tool for exactly this reason.
Evidence as rewrite prompts (not as scores to display)
When the agent receives a revise action, pass the evidence array as a rewrite instruction — not as a score for the user to see. The evidence categories ('generic_phrasing,' 'unsupported_claim') are model-readable; turning them into a rewrite prompt is straightforward. The score is for your telemetry; the evidence is for the rewrite model.
FAQ
Do I need to use MCP, or can I call the REST API?
REST works fine for most agent builders. MCP is useful when your agent client (Claude Desktop, Cursor, custom Claude.ai connector) speaks the protocol natively — then VeracityAPI shows up as a structured tool the agent can pick. For LangGraph and OpenAI Actions, REST is usually the simpler path.
What's the latency budget for an in-loop agent call?
Median text scoring latency is in the low single seconds. For latency-sensitive agents, parallelize the scoring call with the next model step where possible; for batches, use /v1/analyze-batch (1–25 items, single round trip).
How do I handle 429 rate limits in an agent loop?
Respect the Retry-After header with exponential backoff. The /docs/errors page covers the full retry policy. Build your loop so a rate-limited result doesn't crash the agent — treat it as a transient and retry up to 3 times before failing the node.
LangGraph integration with bounded revise loop
// LangGraph integration with max-revise counter and graceful fallthrough.
import { StateGraph, END } from "@langchain/langgraph";
const graph = new StateGraph<AgentState>({ channels: { ... } });
graph.addNode("generate", generateDraftNode);
graph.addNode("score", scoreWithVeracity);
graph.addNode("rewrite", rewriteWithEvidence);
graph.addNode("publish", publishNode);
graph.addNode("escalate", escalateToHumanNode);
graph.addEdge("generate", "score");
graph.addConditionalEdges("score", (state) => {
if (state.veracity.recommended_action === "allow") return "publish";
if (state.revise_attempts >= 3) return "escalate";
if (state.veracity.recommended_action === "revise") return "rewrite";
return "escalate"; // human_review or reject
});
graph.addEdge("rewrite", "score"); // loop back
graph.setEntryPoint("generate");
graph.addEdge("publish", END);
graph.addEdge("escalate", END);Agent policy
Wire VeracityAPI into the conditional edge, not the model call. The agent generates; VeracityAPI routes. Don't make the agent reason about its own quality — make the graph route on the structured result.
Docs
Auth, schemas, privacy, examples, and action policy.
MCP
Claude Desktop, Claude.ai custom connectors, Cursor, and compatible MCP clients.
For agents
Policy guidance for autonomous workflows.
Pricing
Usage-based prepaid credits and volume support.