Pacts
Define behavioral contracts that specify what your agent commits to — latency, accuracy, safety, and more. Every condition is measurable and verifiable.
What is a Pact?
A pact is a behavioral contract between your agent and its counterparties. It declares a set of conditions your agent commits to meeting on every invocation. Each condition has a measurable type (e.g. latency, accuracy, safety), an operator and threshold, a severity rating, and a verification method.
| Field | Type | Description |
|---|---|---|
| type | string | Condition category: latency, accuracy, safety, format, prohibited_topics, … |
| operator | string | Comparison: lte, gte, eq, neq, includes, excludes |
| value | number | boolean | string[] | The threshold or expected value |
| severity | string | Impact level: critical, major, minor, info |
| verificationMethod | string | How the condition is checked: deterministic, heuristic, jury |
Create a Pact
POST to /api/v1/pacts with your pacts:write API key. The pactType field accepts unilateral (single agent) or bilateral (agent-to-agent agreement).
curl -X POST https://www.armalo.ai/api/v1/pacts \
-H "X-Pact-Key: pk_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"agentId": "YOUR_AGENT_ID",
"name": "production-sla-v1",
"pactType": "unilateral",
"conditions": [
{
"type": "latency",
"operator": "lte",
"value": 2000,
"unit": "ms",
"severity": "major",
"verificationMethod": "deterministic",
"description": "Response time under 2 seconds"
},
{
"type": "accuracy",
"operator": "gte",
"value": 0.95,
"severity": "major",
"verificationMethod": "jury",
"description": "Factual accuracy above 95%"
},
{
"type": "safety",
"operator": "eq",
"value": true,
"severity": "critical",
"verificationMethod": "deterministic",
"description": "No harmful content"
}
],
"isPublic": false
}'Verify a Pact
POST to /api/v1/pacts/:pactId/verify to run all pact conditions against a real agent interaction. Supply the raw input, output, and latencyMs. Deterministic checks resolve immediately; jury conditions are dispatched asynchronously via Inngest and the result is returned once all models have voted.
curl -X POST https://www.armalo.ai/api/v1/pacts/YOUR_PACT_ID/verify \
-H "X-Pact-Key: pk_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"input": "What is the current price of AAPL?",
"output": "Apple (AAPL) is currently trading at $187.42.",
"latencyMs": 1240
}'{
"pactName": "production-sla-v1",
"compliant": true,
"totalConditions": 3,
"passedConditions": 3,
"failedConditions": 0,
"results": [
{ "type": "latency", "passed": true, "actual": 1240, "threshold": 2000 },
{ "type": "accuracy", "passed": true, "details": "Jury score: 0.97" },
{ "type": "safety", "passed": true, "details": "No harmful content detected" }
]
}Condition Reference
The verificationMethod determines how each condition is evaluated when a pact is verified.
| Method | How it works |
|---|---|
| deterministic | Checked locally on the server without an LLM. Suitable for numeric thresholds (latency, token count) and boolean flags (safety, format). |
| heuristic | Pattern matching and rule-based checks against the output text. Faster than jury, no LLM cost. |
| jury | Dispatched to the multi-model LLM jury. Multiple independent models vote and a trimmed-mean consensus score is computed. Required for accuracy and subjective quality checks. |
Pact Templates
Armalo ships pre-built pact templates for common use cases — production SLAs, safety guardrails, financial data retrieval, and more. Templates are a fast starting point you can clone and customize.
Browse pact templatesSDK
Use @armalo/core for type-safe pact creation and local condition validation before submitting to the API.
import { ArmaloClient } from '@armalo/core';
const client = new ArmaloClient({ apiKey: process.env.ARMALO_API_KEY });
// Create a pact
const pact = await client.createPact({
agentId: 'YOUR_AGENT_ID',
name: 'production-sla-v1',
pactType: 'unilateral',
conditions: [
{
type: 'latency',
operator: 'lte',
value: 2000,
unit: 'ms',
severity: 'major',
verificationMethod: 'deterministic',
},
{
type: 'accuracy',
operator: 'gte',
value: 0.95,
severity: 'major',
verificationMethod: 'jury',
},
],
});
// Verify a pact
const result = await client.verifyPact(pact.id, {
input: 'What is the price of AAPL?',
output: 'Apple is trading at $187.42.',
latencyMs: 1240,
});
console.log(result.compliant); // trueExplore related docs