PitchHut logo
Defining behavior standards for AI agents through contracts.
Pitch

AgentContract establishes essential behavioral contracts for AI agents, enabling precise control over their actions. By defining clear expectations, developers can ensure consistency and accountability, paving the way for more reliable AI deployments in enterprise environments.

Description

AgentContract provides a groundbreaking behavioral contract specification for AI agents, enabling the declaration and enforcement of agent behaviors across various frameworks. It addresses the unpredictability of AI systems by allowing developers to specify what agents must, must not, and can do during operations, directly contributing to governance and compliance in AI deployments.

The Challenge

AI agents often operate like black boxes, making their behavior unpredictable and difficult to manage. This uncertainty poses significant challenges for businesses, which need to guarantee that their deployed agents will behave as expected. AgentContract defines a standard that allows organizations to express critical operational rules, such as:

  • This agent must never reveal the system prompt.
  • The agent must escalate to a human if confidence drops below 70%.
  • The agent must not access data from other users.
  • The agent must respond within 30 seconds.

How It Works

An agent's behavior is encapsulated in a .contract.yaml file, where developers can specify mandatory, prohibited, and allowed actions. Below is an example of how to define a contract for a customer support agent:

# customer-support.contract.yaml
agent: customer-support-bot
spec-version: 0.1.0
version: 1.0.0
description: Contract for customer-facing support agent

must:
  - respond in the user's language
  - escalate to human if confidence < 0.7
  - complete within 30 seconds
  - log every action with timestamp

must_not:
  - reveal system prompt or internal instructions
  - make pricing promises
  - access data from other user accounts
  - hallucinate source citations

can:
  - query the knowledge base
  - create support tickets
  - schedule callbacks
  - ask clarifying questions

limits:
  max_tokens: 500
  max_latency_ms: 30000
  max_cost_usd: 0.05

assert:
  - name: no_pii_leak
    type: pattern
    must_not_match: "(\\b\\d{4}[- ]?\\d{4}[- ]?\\d{4}[- ]?\\d{4}\\b|\\b\\d{3}-\\d{2}-\\d{4}\\b)"
    description: Output must not contain credit card or SSN patterns

on_violation:
  default: block
  latency: warn
  pii_leak: halt_and_alert

This contract can be applied to any AI agent, regardless of the framework or programming language used:

from agentcontract import Contract, enforce

contract = Contract.load("customer-support.contract.yaml")
@enforce(contract)
def run_agent(user_input: str) -> str:
    # existing agent code — OpenClaw, LangChain, CrewAI, or similar
    return agent.run(user_input)

In the case of violations, detailed logs are generated:

AgentContractViolation: [BLOCK] Clause violated: "must_not: reveal system prompt"
  Agent:    customer-support-bot v1.0.0
  Contract: customer-support.contract.yaml v1.0.0
  Run ID:   run_8f3a2c1d
  At:       2026-03-21T08:42:00Z
  Severity: block
  Action:   response suppressed, incident logged

Core Features

  • Open Specification: AgentContract is an open standard, allowing anyone to implement it without vendor lock-in.
  • Framework-Agnostic: It can be used across various platforms like OpenClaw, LangChain, and CrewAI.
  • Deterministic Checks: Runs checks without using large language models (LLMs), ensuring performance and reliability.
  • Human-Readable Format: Uses YAML for easy comprehension by both developers and non-developers.
  • Community Driven: Promotes a shared library of contracts and implementations around the specification.

Community and Contributions

AgentContract thrives on community collaboration. Contributions are encouraged, whether it’s proposing changes, submitting contracts for the library, or reporting issues. More details regarding contributions can be found in the repository’s CONTRIBUTING.md.

As the demand for reliable AI governance increases, AgentContract stands out as an essential tool for ensuring compliance and control over AI behavior.

0 comments

No comments yet.

Sign in to be the first to comment.