> ## Documentation Index
> Fetch the complete documentation index at: https://arize-ax.mintlify.site/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrations

> List, get, create, update, and delete LLM and agent integrations using the Arize Go SDK.

<Note>
  The `integrations` client methods are currently in **ALPHA**. The API may change without notice. A one-time warning is emitted on first use.
</Note>

An integration is either an `LLM` (model-provider) connection or an `AGENT` (customer-hosted endpoint) connection; each returned `Integration` is a polymorphic union carrying a `type` discriminator, so call `AsLlmIntegration` or `AsAgentIntegration` after checking `Discriminator`. The `Get`, `Delete`, `UpdateAgent`, and `UpdateLLM` methods accept either an integration name or an ID — because names are unique per account and type, `Get` and `Delete` require `Type` when a name is passed, and `Space` optionally narrows name resolution. Use `CreateAgent` / `UpdateAgent` for agent integrations and `CreateLLM` / `UpdateLLM` for LLM integrations. On `CreateLLM`, set exactly one per-provider field on `CreateLLMConfig`; setting zero or more than one returns `integrations.ErrInvalidProviderConfig` without contacting the server.

## List Integrations

`List` returns a paginated list of integrations. Defaults to a page size of 50. `Type`, when set, filters to a single category (`IntegrationTypeLLM` or `IntegrationTypeAgent`); when omitted, every type is returned, each item carrying its own `type` discriminator. `Space`, when non-empty, filters by space (substring match on space name, or exact match if a base64 resource ID is passed).

**Signature:**

```go theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
func (c *Client) List(ctx context.Context, req ListRequest) (*ListIntegrations, error)
```

**Usage Example:**

```go theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
package main

import (
    "context"
    "errors"
    "fmt"
    "log"

    "github.com/Arize-ai/client-go-v2/arize"
    "github.com/Arize-ai/client-go-v2/arize/integrations"
)

func main() {
    client, err := arize.NewClient(arize.Config{APIKey: "your-api-key"})
    if err != nil {
        log.Fatal(err)
    }

    resp, err := client.Integrations.List(context.Background(), integrations.ListRequest{
        Space: "your-space-name-or-id",
        Type:  integrations.IntegrationTypeLLM,
        Limit: 25,
    })
    if err != nil {
        var unauthorized *arize.UnauthorizedError
        if errors.As(err, &unauthorized) {
            log.Fatalf("unauthorized: %v", unauthorized)
        }
        log.Fatal(err)
    }

    for _, integration := range resp.Integrations {
        if llm, err := integration.AsLlmIntegration(); err == nil {
            fmt.Printf("%s: %s (llm)\n", llm.Id, llm.Name)
        }
    }
}
```

## Get an Integration

`Get` returns a single integration, resolving by name or ID. When `Integration` is a name, `Type` is required (names are unique per account and type); a name without a type, like an unresolvable name, returns `*arize.ResourceNotFoundError`.

**Signature:**

```go theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
func (c *Client) Get(ctx context.Context, req GetRequest) (*Integration, error)
```

**Usage Example:**

```go theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
package main

import (
    "context"
    "errors"
    "fmt"
    "log"

    "github.com/Arize-ai/client-go-v2/arize"
    "github.com/Arize-ai/client-go-v2/arize/integrations"
)

func main() {
    client, err := arize.NewClient(arize.Config{APIKey: "your-api-key"})
    if err != nil {
        log.Fatal(err)
    }

    integration, err := client.Integrations.Get(
        context.Background(),
        integrations.GetRequest{
            Integration: "your-integration-name-or-id",
            Type:        integrations.IntegrationTypeLLM,
            Space:       "your-space-name-or-id",
        },
    )
    if err != nil {
        var notFound *arize.NotFoundError
        if errors.As(err, &notFound) {
            log.Fatalf("integration not found: %v", notFound)
        }
        log.Fatal(err)
    }

    d, err := integration.Discriminator()
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("integration type=%s\n", d)
}
```

