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

Delete an agent

client.Beta.Agents.Delete(ctx, agentID) (*AgentDeleted, error)
DELETE/agents/{agent_id}

Deletes a reusable agent. See agent configuration.

ParametersExpand Collapse
agentID string
minLength0
maxLength1048576
ReturnsExpand Collapse
type AgentDeleted struct{…}

A deleted reusable agent.

ID string

The ID of the deleted agent.

minLength0
Deleted bool

Whether the agent was deleted. Always true.

Object AgentDeleted

The object type. Always agent.deleted.

Delete an agent

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"),
  )
  agentDeleted, err := client.Beta.Agents.Delete(context.TODO(), "agent_id")
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", agentDeleted.ID)
}
{
  "id": "id",
  "deleted": true,
  "object": "agent.deleted"
}
Returns Examples
{
  "id": "id",
  "deleted": true,
  "object": "agent.deleted"
}