Policy Overview
The Nomiqon policy model: structure, evaluation, and lifecycle.
Runtime
A Policy is an immutable rule-set that governs every spend initiated by an agent. Policies are versioned — when you update an agent's policy, the old policy record is retained for auditing.
Complete Policy schema
typescriptnomiqon.com
type Policy = {
id: string; // "pol_01jx..."
agentId: string;
version: number; // monotonically increasing
// ── Caps ─────────────────────────────────────────────────
dailyCap?: string; // USDC "10.00"
totalCap?: string; // USDC lifetime ceiling
windowCap?: {
amount: string; // USDC within the window
windowMs: number; // rolling window, e.g. 3_600_000 (1 h)
};
// ── Domain control ────────────────────────────────────────
allowlist?: string[]; // permitted hostnames; if set, others are blocked
blocklist?: string[]; // always-rejected hostnames (overrides allowlist)
// ── Temporal ─────────────────────────────────────────────
activeFrom?: string; // ISO-8601; policy inactive before this time
activeUntil?: string; // ISO-8601; policy expires after this time
activeHours?: {
timezone: string; // IANA tz "America/New_York"
from: string; // "09:00"
to: string; // "17:00"
};
// ── Kill switch ───────────────────────────────────────────
frozen: boolean; // if true, all spends rejected immediately
createdAt: string;
};Evaluation order
- frozen check — if policy.frozen === true, reject immediately.
- Temporal check — reject if current time is outside activeFrom/Until/Hours.
- Blocklist — reject if hostname matches any blocklist entry.
- Allowlist — reject if allowlist is set and hostname is not present.
- Window cap — reject if rolling-window spend + amount > windowCap.amount.
- Total cap — reject if lifetime spend + amount > totalCap.
- Daily cap — reject if today's spend + amount > dailyCap.
- Approved — funds released.
Multi-agent crew settlement
When running agent crews (e.g. CrewAI, AutoGen), assign each role a separate agent with a scoped policy. Use the metadata.crew tag to group them and query aggregate spend:
typescriptnomiqon.com
const crew = "crew_research_run_42";
const [researcher, writer, validator] = await Promise.all([
nomiqon.agents.create({
name: "researcher",
policy: { dailyCap: "8.00", allowlist: ["api.openai.com", "api.bing.com"] },
metadata: { crew },
}),
nomiqon.agents.create({
name: "writer",
policy: { dailyCap: "4.00", allowlist: ["api.openai.com", "api.anthropic.com"] },
metadata: { crew },
}),
nomiqon.agents.create({
name: "validator",
policy: { dailyCap: "1.00", allowlist: ["api.openai.com"] },
metadata: { crew },
}),
]);
const stats = await nomiqon.transactions.aggregate({ metadata: { crew } });
console.log("Total crew spend:", stats.totalUsdc, "USDC");