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 local | You get |
|---|---|
| Tools execute in your process | An agent reads the disk it is on. Nothing is uploaded to be looked at. |
| Permission is a callback | Your code decides, per call, with the arguments in hand. |
| Credits are counted as they go | A budget can stop the run before the next call, not after the bill. |
| The history is yours | You can read it, cut it, summarise it, or throw it away. |
| Only the turn is remote | The 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
| Piece | Decides | Page |
|---|---|---|
machine | Where the tools run — a computer, a phone, a cloud workspace. | Options · machine |
mode | What is allowed without asking. | Modes |
onPermission | What happens when something must be asked. | Permissions |
tools | Which of the 35 the model is told about. | Agent tools |
budget · maxSteps | When the loop gives up. | Budget |
memory | Whether the conversation survives the process. | Sessions |
onEvent | What 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.
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}