AgentContract
Documentation

AgentContract Docs

Install the CLI, authenticate, inspect approved templates, send agreements, wire API calls, receive webhook events, and diagnose the common problems that show up in agent-run contract workflows.

Quickstart

AgentContract is for approved, repeatable contract packets. Agents can read templates, run dry runs, send signing links, and report status. People still review and sign in the browser.

Install and log in

Use the hosted installer for Node.js 20+ machines. The CLI keeps local auth config on the machine that is running the agent.

curl -fsSL https://agentcontract.to/cli/install.sh | bash
agentcontract login --email you@example.com --api-url https://agentcontract.to
agentcontract doctor --json
agentcontract skill

Agent setup prompt

Run agentcontract skill and paste the printed instructions into Codex, Claude Code, or another local agent. The skill tells the agent to preview templates, dry-run sends, and wait for approval before emailing a signer.

agentcontract skill
agentcontract templates --json
agentcontract template read privacy-policy --json

CLI

The CLI is the fastest path for local agents and scripts. It returns JSON for automation, supports dry runs, and exposes agreement lifecycle commands.

Send a packet

Start with a dry run, inspect the JSON, then send only after the human operator approves the recipient, template, and variables.

agentcontract marketplace-onboard --to jane@example.com --name "Jane Contributor" --dry-run --json
agentcontract marketplace-onboard --to jane@example.com --name "Jane Contributor" --json
agentcontract agreement status agr_123 --json
agentcontract agreement download agr_123 --out ./signed.pdf

Command map

  • agentcontract login authenticates with an email code.
  • agentcontract templates lists approved templates.
  • agentcontract template read previews template language before sending.
  • agentcontract marketplace-onboard sends the default onboarding packet.
  • agentcontract update upgrades and verifies the active binary.

Sessions

Sessions let an agent log its contract workflow progress as durable events. Use them when you want feedback and support context tied to a single run.

Lifecycle commands

agentcontract session start --tool codex --repo agentink --json
agentcontract session event --session-id sess_123 --kind progress --message "Read template and prepared dry run" --json
agentcontract session end --session-id sess_123 --status completed --json

What to record

Record template selection, dry-run review, user approval, send result, reminder attempts, and failure details. Keep secrets, raw keys, and private contract text out of session messages.

API

Use the API when the sending workflow lives in your backend instead of a local CLI process. Send approved templates and store the returned agreement id for status polling or webhook correlation.

POST /v1/agreements

POST /v1/agreements
Authorization: Bearer ac_live_...
Content-Type: application/json

{
  "template_id": "privacy-policy",
  "recipient": {
    "email": "jane@example.com",
    "name": "Jane Contributor"
  },
  "variables": {
    "company_name": "Acme"
  },
  "metadata": {
    "source": "agent-workflow"
  }
}

Auth and status

Use dashboard API keys or CLI-managed keys as bearer tokens. Store the agreement id, recipient email, template id, and metadata so later automation can reconcile completion events.

GET /v1/agreements/agr_123
GET /v1/agreements/agr_123/pdf
POST /v1/agreements/agr_123/remind
POST /v1/agreements/agr_123/cancel

Templates

Templates are approved packets with controlled variables. Public previews are available for the standard mutual NDA, one-way NDA, and privacy policy templates.

mutual-ndaTwo-way confidentiality packet for counterparties that exchange confidential information.
one-way-ndaOne-way confidentiality packet for vendors, reviewers, and external collaborators.
privacy-policyWebsite and app privacy policy acknowledgement for controlled onboarding flows.

Webhooks

Webhooks let your app continue once a signer completes, cancels, or stalls on an agreement. Treat webhook handlers as idempotent and fetch agreement status before applying irreversible actions.

Completion event

{
  "type": "agreement.completed",
  "agreement_id": "agr_123",
  "status": "completed",
  "signed_pdf_url": "https://agentcontract.to/v1/agreements/agr_123/pdf",
  "signed_pdf_sha256": "..."
}

Handler checklist

  • Verify the webhook signature before trusting the payload.
  • Deduplicate by event id or agreement id plus status.
  • Fetch the agreement record before unlocking the next workflow step.
  • Store the signed PDF SHA-256 hash with your own record.

Deployment

Production uses Supabase/Postgres-backed storage. Keep secrets in the deployment environment, run migrations with the production database URL, and verify CLI metadata after deploy.

Migrations

DATABASE_URL="postgres://..." npm run migrate -- --status
DATABASE_URL="postgres://..." npm run migrate

Release checks

  • /healthz exposes the current hosted CLI version.
  • /cli/install.sh installs the hosted tarball.
  • /sitemap.xml and /llms.txt list public docs pages only.
  • Private dashboards, signing URLs, auth routes, and /v1/ stay out of crawlable docs.

Troubleshooting

Most user-reported issues land in four places: install/update, login, send routes, or docs drift. Capture feedback from the CLI as soon as the user hits a blocker.

Report feedback

Use agentcontract feedback when a user sees a failed install, stale version, missing command, 404, or confusing response.

agentcontract feedback --area sending --priority high --message "specific-privacy returned HTTP 404"
agentcontract feedback --area install --message "update reports success but active CLI stayed old" --json

Common fixes

  • If update reports success but the version stays old, check which agentcontract binary is first on PATH.
  • If a hosted update fails checksum validation, reinstall from https://agentcontract.to/cli/install.sh.
  • If a send route returns HTTP 404, run agentcontract templates --json and confirm the template id is approved.
  • If docs mention a missing command, run agentcontract update and then agentcontract --version --json.

AgentContract does not let agents draft terms or sign contracts. The safe loop is: read approved template, dry run, show the human, get approval, send, then track the signed record.

Agent guides

Use these practical guides when a local coding agent needs to send approved contracts without becoming the drafter, signer, or silent sender.

Codex

Give Codex a crisp tool contract: inspect templates, dry-run sends, report status, and never email a signer until approval.

Read the Codex contract guide