> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rixxui.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Actions, approval, and idempotency

> Validate generated action requests while keeping authorization, confirmation, execution, and deduplication in the host.

Actions are declarative requests. `defineAction` gives the model a name,
description, risk, approval requirement, and optional input schema.

```tsx theme={null}
import { defineAction } from "@rixx-ui/react";

const removeMember = defineAction<{ memberId: string }>({
  description: "Remove one member from the current workspace.",
  risk: "destructive",
  approval: "strong",
  inputSchema: {
    type: "object",
    additionalProperties: false,
    properties: { memberId: { type: "string", minLength: 1 } },
    required: ["memberId"],
  },
});
```

Risk sets a minimum approval level:

| Risk          | Minimum approval |
| ------------- | ---------------- |
| `read`        | `none`           |
| `write`       | `confirm`        |
| `destructive` | `strong`         |

The renderer validates the registered name and input schema before emitting a
frozen action event. Approval metadata does not mean the user approved anything.

```tsx theme={null}
async function handleAction(event: RUIConfiguredActionEvent<typeof rui>) {
  await requireAuthenticatedUser();
  await authorize(event.name, event.input);
  await showTrustedConfirmation(event.approval, event);

  const idempotencyKey = [event.transactionId, event.nodeId, event.name].join(
    ":",
  );
  await executeOnce(idempotencyKey, event.name, event.input);
}
```

The host must authenticate, authorize against current state, present trusted
confirmation UI, apply rate limits, execute effects, audit outcomes, and persist
idempotency. Never trust the action payload because it passed client-side
validation. Retries and duplicate browser events are possible; Rixx UI does not
maintain a production deduplication ledger.
