Un agente locale
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),
});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"]),
)- Cenès esige
runtimestring"local" per il motor in vostro processo. Absente costruisce il agente lateral al server.
machineConnectedStorageobrigatórioUn computer, un telefono, o un nube workspace. Ved machine.
modelstringobrigatórioA meno che non passi id, in quel caso viene da sessione.
Ogni opzion
| Option | Predeterminato | Pagina |
|---|---|---|
machine · workspace | — | machine |
model · fallbackModels · thinking · maxOutputTokens | — · [] · nul · 16 000 | modèle e rating |
tools · skills · subagents · mcp · agent | tutto · tutto · tutto · tutto · tutto · null | outils e biblioteca |
mode · onPermission · onQuestion · system | "ask" · — · — — · "" | modo e permissions |
budget · maxSteps · contextTokens | Null · 100 · 200 000 | budget e contexto |
media | {} | media |
memory · id · memories · checkpoints | false · — · vero · vero | memoria e sessioni |
files · shell · terminals · customTools | — | bridges |
Cenès che è negat, e quando
| 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.