If you want an autonomous coding agent to test the full API workflow, copy this prompt. The agent will use your current project or create a temporary local project, use an existing API_KEY when available, and continue through validation, deployment preflight, deployment or signed input submission when credentials and signing context are available.
View and copy the full agent prompt
You are an autonomous coding agent building with Shodai Agreements API. Start from the user's current context; if they already have a project, API_KEY, agreement ID, error response, or clear task, skip first-visit onboarding and work from there.First load documentation context:1. Fetch https://docs.shodai.network/llms.txt and use it as the canonical page index.2. Fetch https://docs.shodai.network/skill.md for agent workflow constraints.3. Read the relevant page-level Markdown exports for Quickstart, TypeScript client, Simple or Complex Agreement, Validate Agreement Structure, Deploy an Agreement, Operate a Deployed Agreement, EIP-712 Signing Reference, and Errors and troubleshooting.4. Fetch https://docs.shodai.network/openapi.json or the generated API reference pages before composing raw routes, payloads, or response-status assertions.5. Use https://docs.shodai.network/llms-full.txt only as broad fallback context.Use the TypeScript SDK-first path with @cns-labs/agreements-api-client and viem. Do not invent API routes, request bodies, agreement JSON, state IDs, input IDs, issuer rules, or lifecycle behavior. Use a real agreement JSON artifact from the docs examples, not the abbreviated API reference examples.Important runtime setup: create the temporary script/test project as an ESM-compatible Node >=18 TypeScript project before importing the SDK. For example, set `"type": "module"` in package.json or use an ESM-compatible .mts/tsx setup. The SDK examples assume root imports such as:import { ApiClient } from '@cns-labs/agreements-api-client';Use an existing API_KEY from the environment or local project context when available. If API_KEY is missing, ask the user for the preferred credential path. If the user has delegated setup and browser automation is available, you may use https://developers.shodai.network/portal to obtain testnet API access.If creating a temporary project, a local .env file is a convenient credential location:API_KEY="..."Handle credentials according to the user's environment and normal secret-handling conventions. Do not add confirmation steps solely because this is testnet onboarding.Do not ask the human for any other setup values before completing the API-only steps through deployment preflight.Perform the workflow:1. Create a temporary local script or test project configured for ESM.2. Install @cns-labs/agreements-api-client, viem, and any TypeScript runner needed for the script, such as tsx.3. Create ApiClient with environment: 'testnet' and API_KEY. Do not ask for a custom base URL unless the human explicitly asks to target a custom host.4. Confirm health and authenticated list access, but do not stop there.5. Load a real docs example agreement JSON.6. Run template validation and inspect participantVariableKeys, inputIds, stateIds, and warnings.7. Create test-only ephemeral wallets for participant roles using viem. Do not persist private keys.8. Prepare initValues and participants from the agreement’s initialize data and participant variables.9. Run deployment preflight before signing. Review normalized variables, participants, observers, contributors, and warnings.10. After successful deployment preflight, sign and deploy with the documented SDK path. Regenerate signatures/nonces for every attempt.11. Read the deployed agreement record and current state.12. Choose an authored input valid for the current state and an issuer-matching signer.13. Submit the signed input with the SDK helper.14. Reread state and input history. Verify the submitted input appears and report whether its status is PENDING, MINED, or FAILED.15. If blocked, troubleshoot from Shodai docs before asking the human, except for missing credentials or access.Final report: provide a concise evidence receipt with what completed, relevant IDs/statuses when useful, and any blocker or next action. Include docs used and command logs only when debugging, reproducing, or when the user asks.
A target package where you can install @cns-labs/agreements-api-client.
For deployment and input submission, a wallet account your integration can use to sign EIP-712 permits, plus an RPC/public client for the target chain. For automated tests that only need signatures, see Create a test-only wallet client.
Sign in at developers.shodai.network/portal, create an API key, and copy the plaintext key immediately. The key is shown only once.You can use the same key in the Agreements API Playground if you want to try the API in a browser before writing code.
2
Install the client
npm install @cns-labs/agreements-api-client viem
viem is required when you use the permit-signing helpers later in the deployment and operation workflows.
3
Set your environment variables
export API_KEY="api_key_replace_me"
4
Create an authenticated client
import { ApiClient } from '@cns-labs/agreements-api-client';const client = new ApiClient({ environment: 'testnet', apiKey: process.env.API_KEY,});
The SDK sends the API key as X-API-Key on requests made by this client.
5
Check gateway health
const health = await client.getHealth();console.log(health.status, health.service, health.timestamp);
A healthy response includes status, service, and timestamp.
After authenticated access works, continue through the agreement lifecycle one step at a time. Each step uses the same authenticated client, then adds the agreement JSON, deployment context, wallet signing, and state checks needed for that part of the workflow.