## Create an Agent Integration

`CreateAgent` creates a new `AGENT` (type=`AGENT`) integration — a customer-hosted HTTPS endpoint Arize calls for replay — and returns it. `Endpoint` and `InputSchema` (a Draft-07 JSON Schema) are required.

**Signature:**

```go theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
func (c *Client) CreateAgent(ctx context.Context, req CreateAgentRequest) (*Integration, error)
```

**Usage Example:**

```go theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
package main

import (
    "context"
    "errors"
    "fmt"
    "log"

    "github.com/Arize-ai/client-go-v2/arize"
    "github.com/Arize-ai/client-go-v2/arize/integrations"
)

func main() {
    client, err := arize.NewClient(arize.Config{APIKey: "your-api-key"})
    if err != nil {
        log.Fatal(err)
    }

    integration, err := client.Integrations.CreateAgent(
        context.Background(),
        integrations.CreateAgentRequest{
            Name:     "my-agent",
            Endpoint: "https://agent.example.com/replay",
            InputSchema: map[string]any{
                "type": "object",
                "properties": map[string]any{
                    "prompt": map[string]any{"type": "string"},
                },
            },
        },
    )
    if err != nil {
        var unprocessable *arize.UnprocessableEntityError
        if errors.As(err, &unprocessable) {
            log.Fatalf("invalid agent config: %v", unprocessable)
        }
        log.Fatal(err)
    }

    agent, err := integration.AsAgentIntegration()
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("created agent integration %s\n", agent.Id)
}
```

## Create an LLM Integration

`CreateLLM` creates a new `LLM` (type=`LLM`) integration and returns it. `Config` selects the provider: set exactly one of its per-provider fields (`OpenAI`, `Anthropic`, `Gemini`, `AWSBedrock`, `Custom`, `VertexAI`, `NvidiaNIM`, `LiteLLM`, `Fireworks`, `TogetherAi`). Setting zero or more than one returns `integrations.ErrInvalidProviderConfig`.

**Signature:**

```go theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
func (c *Client) CreateLLM(ctx context.Context, req CreateLLMRequest) (*Integration, error)
```

**Usage Example:**

```go theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
package main

import (
    "context"
    "errors"
    "fmt"
    "log"

    "github.com/Arize-ai/client-go-v2/arize"
    "github.com/Arize-ai/client-go-v2/arize/integrations"
)

func main() {
    client, err := arize.NewClient(arize.Config{APIKey: "your-api-key"})
    if err != nil {
        log.Fatal(err)
    }

    integration, err := client.Integrations.CreateLLM(
        context.Background(),
        integrations.CreateLLMRequest{
            Name: "my-openai",
            Config: integrations.CreateLLMConfig{
                OpenAI: &integrations.CreateOpenAIConfig{
                    APIKey: "sk-...",
                },
            },
        },
    )
    if err != nil {
        if errors.Is(err, integrations.ErrInvalidProviderConfig) {
            log.Fatal("set exactly one provider on CreateLLMConfig")
        }
        log.Fatal(err)
    }

    llm, err := integration.AsLlmIntegration()
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("created llm integration %s\n", llm.Id)
}
```

## Update an Agent Integration

`UpdateAgent` patches an existing agent integration, resolving by name or ID (the type is fixed to `AGENT`), and returns the updated integration. Only non-nil patch fields are sent; nil fields are left unchanged. For nullable fields (`Description`, `Headers`), pass a pointer to the empty value to clear the field. Returns `integrations.ErrNoUpdateFields` without contacting the server when no patch fields are set.

**Signature:**

```go theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
func (c *Client) UpdateAgent(ctx context.Context, req UpdateAgentRequest) (*Integration, error)
```

**Usage Example:**

