Compute
Covenant Compute for Microsoft Agent Framework.
Add a paid inference tool to your Python agents. Your application controls the wallet and spending limits. Covenant returns the answer with a signed Compute receipt.
An inference tool with application-controlled spending
01
Select
The planner sees the task and tool definition. It can choose Covenant and supply a prompt. The wallet, model and payment limits are fixed by your application.
02
Pay and verify
The client checks the quote and payment identities before signing. It verifies the operator’s signed result and the settled USDC payment before returning a completed answer.
03
Resume
Retain the purchase journal and workflow checkpoints. The same completed request returns its saved result after a restart, without another payment.
An incident report, prepared for review
The example gives an agent a sample checkout incident: errors rose after a deployment and fell after a rollback. The task is to separate observations from hypotheses, identify missing evidence and recommend follow-up.
- Customer payment
- 0.05 USDC
- Restart replay
- No additional payment
- Verified
- 18 Oct 2026 · 19:37 UTC
Returned analysis · sample incident
An incident-review draft with impact, hypotheses, missing evidence and follow-up recommendations.
The unedited draft and planner summary contain timing, arithmetic and causality errors, documented in the review notes. A verified signature does not establish answer correctness.
The model selected the tool before payment. The workflow saved that call, completed the purchase, then replayed the identical result in a fresh process without another signature, gateway request, RPC call or planner call.
This workflow prepares an analysis for a human reviewer. It does not modify infrastructure, contact an on-call engineer or establish a confirmed root cause.
Install and register the tool
Requires Python 3.11 or later, a funded Solana USDC wallet and a persistent purchase journal. Keep your existing planner and configure its spending controls separately. The Covenant adapter registers an official Agent Framework FunctionTool.
curl --fail --location --output covenant_compute_x402-0.1.0-py3-none-any.whl \
https://github.com/open-covenant/covenant/releases/download/codex-compute-x402-python-v0.1.0/covenant_compute_x402-0.1.0-py3-none-any.whl &&
echo "0613775ced5316871b2248fd9942b523cee548e8e53e8222e8db614165023325 covenant_compute_x402-0.1.0-py3-none-any.whl" | shasum -a 256 -c - &&
python -m pip install './covenant_compute_x402-0.1.0-py3-none-any.whl[agent-framework]'import json
from agent_framework import Agent
from covenant_compute_x402.agent_framework import covenant_inference_tool
# Save the request UUID before the first run. Load it again after a restart.
with open("./state/run.json") as file:
request_id = json.load(file)["requestId"]
compute = covenant_inference_tool(
client=client, # Configured wallet, journal and spending limits.
request_id=request_id,
model="claude-haiku-4.5",
max_tokens=2048,
temperature=0.2,
system_prompt="Prepare a draft for review. Do not claim actions were performed.",
)
agent = Agent(
client=planner, # Your application's separately budgeted planner.
instructions="Review the incident and identify evidence still needed.",
tools=[compute],
)
# The model supplies only {"prompt": "..."}.
# Wallet, model, purchase identity and spending limits stay in application code.
result = await agent.run(incident_report)Save one request UUID per logical purchase before dispatch. Reuse the exact prompt, system policy, model and generation settings when resuming. A changed request under the same UUID is refused. Retain the journal even when a payment outcome is uncertain. When switching between Python and TypeScript clients, use the same journal and cumulative ceiling.
from covenant_compute_x402.workflow_demo import run_demo
# Reuse this configuration, state directory and request UUID in every process.
run = dict(
client=client,
state_dir="./state/incident-review",
request_id=request_id,
workflow_id=workflow_id,
model="claude-haiku-4.5",
)
# 1. The planner selects a tool. The workflow checkpoints before payment.
plan = await run_demo("plan", planner=planner, **run)
# 2. A new process resumes the exact saved tool call.
purchase = await run_demo("purchase", **run)
if purchase["purchase"]["status"] != "completed":
# Keep the same state and identity; resume purchase to reconcile it.
raise RuntimeError("Purchase pending; no completed answer yet.")
# 3. Replaying the saved call returns the completed purchase from the journal.
replay = await run_demo("replay", **run)
# 4. Continue with the verified answer. This phase has no paid inference tool.
review = await run_demo("finish", planner=planner, **run)The complete example runs on Linux or macOS and uses Agent Framework’s FileCheckpointStorage and WorkflowBuilder. Store checkpoints in a private directory controlled by your application. A pending purchase remains pending; the workflow cannot finish until it has a verified completed result.
Read the complete workflow example ↗Planner adapter for the complete example
The example accepts a configured official chat client. To use the OpenAI-compatible planner adapter, install the optional demo dependencies. Supply your own credentials and a bounded transport; planner calls are billed separately from Covenant inference.
python -m pip install 'agent-framework-openai==1.17.0'Qualified with Agent Framework Core 1.22.0 and its OpenAI adapter 1.17.0: 71 source tests and 71 installed-wheel tests passed.
Model, price and limits
- Model
- claude-haiku-4.5
- Customer price
- 0.05 USDC per completed request
- Maximum output
- 2,048 tokens
- Input limit
- 4,096 UTF-8 bytes across the JSON messages array
- Payment
- Solana USDC through x402
The receipt binds the operator and job to the exact output. It verifies provenance and integrity; review generated answers before acting on them.
This independent integration uses the open-source Microsoft Agent Framework and registers Covenant as an inference tool in your existing agent.