# anthropics/anthropic-sdk-go architecture

> Architecture diagram of the GitHub repository anthropics/anthropic-sdk-go, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/anthropics/anthropic-sdk-go
- Repository: https://github.com/anthropics/anthropic-sdk-go

## Overview

The Claude SDK for Go is a client library for calling Anthropic’s API. An application configures a client, invokes a resource service with typed parameters, and receives decoded responses; the client also exposes beta APIs for managed-agent sessions and organization administration. The environment worker adds a session-processing workflow: fetch session details, prepare skills and tools, then run work. AWS and Google Cloud packages provide optional gateway authentication. The graph reflects README capabilities and available excerpts; unsampled resource wiring is shown only where supported by the documented API surface and tree.

Main entry points: [`internal/requestconfig/requestconfig.go`](https://github.com/anthropics/anthropic-sdk-go/blob/main/internal/requestconfig/requestconfig.go) (Request transport), [`beta.go`](https://github.com/anthropics/anthropic-sdk-go/blob/main/beta.go) (Beta resources), [`client.go`](https://github.com/anthropics/anthropic-sdk-go/blob/main/client.go) (API client), [`lib/environments/worker.go`](https://github.com/anthropics/anthropic-sdk-go/blob/main/lib/environments/worker.go) (Environment worker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Client and API"]
  node_client["API client<br/>[client.go]"]
  node_messages["Messages<br/>[message.go]"]
  node_models["Models<br/>[model.go]"]
  node_completions["Completions<br/>[completion.go]"]
  node_beta["Beta resources<br/>[beta.go]"]
  node_transport["Request transport<br/>[requestconfig.go]"]
end

subgraph group_managed["Managed agents"]
  node_sessions["Sessions and work<br/>[betasession.go]"]
  node_agentresources["Agents and skills<br/>[betaagent.go]"]
  node_worker["Environment worker<br/>[worker.go]"]
  node_toolset["Agent tools<br/>[agenttoolset.go]"]
  node_memory["Memory stores<br/>[betamemorystore.go]"]
end

subgraph group_admin["Organization administration"]
  node_organization["Organization admin"]
  node_webhooks["Webhook events<br/>[betawebhook.go]"]
end

subgraph group_integrations["Cloud integrations"]
  node_aws["AWS gateway auth<br/>[aws.go]"]
  node_googlecloud["Google Cloud auth<br/>[googlecloud.go]"]
end

node_app(("Go application"))
node_anthropic{{"Anthropic API"}}
node_cloudservice{{"Cloud gateways"}}

node_app -->|"configures and calls"| node_client
node_client -->|"exposes"| node_messages
node_client -->|"exposes"| node_models
node_client -->|"exposes"| node_completions
node_client -->|"exposes"| node_beta
node_messages -->|"sends requests"| node_transport
node_models -->|"sends requests"| node_transport
node_completions -->|"sends requests"| node_transport
node_beta -->|"exposes"| node_sessions
node_beta -->|"exposes"| node_agentresources
node_beta -->|"exposes"| node_memory
node_beta -->|"exposes"| node_organization
node_beta -->|"exposes"| node_webhooks
node_sessions -->|"sends requests"| node_transport
node_agentresources -->|"sends requests"| node_transport
node_memory -->|"sends requests"| node_transport
node_organization -->|"sends requests"| node_transport
node_transport -->|"HTTP requests"| node_anthropic
node_worker -->|"fetches session"| node_sessions
node_worker -->|"prepares skills"| node_agentresources
node_worker -->|"syncs memory"| node_memory
node_worker -->|"uses tools"| node_toolset
node_aws -.->|"signs requests"| node_cloudservice
node_googlecloud -.->|"adds bearer auth"| node_cloudservice

click node_client "https://github.com/anthropics/anthropic-sdk-go/blob/main/client.go"
click node_messages "https://github.com/anthropics/anthropic-sdk-go/blob/main/message.go"
click node_models "https://github.com/anthropics/anthropic-sdk-go/blob/main/model.go"
click node_completions "https://github.com/anthropics/anthropic-sdk-go/blob/main/completion.go"
click node_beta "https://github.com/anthropics/anthropic-sdk-go/blob/main/beta.go"
click node_transport "https://github.com/anthropics/anthropic-sdk-go/blob/main/internal/requestconfig/requestconfig.go"
click node_sessions "https://github.com/anthropics/anthropic-sdk-go/blob/main/betasession.go"
click node_agentresources "https://github.com/anthropics/anthropic-sdk-go/blob/main/betaagent.go"
click node_worker "https://github.com/anthropics/anthropic-sdk-go/blob/main/lib/environments/worker.go"
click node_toolset "https://github.com/anthropics/anthropic-sdk-go/blob/main/tools/agenttoolset/agenttoolset.go"
click node_memory "https://github.com/anthropics/anthropic-sdk-go/blob/main/betamemorystore.go"
click node_organization "https://github.com/anthropics/anthropic-sdk-go/blob/main/betaorganization.go"
click node_webhooks "https://github.com/anthropics/anthropic-sdk-go/blob/main/betawebhook.go"
click node_aws "https://github.com/anthropics/anthropic-sdk-go/blob/main/aws/aws.go"
click node_googlecloud "https://github.com/anthropics/anthropic-sdk-go/blob/main/googlecloud/googlecloud.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_client,node_messages,node_models,node_completions,node_beta,node_transport toneBlue
class node_sessions,node_agentresources,node_worker,node_toolset,node_memory toneAmber
class node_organization,node_webhooks,node_anthropic toneMint
class node_aws,node_googlecloud toneRose
class node_app,node_cloudservice toneIndigo
```

## Components

### Client and API

- [API client](https://github.com/anthropics/anthropic-sdk-go/blob/main/client.go): `client.go`
- [Messages](https://github.com/anthropics/anthropic-sdk-go/blob/main/message.go): `message.go`
- [Models](https://github.com/anthropics/anthropic-sdk-go/blob/main/model.go): `model.go`
- [Completions](https://github.com/anthropics/anthropic-sdk-go/blob/main/completion.go): `completion.go`
- [Beta resources](https://github.com/anthropics/anthropic-sdk-go/blob/main/beta.go): `beta.go`
- [Request transport](https://github.com/anthropics/anthropic-sdk-go/blob/main/internal/requestconfig/requestconfig.go): `internal/requestconfig/requestconfig.go`

### Managed agents

- [Sessions and work](https://github.com/anthropics/anthropic-sdk-go/blob/main/betasession.go): `betasession.go`
- [Agents and skills](https://github.com/anthropics/anthropic-sdk-go/blob/main/betaagent.go): `betaagent.go`
- [Environment worker](https://github.com/anthropics/anthropic-sdk-go/blob/main/lib/environments/worker.go): `lib/environments/worker.go`
- [Agent tools](https://github.com/anthropics/anthropic-sdk-go/blob/main/tools/agenttoolset/agenttoolset.go): `tools/agenttoolset/agenttoolset.go`
- [Memory stores](https://github.com/anthropics/anthropic-sdk-go/blob/main/betamemorystore.go): `betamemorystore.go`

### Organization administration

- [Organization admin](https://github.com/anthropics/anthropic-sdk-go/blob/main/betaorganization.go): `betaorganization.go`
- [Webhook events](https://github.com/anthropics/anthropic-sdk-go/blob/main/betawebhook.go): `betawebhook.go`

### Cloud integrations

- [AWS gateway auth](https://github.com/anthropics/anthropic-sdk-go/blob/main/aws/aws.go): `aws/aws.go`
- [Google Cloud auth](https://github.com/anthropics/anthropic-sdk-go/blob/main/googlecloud/googlecloud.go): `googlecloud/googlecloud.go`

### Other components

- **Go application**
- **Anthropic API**
- **Cloud gateways**

## Connections

- Go application → API client: configures and calls
- API client → Messages: exposes
- API client → Models: exposes
- API client → Completions: exposes
- API client → Beta resources: exposes
- Messages → Request transport: sends requests
- Models → Request transport: sends requests
- Completions → Request transport: sends requests
- Beta resources → Sessions and work: exposes
- Beta resources → Agents and skills: exposes
- Beta resources → Memory stores: exposes
- Beta resources → Organization admin: exposes
- Beta resources → Webhook events: exposes
- Sessions and work → Request transport: sends requests
- Agents and skills → Request transport: sends requests
- Memory stores → Request transport: sends requests
- Organization admin → Request transport: sends requests
- Request transport → Anthropic API: HTTP requests
- Environment worker → Sessions and work: fetches session
- Environment worker → Agents and skills: prepares skills
- Environment worker → Memory stores: syncs memory
- Environment worker → Agent tools: uses tools
- AWS gateway auth → Cloud gateways: signs requests
- Google Cloud auth → Cloud gateways: adds bearer auth
