aip-spec

module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2026 License: MIT

README ΒΆ

Agent Interaction Protocol (AIP)

Status: Draft v0.2 β€” Reference Implementation
Author: Empire Labs Pty Ltd
License: CC BY 4.0 (spec) / MIT (schemas, examples)
Repository: github.com/narko4u/aip-spec
Layer: Above ACI, below WitnessOS


What is AIP?

ACI tells an agent who you are and what you offer.
AIP tells an agent how to actually interact with you.
AJSON writes the manifests for both.

AIP is the interaction layer for autonomous agent-to-agent and agent-to-organization commerce. It defines:

  • Action Schemas β€” typed input/output contracts for every capability
  • Contract Templates β€” machine-readable terms (price, SLA, retry, dispute)
  • Negotiation Flows β€” offer/counter/accept/reject between autonomous parties
  • Execution Bindings β€” how the action actually happens (REST, MCP, gRPC, WebSocket)
  • Settlement Hooks β€” payment, receipt, evidence generation via WitnessOS
Relationship to ACI
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    ACI                          β”‚
β”‚   Discovery Β· Identity Β· Capabilities Β· Trust  β”‚
β”‚   (who are you, what do you offer, can I trust β”‚
β”‚    you, where are your agents)                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚ references
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    AIP                          β”‚
β”‚   Interaction Β· Negotiation Β· Execution         β”‚
β”‚   (what exactly can you do for me, on what     β”‚
β”‚    terms, how do we transact)                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚ produces evidence
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 WitnessOS                       β”‚
β”‚   Governance Β· Enforcement Β· Evidence           β”‚
β”‚   (did it happen correctly, prove it, remediate β”‚
β”‚    if not)                                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Core Concepts

1. Action

The atomic unit of interaction. An Action is a typed, machine-readable capability declaration:

{
  "action_id": "aci.evaluate-policy",
  "version": "1.0.0",
  "description": "Evaluate an action against governance policy",
  "input_schema": { ... },
  "output_schema": { ... },
  "binding": {
    "type": "http",
    "method": "POST",
    "url": "https://witnessos.empirelabs.com.au/api/evaluate",
    "headers": { "Authorization": "Bearer {api_key}" }
  },
  "pricing": {
    "model": "per-call",
    "price_per_call": "0.001",
    "currency": "USD"
  },
  "sla": {
    "p99_latency_ms": 500,
    "availability": "99.9",
    "max_retries": 3
  },
  "evidence": {
    "required": true,
    "schema": { "$ref": "https://witnessos.empirelabs.com.au/schemas/evidence-receipt-v1.json" }
  }
}
2. Contract

A binding agreement between two parties (agents or agent→organization):

  • Static Contract β€” predefined, non-negotiable terms (take-it-or-leave-it)
  • Negotiated Contract β€” result of offer/counter/accept/reject flow
  • Smart Contract β€” on-chain execution and settlement (future)

Fields: parties, actions, pricing, SLA, evidence requirements, jurisdiction, dispute resolution.

3. Negotiation

The flow by which two autonomous parties converge on a Contract:

Agent A β†’ Offer (proposed terms)
Agent B β†’ Counter (modified terms) or Accept or Reject
Agent A β†’ Accept or Counter or Reject
...
[Contract executed when both accept identical terms]
4. Execution

The actual performance of an Action under a Contract:

  1. Invocation β€” caller sends request with contract_id
  2. Validation β€” receiver verifies contract is active, within SLA
  3. Processing β€” action is performed
  4. Evidence β€” WitnessOS generates SHA-256 receipt
  5. Response β€” result + evidence receipt returned
  6. Settlement β€” payment triggered (if applicable)
5. Settlement

How value moves between parties:

  • Pre-pay β€” deposit held, released on completion
  • Post-pay β€” invoice generated after execution
  • Subscription β€” recurring access
  • Revenue Share β€” percentage-based settlement
  • Token/Programmable Payment β€” crypto, stablecoins (future)

Protocol Layers

Layer What It Handles Why Separate
L0: Transport HTTP, gRPC, MCP, WebSocket Multiple underlying protocols
L1: Action Typed request/response schemas The actual business logic
L2: Contract Terms, pricing, SLA Binding agreement between parties
L3: Negotiation Offer/counter/accept/reject Dynamic terms, not static
L4: Settlement Payment, receipts, dispute Value transfer and closure
L5: Evidence WitnessOS receipts, audit trail Governance and proof

