Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation

List agents

client.Beta.Agents.List(ctx, query) (*CursorPage[Agent], error)
GET/agents

Lists reusable agents in the current project. See agent configuration.

ParametersExpand Collapse
query BetaAgentListParams
After param.Field[string]Optional

Return resources after this resource ID in the selected order.

minLength0
maxLength1048576
Limit param.Field[int64]Optional

The maximum number of resources to return.

formatint64
minimum1
Order param.Field[BetaAgentListParamsOrder]Optional

The order in which resources are returned. Defaults to desc.

ReturnsExpand Collapse
type Agent struct{…}

A reusable agent scoped to the caller’s project.

ID string

The ID of the reusable agent.

minLength0
CreatedAt int64

The Unix timestamp, in seconds, when the agent was created.

formatint64
Instructions string

Custom instructions appended to the agent’s default base instructions.

minLength0
Metadata map[string, string]

Custom string key-value pairs attached to the agent.

Model string

The requested model name used for inference.

minLength0
MultiAgent MultiAgentConfig

The resolved configuration for creating and coordinating subagents.

Name string

A human-readable name for the agent, or null if it is unnamed.

minLength0
Object Agent

The object type. Always agent.

Reasoning AgentReasoning

The resolved reasoning configuration, including the model default for an omitted effort.

ServiceTier AgentServiceTier

The resolved service-tier policy used for model requests.

The resolved configuration for text generated by the agent.

Tools available to the agent.

UpdatedAt int64

The Unix timestamp, in seconds, when the agent was last updated.

formatint64

List agents

package main

import (
  "context"
  "fmt"

  "github.com/openai/openai-go"
  "github.com/openai/openai-go/option"
)

func main() {
  client := openai.NewClient(
    option.WithAPIKey("My API Key"),
  )
  page, err := client.Beta.Agents.List(context.TODO(), openai.BetaAgentListParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "data": [
    {
      "id": "id",
      "created_at": 0,
      "instructions": "instructions",
      "metadata": {
        "foo": "string"
      },
      "model": "model",
      "multi_agent": {
        "enabled": true,
        "max_concurrent_subagents": 1
      },
      "name": "name",
      "object": "agent",
      "reasoning": {
        "effort": "none",
        "summary": "concise"
      },
      "service_tier": "auto",
      "text": {
        "format": {
          "type": "text"
        },
        "verbosity": "low"
      },
      "tools": [
        {
          "defer_loading": true,
          "description": "description",
          "name": "name",
          "parameters": {
            "foo": "bar"
          },
          "type": "function"
        }
      ],
      "updated_at": 0
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
Returns Examples
{
  "data": [
    {
      "id": "id",
      "created_at": 0,
      "instructions": "instructions",
      "metadata": {
        "foo": "string"
      },
      "model": "model",
      "multi_agent": {
        "enabled": true,
        "max_concurrent_subagents": 1
      },
      "name": "name",
      "object": "agent",
      "reasoning": {
        "effort": "none",
        "summary": "concise"
      },
      "service_tier": "auto",
      "text": {
        "format": {
          "type": "text"
        },
        "verbosity": "low"
      },
      "tools": [
        {
          "defer_loading": true,
          "description": "description",
          "name": "name",
          "parameters": {
            "foo": "bar"
          },
          "type": "function"
        }
      ],
      "updated_at": 0
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}