# Typed actions in the SDK

> defineAction infers input and output types from your schema, end to end.

- URL: https://devtool-changelog-example.notra.site/changelog/2026-09-02
- Published: 2026-09-02
- Version: v2.5.0
- Tags: Feature

`defineAction` takes a Zod or Valibot schema and infers the input type in the UI and the handler. No more hand-written types that drift.

**npm**

```bash
npm install @forgekit/sdk@2.5.0
```

**bun**

```bash
bun add @forgekit/sdk@2.5.0
```

**pnpm**

```bash
pnpm add @forgekit/sdk@2.5.0
```

```typescript
import { defineAction } from "@forgekit/sdk";
import { z } from "zod";

export const refundOrder = defineAction({
  input: z.object({ orderId: z.string(), amountCents: z.number().int() }),
  async run({ input, db }) {
    return db.refunds.create({ data: input });
  },
});
```

- Inputs are validated on the server before `run` is called
- Validation errors show next to the matching form field
