# create

URL: /business/nouns/function/create · Id: `verb:Function.create` · Call: `await $.Function.create({ … })` (SDK) or the `do` tool at `https://api.sb/mcp`. Inputs says what to pass, Outputs what returns, When it waits who approves.

> Creates a Function.

Create makes a new [Function](/business/nouns/function) from the inputs below. It is inherited: every [Noun](/business/nouns/noun) has `get`, `list`, `create`, `update` and `delete`.

## Inputs
| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `string` | Yes | One of `code`, `generative`, `agentic`, or `human`. |
| `cascade` | `string[]` | No | Kinds tried in order when one declines, such as code, then a Human. |
| `instructions` | `text` | No | For a generative or agentic Function, what it does and how. |
| `model` | `string` | No | For a generative or agentic Function, the model it runs on. |
| `tools` | list of [Verb](/business/nouns/verb) | No | For an agentic Function, the Verbs it may call; Permissions and Limits apply to each. |
| `maxSteps` | `integer` | No | For an agentic Function, the most steps one Action may take. |
| `budget` | `money` | No | The most one Action may spend; the Mandate’s Limits apply as well. |
| `role` | [Role](/business/nouns/role) | No | For a human Function, the Role its Tasks go to. |
| `form` | `json` | No | For a human Function, the form; generated from the Verb’s inputs and outputs when absent. |
| `sla` | `string` | No | For a human Function, how long a Task may wait, as an ISO 8601 duration. |
| `escalateTo` | [Role](/business/nouns/role) | No | For a human Function, the Role a Task moves to when the service level passes. |

## Outputs
| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `function` | [Function](/business/nouns/function) | Yes | The Function. |

## Effects
- Emits `Function.created`.
- Two-way: `try`, `send`, `do`.

## Refuses when
| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | [Function.create](/business/nouns/function/create) |

## When it waits
| Gate | Default |
| --- | --- |
| Decision class | Low: two-way, nothing at stake |
| [Delay window](/systems/trust-and-governance/controls/one-way-windows) | None: it runs once review passes. |
| Limit | The call [Limit](/business/nouns/limit) of the [Permission](/business/nouns/permission) it runs under. |
| Over the Limit | It waits `pending` for an [Approval](/business/nouns/approval) from the [Founder](/agents/founding/founder). Approved, it runs; refused, it ends `refused` with [`limit-exceeded`](/code/api/errors/limit-exceeded); unanswered by its deadline, it ends `canceled`. |

## Example

**Ask**

```text
Add a function to PetPantry.
```

**API**

```bash
curl -X POST https://api.sb/petpantry.shop/functions \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"kind":"code"}'
```

```json
{
  "api": "https://api.sb/petpantry.shop",
  "function": {
    "$id": "https://api.sb/petpantry.shop/functions/function_1",
    "$type": "Function",
    "kind": "code"
  },
  "action": {
    "$id": "https://api.sb/petpantry.shop/actions/action_1",
    "operation": "Function.create",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/petpantry.shop/actions/action_1"
  }
}
```

**SDK**

```ts
import { $ } from 'startup-builder'

const result = await $.Function.create({ kind: 'code' })
```

**CLI**

```bash
npx startup-builder do Function.create --json '{"kind":"code"}'
```

**MCP**

```json
{
  "name": "do",
  "arguments": {
    "code": "return await $.Function.create({ kind: 'code' })"
  }
}
```