Agent engine

Overview

A real agent loop, running inside your process. The server serves one thing — a model turn — and every tool executes where your code is.

runtime: "local"36 toolsthe loop is yours
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

api.agents.create({ runtime: "local" }) does not start anything remote. It builds an object that, when you call run(), asks the model what to do, performs the tools itself, feeds the results back, and repeats until the model stops asking. That loop is the product.

What follows from running it here

Because the loop is localYou get
Tools execute in your processAn agent reads the disk it is on. Nothing is uploaded to be looked at.
Permission is a callbackYour code decides, per call, with the arguments in hand.
Credits are counted as they goA budget can stop the run before the next call, not after the bill.
The history is yoursYou can read it, cut it, summarise it, or throw it away.
Only the turn is remoteThe one thing a server has to do is the only thing it does.

The smallest agent that works

import { IaGenify } from "iagenify";

const api = new IaGenify({ apiKey: process.env.IAGENIFY_API_KEY });
const pc = await api.storage.get();

const agent = api.agents.create({
  runtime: "local",
  machine: pc,
  model: "gemini-3.5-flash",
  mode: "ask",
  onPermission: async ({ tool, category, args }) => {
    console.log("asking for", tool, category, args);
    return "once";                       // "once" | "always" | "deny"
  },
});

const result = await agent.run({
  inputs: "Read every markdown file in Notes and tell me what is unfinished.",
  onEvent: (event) => {
    if (event.type === "text") process.stdout.write(event.text);
  },
});

console.log(result.stopReason, result.usage);
import os, sys
from iagenify import IaGenify

api = IaGenify(api_key=os.environ["IAGENIFY_API_KEY"])
pc = api.storage.get()

def on_permission(request):
    print("asking for", request["tool"], request["category"], request["args"])
    return "once"                         # "once" | "always" | "deny"

agent = api.agents.create(
    runtime="local",
    machine=pc,
    model="gemini-3.5-flash",
    mode="ask",
    on_permission=on_permission,
)

def on_event(event):
    if event["type"] == "text":
        sys.stdout.write(event["text"])

result = agent.run(
    inputs="Read every markdown file in Notes and tell me what is unfinished.",
    on_event=on_event,
)

print(result["stopReason"], result["usage"])

The pieces, and where each is documented

PieceDecidesPage
machineWhere the tools run — a computer, a phone, a cloud workspace.Options · machine
modeWhat is allowed without asking.Modes
onPermissionWhat happens when something must be asked.Permissions
toolsWhich of the 35 the model is told about.Agent tools
budget · maxStepsWhen the loop gives up.Budget
memoryWhether the conversation survives the process.Sessions
onEventWhat you see while it works.Events

There is a second, older agent

Without runtime, create() builds the server-side agent: the loop runs on the platform, the tools are the platform's, and your code receives steps. It is what a workflow step uses, because a workflow has no process of yours to run in.

Prefer the local engine when you have a process

It has the larger tool set, the permission callback, checkpoints, skills and subagents. The server-side one exists for the case where nothing of yours is running.

What a run costs

One model turn per step, billed like any turn, plus whatever the paid tools spend — a search, a page capture, a generated image. usage carries the total, and every turn event carries the running count.

result.usage;    // { credits: 31, turns: 6, toolCalls: 9 }
result["usage"]   # {"credits": 31, "turns": 6, "toolCalls": 9}