Agent tools

generate

generate({ prompt, model?, schema?, instructions? })

Ask a second, cheaper model one question without carrying the material through the conversation. For volume: classify two hundred rows, extract a field from fifty pages.

category: writecosts like any model callschema for JSON
Using Python?

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

promptstringrequired

The whole question, material included.

modelstring

A fast cheap one by default.

schemastring

The shape of the answer, as JSON text. Gets an object back instead of prose.

instructionsstring

A system instruction for it.

Why it exists

The material never enters the agent's own context

Fifty pages read into the conversation are paid for on every later turn. Sent to a second model, they are paid for once — and the agent gets back only the answer.

It is for volume

  • Classify two hundred rows: one call each.
  • Extract one field from fifty pages.
  • Summarise twenty documents.

The instruction is explicit the other way too: never use it for something answerable in a sentence. A second model call to do what the agent can already do is pure cost.

Structured answers

generate({
  prompt: "Classify this support message: …",
  schema: '{"type":"object","properties":{"sentiment":{"type":"string"},"urgent":{"type":"boolean"}}}',
})
# The call the model makes:
generate = {
    "prompt": "Classify this support message: …",
    "schema": '{"type":"object","properties":{"sentiment":{"type":"string"},"urgent":{"type":"boolean"}}}',
}

It is billed

Like any model call, and it counts against the run's budget. Its category is write, so it is asked in ask mode and free in auto.