# create()

Canonical URL: https://developers.iagenify.com/pt/sdk/ref/agents/create/
Language: pt

`api.agents.create(options) → LocalAgent | Agent`

Costruisce un agente a partir de ses opcions.Tutto è validato qui, nada è enviado — l'oggetto è pronto e il conto non sa nada al riguardo.

Status: no request · strict validation · returns an object

## Un agente locale {#local}

```javascript
const agent = api.agents.create({
  runtime: "local",
  machine: pc,                      // required
  model: "gemini-3.5-flash",        // required
  mode: "ask",
  tools: ["read", "list", "glob", "grep", "write", "edit", "bash"],
  budget: 200,
  memory: true,
  onPermission: async ({ tool, category, args }) => "once",
  onQuestion: async ({ question }) => answer(question),
});
```

## - Cenès esige {#required}

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `runtime` | string |  | `"local"` per il motor in vostro processo. Absente costruisce il [agente lateral al server](/pt/sdk/ref/agent). |
| `machine` | ConnectedStorage | obrigatório | Un computer, un telefono, o un nube workspace. Ved [machine](/pt/sdk/ref/agents/options/machine). |
| `model` | string | obrigatório | A meno che non passi `id`, in quel caso viene da sessione. |

## Ogni opzion {#all}

| Option | Predeterminato | Pagina |
| --- | --- | --- |
| `machine` · `workspace` | — | [machine](/pt/sdk/ref/agents/options/machine) |
| `model` · `fallbackModels` · `thinking` · `maxOutputTokens` | — · [] · nul · 16 000 | [modèle e rating](/pt/sdk/ref/agents/options/model) |
| `tools` · `skills` · `subagents` · `mcp` · `agent` | tutto · tutto · tutto · tutto · tutto · null | [outils e biblioteca](/pt/sdk/ref/agents/options/tools) |
| `mode` · `onPermission` · `onQuestion` · `system` | `"ask"` · — · — — · "" | [modo e permissions](/pt/sdk/ref/agents/options/mode) |
| `budget` · `maxSteps` · `contextTokens` | Null · 100 · 200 000 | [budget e contexto](/pt/sdk/ref/agents/options/budget) |
| `media` | {} | [media](/pt/sdk/ref/agents/options/media) |
| `memory` · `id` · `memories` · `checkpoints` | false · — · vero · vero | [memoria e sessioni](/pt/sdk/ref/agents/options/memory) |
| `files` · `shell` · `terminals` · `customTools` | — | [bridges](/pt/sdk/ref/agents/options/bridges) |

## Cenès che è negat, e quando {#refusals}

| Código | Quando |
| --- | --- |
| machine_required | No `machine`, o uno che non è un computer, un telefono o un nublat de workspace. |
| files_required | Un telefono o un nube workspace senza le sei operazion de file. Il messaggio nomies os faltant. |
| model_required | No `model` e no `id`. |
| invalid_mode | Un modo fuori dels quattro. |
| unknown_tool | Un nome d'utensiliu che il motor non sa. Il messaggio listasquequele che fa. |
| invalid_context | `contextTokens` che non è un numero intero di almeno 10 000. |
| invalid_shell | A `shell` senza una funzione `run`. |
| invalid_custom_tool | Un utensiliu personalizzato senza descripzion, no `run`, un nome reservat, o una categoria al di fuori del quattro. |
| invalid_media | A `media` chiave che non è `image`, `video`, `voice` o `music`. |
| invalid_agent | Un nome `agent` che non è un nome di biblioteca. |
| invalid_session_id | Un `id` che non è un identificator di sessione. |
| workspace_not_allowed | A `workspace` a part del dossier SDK. |

> **Tutti geta a creazion, non in tempo di run**
>
> Un agente mal configurat deve fail in linea che lo configura. La una excepzion i contextTokens is beaver than the winest of the model's, which need the cataloga et donc superes on the first run.

- [get()](/pt/sdk/ref/agents/get): Reaprendo in lugar de crear.
- [Agente locale](/pt/sdk/ref/local-agent): Ogni propriet e metodo.
- [Mecanismo de agentes](/pt/sdk/agent): Come funciona la loop.

```python
agent = api.agents.create(
    runtime="local",
    machine=pc,                       # required
    model="gemini-3.5-flash",         # required
    mode="ask",
    tools=["read", "list", "glob", "grep", "write", "edit", "bash"],
    budget=200,
    memory=True,
    on_permission=lambda request: "once",
    on_question=lambda request: answer(request["question"]),
)
```