```go theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
package main

import (
    "context"
    "errors"
    "fmt"
    "log"

    "github.com/Arize-ai/client-go-v2/arize"
    "github.com/Arize-ai/client-go-v2/arize/integrations"
)

func main() {
    client, err := arize.NewClient(arize.Config{APIKey: "your-api-key"})
    if err != nil {
        log.Fatal(err)
    }

    newEndpoint := "https://agent.example.com/replay-v2"
    integration, err := client.Integrations.UpdateAgent(
        context.Background(),
        integrations.UpdateAgentRequest{
            Integration: "your-integration-name-or-id",
            Space:       "your-space-name-or-id",
            Endpoint:    &newEndpoint,
        },
    )
    if err != nil {
        if errors.Is(err, integrations.ErrNoUpdateFields) {
            log.Fatal("no fields to update")
        }
        var notFound *arize.NotFoundError
        if errors.As(err, &notFound) {
            log.Fatalf("integration not found: %v", notFound)
        }
        log.Fatal(err)
    }

    agent, err := integration.AsAgentIntegration()
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("updated agent integration %s\n", agent.Id)
}
```

## Update an LLM Integration

`UpdateLLM` patches an existing LLM integration, resolving by name or ID (the type is fixed to `LLM`), and returns the updated integration. Only non-nil patch fields are sent; nil fields are left unchanged. The provider is immutable. For nullable fields (`APIKey`, `BaseURL`, `Headers`), pass a pointer to the empty value to clear the field. Field applicability is provider-specific and enforced server-side. Returns `integrations.ErrNoUpdateFields` without contacting the server when no patch fields are set.

**Signature:**

```go theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
func (c *Client) UpdateLLM(ctx context.Context, req UpdateLLMRequest) (*Integration, error)
```

**Usage Example:**

```go theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
package main

import (
    "context"
    "errors"
    "fmt"
    "log"

    "github.com/Arize-ai/client-go-v2/arize"
    "github.com/Arize-ai/client-go-v2/arize/integrations"
)

func main() {
    client, err := arize.NewClient(arize.Config{APIKey: "your-api-key"})
    if err != nil {
        log.Fatal(err)
    }

    newKey := "sk-rotated-..."
    integration, err := client.Integrations.UpdateLLM(
        context.Background(),
        integrations.UpdateLLMRequest{
            Integration: "your-integration-name-or-id",
            Space:       "your-space-name-or-id",
            APIKey:      &newKey,
        },
    )
    if err != nil {
        if errors.Is(err, integrations.ErrNoUpdateFields) {
            log.Fatal("no fields to update")
        }
        var notFound *arize.NotFoundError
        if errors.As(err, &notFound) {
            log.Fatalf("integration not found: %v", notFound)
        }
        log.Fatal(err)
    }

    llm, err := integration.AsLlmIntegration()
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("updated llm integration %s\n", llm.Id)
}
```

## Delete an Integration

`Delete` removes an integration, resolving by name or ID. When `Integration` is a name, `Type` is required; a name without a type, like an unresolvable name, returns `*arize.ResourceNotFoundError`. It returns only an error.

**Signature:**

```go theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
func (c *Client) Delete(ctx context.Context, req DeleteRequest) error
```

**Usage Example:**

```go theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
package main

import (
    "context"
    "errors"
    "log"

    "github.com/Arize-ai/client-go-v2/arize"
    "github.com/Arize-ai/client-go-v2/arize/integrations"
)

func main() {
    client, err := arize.NewClient(arize.Config{APIKey: "your-api-key"})
    if err != nil {
        log.Fatal(err)
    }

    err = client.Integrations.Delete(
        context.Background(),
        integrations.DeleteRequest{
            Integration: "your-integration-name-or-id",
            Type:        integrations.IntegrationTypeLLM,
            Space:       "your-space-name-or-id",
        },
    )
    if err != nil {
        var notFound *arize.NotFoundError
        if errors.As(err, &notFound) {
            log.Printf("no integration to remove: %v", notFound)
            return
        }
        log.Fatal(err)
    }
}
```