Manifest Types (bound to ACI)

AIP manifests are referenced FROM ACI manifests. An ACI Capability Manifest would reference AIP Action manifests:

{
  "capability_id": "empire.witnessos.policy-evaluation",
  "name": "Policy Evaluation",
  "description": "Evaluate agent actions against defined governance policies",
  "aip_actions": [
    "https://empirelabs.com.au/.well-known/aip/actions/evaluate-policy.json",
    "https://empirelabs.com.au/.well-known/aip/actions/batch-evaluate.json"
  ],
  "aip_contracts": [
    "https://empirelabs.com.au/.well-known/aip/contracts/standard.json",
    "https://empirelabs.com.au/.well-known/aip/contracts/enterprise.json"
  ]
}

Reference Implementation (Go)

Location: Root of this repository

The AIP reference implementation is built in Go β€” a single binary with zero runtime dependencies.

Project Structure
β”œβ”€β”€ cmd/
β”‚   └── aip/main.go          # CLI tool
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ crypto/sign.go       # Ed25519 signing/verification
β”‚   └── types/types.go       # Shared protocol types
β”œβ”€β”€ pkg/
β”‚   β”œβ”€β”€ action/schema.go     # Action Schema parsing and validation
β”‚   β”œβ”€β”€ contract/template.go # Contract templates and binding agreements
β”‚   β”œβ”€β”€ contract/binding.go  # Signed contract bindings
β”‚   β”œβ”€β”€ negotiation/nego.go  # Offer/counter-offer state machine
β”‚   β”œβ”€β”€ execution/execute.go # Transport dispatch + schema validation
β”‚   β”œβ”€β”€ settlement/settle.go # Transaction ledger and receipts
β”‚   └── evidence/receipt.go  # Signed evidence attestations
β”œβ”€β”€ schemas/
β”‚   β”œβ”€β”€ action-schema.json   # JSON Schema for Action definitions
β”‚   β”œβ”€β”€ contract-template.json
β”‚   └── evidence-receipt.json
β”œβ”€β”€ examples/
β”‚   β”œβ”€β”€ action-schema.ajson  # AJSON example: action schema
β”‚   └── aip-contract.ajson   # AJSON example: contract template
β”œβ”€β”€ mcp-server/
β”‚   └── aip_mcp_server.py    # MCP server exposing AIP as tools
β”œβ”€β”€ go.mod / go.sum
└── README.md
CLI Usage
Installation

You have three options:

Option 1 β€” Go install (requires Go 1.22+)

go install github.com/narko4u/aip-spec/cmd/aip@latest

Option 2 β€” Homebrew (macOS / Linux, no Go required)

brew install narko4u/tap/aip

Option 3 β€” GitHub Release (pre-built binaries) Download the appropriate archive for your platform from Releases, extract, and place aip on your $PATH.

# Example: Linux amd64
curl -sL https://github.com/narko4u/aip-spec/releases/download/v0.2.0/aip_v0.2.0_linux_amd64.tar.gz \
  | tar xz
sudo mv aip /usr/local/bin/

# Generate identity key pair
aip keygen

# Negotiate a contract from an action schema
aip negotiate schema.json

# Execute an action against a negotiated contract
aip execute schema.json input.json

# Settle a completed contract
aip settle contract.json

# Verify an evidence receipt
aip verify receipt.json <public_key_hex>

# Run full end-to-end demo
aip demo
Architecture
Agent (any language)
  β†’ subprocess/HTTP β†’ aip binary (Go)
    β†’ validates action schema
    β†’ negotiates contract (state machine)
    β†’ dispatches execution via transport
    β†’ generates Ed25519-signed evidence receipt
    β†’ records settlement transaction
Dependencies
  • Zero external dependencies β€” stdlib only (crypto/ed25519, net/http, encoding/json)
  • Single binary: go build produces a ~8MB static binary
  • Cross-compile: GOOS=linux GOARCH=arm64 go build for any platform

Roadmap

