Back to news
ReleaseGemini10 min read

Build a deep research agent with Gemini 4 Argon.

Let Argon search the web, read the sources it finds and write a cited research memo — within a credit budget, with a JSON summary your app can use.

geminiargonresearchagentssdktutorial

Research questions rarely have one source. Which European capitals changed their short-term rental rules this year, and how? That takes a search, a dozen pages read carefully, contradictions noticed and a summary that says where each fact came from. It is the kind of long, careful work Gemini 4 Argon is made for; this tutorial wires it into a local agent with web search, page reading and a file to write.

Create the research agent

The agent gets the tools it needs and no more: search to find sources, fetch to read them, write to save the memo and todo_write to plan. Searches and page reads cost credits, so the run has a budget and a step limit.

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-4-argon",
  tools: ["search", "fetch", "write", "todo_write"],
  mode: "auto",
  budget: 150,
  maxSteps: 40,
  system: "You are a careful researcher. Every factual sentence in your memo cites the URL you read it on. Say when sources disagree.",
});

const result = await agent.run({
  message: "Research which European capitals changed their short-term rental rules in 2026. Read at least eight official or primary sources. Write the memo to Research/rentals-2026.md with a sources section.",
});
console.log(result.usage.credits, result.stopReason);

Turn the memo into data

The memo is for people. For an app, a second call with a schema extracts the findings as JSON, one entry per city, with the source each one relies on.

const memo = await pc.files.read("Research/rentals-2026.md");

const extractor = await api.models.create({
  model: "gemini-4-argon",
  memory: false,
  schema: {
    type: "object",
    properties: {
      cities: {
        type: "array",
        items: {
          type: "object",
          properties: {
            city: { type: "string" },
            change: { type: "string", description: "What changed, in one sentence" },
            effective: { type: "string", description: "ISO 8601 date, or empty if unknown" },
            source: { type: "string", description: "The URL this finding relies on" },
          },
          required: ["city", "change", "source"],
        },
      },
    },
    required: ["cities"],
  },
});

const { outputs } = await extractor.generate({ inputs: [{ type: "text", content: memo.content }] });
console.log(outputs[0].content.cities);

Check before you publish

A cited memo is easier to verify, not verified. Open the sources behind the findings you rely on, and keep a person responsible for the conclusion.

References

Frequently asked questions

Why an agent instead of one long prompt?

Because the sources are not known in advance: the agent searches, reads what it finds and decides what to read next.

How much can a run spend?

No more than its budget — 150 credits in this example. The run stops before going past it and says so in stopReason.

Back to news