Search ARuntime.com

Find runtime definitions and implementation guidance

Search page titles, summaries, headings, glossary terms, use cases, and runtime-directory entries.

Enter at least two characters.

Developers

Tool Contract

Tool identity, schemas, authentication, permissions, side effects, egress, timeout, retry, idempotency, approval, compensation, audit, and deprecation.

Audience: Agent developers; platform engineers; security engineers Reading time: 5 minutes Status: Production guidance Last reviewed:

A tool contract defines what a runtime may call, with which authority, under what failure and side-effect semantics, and with what evidence.

Status and scope

Read-only, reversible write, irreversible, financial or high-impact, external communication, code execution, and administrative tools.

Download JSON SchemaOpen examples

Fields

Tool Contract v1
FieldTypeRequiredContract meaning
contractVersionconstantYesSee the schema constraints and examples for this versioned field. Required value: aruntime.tool-contract.v1.
toolIdstringYesSee the schema constraints and examples for this versioned field.
versionstringYesSee the schema constraints and examples for this versioned field.
descriptionstringYesSee the schema constraints and examples for this versioned field.
inputSchemaobjectYesSee the schema constraints and examples for this versioned field.
outputSchemaobjectYesSee the schema constraints and examples for this versioned field.
authenticationRefstringYesSee the schema constraints and examples for this versioned field.
permissionClassenumYesSee the schema constraints and examples for this versioned field. Allowed values: read, reversible-write, irreversible, financial-high-impact, external-communication, code-execution, administrative.
sideEffectClassenumYesSee the schema constraints and examples for this versioned field. Allowed values: none, reversible, compensatable, irreversible.
dataClassificationenumYesSee the schema constraints and examples for this versioned field. Allowed values: public, internal, confidential, restricted.
egressPolicyobjectYesSee the schema constraints and examples for this versioned field.
timeoutMsintegerYesSee the schema constraints and examples for this versioned field.
retryPolicyobjectYesSee the schema constraints and examples for this versioned field.
idempotencyobjectYesSee the schema constraints and examples for this versioned field.
concurrencyobjectYesSee the schema constraints and examples for this versioned field.
approvalTriggersarrayYesSee the schema constraints and examples for this versioned field.
compensationobjectYesSee the schema constraints and examples for this versioned field.
errorTaxonomyarrayYesSee the schema constraints and examples for this versioned field.
rateLimitsobjectYesSee the schema constraints and examples for this versioned field.
observabilityobjectYesSee the schema constraints and examples for this versioned field.
auditFieldsarrayYesSee the schema constraints and examples for this versioned field.
deprecationobjectYesSee the schema constraints and examples for this versioned field.

Versioning and compatibility rules

  • Tool identifiers are stable; incompatible input, output, authorization, or side-effect changes require a new version.
  • Retry policy must align with idempotency. An irreversible tool without deduplication must not be automatically retried after an ambiguous timeout.
  • Permission class and side-effect class are separate: a tool can be authorized for a role while still requiring approval for a specific invocation.
  • Compensation is a new governed action, not proof that the original side effect never occurred.

Validation and error behavior

Validate the complete envelope before model execution or credential resolution. Return a stable machine code, a safe human explanation, the failing JSON Pointer, and the supported contract versions. Never “repair” missing authority or risk fields with model-generated values.

{
  "error": {
    "code": "contract-validation-failed",
    "contractVersion": "aruntime.tool-contract.v1",
    "path": "/idempotencyKey",
    "message": "A stable idempotency key is required.",
    "retryable": false
  }
}

Security, redaction, and minimization

  • Authentication references point to a secret manager or workload identity; contracts never contain secret values.
  • Egress destinations are explicit and default-deny. Tool adapters validate input after planning and before credential resolution.
  • Code-execution tools require a bounded environment, resource limits, network policy, secret isolation, artifact capture, and termination controls.

Validated examples

Read-only customer projection tool

Download this example

{
    "contractVersion": "aruntime.tool-contract.v1",
    "toolId": "customer.read.v3",
    "version": "3.2.0",
    "description": "Reads a bounded customer account projection without modifying the account.",
    "inputSchema": {
        "type": "object",
        "required": [
            "customerRef"
        ],
        "properties": {
            "customerRef": {
                "type": "string"
            }
        },
        "additionalProperties": false
    },
    "outputSchema": {
        "type": "object",
        "required": [
            "customerRef",
            "status"
        ],
        "properties": {
            "customerRef": {
                "type": "string"
            },
            "status": {
                "type": "string"
            }
        },
        "additionalProperties": true
    },
    "authenticationRef": "secretref://customer-api/runtime-reader",
    "permissionClass": "read",
    "sideEffectClass": "none",
    "dataClassification": "confidential",
    "egressPolicy": {
        "allowed": true,
        "destinations": [
            "customer-api.internal"
        ]
    },
    "timeoutMs": 3000,
    "retryPolicy": {
        "maxAttempts": 3,
        "backoff": "exponential-jitter",
        "retryableErrors": [
            "timeout",
            "upstream-unavailable"
        ]
    },
    "idempotency": {
        "supported": true,
        "keyLocation": "header:Idempotency-Key",
        "deduplicationWindowSeconds": 86400
    },
    "concurrency": {
        "mode": "parallel",
        "maxConcurrent": 100
    },
    "approvalTriggers": [],
    "compensation": {
        "supported": false,
        "toolRef": null,
        "deadlineSeconds": null
    },
    "errorTaxonomy": [
        {
            "code": "not-found",
            "retryable": false,
            "meaning": "The customer reference does not exist."
        },
        {
            "code": "upstream-unavailable",
            "retryable": true,
            "meaning": "The authoritative customer service is unavailable."
        }
    ],
    "rateLimits": {
        "requests": 100,
        "perSeconds": 60,
        "scope": "tenant"
    },
    "observability": {
        "requiredSpans": [
            "tool.validate",
            "tool.invoke"
        ],
        "requiredMetrics": [
            "tool.duration",
            "tool.errors"
        ],
        "logPayloads": false
    },
    "auditFields": [
        "requestId",
        "actorRef",
        "tenantRef",
        "toolVersion",
        "outcome"
    ],
    "deprecation": {
        "status": "active",
        "replacementRef": null,
        "sunsetUtc": null
    }
}

Reference implementation

The bundled PHP 8.1 example validates admission fields, selects a constrained model route, checks tool permission and approval requirements, performs an idempotent synthetic operation, creates minimized evidence, handles errors, and prints expected JSON output.

Download the runnable PHP example

php examples/php/runtime_pipeline.php

Maintenance record

Found an error, outdated capability, or unclear category boundary? Submit a correction with a supporting source.