Introducing the Indent API

8 months ago
Written by
Fouad Matin
@fouadmatin
Dan Gillespie
@ethernetdan

Today we’re introducing the Indent API – the easiest way to add human approvals to any software.

With it, you can secure your applications, internal tools, and AI agents with a general-purpose interface for requesting human review. Reduce the risk of your most dangerous code paths by defining policy checkpoints that can either be automated or require human approval.

import { approval } from '@indent/approvals'
async function resetPassword({ actor, user, reason }) {
await approval(
{
reason,
petitioners: [{ kind: 'staff', email: actor.email }],
resources: [
{
kind: 'action',
id: `reset-password:${user.id}`,
displayName: `Reset Password - ${user.name}`,
altIds: [user.id],
},
],
},
{ retries: 10, wait: 1000 }
) // wait for max 10 seconds
// continue
}

Join private beta

Explore API docs

Who is Indent API for?

Developers who need to secure potentially dangerous API operations like:

  • Sensitive actions like deleting a project
  • AI agents that need human review for edge cases
  • Low-code internal tools (Retool, Zapier, etc) that need human review

With Indent, we've built a system that lets you define approval checkpoints that can either be automated or require human approval.

It provides a general-purpose interface for requesting human review, and we're making it available to developers to use in their code.

How it works

  1. Install the Indent SDK. We have SDKs for JavaScript, Python, and Go. You can also use our REST API directly.
npm install @indent/approvals
pip install approvals
  1. Request approval. When you want to request approval, call the approval function in the SDK. You can specify the reason for the request, the people who need to approve it, and the resources that are being accessed. Requests can also be auto-approved based on a set of policy conditions.

  2. Wait for approval. The approval async function will wait for the request to be approved. You can specify how long to wait, how many times to retry, or if you want it to be resumable.

  3. Continue. Once the request is granted, the approval promise will resolve. You can continue with the rest of your code.

How to use it

You can use await approval in your code anywhere that you need approvals. The API will check if the request can be auto-approved or if it requires human review, then Indent handles all the notificatoin, time-bounded state management, retry, and other distributed systems logic.

Here's an example for LangChain using callbacks to require approval before running shell commands:

from approvals.using.langchain import HumanApprovalCallbackHandler
from langchain.tools import ShellTool
tool = ShellTool(callbacks=[HumanApprovalCallbackHandler()])
print(tool.run("ls /usr"))
$ python tool.py
✳︎ Requesting approval for: ls /usr
Requested approval
Waiting for approval... (2s elapsed)
Waiting for approval... (4s elapsed)
Waiting for approval... (8s elapsed)
Granted
X11
X11R6
bin
lib
libexec
sbin
share
standalone

Roadmap

We’ve designed the API to be both simple for anyone to use but also flexible enough to give engineers what they need to secure their products and tools.

Every part of Indent is designed and built with engineers in mind. You can now request access in order to integrate approvals into your product, internal tools, or AI agents.

Here’s a preview of what’s next:

  • Ready-to-go examples for frameworks and integrations
  • Drop-in UI components for approvals in your apps
  • Terraform provider to manage Indent resources
  • Multiparty policy engine for inline authorization checks

Interested in exploring the API? Join our private beta. Private beta starting November 2023. Open beta in December 2023.

Try Indent for free.