Tool calling

Let your application connect models to useful functions.

Define a tool

Provide a function name, description, and JSON schema in tools. When the model returns a tool call, your application validates its arguments and decides whether to execute it.

JSON
{
  "type": "function",
  "function": {
    "name": "get_project",
    "description": "Read a project by ID",
    "parameters": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        }
      },
      "required": [
        "id"
      ]
    }
  }
}

Complete the loop

  1. Send your messages and tool definitions.
  2. Add the assistant message containing its tool calls to the conversation.
  3. Run approved tools in your application.
  4. Return each result as a tool message with its matching tool_call_id.
  5. Ask the model to continue.

Execution boundaries

The inference API does not execute tools itself. Keep permissions, validation, timeouts, and spending controls in your application. Studio and agent-team interfaces remain previews where explicitly labeled.

Availability depends on your connected provider. Check service status and keep x-request-id with your diagnostics.