Phase Contents Target
v0.1 (current) This outline + core concept definitions Now
v0.2 Action Schema spec + JSON Schema definitions Q3 2026
v0.3 Contract Template spec + negotiation flow Q3 2026
v0.4 Execution binding spec (HTTP, MCP, gRPC) Q4 2026
v0.5 Settlement integration spec Q4 2026
v0.6 Evidence/Receipt integration with WitnessOS Q4 2026
v0.7 SDK support (Python, Go) Q1 2027
v1.0 Stable spec + 3+ independent implementations Q2 2027

Canonical Use Case

sequenceDiagram
    participant A as Agent A<br/>(ACI-enabled)
    participant D as Discovery<br/>(ACI Manifests)
    participant AIP as AIP Registry
    participant B as Agent B<br/>(WitnessOS-Governed)
    participant W as WitnessOS

    A->>D: Discover Agent B's capabilities
    D->>A: ACI manifests (agent, capability, identity)
    A->>AIP: Fetch AIP action schemas & contract templates
    AIP->>A: Action definitions + pricing + SLA
    A->>B: Offer (action X, price Y, SLA Z)
    B->>A: Counter (price Y+10%, SLA Z)
    A->>B: Accept
    Note over A,B: Contract active βœ“
    A->>B: Execute action (with contract_id)
    B->>W: Evaluate action, generate receipt
    W->>B: Receipt (SHA-256, policy result)
    B->>A: Result + Evidence Receipt
    A->>B: Payment/Settlement
    Note over A,B: Interaction complete βœ“

Design Principles

  1. Stateless at Rest β€” AIP manifests are static JSON (or AJSON β€” a superset with comments, multi-line strings, and reusable references). The protocol becomes stateful only during negotiation and execution.
  2. AC-Compatible β€” AIP references ACI identities and capabilities but doesn't require ACI to function (agents can advertise AIP actions independently).
  3. WitnessOS-Native β€” Evidence generation is assumed. Every execution produces a verifiable receipt.
  4. Negotiable by Default β€” Terms should be negotiable unless explicitly marked "fixed".
  5. Failure-Aware β€” Every action defines what happens on timeout, error, partial success, and dispute.
  6. Versioned Strictly β€” Breaking changes require major version bump. Agents MUST check version compatibility.

Open Questions (to resolve before v0.2)

  • Should AIP have its own well-known URL (.well-known/aip/) or be embedded in ACI manifests?
  • Is negotiation synchronous (request/response within one session) or async (message queue)?
  • What's the dispute resolution mechanism? Arbitration by a third-party agent?
  • How does AIP handle identity verification beyond what ACI provides?
  • Should AIP define a lightweight payment token for micro-transactions between agents?


🍻 Buy the Empire a Pint

If AIP helps your agents negotiate and execute contracts, buy the Empire a pint. We like to split the G.

ko-fi

Pay what you want. No tiers, no strings. Every donation helps keep this protocol sovereign and open.



Built by Empire Labs Pty Ltd | Maintained by Sovereign

This is a living document. Open issues and PRs on the repo to contribute.

Directories ΒΆ

Path Synopsis
cmd
aip command
internal
pkg
action
Package action defines Action Schemas β€” typed input/output contracts that agents use to invoke capabilities discovered through ACI manifests.
Package action defines Action Schemas β€” typed input/output contracts that agents use to invoke capabilities discovered through ACI manifests.
contract
Package contract defines Contract Templates and Binding Agreements between agents discovered through ACI and negotiated via AIP.
Package contract defines Contract Templates and Binding Agreements between agents discovered through ACI and negotiated via AIP.
evidence
Package evidence defines evidence receipts β€” signed attestations that an action was executed under a specific contract.
Package evidence defines evidence receipts β€” signed attestations that an action was executed under a specific contract.
execution
Package execution defines the action invocation lifecycle: validate input β†’ invoke transport β†’ validate output β†’ record evidence.
Package execution defines the action invocation lifecycle: validate input β†’ invoke transport β†’ validate output β†’ record evidence.
negotiation
Package negotiation implements the AIP negotiation state machine.
Package negotiation implements the AIP negotiation state machine.
settlement
Package settlement handles economic settlement between agents: payment processing, receipt generation, and reconciliation.
Package settlement handles economic settlement between agents: payment processing, receipt generation, and reconciliation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL