Skip to content
intermediate20 min7 steps

Getting Started with Cinchor Proof: Verifying Autonomous Agent Actions

Learn how to integrate Cinchor Proof into your AI agent workflow to generate cryptographically verifiable evidence of business operations, ensuring trust and accountability in autonomous systems.

By AI Indigo Team

1

Understand the Core Concept: Cryptographic Proofs

Before diving into the code, it is crucial to understand what Cinchor Proof actually delivers. In the era of autonomous AI agents, standard logging is insufficient because logs can be tampered with or generated post-hoc. Cinchor Proof provides a cryptographically signed artifact that proves an action occurred at a specific time, by a specific agent, with specific inputs and outputs. This 'proof' is immutable and verifiable by any third party without needing to trust the AI provider itself. Think of it as a digital notary stamp for every transaction an AI agent performs. This step involves reviewing the documentation at the provided URL to understand the data structure of the proof object, which typically includes a timestamp, agent ID, action hash, and a digital signature. Familiarizing yourself with these fields will help you interpret the responses you receive later in this tutorial.

Pro Tip

Review the 'Trust Model' section in the Cinchor documentation to understand how the root of trust is established for your specific deployment environment.

2

Set Up Your Development Environment

To interact with the Cinchor Proof API, you will need a basic development environment. Since the example endpoint provided (`https://api.cinchor.com/proof/refund`) is an HTTP API, you can use any language with an HTTP client. For this tutorial, we will use Python with the `requests` library, but the logic applies equally to JavaScript, Go, or Java. First, ensure you have Python 3.8+ installed. Then, install the requests library by running `pip install requests` in your terminal. You will also need an API key from Cinchor. Visit the developer portal (linked in the main documentation) to register your application and generate a secret key. Store this key securely in an environment variable (e.g., `CINCHOR_API_KEY`) to avoid hardcoding it into your source files. This setup ensures you have the necessary tools to send requests and receive verified responses from the platform.

Pro Tip

Never commit your API keys to version control. Use a `.env` file and a library like `python-dotenv` to load secrets securely during development.

3

Generate a Proof for a Refund Action

Now, let's create a script to generate a proof for a specific action: processing a customer refund. This is a high-stakes operation where accountability is critical. Create a new file named `generate_proof.py`. In this script, you will send a POST request to the `/proof/refund` endpoint. The request body must include the details of the action: the `transaction_id`, the `amount`, the `customer_id`, and the `agent_id` executing the refund. Cinchor's system will hash these inputs and sign them with its private key. Below is the Python code snippet to do this. We use `os.environ` to fetch the API key and construct the JSON payload. The response from the API will contain the `proof_object`, which is the core artifact you need to store alongside your business records.

Pro Tip

Ensure the `agent_id` matches the unique identifier of the AI agent performing the action. Mismatched IDs will invalidate the proof's attribution.

4

Implement the API Call in Python

Here is the practical implementation of the API call discussed in the previous step. Copy this code into your `generate_proof.py` file. This script demonstrates how to securely format the request and handle the response. We define the endpoint URL and a payload dictionary containing mock data for a refund transaction. The `Authorization` header uses the Bearer token scheme with your API key. Upon execution, the script prints the JSON response. You should see a `status` of 'success' and a `proof` object containing fields like `signature`, `timestamp`, and `data_hash`. This `proof` object is what you will save to your database. It serves as the immutable evidence that the refund was processed by the specified agent at that exact time. Remember to replace the mock `transaction_id` with real data from your system when integrating this into your production workflow.

Pro Tip

Add error handling (try/except blocks) to manage potential network failures or invalid API keys gracefully in production environments.

5

Verify the Proof Independently

Generating the proof is only half the battle; the true value lies in verification. In a trustless environment, a third party (such as an auditor or a customer) should be able to verify the proof without trusting Cinchor's infrastructure entirely. Cinchor provides a public verification endpoint or a client-side library to validate the signature. For this tutorial, we will use the verification endpoint. Create a new script `verify_proof.py`. This script takes the `proof` object returned from the previous step and sends it to the verify endpoint. The verification process checks the cryptographic signature against Cinchor's public key. If the signature is valid and the data hasn't been tampered with, the API returns a `valid: true` response. This step is crucial for demonstrating to stakeholders that the AI agent's actions are auditable and trustworthy. Include this verification logic in your audit trails or customer-facing dispute resolution flows.

Pro Tip

Caching the public verification key locally can improve performance, but ensure you have a mechanism to update it if Cinchor rotates keys.

6

Handle Edge Cases and Error Responses

In production, not every request will succeed. You need to handle cases where the input data is malformed, the API key is invalid, or the service is temporarily unavailable. Cinchor's API returns standard HTTP status codes. A `400 Bad Request` usually indicates a problem with your payload structure (e.g., missing `amount` or invalid `customer_id` format). A `401 Unauthorized` means your API key is incorrect or expired. A `500 Internal Server Error` suggests a problem on Cinchor's side. In your `generate_proof.py` script, add logic to check the `response.status_code`. If it's not `200`, print the `response.json()` for debugging. For example, if you forget to include the `agent_id`, the API will reject the request. Handling these errors gracefully ensures your AI agents can retry operations or log failures appropriately without crashing the entire business process. Robust error handling is essential for maintaining the integrity of your audit trail.

Pro Tip

Always log the request payload (excluding sensitive PII) and the error response for debugging issues with Cinchor support if needed.

7

Integrate into Your AI Agent Workflow

The final step is integrating this verification layer into your actual AI agent's decision loop. Whenever your agent decides to perform a critical action (like a refund, a large transfer, or a contract modification), it should call the Cinchor Proof API immediately after the action is executed. Store the returned `proof` object in your database alongside the transaction record. This transforms your simple database entry into a cryptographically verifiable fact. For example, if a customer disputes a refund, you can present them with the proof object. They can use a public verifier to confirm that the refund was indeed processed by your agent at the stated time. This integration creates a 'trust layer' over your existing application logic with minimal overhead. By following these steps, you have successfully implemented a system that provides undeniable accountability for your autonomous AI agents, meeting the rigorous standards of the AI-first world.

Pro Tip

Consider implementing a batch verification process for high-volume agents to reduce API latency and costs, if supported by the Cinchor SDK.

🔥Stay ahead of the AI curve

Never Miss a Breakthrough AI Tool

Get the hottest AI tools, exclusive tutorials, and insider tips delivered to your inbox every Friday. Free forever.

🔒 No spam, unsubscribe anytime. We respect your inbox.

0+
AI Tools
0+
Free Tools
Weekly
Updates