Skip to content

TypeScript

Install and configure the client as shown in the Quickstart. The SDK’s authorizeAction() method is the small authorization primitive for any server-side action boundary.

async function createRefund(input: RefundInput) {
const decision = await actera.authorizeAction({
agent: { id: input.agentId },
action: { type: 'refund.create', attributes: input.refund },
context: { customer: input.customer },
idempotencyKey: input.requestId,
})
if (decision.effect === 'BLOCK') throw new Error(decision.explanation || 'Action blocked')
if (decision.effect === 'REQUIRE_APPROVAL') {
return { status: 'pending_approval', decisionId: decision.id }
}
return refundProvider.create(input.refund)
}
  • Call Actera before the side effect, from a trusted server boundary.
  • Reuse the same idempotency key only when retrying the same logical input.
  • Handle all three effects explicitly.
  • Treat authorization infrastructure errors as a separate failure mode.
  • Do not claim exactly-once external execution. The external provider’s idempotency behavior still matters.

For MCP tools, use the adapter in the MCP integration instead of wrapping each call site.