Mandate SDK introduces a crucial runtime enforcement layer for AI agents, ensuring that their actions remain within defined policies. By intercepting calls and evaluating them against rules, Mandate protects against unauthorized actions, enabling accountability and cost management in an increasingly automated world.
Runtime enforcement for AI agent authority.
Mandate SDK serves as the foundational component of the Know Your Agent (KYA) infrastructure, delivering mechanical enforcement of AI agent authority at runtime rather than relying solely on prompt suggestions. This ensures that AI agents have a stable identity and enforces the policies established for their operations.
As AI agents increasingly function as economic actors—spending money, interfacing with APIs, and making consequential decisions—they risk operating in an ungoverned manner. Presently, these agents act as unbanked entities characterized by:
Without strong enforcement, the following issues can arise:
delete_*, execute_*) due to unintentional hallucinations by language models.Mandate SDK provides a robust runtime enforcement mechanism through a layered execution model:
import { MandateClient, createToolAction } from "@mandate/sdk";
const client = new MandateClient({
mandate: {
version: 1,
id: "mandate-1",
agentId: "email-agent",
issuedAt: Date.now(),
maxCostTotal: 10.0, // $10 total budget
allowedTools: ["send_email"], // Tool permissions
toolPolicies: {
send_email: {
rateLimit: {
maxCalls: 5,
windowMs: 60_000,
},
chargingPolicy: {
type: "ATTEMPT_BASED",
},
},
},
},
auditLogger: "console",
});
const action = createToolAction("email-agent", "send_email", {
to: "user@example.com",
subject: "Invoice",
});
try {
await client.executeTool(action, () => sendEmail());
} catch (error) {
// Blocked if policy violations occur.
}
Mandate SDK is structured to maintain a separation of concerns, utilizing a Policy Engine and a State Manager to enforce policies at runtime effectively. Key components include:
Phase 3 introduces a Redis backend for distributed state management, allowing for atomic operations and global limits across multiple servers.
Mandate ensures AI agents are governable at the identity level, providing essential features such as:
Mandate serves various audiences including:
Mandate SDK offers a seamless integration experience with examples and thorough documentation covering all aspects of its functionality. For detailed usage and exploration, refer to the documentation and examples.
Contributions are welcomed, and interested developers can participate in expanding the functionalities or improving documentation. For issues, discussions, or feature requests, visit the relevant sections on GitHub.
For further learning, refer to the detailed guides and examples provided in this repository.
No comments yet.
Sign in to be the first to comment.