AI Agent

An agent that stalls mid-loop is a demo, not an agent.

Schema-strict function calling, SSE streams that survive step seven, and one key per agent so cost stays traceable. The loop still runs on your server; DataGo handles model routing, retries, and quotas.

  • Endpointapi.datago.id/v1
  • StreamingSSE per delta
  • Controlone key per agent
The problem

Why agents fail in production

Not because the model is not smart enough. Usually three mundane things: invalid tool arguments, a stream that drops halfway, and costs you only notice when the invoice arrives. All reliability, not IQ.

  • The model invents parameters that are not in the tool schema
  • A dropped stream leaves the UI stuck on "thinking" forever
  • One key shared by every agent means you cannot tell which one overspends
What you get

Three jobs, one endpoint

01

A stable multi-step loop

Function calling against a strict schema: bad arguments are rejected and re-requested instead of silently executed.

02

Real-time tool status

SSE streams deltas per step — tool name, arguments, result — so the UI never needs to poll.

03

Cost per agent, not per account

One key per agent plus step and token ceilings, so one rogue agent cannot drain the others.

Pipeline

One loop iteration

Three steps, executed inside your own infrastructure.

  1. 01

    Define the tools

    Send the JSON schema of tools you already have. The model may only pick from that list, never invent one.

  2. 02

    Execute on your server

    The model returns a tool_call; your code runs the DB query or API call. DataGo never touches your systems.

  3. 03

    Return the result, repeat

    Tool output goes back as role=tool. Step limits and budgets keep the loop under control.

Models

Models that respect tool schemas

Prices come straight from the catalog when the page loads. Estimates use typical tokens for one agent step.

Models that respect tool schemas
Model Role Input / 1M Output / 1M Estimate / request
openai/gpt-6-luna Most schema-compliant and cheapest — default for high-volume agents Rp675 Rp2.250 Rp1,71
glm/glm-5.3-flash Fast for lightweight agents and intent classification Rp1.575 Rp4.500 Rp3,69
qwen/qwen3.8-max Deeper reasoning for complex multi-step planning Rp3.150 Rp9.450 Rp17,96

Estimates use the token counts shown in the header. Prices update automatically whenever the catalog changes.

Browse all agent models
Code

A tool call, end to end

Two-step pattern: send the tool list, execute the tool_call, then send the result back.

agent.py
import json, os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.datago.id/v1",
    api_key=os.environ["DATAGO_API_KEY"],
)

tools = [{
    "type": "function",
    "function": {
        "name": "get_order_status",
        "description": "Look up an order status by order id",
        "parameters": {
            "type": "object",
            "properties": {"order_id": {"type": "string"}},
            "required": ["order_id"],
        },
    },
}]

r = client.chat.completions.create(
    model="openai/gpt-6-luna",
    messages=[{"role": "user", "content": "Has order INV-2041 shipped?"}],
    tools=tools,
    tool_choice="auto",
)

call = r.choices[0].message.tool_calls[0]
print(call.function.name, json.loads(call.function.arguments))

→ Always cap iterations: a step counter plus max_tokens. An uncapped loop is the fastest way to burn balance.

Fit check

Good fit when

  • Agents with 3–15 tools whose schemas are clear
  • You need per-step status in the UI, live
  • Several distinct agents whose costs need separating

Not for

  • Browser automation or RPA — that needs a runtime driving pages, not an LLM API
  • Hours-long autonomous jobs with no step limit: that is an architecture problem, not a model choice

Agent questions

01 Why does a tool_call sometimes contain invalid arguments?

Usually the schema is too loose or the description is vague. Tighten required and enum, then validate server-side before executing — if it fails, send the error back and ask the model to retry.

02 How do I show tool status to the user?

Stream it. Each delta carries a slice of the tool call, so the UI can show the tool name when it starts and the result when it finishes, with no polling.

03 Can it run several tools at once?

Yes. The model can return multiple tool_calls in one response; run them in parallel and send every result back in a single role=tool message.

04 How do I cap cost per agent?

Create a separate API key per agent in the dashboard and set step/token ceilings in your app. Per-key usage tells you which agent is expensive.

Build your first agent

One key, one endpoint, tool calling docs already written. Start with one tool, not ten.