github.com/anthropics/anthropic-sdk-go@v1.70.1/betadeployment.go (about)

     1  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
     2  
     3  package anthropic
     4  
     5  import (
     6  	"context"
     7  	"encoding/json"
     8  	"errors"
     9  	"fmt"
    10  	"net/http"
    11  	"net/url"
    12  	"slices"
    13  	"time"
    14  
    15  	"github.com/anthropics/anthropic-sdk-go/internal/apijson"
    16  	"github.com/anthropics/anthropic-sdk-go/internal/apiquery"
    17  	"github.com/anthropics/anthropic-sdk-go/internal/requestconfig"
    18  	"github.com/anthropics/anthropic-sdk-go/option"
    19  	"github.com/anthropics/anthropic-sdk-go/packages/pagination"
    20  	"github.com/anthropics/anthropic-sdk-go/packages/param"
    21  	"github.com/anthropics/anthropic-sdk-go/packages/respjson"
    22  )
    23  
    24  // BetaDeploymentService contains methods and other services that help with
    25  // interacting with the anthropic API.
    26  //
    27  // Note, unlike clients, this service does not read variables from the environment
    28  // automatically. You should not instantiate this service directly, and instead use
    29  // the [NewBetaDeploymentService] method instead.
    30  type BetaDeploymentService struct {
    31  	Options []option.RequestOption
    32  }
    33  
    34  // NewBetaDeploymentService generates a new service that applies the given options
    35  // to each request. These options are applied after the parent client's options (if
    36  // there is one), and before any request-specific options.
    37  func NewBetaDeploymentService(opts ...option.RequestOption) (r BetaDeploymentService) {
    38  	r = BetaDeploymentService{}
    39  	r.Options = opts
    40  	return
    41  }
    42  
    43  // Create Deployment
    44  func (r *BetaDeploymentService) New(ctx context.Context, params BetaDeploymentNewParams, opts ...option.RequestOption) (res *BetaManagedAgentsDeployment, err error) {
    45  	for _, v := range params.Betas {
    46  		opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v)))
    47  	}
    48  	if !param.IsOmitted(params.WorkspaceID) {
    49  		opts = append(opts, option.WithHeader("anthropic-workspace-id", fmt.Sprintf("%v", params.WorkspaceID.Value)))
    50  	}
    51  	opts = slices.Concat(r.Options, opts)
    52  	opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "managed-agents-2026-04-01")}, opts...)
    53  	path := "v1/deployments?beta=true"
    54  	err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
    55  	return res, err
    56  }
    57  
    58  // Get Deployment
    59  func (r *BetaDeploymentService) Get(ctx context.Context, deploymentID string, query BetaDeploymentGetParams, opts ...option.RequestOption) (res *BetaManagedAgentsDeployment, err error) {
    60  	for _, v := range query.Betas {
    61  		opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v)))
    62  	}
    63  	if !param.IsOmitted(query.WorkspaceID) {
    64  		opts = append(opts, option.WithHeader("anthropic-workspace-id", fmt.Sprintf("%v", query.WorkspaceID.Value)))
    65  	}
    66  	opts = slices.Concat(r.Options, opts)
    67  	opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "managed-agents-2026-04-01")}, opts...)
    68  	if deploymentID == "" {
    69  		err = errors.New("missing required deployment_id parameter")
    70  		return nil, err
    71  	}
    72  	path := fmt.Sprintf("v1/deployments/%s?beta=true", deploymentID)
    73  	err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
    74  	return res, err
    75  }
    76  
    77  // Update Deployment
    78  func (r *BetaDeploymentService) Update(ctx context.Context, deploymentID string, params BetaDeploymentUpdateParams, opts ...option.RequestOption) (res *BetaManagedAgentsDeployment, err error) {
    79  	for _, v := range params.Betas {
    80  		opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v)))
    81  	}
    82  	if !param.IsOmitted(params.WorkspaceID) {
    83  		opts = append(opts, option.WithHeader("anthropic-workspace-id", fmt.Sprintf("%v", params.WorkspaceID.Value)))
    84  	}
    85  	opts = slices.Concat(r.Options, opts)
    86  	opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "managed-agents-2026-04-01")}, opts...)
    87  	if deploymentID == "" {
    88  		err = errors.New("missing required deployment_id parameter")
    89  		return nil, err
    90  	}
    91  	path := fmt.Sprintf("v1/deployments/%s?beta=true", deploymentID)
    92  	err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
    93  	return res, err
    94  }
    95  
    96  // List Deployments
    97  func (r *BetaDeploymentService) List(ctx context.Context, params BetaDeploymentListParams, opts ...option.RequestOption) (res *pagination.PageCursor[BetaManagedAgentsDeployment], err error) {
    98  	var raw *http.Response
    99  	for _, v := range params.Betas {
   100  		opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v)))
   101  	}
   102  	if !param.IsOmitted(params.WorkspaceID) {
   103  		opts = append(opts, option.WithHeader("anthropic-workspace-id", fmt.Sprintf("%v", params.WorkspaceID.Value)))
   104  	}
   105  	opts = slices.Concat(r.Options, opts)
   106  	opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "managed-agents-2026-04-01"), option.WithResponseInto(&raw)}, opts...)
   107  	path := "v1/deployments?beta=true"
   108  	cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, params, &res, opts...)
   109  	if err != nil {
   110  		return nil, err
   111  	}
   112  	err = cfg.Execute()
   113  	if err != nil {
   114  		return nil, err
   115  	}
   116  	res.SetPageConfig(cfg, raw)
   117  	return res, nil
   118  }
   119  
   120  // List Deployments
   121  func (r *BetaDeploymentService) ListAutoPaging(ctx context.Context, params BetaDeploymentListParams, opts ...option.RequestOption) *pagination.PageCursorAutoPager[BetaManagedAgentsDeployment] {
   122  	return pagination.NewPageCursorAutoPager(r.List(ctx, params, opts...))
   123  }
   124  
   125  // Archive Deployment
   126  func (r *BetaDeploymentService) Archive(ctx context.Context, deploymentID string, body BetaDeploymentArchiveParams, opts ...option.RequestOption) (res *BetaManagedAgentsDeployment, err error) {
   127  	for _, v := range body.Betas {
   128  		opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v)))
   129  	}
   130  	if !param.IsOmitted(body.WorkspaceID) {
   131  		opts = append(opts, option.WithHeader("anthropic-workspace-id", fmt.Sprintf("%v", body.WorkspaceID.Value)))
   132  	}
   133  	opts = slices.Concat(r.Options, opts)
   134  	opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "managed-agents-2026-04-01")}, opts...)
   135  	if deploymentID == "" {
   136  		err = errors.New("missing required deployment_id parameter")
   137  		return nil, err
   138  	}
   139  	path := fmt.Sprintf("v1/deployments/%s/archive?beta=true", deploymentID)
   140  	err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
   141  	return res, err
   142  }
   143  
   144  // Pause Deployment
   145  func (r *BetaDeploymentService) Pause(ctx context.Context, deploymentID string, body BetaDeploymentPauseParams, opts ...option.RequestOption) (res *BetaManagedAgentsDeployment, err error) {
   146  	for _, v := range body.Betas {
   147  		opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v)))
   148  	}
   149  	if !param.IsOmitted(body.WorkspaceID) {
   150  		opts = append(opts, option.WithHeader("anthropic-workspace-id", fmt.Sprintf("%v", body.WorkspaceID.Value)))
   151  	}
   152  	opts = slices.Concat(r.Options, opts)
   153  	opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "managed-agents-2026-04-01")}, opts...)
   154  	if deploymentID == "" {
   155  		err = errors.New("missing required deployment_id parameter")
   156  		return nil, err
   157  	}
   158  	path := fmt.Sprintf("v1/deployments/%s/pause?beta=true", deploymentID)
   159  	err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
   160  	return res, err
   161  }
   162  
   163  // Run Deployment Now
   164  func (r *BetaDeploymentService) Run(ctx context.Context, deploymentID string, body BetaDeploymentRunParams, opts ...option.RequestOption) (res *BetaManagedAgentsDeploymentRun, err error) {
   165  	for _, v := range body.Betas {
   166  		opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v)))
   167  	}
   168  	if !param.IsOmitted(body.WorkspaceID) {
   169  		opts = append(opts, option.WithHeader("anthropic-workspace-id", fmt.Sprintf("%v", body.WorkspaceID.Value)))
   170  	}
   171  	opts = slices.Concat(r.Options, opts)
   172  	opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "managed-agents-2026-04-01")}, opts...)
   173  	if deploymentID == "" {
   174  		err = errors.New("missing required deployment_id parameter")
   175  		return nil, err
   176  	}
   177  	path := fmt.Sprintf("v1/deployments/%s/run?beta=true", deploymentID)
   178  	err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
   179  	return res, err
   180  }
   181  
   182  // Unpause Deployment
   183  func (r *BetaDeploymentService) Unpause(ctx context.Context, deploymentID string, body BetaDeploymentUnpauseParams, opts ...option.RequestOption) (res *BetaManagedAgentsDeployment, err error) {
   184  	for _, v := range body.Betas {
   185  		opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%v", v)))
   186  	}
   187  	if !param.IsOmitted(body.WorkspaceID) {
   188  		opts = append(opts, option.WithHeader("anthropic-workspace-id", fmt.Sprintf("%v", body.WorkspaceID.Value)))
   189  	}
   190  	opts = slices.Concat(r.Options, opts)
   191  	opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "managed-agents-2026-04-01")}, opts...)
   192  	if deploymentID == "" {
   193  		err = errors.New("missing required deployment_id parameter")
   194  		return nil, err
   195  	}
   196  	path := fmt.Sprintf("v1/deployments/%s/unpause?beta=true", deploymentID)
   197  	err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
   198  	return res, err
   199  }
   200  
   201  // The deployment's agent was archived.
   202  type BetaManagedAgentsAgentArchivedDeploymentPausedReasonError struct {
   203  	// Any of "agent_archived_error".
   204  	Type BetaManagedAgentsAgentArchivedDeploymentPausedReasonErrorType `json:"type" api:"required"`
   205  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
   206  	JSON struct {
   207  		Type        respjson.Field
   208  		ExtraFields map[string]respjson.Field
   209  		raw         string
   210  	} `json:"-"`
   211  }
   212  
   213  // Returns the unmodified JSON received from the API
   214  func (r BetaManagedAgentsAgentArchivedDeploymentPausedReasonError) RawJSON() string {
   215  	return r.JSON.raw
   216  }
   217  func (r *BetaManagedAgentsAgentArchivedDeploymentPausedReasonError) UnmarshalJSON(data []byte) error {
   218  	return apijson.UnmarshalRoot(data, r)
   219  }
   220  
   221  type BetaManagedAgentsAgentArchivedDeploymentPausedReasonErrorType string
   222  
   223  const (
   224  	BetaManagedAgentsAgentArchivedDeploymentPausedReasonErrorTypeAgentArchivedError BetaManagedAgentsAgentArchivedDeploymentPausedReasonErrorType = "agent_archived_error"
   225  )
   226  
   227  // A deployment is a configured instance of an agent — it binds the agent to
   228  // everything needed to run it autonomously: an environment, credentials, initial
   229  // events, and an optional schedule.
   230  type BetaManagedAgentsDeployment struct {
   231  	// Unique identifier for this deployment.
   232  	ID string `json:"id" api:"required"`
   233  	// A resolved agent reference with a concrete version.
   234  	Agent BetaManagedAgentsAgentReference `json:"agent" api:"required"`
   235  	// A timestamp in RFC 3339 format
   236  	ArchivedAt time.Time `json:"archived_at" api:"required" format:"date-time"`
   237  	// A timestamp in RFC 3339 format
   238  	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
   239  	// Description of what the deployment does.
   240  	Description string `json:"description" api:"required"`
   241  	// ID of the `environment` where sessions run.
   242  	EnvironmentID string `json:"environment_id" api:"required"`
   243  	// Events sent to each session immediately after creation.
   244  	InitialEvents []BetaManagedAgentsDeploymentInitialEventUnion `json:"initial_events" api:"required"`
   245  	// Arbitrary key-value metadata. Maximum 16 pairs.
   246  	Metadata map[string]string `json:"metadata" api:"required"`
   247  	// Human-readable name.
   248  	Name string `json:"name" api:"required"`
   249  	// Why a deployment is paused. Non-null exactly when `status` is `paused`.
   250  	PausedReason BetaManagedAgentsDeploymentPausedReasonUnion `json:"paused_reason" api:"required"`
   251  	// Resources attached to sessions created from this deployment. Echoes the input
   252  	// minus write-only credentials.
   253  	Resources []BetaManagedAgentsSessionResourceConfigUnion `json:"resources" api:"required"`
   254  	// 5-field POSIX cron schedule with computed runtime timestamps.
   255  	Schedule BetaManagedAgentsSchedule `json:"schedule" api:"required"`
   256  	// Lifecycle status of a deployment.
   257  	//
   258  	// Any of "active", "paused".
   259  	Status BetaManagedAgentsDeploymentStatus `json:"status" api:"required"`
   260  	// Any of "deployment".
   261  	Type BetaManagedAgentsDeploymentType `json:"type" api:"required"`
   262  	// A timestamp in RFC 3339 format
   263  	UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
   264  	// Vault IDs supplying stored credentials for sessions created from this
   265  	// deployment.
   266  	VaultIDs []string `json:"vault_ids" api:"required"`
   267  	// A hard spend ceiling. The session stops issuing new model requests once the
   268  	// tracked list cost reaches `max_list_cost`.
   269  	Budget BetaManagedAgentsBudgetLimit `json:"budget" api:"nullable"`
   270  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
   271  	JSON struct {
   272  		ID            respjson.Field
   273  		Agent         respjson.Field
   274  		ArchivedAt    respjson.Field
   275  		CreatedAt     respjson.Field
   276  		Description   respjson.Field
   277  		EnvironmentID respjson.Field
   278  		InitialEvents respjson.Field
   279  		Metadata      respjson.Field
   280  		Name          respjson.Field
   281  		PausedReason  respjson.Field
   282  		Resources     respjson.Field
   283  		Schedule      respjson.Field
   284  		Status        respjson.Field
   285  		Type          respjson.Field
   286  		UpdatedAt     respjson.Field
   287  		VaultIDs      respjson.Field
   288  		Budget        respjson.Field
   289  		ExtraFields   map[string]respjson.Field
   290  		raw           string
   291  	} `json:"-"`
   292  }
   293  
   294  // Returns the unmodified JSON received from the API
   295  func (r BetaManagedAgentsDeployment) RawJSON() string { return r.JSON.raw }
   296  func (r *BetaManagedAgentsDeployment) UnmarshalJSON(data []byte) error {
   297  	return apijson.UnmarshalRoot(data, r)
   298  }
   299  
   300  type BetaManagedAgentsDeploymentType string
   301  
   302  const (
   303  	BetaManagedAgentsDeploymentTypeDeployment BetaManagedAgentsDeploymentType = "deployment"
   304  )
   305  
   306  // BetaManagedAgentsDeploymentInitialEventUnion contains all possible properties
   307  // and values from [BetaManagedAgentsDeploymentUserMessageEvent],
   308  // [BetaManagedAgentsDeploymentUserDefineOutcomeEvent],
   309  // [BetaManagedAgentsDeploymentSystemMessageEvent].
   310  //
   311  // Use the [BetaManagedAgentsDeploymentInitialEventUnion.AsAny] method to switch on
   312  // the variant.
   313  //
   314  // Use the methods beginning with 'As' to cast the union to one of its variants.
   315  type BetaManagedAgentsDeploymentInitialEventUnion struct {
   316  	// This field is a union of
   317  	// [[]BetaManagedAgentsDeploymentUserMessageEventContentUnion],
   318  	// [[]BetaManagedAgentsSystemContentBlock]
   319  	Content BetaManagedAgentsDeploymentInitialEventUnionContent `json:"content"`
   320  	// Any of "user.message", "user.define_outcome", "system.message".
   321  	Type string `json:"type"`
   322  	// This field is from variant [BetaManagedAgentsDeploymentUserDefineOutcomeEvent].
   323  	Description string `json:"description"`
   324  	// This field is from variant [BetaManagedAgentsDeploymentUserDefineOutcomeEvent].
   325  	Rubric BetaManagedAgentsDeploymentUserDefineOutcomeEventRubricUnion `json:"rubric"`
   326  	// This field is from variant [BetaManagedAgentsDeploymentUserDefineOutcomeEvent].
   327  	MaxIterations int64 `json:"max_iterations"`
   328  	JSON          struct {
   329  		Content       respjson.Field
   330  		Type          respjson.Field
   331  		Description   respjson.Field
   332  		Rubric        respjson.Field
   333  		MaxIterations respjson.Field
   334  		raw           string
   335  	} `json:"-"`
   336  }
   337  
   338  // anyBetaManagedAgentsDeploymentInitialEvent is implemented by each variant of
   339  // [BetaManagedAgentsDeploymentInitialEventUnion] to add type safety for the return
   340  // type of [BetaManagedAgentsDeploymentInitialEventUnion.AsAny]
   341  type anyBetaManagedAgentsDeploymentInitialEvent interface {
   342  	implBetaManagedAgentsDeploymentInitialEventUnion()
   343  }
   344  
   345  func (BetaManagedAgentsDeploymentUserMessageEvent) implBetaManagedAgentsDeploymentInitialEventUnion() {
   346  }
   347  func (BetaManagedAgentsDeploymentUserDefineOutcomeEvent) implBetaManagedAgentsDeploymentInitialEventUnion() {
   348  }
   349  func (BetaManagedAgentsDeploymentSystemMessageEvent) implBetaManagedAgentsDeploymentInitialEventUnion() {
   350  }
   351  
   352  // Use the following switch statement to find the correct variant
   353  //
   354  //	switch variant := BetaManagedAgentsDeploymentInitialEventUnion.AsAny().(type) {
   355  //	case anthropic.BetaManagedAgentsDeploymentUserMessageEvent:
   356  //	case anthropic.BetaManagedAgentsDeploymentUserDefineOutcomeEvent:
   357  //	case anthropic.BetaManagedAgentsDeploymentSystemMessageEvent:
   358  //	default:
   359  //	  fmt.Errorf("no variant present")
   360  //	}
   361  func (u BetaManagedAgentsDeploymentInitialEventUnion) AsAny() anyBetaManagedAgentsDeploymentInitialEvent {
   362  	switch u.Type {
   363  	case "user.message":
   364  		return u.AsUserMessage()
   365  	case "user.define_outcome":
   366  		return u.AsUserDefineOutcome()
   367  	case "system.message":
   368  		return u.AsSystemMessage()
   369  	}
   370  	return nil
   371  }
   372  
   373  func (u BetaManagedAgentsDeploymentInitialEventUnion) AsUserMessage() (v BetaManagedAgentsDeploymentUserMessageEvent) {
   374  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
   375  	return
   376  }
   377  
   378  func (u BetaManagedAgentsDeploymentInitialEventUnion) AsUserDefineOutcome() (v BetaManagedAgentsDeploymentUserDefineOutcomeEvent) {
   379  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
   380  	return
   381  }
   382  
   383  func (u BetaManagedAgentsDeploymentInitialEventUnion) AsSystemMessage() (v BetaManagedAgentsDeploymentSystemMessageEvent) {
   384  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
   385  	return
   386  }
   387  
   388  // Returns the unmodified JSON received from the API
   389  func (u BetaManagedAgentsDeploymentInitialEventUnion) RawJSON() string { return u.JSON.raw }
   390  
   391  func (r *BetaManagedAgentsDeploymentInitialEventUnion) UnmarshalJSON(data []byte) error {
   392  	return apijson.UnmarshalRoot(data, r)
   393  }
   394  
   395  // BetaManagedAgentsDeploymentInitialEventUnionContent is an implicit subunion of
   396  // [BetaManagedAgentsDeploymentInitialEventUnion].
   397  // BetaManagedAgentsDeploymentInitialEventUnionContent provides convenient access
   398  // to the sub-properties of the union.
   399  //
   400  // For type safety it is recommended to directly use a variant of the
   401  // [BetaManagedAgentsDeploymentInitialEventUnion].
   402  //
   403  // If the underlying value is not a json object, one of the following properties
   404  // will be valid: OfBetaManagedAgentsDeploymentUserMessageEventContentArray
   405  // OfBetaManagedAgentsSystemContentBlockArray]
   406  type BetaManagedAgentsDeploymentInitialEventUnionContent struct {
   407  	// This field will be present if the value is a
   408  	// [[]BetaManagedAgentsDeploymentUserMessageEventContentUnion] instead of an
   409  	// object.
   410  	OfBetaManagedAgentsDeploymentUserMessageEventContentArray []BetaManagedAgentsDeploymentUserMessageEventContentUnion `json:",inline"`
   411  	// This field will be present if the value is a
   412  	// [[]BetaManagedAgentsSystemContentBlock] instead of an object.
   413  	OfBetaManagedAgentsSystemContentBlockArray []BetaManagedAgentsSystemContentBlock `json:",inline"`
   414  	JSON                                       struct {
   415  		OfBetaManagedAgentsDeploymentUserMessageEventContentArray respjson.Field
   416  		OfBetaManagedAgentsSystemContentBlockArray                respjson.Field
   417  		raw                                                       string
   418  	} `json:"-"`
   419  }
   420  
   421  func (r *BetaManagedAgentsDeploymentInitialEventUnionContent) UnmarshalJSON(data []byte) error {
   422  	return apijson.UnmarshalRoot(data, r)
   423  }
   424  
   425  func BetaManagedAgentsDeploymentInitialEventParamsOfUserMessage(content []BetaManagedAgentsUserMessageEventParamsContentUnion) BetaManagedAgentsDeploymentInitialEventParamsUnion {
   426  	var userMessage BetaManagedAgentsUserMessageEventParams
   427  	userMessage.Content = content
   428  	return BetaManagedAgentsDeploymentInitialEventParamsUnion{OfUserMessage: &userMessage}
   429  }
   430  
   431  func BetaManagedAgentsDeploymentInitialEventParamsOfUserDefineOutcome[
   432  	T BetaManagedAgentsFileRubricParams | BetaManagedAgentsTextRubricParams,
   433  ](description string, rubric T, type_ BetaManagedAgentsUserDefineOutcomeEventParamsType) BetaManagedAgentsDeploymentInitialEventParamsUnion {
   434  	var userDefineOutcome BetaManagedAgentsUserDefineOutcomeEventParams
   435  	userDefineOutcome.Description = description
   436  	switch v := any(rubric).(type) {
   437  	case BetaManagedAgentsFileRubricParams:
   438  		userDefineOutcome.Rubric.OfFile = &v
   439  	case BetaManagedAgentsTextRubricParams:
   440  		userDefineOutcome.Rubric.OfText = &v
   441  	}
   442  	userDefineOutcome.Type = type_
   443  	return BetaManagedAgentsDeploymentInitialEventParamsUnion{OfUserDefineOutcome: &userDefineOutcome}
   444  }
   445  
   446  func BetaManagedAgentsDeploymentInitialEventParamsOfSystemMessage(content []BetaManagedAgentsSystemContentBlockParam) BetaManagedAgentsDeploymentInitialEventParamsUnion {
   447  	var systemMessage BetaManagedAgentsSystemMessageEventParams
   448  	systemMessage.Content = content
   449  	return BetaManagedAgentsDeploymentInitialEventParamsUnion{OfSystemMessage: &systemMessage}
   450  }
   451  
   452  // Only one field can be non-zero.
   453  //
   454  // Use [param.IsOmitted] to confirm if a field is set.
   455  type BetaManagedAgentsDeploymentInitialEventParamsUnion struct {
   456  	OfUserMessage       *BetaManagedAgentsUserMessageEventParams       `json:",omitzero,inline"`
   457  	OfUserDefineOutcome *BetaManagedAgentsUserDefineOutcomeEventParams `json:",omitzero,inline"`
   458  	OfSystemMessage     *BetaManagedAgentsSystemMessageEventParams     `json:",omitzero,inline"`
   459  	paramUnion
   460  }
   461  
   462  func (u BetaManagedAgentsDeploymentInitialEventParamsUnion) MarshalJSON() ([]byte, error) {
   463  	return param.MarshalUnion(u, u.OfUserMessage, u.OfUserDefineOutcome, u.OfSystemMessage)
   464  }
   465  func (u *BetaManagedAgentsDeploymentInitialEventParamsUnion) UnmarshalJSON(data []byte) error {
   466  	return apijson.UnmarshalRoot(data, u)
   467  }
   468  
   469  func (u *BetaManagedAgentsDeploymentInitialEventParamsUnion) asAny() any {
   470  	if !param.IsOmitted(u.OfUserMessage) {
   471  		return u.OfUserMessage
   472  	} else if !param.IsOmitted(u.OfUserDefineOutcome) {
   473  		return u.OfUserDefineOutcome
   474  	} else if !param.IsOmitted(u.OfSystemMessage) {
   475  		return u.OfSystemMessage
   476  	}
   477  	return nil
   478  }
   479  
   480  // Returns a pointer to the underlying variant's property, if present.
   481  func (u BetaManagedAgentsDeploymentInitialEventParamsUnion) GetDescription() *string {
   482  	if vt := u.OfUserDefineOutcome; vt != nil {
   483  		return &vt.Description
   484  	}
   485  	return nil
   486  }
   487  
   488  // Returns a pointer to the underlying variant's property, if present.
   489  func (u BetaManagedAgentsDeploymentInitialEventParamsUnion) GetRubric() *BetaManagedAgentsUserDefineOutcomeEventParamsRubricUnion {
   490  	if vt := u.OfUserDefineOutcome; vt != nil {
   491  		return &vt.Rubric
   492  	}
   493  	return nil
   494  }
   495  
   496  // Returns a pointer to the underlying variant's property, if present.
   497  func (u BetaManagedAgentsDeploymentInitialEventParamsUnion) GetMaxIterations() *int64 {
   498  	if vt := u.OfUserDefineOutcome; vt != nil && vt.MaxIterations.Valid() {
   499  		return &vt.MaxIterations.Value
   500  	}
   501  	return nil
   502  }
   503  
   504  // Returns a pointer to the underlying variant's property, if present.
   505  func (u BetaManagedAgentsDeploymentInitialEventParamsUnion) GetType() *string {
   506  	if vt := u.OfUserMessage; vt != nil {
   507  		return (*string)(&vt.Type)
   508  	} else if vt := u.OfUserDefineOutcome; vt != nil {
   509  		return (*string)(&vt.Type)
   510  	} else if vt := u.OfSystemMessage; vt != nil {
   511  		return (*string)(&vt.Type)
   512  	}
   513  	return nil
   514  }
   515  
   516  // Returns a subunion which exports methods to access subproperties
   517  //
   518  // Or use AsAny() to get the underlying value
   519  func (u BetaManagedAgentsDeploymentInitialEventParamsUnion) GetContent() (res betaManagedAgentsDeploymentInitialEventParamsUnionContent) {
   520  	if vt := u.OfUserMessage; vt != nil {
   521  		res.any = &vt.Content
   522  	} else if vt := u.OfSystemMessage; vt != nil {
   523  		res.any = &vt.Content
   524  	}
   525  	return
   526  }
   527  
   528  // Can have the runtime types
   529  // [_[]BetaManagedAgentsUserMessageEventParamsContentUnion],
   530  // [_[]BetaManagedAgentsSystemContentBlockParam]
   531  type betaManagedAgentsDeploymentInitialEventParamsUnionContent struct{ any }
   532  
   533  // Use the following switch statement to get the type of the union:
   534  //
   535  //	switch u.AsAny().(type) {
   536  //	case *[]anthropic.BetaManagedAgentsUserMessageEventParamsContentUnion:
   537  //	case *[]anthropic.BetaManagedAgentsSystemContentBlockParam:
   538  //	default:
   539  //	    fmt.Errorf("not present")
   540  //	}
   541  func (u betaManagedAgentsDeploymentInitialEventParamsUnionContent) AsAny() any { return u.any }
   542  
   543  func init() {
   544  	apijson.RegisterUnion[BetaManagedAgentsDeploymentInitialEventParamsUnion](
   545  		"type",
   546  		apijson.Discriminator[BetaManagedAgentsUserMessageEventParams]("user.message"),
   547  		apijson.Discriminator[BetaManagedAgentsUserDefineOutcomeEventParams]("user.define_outcome"),
   548  		apijson.Discriminator[BetaManagedAgentsSystemMessageEventParams]("system.message"),
   549  	)
   550  }
   551  
   552  // BetaManagedAgentsDeploymentPausedReasonUnion contains all possible properties
   553  // and values from [BetaManagedAgentsManualDeploymentPausedReason],
   554  // [BetaManagedAgentsErrorDeploymentPausedReason].
   555  //
   556  // Use the [BetaManagedAgentsDeploymentPausedReasonUnion.AsAny] method to switch on
   557  // the variant.
   558  //
   559  // Use the methods beginning with 'As' to cast the union to one of its variants.
   560  type BetaManagedAgentsDeploymentPausedReasonUnion struct {
   561  	// Any of "manual", "error".
   562  	Type string `json:"type"`
   563  	// This field is from variant [BetaManagedAgentsErrorDeploymentPausedReason].
   564  	Error BetaManagedAgentsDeploymentPausedReasonErrorUnion `json:"error"`
   565  	JSON  struct {
   566  		Type  respjson.Field
   567  		Error respjson.Field
   568  		raw   string
   569  	} `json:"-"`
   570  }
   571  
   572  // anyBetaManagedAgentsDeploymentPausedReason is implemented by each variant of
   573  // [BetaManagedAgentsDeploymentPausedReasonUnion] to add type safety for the return
   574  // type of [BetaManagedAgentsDeploymentPausedReasonUnion.AsAny]
   575  type anyBetaManagedAgentsDeploymentPausedReason interface {
   576  	implBetaManagedAgentsDeploymentPausedReasonUnion()
   577  }
   578  
   579  func (BetaManagedAgentsManualDeploymentPausedReason) implBetaManagedAgentsDeploymentPausedReasonUnion() {
   580  }
   581  func (BetaManagedAgentsErrorDeploymentPausedReason) implBetaManagedAgentsDeploymentPausedReasonUnion() {
   582  }
   583  
   584  // Use the following switch statement to find the correct variant
   585  //
   586  //	switch variant := BetaManagedAgentsDeploymentPausedReasonUnion.AsAny().(type) {
   587  //	case anthropic.BetaManagedAgentsManualDeploymentPausedReason:
   588  //	case anthropic.BetaManagedAgentsErrorDeploymentPausedReason:
   589  //	default:
   590  //	  fmt.Errorf("no variant present")
   591  //	}
   592  func (u BetaManagedAgentsDeploymentPausedReasonUnion) AsAny() anyBetaManagedAgentsDeploymentPausedReason {
   593  	switch u.Type {
   594  	case "manual":
   595  		return u.AsManual()
   596  	case "error":
   597  		return u.AsError()
   598  	}
   599  	return nil
   600  }
   601  
   602  func (u BetaManagedAgentsDeploymentPausedReasonUnion) AsManual() (v BetaManagedAgentsManualDeploymentPausedReason) {
   603  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
   604  	return
   605  }
   606  
   607  func (u BetaManagedAgentsDeploymentPausedReasonUnion) AsError() (v BetaManagedAgentsErrorDeploymentPausedReason) {
   608  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
   609  	return
   610  }
   611  
   612  // Returns the unmodified JSON received from the API
   613  func (u BetaManagedAgentsDeploymentPausedReasonUnion) RawJSON() string { return u.JSON.raw }
   614  
   615  func (r *BetaManagedAgentsDeploymentPausedReasonUnion) UnmarshalJSON(data []byte) error {
   616  	return apijson.UnmarshalRoot(data, r)
   617  }
   618  
   619  // BetaManagedAgentsDeploymentPausedReasonErrorUnion contains all possible
   620  // properties and values from
   621  // [BetaManagedAgentsEnvironmentArchivedDeploymentPausedReasonError],
   622  // [BetaManagedAgentsAgentArchivedDeploymentPausedReasonError],
   623  // [BetaManagedAgentsEnvironmentNotFoundDeploymentPausedReasonError],
   624  // [BetaManagedAgentsVaultNotFoundDeploymentPausedReasonError],
   625  // [BetaManagedAgentsFileNotFoundDeploymentPausedReasonError],
   626  // [BetaManagedAgentsSessionResourceNotFoundDeploymentPausedReasonError],
   627  // [BetaManagedAgentsWorkspaceArchivedDeploymentPausedReasonError],
   628  // [BetaManagedAgentsOrganizationDisabledDeploymentPausedReasonError],
   629  // [BetaManagedAgentsMemoryStoreArchivedDeploymentPausedReasonError],
   630  // [BetaManagedAgentsSkillNotFoundDeploymentPausedReasonError],
   631  // [BetaManagedAgentsVaultArchivedDeploymentPausedReasonError],
   632  // [BetaManagedAgentsUnknownDeploymentPausedReasonError],
   633  // [BetaManagedAgentsSelfHostedResourcesUnsupportedDeploymentPausedReasonError],
   634  // [BetaManagedAgentsMCPEgressBlockedDeploymentPausedReasonError].
   635  //
   636  // Use the [BetaManagedAgentsDeploymentPausedReasonErrorUnion.AsAny] method to
   637  // switch on the variant.
   638  //
   639  // Use the methods beginning with 'As' to cast the union to one of its variants.
   640  type BetaManagedAgentsDeploymentPausedReasonErrorUnion struct {
   641  	// Any of "environment_archived_error", "agent_archived_error",
   642  	// "environment_not_found_error", "vault_not_found_error", "file_not_found_error",
   643  	// "session_resource_not_found_error", "workspace_archived_error",
   644  	// "organization_disabled_error", "memory_store_archived_error",
   645  	// "skill_not_found_error", "vault_archived_error", "unknown_error",
   646  	// "self_hosted_resources_unsupported_error", "mcp_egress_blocked_error".
   647  	Type string `json:"type"`
   648  	JSON struct {
   649  		Type respjson.Field
   650  		raw  string
   651  	} `json:"-"`
   652  }
   653  
   654  // anyBetaManagedAgentsDeploymentPausedReasonError is implemented by each variant
   655  // of [BetaManagedAgentsDeploymentPausedReasonErrorUnion] to add type safety for
   656  // the return type of [BetaManagedAgentsDeploymentPausedReasonErrorUnion.AsAny]
   657  type anyBetaManagedAgentsDeploymentPausedReasonError interface {
   658  	implBetaManagedAgentsDeploymentPausedReasonErrorUnion()
   659  }
   660  
   661  func (BetaManagedAgentsEnvironmentArchivedDeploymentPausedReasonError) implBetaManagedAgentsDeploymentPausedReasonErrorUnion() {
   662  }
   663  func (BetaManagedAgentsAgentArchivedDeploymentPausedReasonError) implBetaManagedAgentsDeploymentPausedReasonErrorUnion() {
   664  }
   665  func (BetaManagedAgentsEnvironmentNotFoundDeploymentPausedReasonError) implBetaManagedAgentsDeploymentPausedReasonErrorUnion() {
   666  }
   667  func (BetaManagedAgentsVaultNotFoundDeploymentPausedReasonError) implBetaManagedAgentsDeploymentPausedReasonErrorUnion() {
   668  }
   669  func (BetaManagedAgentsFileNotFoundDeploymentPausedReasonError) implBetaManagedAgentsDeploymentPausedReasonErrorUnion() {
   670  }
   671  func (BetaManagedAgentsSessionResourceNotFoundDeploymentPausedReasonError) implBetaManagedAgentsDeploymentPausedReasonErrorUnion() {
   672  }
   673  func (BetaManagedAgentsWorkspaceArchivedDeploymentPausedReasonError) implBetaManagedAgentsDeploymentPausedReasonErrorUnion() {
   674  }
   675  func (BetaManagedAgentsOrganizationDisabledDeploymentPausedReasonError) implBetaManagedAgentsDeploymentPausedReasonErrorUnion() {
   676  }
   677  func (BetaManagedAgentsMemoryStoreArchivedDeploymentPausedReasonError) implBetaManagedAgentsDeploymentPausedReasonErrorUnion() {
   678  }
   679  func (BetaManagedAgentsSkillNotFoundDeploymentPausedReasonError) implBetaManagedAgentsDeploymentPausedReasonErrorUnion() {
   680  }
   681  func (BetaManagedAgentsVaultArchivedDeploymentPausedReasonError) implBetaManagedAgentsDeploymentPausedReasonErrorUnion() {
   682  }
   683  func (BetaManagedAgentsUnknownDeploymentPausedReasonError) implBetaManagedAgentsDeploymentPausedReasonErrorUnion() {
   684  }
   685  func (BetaManagedAgentsSelfHostedResourcesUnsupportedDeploymentPausedReasonError) implBetaManagedAgentsDeploymentPausedReasonErrorUnion() {
   686  }
   687  func (BetaManagedAgentsMCPEgressBlockedDeploymentPausedReasonError) implBetaManagedAgentsDeploymentPausedReasonErrorUnion() {
   688  }
   689  
   690  // Use the following switch statement to find the correct variant
   691  //
   692  //	switch variant := BetaManagedAgentsDeploymentPausedReasonErrorUnion.AsAny().(type) {
   693  //	case anthropic.BetaManagedAgentsEnvironmentArchivedDeploymentPausedReasonError:
   694  //	case anthropic.BetaManagedAgentsAgentArchivedDeploymentPausedReasonError:
   695  //	case anthropic.BetaManagedAgentsEnvironmentNotFoundDeploymentPausedReasonError:
   696  //	case anthropic.BetaManagedAgentsVaultNotFoundDeploymentPausedReasonError:
   697  //	case anthropic.BetaManagedAgentsFileNotFoundDeploymentPausedReasonError:
   698  //	case anthropic.BetaManagedAgentsSessionResourceNotFoundDeploymentPausedReasonError:
   699  //	case anthropic.BetaManagedAgentsWorkspaceArchivedDeploymentPausedReasonError:
   700  //	case anthropic.BetaManagedAgentsOrganizationDisabledDeploymentPausedReasonError:
   701  //	case anthropic.BetaManagedAgentsMemoryStoreArchivedDeploymentPausedReasonError:
   702  //	case anthropic.BetaManagedAgentsSkillNotFoundDeploymentPausedReasonError:
   703  //	case anthropic.BetaManagedAgentsVaultArchivedDeploymentPausedReasonError:
   704  //	case anthropic.BetaManagedAgentsUnknownDeploymentPausedReasonError:
   705  //	case anthropic.BetaManagedAgentsSelfHostedResourcesUnsupportedDeploymentPausedReasonError:
   706  //	case anthropic.BetaManagedAgentsMCPEgressBlockedDeploymentPausedReasonError:
   707  //	default:
   708  //	  fmt.Errorf("no variant present")
   709  //	}
   710  func (u BetaManagedAgentsDeploymentPausedReasonErrorUnion) AsAny() anyBetaManagedAgentsDeploymentPausedReasonError {
   711  	switch u.Type {
   712  	case "environment_archived_error":
   713  		return u.AsEnvironmentArchivedError()
   714  	case "agent_archived_error":
   715  		return u.AsAgentArchivedError()
   716  	case "environment_not_found_error":
   717  		return u.AsEnvironmentNotFoundError()
   718  	case "vault_not_found_error":
   719  		return u.AsVaultNotFoundError()
   720  	case "file_not_found_error":
   721  		return u.AsFileNotFoundError()
   722  	case "session_resource_not_found_error":
   723  		return u.AsSessionResourceNotFoundError()
   724  	case "workspace_archived_error":
   725  		return u.AsWorkspaceArchivedError()
   726  	case "organization_disabled_error":
   727  		return u.AsOrganizationDisabledError()
   728  	case "memory_store_archived_error":
   729  		return u.AsMemoryStoreArchivedError()
   730  	case "skill_not_found_error":
   731  		return u.AsSkillNotFoundError()
   732  	case "vault_archived_error":
   733  		return u.AsVaultArchivedError()
   734  	case "unknown_error":
   735  		return u.AsUnknownError()
   736  	case "self_hosted_resources_unsupported_error":
   737  		return u.AsSelfHostedResourcesUnsupportedError()
   738  	case "mcp_egress_blocked_error":
   739  		return u.AsMCPEgressBlockedError()
   740  	}
   741  	return nil
   742  }
   743  
   744  func (u BetaManagedAgentsDeploymentPausedReasonErrorUnion) AsEnvironmentArchivedError() (v BetaManagedAgentsEnvironmentArchivedDeploymentPausedReasonError) {
   745  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
   746  	return
   747  }
   748  
   749  func (u BetaManagedAgentsDeploymentPausedReasonErrorUnion) AsAgentArchivedError() (v BetaManagedAgentsAgentArchivedDeploymentPausedReasonError) {
   750  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
   751  	return
   752  }
   753  
   754  func (u BetaManagedAgentsDeploymentPausedReasonErrorUnion) AsEnvironmentNotFoundError() (v BetaManagedAgentsEnvironmentNotFoundDeploymentPausedReasonError) {
   755  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
   756  	return
   757  }
   758  
   759  func (u BetaManagedAgentsDeploymentPausedReasonErrorUnion) AsVaultNotFoundError() (v BetaManagedAgentsVaultNotFoundDeploymentPausedReasonError) {
   760  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
   761  	return
   762  }
   763  
   764  func (u BetaManagedAgentsDeploymentPausedReasonErrorUnion) AsFileNotFoundError() (v BetaManagedAgentsFileNotFoundDeploymentPausedReasonError) {
   765  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
   766  	return
   767  }
   768  
   769  func (u BetaManagedAgentsDeploymentPausedReasonErrorUnion) AsSessionResourceNotFoundError() (v BetaManagedAgentsSessionResourceNotFoundDeploymentPausedReasonError) {
   770  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
   771  	return
   772  }
   773  
   774  func (u BetaManagedAgentsDeploymentPausedReasonErrorUnion) AsWorkspaceArchivedError() (v BetaManagedAgentsWorkspaceArchivedDeploymentPausedReasonError) {
   775  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
   776  	return
   777  }
   778  
   779  func (u BetaManagedAgentsDeploymentPausedReasonErrorUnion) AsOrganizationDisabledError() (v BetaManagedAgentsOrganizationDisabledDeploymentPausedReasonError) {
   780  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
   781  	return
   782  }
   783  
   784  func (u BetaManagedAgentsDeploymentPausedReasonErrorUnion) AsMemoryStoreArchivedError() (v BetaManagedAgentsMemoryStoreArchivedDeploymentPausedReasonError) {
   785  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
   786  	return
   787  }
   788  
   789  func (u BetaManagedAgentsDeploymentPausedReasonErrorUnion) AsSkillNotFoundError() (v BetaManagedAgentsSkillNotFoundDeploymentPausedReasonError) {
   790  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
   791  	return
   792  }
   793  
   794  func (u BetaManagedAgentsDeploymentPausedReasonErrorUnion) AsVaultArchivedError() (v BetaManagedAgentsVaultArchivedDeploymentPausedReasonError) {
   795  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
   796  	return
   797  }
   798  
   799  func (u BetaManagedAgentsDeploymentPausedReasonErrorUnion) AsUnknownError() (v BetaManagedAgentsUnknownDeploymentPausedReasonError) {
   800  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
   801  	return
   802  }
   803  
   804  func (u BetaManagedAgentsDeploymentPausedReasonErrorUnion) AsSelfHostedResourcesUnsupportedError() (v BetaManagedAgentsSelfHostedResourcesUnsupportedDeploymentPausedReasonError) {
   805  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
   806  	return
   807  }
   808  
   809  func (u BetaManagedAgentsDeploymentPausedReasonErrorUnion) AsMCPEgressBlockedError() (v BetaManagedAgentsMCPEgressBlockedDeploymentPausedReasonError) {
   810  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
   811  	return
   812  }
   813  
   814  // Returns the unmodified JSON received from the API
   815  func (u BetaManagedAgentsDeploymentPausedReasonErrorUnion) RawJSON() string { return u.JSON.raw }
   816  
   817  func (r *BetaManagedAgentsDeploymentPausedReasonErrorUnion) UnmarshalJSON(data []byte) error {
   818  	return apijson.UnmarshalRoot(data, r)
   819  }
   820  
   821  // Lifecycle status of a deployment.
   822  type BetaManagedAgentsDeploymentStatus string
   823  
   824  const (
   825  	BetaManagedAgentsDeploymentStatusActive BetaManagedAgentsDeploymentStatus = "active"
   826  	BetaManagedAgentsDeploymentStatusPaused BetaManagedAgentsDeploymentStatus = "paused"
   827  )
   828  
   829  // Privileged context for the accompanying turn and all subsequent turns, appended
   830  // to the session's system context as a `role: "system"` turn rather than replacing
   831  // the top-level system prompt.
   832  type BetaManagedAgentsDeploymentSystemMessageEvent struct {
   833  	// System content blocks to append. Text-only.
   834  	Content []BetaManagedAgentsSystemContentBlock `json:"content" api:"required"`
   835  	// Any of "system.message".
   836  	Type BetaManagedAgentsDeploymentSystemMessageEventType `json:"type" api:"required"`
   837  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
   838  	JSON struct {
   839  		Content     respjson.Field
   840  		Type        respjson.Field
   841  		ExtraFields map[string]respjson.Field
   842  		raw         string
   843  	} `json:"-"`
   844  }
   845  
   846  // Returns the unmodified JSON received from the API
   847  func (r BetaManagedAgentsDeploymentSystemMessageEvent) RawJSON() string { return r.JSON.raw }
   848  func (r *BetaManagedAgentsDeploymentSystemMessageEvent) UnmarshalJSON(data []byte) error {
   849  	return apijson.UnmarshalRoot(data, r)
   850  }
   851  
   852  type BetaManagedAgentsDeploymentSystemMessageEventType string
   853  
   854  const (
   855  	BetaManagedAgentsDeploymentSystemMessageEventTypeSystemMessage BetaManagedAgentsDeploymentSystemMessageEventType = "system.message"
   856  )
   857  
   858  // An outcome the agent should work toward. The agent begins work on receipt.
   859  type BetaManagedAgentsDeploymentUserDefineOutcomeEvent struct {
   860  	// What the agent should produce. This is the task specification.
   861  	Description string `json:"description" api:"required"`
   862  	// Rubric for grading the quality of an outcome.
   863  	Rubric BetaManagedAgentsDeploymentUserDefineOutcomeEventRubricUnion `json:"rubric" api:"required"`
   864  	// Any of "user.define_outcome".
   865  	Type BetaManagedAgentsDeploymentUserDefineOutcomeEventType `json:"type" api:"required"`
   866  	// Eval→revision cycles before giving up. Default 3, max 20.
   867  	MaxIterations int64 `json:"max_iterations" api:"nullable"`
   868  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
   869  	JSON struct {
   870  		Description   respjson.Field
   871  		Rubric        respjson.Field
   872  		Type          respjson.Field
   873  		MaxIterations respjson.Field
   874  		ExtraFields   map[string]respjson.Field
   875  		raw           string
   876  	} `json:"-"`
   877  }
   878  
   879  // Returns the unmodified JSON received from the API
   880  func (r BetaManagedAgentsDeploymentUserDefineOutcomeEvent) RawJSON() string { return r.JSON.raw }
   881  func (r *BetaManagedAgentsDeploymentUserDefineOutcomeEvent) UnmarshalJSON(data []byte) error {
   882  	return apijson.UnmarshalRoot(data, r)
   883  }
   884  
   885  // BetaManagedAgentsDeploymentUserDefineOutcomeEventRubricUnion contains all
   886  // possible properties and values from [BetaManagedAgentsFileRubric],
   887  // [BetaManagedAgentsTextRubric].
   888  //
   889  // Use the [BetaManagedAgentsDeploymentUserDefineOutcomeEventRubricUnion.AsAny]
   890  // method to switch on the variant.
   891  //
   892  // Use the methods beginning with 'As' to cast the union to one of its variants.
   893  type BetaManagedAgentsDeploymentUserDefineOutcomeEventRubricUnion struct {
   894  	// This field is from variant [BetaManagedAgentsFileRubric].
   895  	FileID string `json:"file_id"`
   896  	// Any of "file", "text".
   897  	Type string `json:"type"`
   898  	// This field is from variant [BetaManagedAgentsTextRubric].
   899  	Content string `json:"content"`
   900  	JSON    struct {
   901  		FileID  respjson.Field
   902  		Type    respjson.Field
   903  		Content respjson.Field
   904  		raw     string
   905  	} `json:"-"`
   906  }
   907  
   908  // anyBetaManagedAgentsDeploymentUserDefineOutcomeEventRubric is implemented by
   909  // each variant of [BetaManagedAgentsDeploymentUserDefineOutcomeEventRubricUnion]
   910  // to add type safety for the return type of
   911  // [BetaManagedAgentsDeploymentUserDefineOutcomeEventRubricUnion.AsAny]
   912  type anyBetaManagedAgentsDeploymentUserDefineOutcomeEventRubric interface {
   913  	implBetaManagedAgentsDeploymentUserDefineOutcomeEventRubricUnion()
   914  }
   915  
   916  func (BetaManagedAgentsFileRubric) implBetaManagedAgentsDeploymentUserDefineOutcomeEventRubricUnion() {
   917  }
   918  func (BetaManagedAgentsTextRubric) implBetaManagedAgentsDeploymentUserDefineOutcomeEventRubricUnion() {
   919  }
   920  
   921  // Use the following switch statement to find the correct variant
   922  //
   923  //	switch variant := BetaManagedAgentsDeploymentUserDefineOutcomeEventRubricUnion.AsAny().(type) {
   924  //	case anthropic.BetaManagedAgentsFileRubric:
   925  //	case anthropic.BetaManagedAgentsTextRubric:
   926  //	default:
   927  //	  fmt.Errorf("no variant present")
   928  //	}
   929  func (u BetaManagedAgentsDeploymentUserDefineOutcomeEventRubricUnion) AsAny() anyBetaManagedAgentsDeploymentUserDefineOutcomeEventRubric {
   930  	switch u.Type {
   931  	case "file":
   932  		return u.AsFile()
   933  	case "text":
   934  		return u.AsText()
   935  	}
   936  	return nil
   937  }
   938  
   939  func (u BetaManagedAgentsDeploymentUserDefineOutcomeEventRubricUnion) AsFile() (v BetaManagedAgentsFileRubric) {
   940  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
   941  	return
   942  }
   943  
   944  func (u BetaManagedAgentsDeploymentUserDefineOutcomeEventRubricUnion) AsText() (v BetaManagedAgentsTextRubric) {
   945  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
   946  	return
   947  }
   948  
   949  // Returns the unmodified JSON received from the API
   950  func (u BetaManagedAgentsDeploymentUserDefineOutcomeEventRubricUnion) RawJSON() string {
   951  	return u.JSON.raw
   952  }
   953  
   954  func (r *BetaManagedAgentsDeploymentUserDefineOutcomeEventRubricUnion) UnmarshalJSON(data []byte) error {
   955  	return apijson.UnmarshalRoot(data, r)
   956  }
   957  
   958  type BetaManagedAgentsDeploymentUserDefineOutcomeEventType string
   959  
   960  const (
   961  	BetaManagedAgentsDeploymentUserDefineOutcomeEventTypeUserDefineOutcome BetaManagedAgentsDeploymentUserDefineOutcomeEventType = "user.define_outcome"
   962  )
   963  
   964  // A user message sent to the session.
   965  type BetaManagedAgentsDeploymentUserMessageEvent struct {
   966  	// Array of content blocks for the user message.
   967  	Content []BetaManagedAgentsDeploymentUserMessageEventContentUnion `json:"content" api:"required"`
   968  	// Any of "user.message".
   969  	Type BetaManagedAgentsDeploymentUserMessageEventType `json:"type" api:"required"`
   970  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
   971  	JSON struct {
   972  		Content     respjson.Field
   973  		Type        respjson.Field
   974  		ExtraFields map[string]respjson.Field
   975  		raw         string
   976  	} `json:"-"`
   977  }
   978  
   979  // Returns the unmodified JSON received from the API
   980  func (r BetaManagedAgentsDeploymentUserMessageEvent) RawJSON() string { return r.JSON.raw }
   981  func (r *BetaManagedAgentsDeploymentUserMessageEvent) UnmarshalJSON(data []byte) error {
   982  	return apijson.UnmarshalRoot(data, r)
   983  }
   984  
   985  // BetaManagedAgentsDeploymentUserMessageEventContentUnion contains all possible
   986  // properties and values from [BetaManagedAgentsTextBlock],
   987  // [BetaManagedAgentsImageBlock], [BetaManagedAgentsDocumentBlock],
   988  // [BetaManagedAgentsRedactedBlock].
   989  //
   990  // Use the [BetaManagedAgentsDeploymentUserMessageEventContentUnion.AsAny] method
   991  // to switch on the variant.
   992  //
   993  // Use the methods beginning with 'As' to cast the union to one of its variants.
   994  type BetaManagedAgentsDeploymentUserMessageEventContentUnion struct {
   995  	// This field is from variant [BetaManagedAgentsTextBlock].
   996  	Text string `json:"text"`
   997  	// Any of "text", "image", "document", "redacted".
   998  	Type string `json:"type"`
   999  	// This field is a union of [BetaManagedAgentsImageBlockSourceUnion],
  1000  	// [BetaManagedAgentsDocumentBlockSourceUnion]
  1001  	Source BetaManagedAgentsDeploymentUserMessageEventContentUnionSource `json:"source"`
  1002  	// This field is from variant [BetaManagedAgentsDocumentBlock].
  1003  	Context string `json:"context"`
  1004  	// This field is from variant [BetaManagedAgentsDocumentBlock].
  1005  	Title string `json:"title"`
  1006  	JSON  struct {
  1007  		Text    respjson.Field
  1008  		Type    respjson.Field
  1009  		Source  respjson.Field
  1010  		Context respjson.Field
  1011  		Title   respjson.Field
  1012  		raw     string
  1013  	} `json:"-"`
  1014  }
  1015  
  1016  // anyBetaManagedAgentsDeploymentUserMessageEventContent is implemented by each
  1017  // variant of [BetaManagedAgentsDeploymentUserMessageEventContentUnion] to add type
  1018  // safety for the return type of
  1019  // [BetaManagedAgentsDeploymentUserMessageEventContentUnion.AsAny]
  1020  type anyBetaManagedAgentsDeploymentUserMessageEventContent interface {
  1021  	implBetaManagedAgentsDeploymentUserMessageEventContentUnion()
  1022  }
  1023  
  1024  func (BetaManagedAgentsTextBlock) implBetaManagedAgentsDeploymentUserMessageEventContentUnion()     {}
  1025  func (BetaManagedAgentsImageBlock) implBetaManagedAgentsDeploymentUserMessageEventContentUnion()    {}
  1026  func (BetaManagedAgentsDocumentBlock) implBetaManagedAgentsDeploymentUserMessageEventContentUnion() {}
  1027  func (BetaManagedAgentsRedactedBlock) implBetaManagedAgentsDeploymentUserMessageEventContentUnion() {}
  1028  
  1029  // Use the following switch statement to find the correct variant
  1030  //
  1031  //	switch variant := BetaManagedAgentsDeploymentUserMessageEventContentUnion.AsAny().(type) {
  1032  //	case anthropic.BetaManagedAgentsTextBlock:
  1033  //	case anthropic.BetaManagedAgentsImageBlock:
  1034  //	case anthropic.BetaManagedAgentsDocumentBlock:
  1035  //	case anthropic.BetaManagedAgentsRedactedBlock:
  1036  //	default:
  1037  //	  fmt.Errorf("no variant present")
  1038  //	}
  1039  func (u BetaManagedAgentsDeploymentUserMessageEventContentUnion) AsAny() anyBetaManagedAgentsDeploymentUserMessageEventContent {
  1040  	switch u.Type {
  1041  	case "text":
  1042  		return u.AsText()
  1043  	case "image":
  1044  		return u.AsImage()
  1045  	case "document":
  1046  		return u.AsDocument()
  1047  	case "redacted":
  1048  		return u.AsRedacted()
  1049  	}
  1050  	return nil
  1051  }
  1052  
  1053  func (u BetaManagedAgentsDeploymentUserMessageEventContentUnion) AsText() (v BetaManagedAgentsTextBlock) {
  1054  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  1055  	return
  1056  }
  1057  
  1058  func (u BetaManagedAgentsDeploymentUserMessageEventContentUnion) AsImage() (v BetaManagedAgentsImageBlock) {
  1059  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  1060  	return
  1061  }
  1062  
  1063  func (u BetaManagedAgentsDeploymentUserMessageEventContentUnion) AsDocument() (v BetaManagedAgentsDocumentBlock) {
  1064  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  1065  	return
  1066  }
  1067  
  1068  func (u BetaManagedAgentsDeploymentUserMessageEventContentUnion) AsRedacted() (v BetaManagedAgentsRedactedBlock) {
  1069  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  1070  	return
  1071  }
  1072  
  1073  // Returns the unmodified JSON received from the API
  1074  func (u BetaManagedAgentsDeploymentUserMessageEventContentUnion) RawJSON() string { return u.JSON.raw }
  1075  
  1076  func (r *BetaManagedAgentsDeploymentUserMessageEventContentUnion) UnmarshalJSON(data []byte) error {
  1077  	return apijson.UnmarshalRoot(data, r)
  1078  }
  1079  
  1080  // BetaManagedAgentsDeploymentUserMessageEventContentUnionSource is an implicit
  1081  // subunion of [BetaManagedAgentsDeploymentUserMessageEventContentUnion].
  1082  // BetaManagedAgentsDeploymentUserMessageEventContentUnionSource provides
  1083  // convenient access to the sub-properties of the union.
  1084  //
  1085  // For type safety it is recommended to directly use a variant of the
  1086  // [BetaManagedAgentsDeploymentUserMessageEventContentUnion].
  1087  type BetaManagedAgentsDeploymentUserMessageEventContentUnionSource struct {
  1088  	Data      string `json:"data"`
  1089  	MediaType string `json:"media_type"`
  1090  	Type      string `json:"type"`
  1091  	URL       string `json:"url"`
  1092  	FileID    string `json:"file_id"`
  1093  	JSON      struct {
  1094  		Data      respjson.Field
  1095  		MediaType respjson.Field
  1096  		Type      respjson.Field
  1097  		URL       respjson.Field
  1098  		FileID    respjson.Field
  1099  		raw       string
  1100  	} `json:"-"`
  1101  }
  1102  
  1103  func (r *BetaManagedAgentsDeploymentUserMessageEventContentUnionSource) UnmarshalJSON(data []byte) error {
  1104  	return apijson.UnmarshalRoot(data, r)
  1105  }
  1106  
  1107  type BetaManagedAgentsDeploymentUserMessageEventType string
  1108  
  1109  const (
  1110  	BetaManagedAgentsDeploymentUserMessageEventTypeUserMessage BetaManagedAgentsDeploymentUserMessageEventType = "user.message"
  1111  )
  1112  
  1113  // The deployment's environment was archived.
  1114  type BetaManagedAgentsEnvironmentArchivedDeploymentPausedReasonError struct {
  1115  	// Any of "environment_archived_error".
  1116  	Type BetaManagedAgentsEnvironmentArchivedDeploymentPausedReasonErrorType `json:"type" api:"required"`
  1117  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  1118  	JSON struct {
  1119  		Type        respjson.Field
  1120  		ExtraFields map[string]respjson.Field
  1121  		raw         string
  1122  	} `json:"-"`
  1123  }
  1124  
  1125  // Returns the unmodified JSON received from the API
  1126  func (r BetaManagedAgentsEnvironmentArchivedDeploymentPausedReasonError) RawJSON() string {
  1127  	return r.JSON.raw
  1128  }
  1129  func (r *BetaManagedAgentsEnvironmentArchivedDeploymentPausedReasonError) UnmarshalJSON(data []byte) error {
  1130  	return apijson.UnmarshalRoot(data, r)
  1131  }
  1132  
  1133  type BetaManagedAgentsEnvironmentArchivedDeploymentPausedReasonErrorType string
  1134  
  1135  const (
  1136  	BetaManagedAgentsEnvironmentArchivedDeploymentPausedReasonErrorTypeEnvironmentArchivedError BetaManagedAgentsEnvironmentArchivedDeploymentPausedReasonErrorType = "environment_archived_error"
  1137  )
  1138  
  1139  // The deployment's environment no longer exists.
  1140  type BetaManagedAgentsEnvironmentNotFoundDeploymentPausedReasonError struct {
  1141  	// Any of "environment_not_found_error".
  1142  	Type BetaManagedAgentsEnvironmentNotFoundDeploymentPausedReasonErrorType `json:"type" api:"required"`
  1143  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  1144  	JSON struct {
  1145  		Type        respjson.Field
  1146  		ExtraFields map[string]respjson.Field
  1147  		raw         string
  1148  	} `json:"-"`
  1149  }
  1150  
  1151  // Returns the unmodified JSON received from the API
  1152  func (r BetaManagedAgentsEnvironmentNotFoundDeploymentPausedReasonError) RawJSON() string {
  1153  	return r.JSON.raw
  1154  }
  1155  func (r *BetaManagedAgentsEnvironmentNotFoundDeploymentPausedReasonError) UnmarshalJSON(data []byte) error {
  1156  	return apijson.UnmarshalRoot(data, r)
  1157  }
  1158  
  1159  type BetaManagedAgentsEnvironmentNotFoundDeploymentPausedReasonErrorType string
  1160  
  1161  const (
  1162  	BetaManagedAgentsEnvironmentNotFoundDeploymentPausedReasonErrorTypeEnvironmentNotFoundError BetaManagedAgentsEnvironmentNotFoundDeploymentPausedReasonErrorType = "environment_not_found_error"
  1163  )
  1164  
  1165  // A scheduled fire recorded a failed run whose error auto-pauses the deployment.
  1166  type BetaManagedAgentsErrorDeploymentPausedReason struct {
  1167  	// The error that triggered an auto-pause. Matches the failed run's `error.type`.
  1168  	Error BetaManagedAgentsDeploymentPausedReasonErrorUnion `json:"error" api:"required"`
  1169  	// Any of "error".
  1170  	Type BetaManagedAgentsErrorDeploymentPausedReasonType `json:"type" api:"required"`
  1171  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  1172  	JSON struct {
  1173  		Error       respjson.Field
  1174  		Type        respjson.Field
  1175  		ExtraFields map[string]respjson.Field
  1176  		raw         string
  1177  	} `json:"-"`
  1178  }
  1179  
  1180  // Returns the unmodified JSON received from the API
  1181  func (r BetaManagedAgentsErrorDeploymentPausedReason) RawJSON() string { return r.JSON.raw }
  1182  func (r *BetaManagedAgentsErrorDeploymentPausedReason) UnmarshalJSON(data []byte) error {
  1183  	return apijson.UnmarshalRoot(data, r)
  1184  }
  1185  
  1186  type BetaManagedAgentsErrorDeploymentPausedReasonType string
  1187  
  1188  const (
  1189  	BetaManagedAgentsErrorDeploymentPausedReasonTypeError BetaManagedAgentsErrorDeploymentPausedReasonType = "error"
  1190  )
  1191  
  1192  // A file resource referenced by the deployment no longer exists.
  1193  type BetaManagedAgentsFileNotFoundDeploymentPausedReasonError struct {
  1194  	// Any of "file_not_found_error".
  1195  	Type BetaManagedAgentsFileNotFoundDeploymentPausedReasonErrorType `json:"type" api:"required"`
  1196  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  1197  	JSON struct {
  1198  		Type        respjson.Field
  1199  		ExtraFields map[string]respjson.Field
  1200  		raw         string
  1201  	} `json:"-"`
  1202  }
  1203  
  1204  // Returns the unmodified JSON received from the API
  1205  func (r BetaManagedAgentsFileNotFoundDeploymentPausedReasonError) RawJSON() string { return r.JSON.raw }
  1206  func (r *BetaManagedAgentsFileNotFoundDeploymentPausedReasonError) UnmarshalJSON(data []byte) error {
  1207  	return apijson.UnmarshalRoot(data, r)
  1208  }
  1209  
  1210  type BetaManagedAgentsFileNotFoundDeploymentPausedReasonErrorType string
  1211  
  1212  const (
  1213  	BetaManagedAgentsFileNotFoundDeploymentPausedReasonErrorTypeFileNotFoundError BetaManagedAgentsFileNotFoundDeploymentPausedReasonErrorType = "file_not_found_error"
  1214  )
  1215  
  1216  // A file mounted into each session's container.
  1217  type BetaManagedAgentsFileResourceConfig struct {
  1218  	// ID of a previously uploaded file.
  1219  	FileID string `json:"file_id" api:"required"`
  1220  	// Any of "file".
  1221  	Type BetaManagedAgentsFileResourceConfigType `json:"type" api:"required"`
  1222  	// Mount path in the container. Defaults to `/mnt/session/uploads/<file_id>`.
  1223  	MountPath string `json:"mount_path" api:"nullable"`
  1224  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  1225  	JSON struct {
  1226  		FileID      respjson.Field
  1227  		Type        respjson.Field
  1228  		MountPath   respjson.Field
  1229  		ExtraFields map[string]respjson.Field
  1230  		raw         string
  1231  	} `json:"-"`
  1232  }
  1233  
  1234  // Returns the unmodified JSON received from the API
  1235  func (r BetaManagedAgentsFileResourceConfig) RawJSON() string { return r.JSON.raw }
  1236  func (r *BetaManagedAgentsFileResourceConfig) UnmarshalJSON(data []byte) error {
  1237  	return apijson.UnmarshalRoot(data, r)
  1238  }
  1239  
  1240  type BetaManagedAgentsFileResourceConfigType string
  1241  
  1242  const (
  1243  	BetaManagedAgentsFileResourceConfigTypeFile BetaManagedAgentsFileResourceConfigType = "file"
  1244  )
  1245  
  1246  // A GitHub repository mounted into each session's container. The authorization
  1247  // token is write-only and never returned.
  1248  type BetaManagedAgentsGitHubRepositoryResourceConfig struct {
  1249  	// Any of "github_repository".
  1250  	Type BetaManagedAgentsGitHubRepositoryResourceConfigType `json:"type" api:"required"`
  1251  	// Github URL of the repository
  1252  	URL string `json:"url" api:"required"`
  1253  	// Branch or commit to check out. Defaults to the repository's default branch.
  1254  	Checkout BetaManagedAgentsGitHubRepositoryResourceConfigCheckoutUnion `json:"checkout" api:"nullable"`
  1255  	// Mount path in the container. Defaults to `/workspace/<repo-name>`.
  1256  	MountPath string `json:"mount_path" api:"nullable"`
  1257  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  1258  	JSON struct {
  1259  		Type        respjson.Field
  1260  		URL         respjson.Field
  1261  		Checkout    respjson.Field
  1262  		MountPath   respjson.Field
  1263  		ExtraFields map[string]respjson.Field
  1264  		raw         string
  1265  	} `json:"-"`
  1266  }
  1267  
  1268  // Returns the unmodified JSON received from the API
  1269  func (r BetaManagedAgentsGitHubRepositoryResourceConfig) RawJSON() string { return r.JSON.raw }
  1270  func (r *BetaManagedAgentsGitHubRepositoryResourceConfig) UnmarshalJSON(data []byte) error {
  1271  	return apijson.UnmarshalRoot(data, r)
  1272  }
  1273  
  1274  type BetaManagedAgentsGitHubRepositoryResourceConfigType string
  1275  
  1276  const (
  1277  	BetaManagedAgentsGitHubRepositoryResourceConfigTypeGitHubRepository BetaManagedAgentsGitHubRepositoryResourceConfigType = "github_repository"
  1278  )
  1279  
  1280  // BetaManagedAgentsGitHubRepositoryResourceConfigCheckoutUnion contains all
  1281  // possible properties and values from [BetaManagedAgentsBranchCheckout],
  1282  // [BetaManagedAgentsCommitCheckout].
  1283  //
  1284  // Use the [BetaManagedAgentsGitHubRepositoryResourceConfigCheckoutUnion.AsAny]
  1285  // method to switch on the variant.
  1286  //
  1287  // Use the methods beginning with 'As' to cast the union to one of its variants.
  1288  type BetaManagedAgentsGitHubRepositoryResourceConfigCheckoutUnion struct {
  1289  	// This field is from variant [BetaManagedAgentsBranchCheckout].
  1290  	Name string `json:"name"`
  1291  	// Any of "branch", "commit".
  1292  	Type string `json:"type"`
  1293  	// This field is from variant [BetaManagedAgentsCommitCheckout].
  1294  	Sha  string `json:"sha"`
  1295  	JSON struct {
  1296  		Name respjson.Field
  1297  		Type respjson.Field
  1298  		Sha  respjson.Field
  1299  		raw  string
  1300  	} `json:"-"`
  1301  }
  1302  
  1303  // anyBetaManagedAgentsGitHubRepositoryResourceConfigCheckout is implemented by
  1304  // each variant of [BetaManagedAgentsGitHubRepositoryResourceConfigCheckoutUnion]
  1305  // to add type safety for the return type of
  1306  // [BetaManagedAgentsGitHubRepositoryResourceConfigCheckoutUnion.AsAny]
  1307  type anyBetaManagedAgentsGitHubRepositoryResourceConfigCheckout interface {
  1308  	implBetaManagedAgentsGitHubRepositoryResourceConfigCheckoutUnion()
  1309  }
  1310  
  1311  func (BetaManagedAgentsBranchCheckout) implBetaManagedAgentsGitHubRepositoryResourceConfigCheckoutUnion() {
  1312  }
  1313  func (BetaManagedAgentsCommitCheckout) implBetaManagedAgentsGitHubRepositoryResourceConfigCheckoutUnion() {
  1314  }
  1315  
  1316  // Use the following switch statement to find the correct variant
  1317  //
  1318  //	switch variant := BetaManagedAgentsGitHubRepositoryResourceConfigCheckoutUnion.AsAny().(type) {
  1319  //	case anthropic.BetaManagedAgentsBranchCheckout:
  1320  //	case anthropic.BetaManagedAgentsCommitCheckout:
  1321  //	default:
  1322  //	  fmt.Errorf("no variant present")
  1323  //	}
  1324  func (u BetaManagedAgentsGitHubRepositoryResourceConfigCheckoutUnion) AsAny() anyBetaManagedAgentsGitHubRepositoryResourceConfigCheckout {
  1325  	switch u.Type {
  1326  	case "branch":
  1327  		return u.AsBranch()
  1328  	case "commit":
  1329  		return u.AsCommit()
  1330  	}
  1331  	return nil
  1332  }
  1333  
  1334  func (u BetaManagedAgentsGitHubRepositoryResourceConfigCheckoutUnion) AsBranch() (v BetaManagedAgentsBranchCheckout) {
  1335  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  1336  	return
  1337  }
  1338  
  1339  func (u BetaManagedAgentsGitHubRepositoryResourceConfigCheckoutUnion) AsCommit() (v BetaManagedAgentsCommitCheckout) {
  1340  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  1341  	return
  1342  }
  1343  
  1344  // Returns the unmodified JSON received from the API
  1345  func (u BetaManagedAgentsGitHubRepositoryResourceConfigCheckoutUnion) RawJSON() string {
  1346  	return u.JSON.raw
  1347  }
  1348  
  1349  func (r *BetaManagedAgentsGitHubRepositoryResourceConfigCheckoutUnion) UnmarshalJSON(data []byte) error {
  1350  	return apijson.UnmarshalRoot(data, r)
  1351  }
  1352  
  1353  // The caller invoked the pause endpoint on the deployment.
  1354  type BetaManagedAgentsManualDeploymentPausedReason struct {
  1355  	// Any of "manual".
  1356  	Type BetaManagedAgentsManualDeploymentPausedReasonType `json:"type" api:"required"`
  1357  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  1358  	JSON struct {
  1359  		Type        respjson.Field
  1360  		ExtraFields map[string]respjson.Field
  1361  		raw         string
  1362  	} `json:"-"`
  1363  }
  1364  
  1365  // Returns the unmodified JSON received from the API
  1366  func (r BetaManagedAgentsManualDeploymentPausedReason) RawJSON() string { return r.JSON.raw }
  1367  func (r *BetaManagedAgentsManualDeploymentPausedReason) UnmarshalJSON(data []byte) error {
  1368  	return apijson.UnmarshalRoot(data, r)
  1369  }
  1370  
  1371  type BetaManagedAgentsManualDeploymentPausedReasonType string
  1372  
  1373  const (
  1374  	BetaManagedAgentsManualDeploymentPausedReasonTypeManual BetaManagedAgentsManualDeploymentPausedReasonType = "manual"
  1375  )
  1376  
  1377  // An MCP server host used by the deployment's agent is blocked by the
  1378  // environment's network policy.
  1379  type BetaManagedAgentsMCPEgressBlockedDeploymentPausedReasonError struct {
  1380  	// Any of "mcp_egress_blocked_error".
  1381  	Type BetaManagedAgentsMCPEgressBlockedDeploymentPausedReasonErrorType `json:"type" api:"required"`
  1382  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  1383  	JSON struct {
  1384  		Type        respjson.Field
  1385  		ExtraFields map[string]respjson.Field
  1386  		raw         string
  1387  	} `json:"-"`
  1388  }
  1389  
  1390  // Returns the unmodified JSON received from the API
  1391  func (r BetaManagedAgentsMCPEgressBlockedDeploymentPausedReasonError) RawJSON() string {
  1392  	return r.JSON.raw
  1393  }
  1394  func (r *BetaManagedAgentsMCPEgressBlockedDeploymentPausedReasonError) UnmarshalJSON(data []byte) error {
  1395  	return apijson.UnmarshalRoot(data, r)
  1396  }
  1397  
  1398  type BetaManagedAgentsMCPEgressBlockedDeploymentPausedReasonErrorType string
  1399  
  1400  const (
  1401  	BetaManagedAgentsMCPEgressBlockedDeploymentPausedReasonErrorTypeMCPEgressBlockedError BetaManagedAgentsMCPEgressBlockedDeploymentPausedReasonErrorType = "mcp_egress_blocked_error"
  1402  )
  1403  
  1404  // A memory store referenced by the deployment is archived.
  1405  type BetaManagedAgentsMemoryStoreArchivedDeploymentPausedReasonError struct {
  1406  	// Any of "memory_store_archived_error".
  1407  	Type BetaManagedAgentsMemoryStoreArchivedDeploymentPausedReasonErrorType `json:"type" api:"required"`
  1408  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  1409  	JSON struct {
  1410  		Type        respjson.Field
  1411  		ExtraFields map[string]respjson.Field
  1412  		raw         string
  1413  	} `json:"-"`
  1414  }
  1415  
  1416  // Returns the unmodified JSON received from the API
  1417  func (r BetaManagedAgentsMemoryStoreArchivedDeploymentPausedReasonError) RawJSON() string {
  1418  	return r.JSON.raw
  1419  }
  1420  func (r *BetaManagedAgentsMemoryStoreArchivedDeploymentPausedReasonError) UnmarshalJSON(data []byte) error {
  1421  	return apijson.UnmarshalRoot(data, r)
  1422  }
  1423  
  1424  type BetaManagedAgentsMemoryStoreArchivedDeploymentPausedReasonErrorType string
  1425  
  1426  const (
  1427  	BetaManagedAgentsMemoryStoreArchivedDeploymentPausedReasonErrorTypeMemoryStoreArchivedError BetaManagedAgentsMemoryStoreArchivedDeploymentPausedReasonErrorType = "memory_store_archived_error"
  1428  )
  1429  
  1430  // A memory store attached to each session created from this deployment.
  1431  type BetaManagedAgentsMemoryStoreResourceConfig struct {
  1432  	// The memory store ID (memstore\_...). Must belong to the caller's organization
  1433  	// and workspace.
  1434  	MemoryStoreID string `json:"memory_store_id" api:"required"`
  1435  	// Any of "memory_store".
  1436  	Type BetaManagedAgentsMemoryStoreResourceConfigType `json:"type" api:"required"`
  1437  	// Access mode for an attached memory store.
  1438  	//
  1439  	// Any of "read_write", "read_only".
  1440  	Access BetaManagedAgentsMemoryStoreResourceConfigAccess `json:"access" api:"nullable"`
  1441  	// Per-attachment guidance for the agent on how to use this store. Rendered into
  1442  	// the memory section of the system prompt. Max 4096 chars.
  1443  	Instructions string `json:"instructions" api:"nullable"`
  1444  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  1445  	JSON struct {
  1446  		MemoryStoreID respjson.Field
  1447  		Type          respjson.Field
  1448  		Access        respjson.Field
  1449  		Instructions  respjson.Field
  1450  		ExtraFields   map[string]respjson.Field
  1451  		raw           string
  1452  	} `json:"-"`
  1453  }
  1454  
  1455  // Returns the unmodified JSON received from the API
  1456  func (r BetaManagedAgentsMemoryStoreResourceConfig) RawJSON() string { return r.JSON.raw }
  1457  func (r *BetaManagedAgentsMemoryStoreResourceConfig) UnmarshalJSON(data []byte) error {
  1458  	return apijson.UnmarshalRoot(data, r)
  1459  }
  1460  
  1461  type BetaManagedAgentsMemoryStoreResourceConfigType string
  1462  
  1463  const (
  1464  	BetaManagedAgentsMemoryStoreResourceConfigTypeMemoryStore BetaManagedAgentsMemoryStoreResourceConfigType = "memory_store"
  1465  )
  1466  
  1467  // Access mode for an attached memory store.
  1468  type BetaManagedAgentsMemoryStoreResourceConfigAccess string
  1469  
  1470  const (
  1471  	BetaManagedAgentsMemoryStoreResourceConfigAccessReadWrite BetaManagedAgentsMemoryStoreResourceConfigAccess = "read_write"
  1472  	BetaManagedAgentsMemoryStoreResourceConfigAccessReadOnly  BetaManagedAgentsMemoryStoreResourceConfigAccess = "read_only"
  1473  )
  1474  
  1475  // The deployment's organization is disabled.
  1476  type BetaManagedAgentsOrganizationDisabledDeploymentPausedReasonError struct {
  1477  	// Any of "organization_disabled_error".
  1478  	Type BetaManagedAgentsOrganizationDisabledDeploymentPausedReasonErrorType `json:"type" api:"required"`
  1479  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  1480  	JSON struct {
  1481  		Type        respjson.Field
  1482  		ExtraFields map[string]respjson.Field
  1483  		raw         string
  1484  	} `json:"-"`
  1485  }
  1486  
  1487  // Returns the unmodified JSON received from the API
  1488  func (r BetaManagedAgentsOrganizationDisabledDeploymentPausedReasonError) RawJSON() string {
  1489  	return r.JSON.raw
  1490  }
  1491  func (r *BetaManagedAgentsOrganizationDisabledDeploymentPausedReasonError) UnmarshalJSON(data []byte) error {
  1492  	return apijson.UnmarshalRoot(data, r)
  1493  }
  1494  
  1495  type BetaManagedAgentsOrganizationDisabledDeploymentPausedReasonErrorType string
  1496  
  1497  const (
  1498  	BetaManagedAgentsOrganizationDisabledDeploymentPausedReasonErrorTypeOrganizationDisabledError BetaManagedAgentsOrganizationDisabledDeploymentPausedReasonErrorType = "organization_disabled_error"
  1499  )
  1500  
  1501  // 5-field POSIX cron schedule with computed runtime timestamps.
  1502  type BetaManagedAgentsSchedule struct {
  1503  	// 5-field POSIX cron expression: minute hour day-of-month month day-of-week (e.g.,
  1504  	// "0 9 \* \* 1-5" for weekdays at 9am). Day-of-week is 0-7 where 0 and 7 both mean
  1505  	// Sunday. Extended cron syntax - seconds or year fields, and the special
  1506  	// characters L, W, #, and ? - is not supported, nor are predefined shortcuts
  1507  	// (@daily).
  1508  	Expression string `json:"expression" api:"required"`
  1509  	// IANA timezone identifier (e.g., "America/Los_Angeles", "UTC").
  1510  	Timezone string `json:"timezone" api:"required"`
  1511  	// Any of "cron".
  1512  	Type BetaManagedAgentsScheduleType `json:"type" api:"required"`
  1513  	// A timestamp in RFC 3339 format
  1514  	LastRunAt time.Time `json:"last_run_at" api:"nullable" format:"date-time"`
  1515  	// Up to 5 timestamps of upcoming cron occurrences. Non-empty for active and paused
  1516  	// deployments (reflects what the schedule would do if unpaused); empty once the
  1517  	// deployment is archived (`archived_at` set). Each fire is offset by a small
  1518  	// per-schedule jitter, so a run will actually start at or shortly after its listed
  1519  	// time.
  1520  	UpcomingRunsAt []time.Time `json:"upcoming_runs_at" format:"date-time"`
  1521  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  1522  	JSON struct {
  1523  		Expression     respjson.Field
  1524  		Timezone       respjson.Field
  1525  		Type           respjson.Field
  1526  		LastRunAt      respjson.Field
  1527  		UpcomingRunsAt respjson.Field
  1528  		ExtraFields    map[string]respjson.Field
  1529  		raw            string
  1530  	} `json:"-"`
  1531  }
  1532  
  1533  // Returns the unmodified JSON received from the API
  1534  func (r BetaManagedAgentsSchedule) RawJSON() string { return r.JSON.raw }
  1535  func (r *BetaManagedAgentsSchedule) UnmarshalJSON(data []byte) error {
  1536  	return apijson.UnmarshalRoot(data, r)
  1537  }
  1538  
  1539  type BetaManagedAgentsScheduleType string
  1540  
  1541  const (
  1542  	BetaManagedAgentsScheduleTypeCron BetaManagedAgentsScheduleType = "cron"
  1543  )
  1544  
  1545  // 5-field POSIX cron schedule. Literal wall-clock matching in the configured
  1546  // timezone.
  1547  //
  1548  // The properties Expression, Timezone, Type are required.
  1549  type BetaManagedAgentsScheduleParams struct {
  1550  	// 5-field POSIX cron expression: minute hour day-of-month month day-of-week (e.g.,
  1551  	// "0 9 \* \* 1-5" for weekdays at 9am). Day-of-week is 0-7 where 0 and 7 both mean
  1552  	// Sunday. Extended cron syntax - seconds or year fields, and the special
  1553  	// characters L, W, #, and ? - is not supported, nor are predefined shortcuts
  1554  	// (@daily).
  1555  	Expression string `json:"expression" api:"required"`
  1556  	// Required. IANA timezone identifier (e.g., "America/Los_Angeles", "UTC").
  1557  	// Validated against the IANA timezone database.
  1558  	Timezone string `json:"timezone" api:"required"`
  1559  	// Any of "cron".
  1560  	Type BetaManagedAgentsScheduleParamsType `json:"type,omitzero" api:"required"`
  1561  	paramObj
  1562  }
  1563  
  1564  func (r BetaManagedAgentsScheduleParams) MarshalJSON() (data []byte, err error) {
  1565  	type shadow BetaManagedAgentsScheduleParams
  1566  	return param.MarshalObject(r, (*shadow)(&r))
  1567  }
  1568  func (r *BetaManagedAgentsScheduleParams) UnmarshalJSON(data []byte) error {
  1569  	return apijson.UnmarshalRoot(data, r)
  1570  }
  1571  
  1572  type BetaManagedAgentsScheduleParamsType string
  1573  
  1574  const (
  1575  	BetaManagedAgentsScheduleParamsTypeCron BetaManagedAgentsScheduleParamsType = "cron"
  1576  )
  1577  
  1578  // The deployment configures resources, but its environment is self-hosted and
  1579  // cannot mount them.
  1580  type BetaManagedAgentsSelfHostedResourcesUnsupportedDeploymentPausedReasonError struct {
  1581  	// Any of "self_hosted_resources_unsupported_error".
  1582  	Type BetaManagedAgentsSelfHostedResourcesUnsupportedDeploymentPausedReasonErrorType `json:"type" api:"required"`
  1583  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  1584  	JSON struct {
  1585  		Type        respjson.Field
  1586  		ExtraFields map[string]respjson.Field
  1587  		raw         string
  1588  	} `json:"-"`
  1589  }
  1590  
  1591  // Returns the unmodified JSON received from the API
  1592  func (r BetaManagedAgentsSelfHostedResourcesUnsupportedDeploymentPausedReasonError) RawJSON() string {
  1593  	return r.JSON.raw
  1594  }
  1595  func (r *BetaManagedAgentsSelfHostedResourcesUnsupportedDeploymentPausedReasonError) UnmarshalJSON(data []byte) error {
  1596  	return apijson.UnmarshalRoot(data, r)
  1597  }
  1598  
  1599  type BetaManagedAgentsSelfHostedResourcesUnsupportedDeploymentPausedReasonErrorType string
  1600  
  1601  const (
  1602  	BetaManagedAgentsSelfHostedResourcesUnsupportedDeploymentPausedReasonErrorTypeSelfHostedResourcesUnsupportedError BetaManagedAgentsSelfHostedResourcesUnsupportedDeploymentPausedReasonErrorType = "self_hosted_resources_unsupported_error"
  1603  )
  1604  
  1605  // BetaManagedAgentsSessionResourceConfigUnion contains all possible properties and
  1606  // values from [BetaManagedAgentsGitHubRepositoryResourceConfig],
  1607  // [BetaManagedAgentsFileResourceConfig],
  1608  // [BetaManagedAgentsMemoryStoreResourceConfig].
  1609  //
  1610  // Use the [BetaManagedAgentsSessionResourceConfigUnion.AsAny] method to switch on
  1611  // the variant.
  1612  //
  1613  // Use the methods beginning with 'As' to cast the union to one of its variants.
  1614  type BetaManagedAgentsSessionResourceConfigUnion struct {
  1615  	// Any of "github_repository", "file", "memory_store".
  1616  	Type string `json:"type"`
  1617  	// This field is from variant [BetaManagedAgentsGitHubRepositoryResourceConfig].
  1618  	URL string `json:"url"`
  1619  	// This field is from variant [BetaManagedAgentsGitHubRepositoryResourceConfig].
  1620  	Checkout  BetaManagedAgentsGitHubRepositoryResourceConfigCheckoutUnion `json:"checkout"`
  1621  	MountPath string                                                       `json:"mount_path"`
  1622  	// This field is from variant [BetaManagedAgentsFileResourceConfig].
  1623  	FileID string `json:"file_id"`
  1624  	// This field is from variant [BetaManagedAgentsMemoryStoreResourceConfig].
  1625  	MemoryStoreID string `json:"memory_store_id"`
  1626  	// This field is from variant [BetaManagedAgentsMemoryStoreResourceConfig].
  1627  	Access BetaManagedAgentsMemoryStoreResourceConfigAccess `json:"access"`
  1628  	// This field is from variant [BetaManagedAgentsMemoryStoreResourceConfig].
  1629  	Instructions string `json:"instructions"`
  1630  	JSON         struct {
  1631  		Type          respjson.Field
  1632  		URL           respjson.Field
  1633  		Checkout      respjson.Field
  1634  		MountPath     respjson.Field
  1635  		FileID        respjson.Field
  1636  		MemoryStoreID respjson.Field
  1637  		Access        respjson.Field
  1638  		Instructions  respjson.Field
  1639  		raw           string
  1640  	} `json:"-"`
  1641  }
  1642  
  1643  // anyBetaManagedAgentsSessionResourceConfig is implemented by each variant of
  1644  // [BetaManagedAgentsSessionResourceConfigUnion] to add type safety for the return
  1645  // type of [BetaManagedAgentsSessionResourceConfigUnion.AsAny]
  1646  type anyBetaManagedAgentsSessionResourceConfig interface {
  1647  	implBetaManagedAgentsSessionResourceConfigUnion()
  1648  }
  1649  
  1650  func (BetaManagedAgentsGitHubRepositoryResourceConfig) implBetaManagedAgentsSessionResourceConfigUnion() {
  1651  }
  1652  func (BetaManagedAgentsFileResourceConfig) implBetaManagedAgentsSessionResourceConfigUnion()        {}
  1653  func (BetaManagedAgentsMemoryStoreResourceConfig) implBetaManagedAgentsSessionResourceConfigUnion() {}
  1654  
  1655  // Use the following switch statement to find the correct variant
  1656  //
  1657  //	switch variant := BetaManagedAgentsSessionResourceConfigUnion.AsAny().(type) {
  1658  //	case anthropic.BetaManagedAgentsGitHubRepositoryResourceConfig:
  1659  //	case anthropic.BetaManagedAgentsFileResourceConfig:
  1660  //	case anthropic.BetaManagedAgentsMemoryStoreResourceConfig:
  1661  //	default:
  1662  //	  fmt.Errorf("no variant present")
  1663  //	}
  1664  func (u BetaManagedAgentsSessionResourceConfigUnion) AsAny() anyBetaManagedAgentsSessionResourceConfig {
  1665  	switch u.Type {
  1666  	case "github_repository":
  1667  		return u.AsGitHubRepository()
  1668  	case "file":
  1669  		return u.AsFile()
  1670  	case "memory_store":
  1671  		return u.AsMemoryStore()
  1672  	}
  1673  	return nil
  1674  }
  1675  
  1676  func (u BetaManagedAgentsSessionResourceConfigUnion) AsGitHubRepository() (v BetaManagedAgentsGitHubRepositoryResourceConfig) {
  1677  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  1678  	return
  1679  }
  1680  
  1681  func (u BetaManagedAgentsSessionResourceConfigUnion) AsFile() (v BetaManagedAgentsFileResourceConfig) {
  1682  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  1683  	return
  1684  }
  1685  
  1686  func (u BetaManagedAgentsSessionResourceConfigUnion) AsMemoryStore() (v BetaManagedAgentsMemoryStoreResourceConfig) {
  1687  	apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
  1688  	return
  1689  }
  1690  
  1691  // Returns the unmodified JSON received from the API
  1692  func (u BetaManagedAgentsSessionResourceConfigUnion) RawJSON() string { return u.JSON.raw }
  1693  
  1694  func (r *BetaManagedAgentsSessionResourceConfigUnion) UnmarshalJSON(data []byte) error {
  1695  	return apijson.UnmarshalRoot(data, r)
  1696  }
  1697  
  1698  // A referenced resource no longer exists and its kind was not reported.
  1699  type BetaManagedAgentsSessionResourceNotFoundDeploymentPausedReasonError struct {
  1700  	// Any of "session_resource_not_found_error".
  1701  	Type BetaManagedAgentsSessionResourceNotFoundDeploymentPausedReasonErrorType `json:"type" api:"required"`
  1702  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  1703  	JSON struct {
  1704  		Type        respjson.Field
  1705  		ExtraFields map[string]respjson.Field
  1706  		raw         string
  1707  	} `json:"-"`
  1708  }
  1709  
  1710  // Returns the unmodified JSON received from the API
  1711  func (r BetaManagedAgentsSessionResourceNotFoundDeploymentPausedReasonError) RawJSON() string {
  1712  	return r.JSON.raw
  1713  }
  1714  func (r *BetaManagedAgentsSessionResourceNotFoundDeploymentPausedReasonError) UnmarshalJSON(data []byte) error {
  1715  	return apijson.UnmarshalRoot(data, r)
  1716  }
  1717  
  1718  type BetaManagedAgentsSessionResourceNotFoundDeploymentPausedReasonErrorType string
  1719  
  1720  const (
  1721  	BetaManagedAgentsSessionResourceNotFoundDeploymentPausedReasonErrorTypeSessionResourceNotFoundError BetaManagedAgentsSessionResourceNotFoundDeploymentPausedReasonErrorType = "session_resource_not_found_error"
  1722  )
  1723  
  1724  // A skill referenced by the deployment's agent no longer exists.
  1725  type BetaManagedAgentsSkillNotFoundDeploymentPausedReasonError struct {
  1726  	// Any of "skill_not_found_error".
  1727  	Type BetaManagedAgentsSkillNotFoundDeploymentPausedReasonErrorType `json:"type" api:"required"`
  1728  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  1729  	JSON struct {
  1730  		Type        respjson.Field
  1731  		ExtraFields map[string]respjson.Field
  1732  		raw         string
  1733  	} `json:"-"`
  1734  }
  1735  
  1736  // Returns the unmodified JSON received from the API
  1737  func (r BetaManagedAgentsSkillNotFoundDeploymentPausedReasonError) RawJSON() string {
  1738  	return r.JSON.raw
  1739  }
  1740  func (r *BetaManagedAgentsSkillNotFoundDeploymentPausedReasonError) UnmarshalJSON(data []byte) error {
  1741  	return apijson.UnmarshalRoot(data, r)
  1742  }
  1743  
  1744  type BetaManagedAgentsSkillNotFoundDeploymentPausedReasonErrorType string
  1745  
  1746  const (
  1747  	BetaManagedAgentsSkillNotFoundDeploymentPausedReasonErrorTypeSkillNotFoundError BetaManagedAgentsSkillNotFoundDeploymentPausedReasonErrorType = "skill_not_found_error"
  1748  )
  1749  
  1750  // An unrecognized error auto-paused the deployment. A fallback variant; matches a
  1751  // run whose `error.type` is `unknown_error`.
  1752  type BetaManagedAgentsUnknownDeploymentPausedReasonError struct {
  1753  	// Any of "unknown_error".
  1754  	Type BetaManagedAgentsUnknownDeploymentPausedReasonErrorType `json:"type" api:"required"`
  1755  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  1756  	JSON struct {
  1757  		Type        respjson.Field
  1758  		ExtraFields map[string]respjson.Field
  1759  		raw         string
  1760  	} `json:"-"`
  1761  }
  1762  
  1763  // Returns the unmodified JSON received from the API
  1764  func (r BetaManagedAgentsUnknownDeploymentPausedReasonError) RawJSON() string { return r.JSON.raw }
  1765  func (r *BetaManagedAgentsUnknownDeploymentPausedReasonError) UnmarshalJSON(data []byte) error {
  1766  	return apijson.UnmarshalRoot(data, r)
  1767  }
  1768  
  1769  type BetaManagedAgentsUnknownDeploymentPausedReasonErrorType string
  1770  
  1771  const (
  1772  	BetaManagedAgentsUnknownDeploymentPausedReasonErrorTypeUnknownError BetaManagedAgentsUnknownDeploymentPausedReasonErrorType = "unknown_error"
  1773  )
  1774  
  1775  // A vault referenced by the deployment is archived.
  1776  type BetaManagedAgentsVaultArchivedDeploymentPausedReasonError struct {
  1777  	// Any of "vault_archived_error".
  1778  	Type BetaManagedAgentsVaultArchivedDeploymentPausedReasonErrorType `json:"type" api:"required"`
  1779  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  1780  	JSON struct {
  1781  		Type        respjson.Field
  1782  		ExtraFields map[string]respjson.Field
  1783  		raw         string
  1784  	} `json:"-"`
  1785  }
  1786  
  1787  // Returns the unmodified JSON received from the API
  1788  func (r BetaManagedAgentsVaultArchivedDeploymentPausedReasonError) RawJSON() string {
  1789  	return r.JSON.raw
  1790  }
  1791  func (r *BetaManagedAgentsVaultArchivedDeploymentPausedReasonError) UnmarshalJSON(data []byte) error {
  1792  	return apijson.UnmarshalRoot(data, r)
  1793  }
  1794  
  1795  type BetaManagedAgentsVaultArchivedDeploymentPausedReasonErrorType string
  1796  
  1797  const (
  1798  	BetaManagedAgentsVaultArchivedDeploymentPausedReasonErrorTypeVaultArchivedError BetaManagedAgentsVaultArchivedDeploymentPausedReasonErrorType = "vault_archived_error"
  1799  )
  1800  
  1801  // A vault referenced by the deployment no longer exists.
  1802  type BetaManagedAgentsVaultNotFoundDeploymentPausedReasonError struct {
  1803  	// Any of "vault_not_found_error".
  1804  	Type BetaManagedAgentsVaultNotFoundDeploymentPausedReasonErrorType `json:"type" api:"required"`
  1805  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  1806  	JSON struct {
  1807  		Type        respjson.Field
  1808  		ExtraFields map[string]respjson.Field
  1809  		raw         string
  1810  	} `json:"-"`
  1811  }
  1812  
  1813  // Returns the unmodified JSON received from the API
  1814  func (r BetaManagedAgentsVaultNotFoundDeploymentPausedReasonError) RawJSON() string {
  1815  	return r.JSON.raw
  1816  }
  1817  func (r *BetaManagedAgentsVaultNotFoundDeploymentPausedReasonError) UnmarshalJSON(data []byte) error {
  1818  	return apijson.UnmarshalRoot(data, r)
  1819  }
  1820  
  1821  type BetaManagedAgentsVaultNotFoundDeploymentPausedReasonErrorType string
  1822  
  1823  const (
  1824  	BetaManagedAgentsVaultNotFoundDeploymentPausedReasonErrorTypeVaultNotFoundError BetaManagedAgentsVaultNotFoundDeploymentPausedReasonErrorType = "vault_not_found_error"
  1825  )
  1826  
  1827  // The deployment's workspace was archived.
  1828  type BetaManagedAgentsWorkspaceArchivedDeploymentPausedReasonError struct {
  1829  	// Any of "workspace_archived_error".
  1830  	Type BetaManagedAgentsWorkspaceArchivedDeploymentPausedReasonErrorType `json:"type" api:"required"`
  1831  	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
  1832  	JSON struct {
  1833  		Type        respjson.Field
  1834  		ExtraFields map[string]respjson.Field
  1835  		raw         string
  1836  	} `json:"-"`
  1837  }
  1838  
  1839  // Returns the unmodified JSON received from the API
  1840  func (r BetaManagedAgentsWorkspaceArchivedDeploymentPausedReasonError) RawJSON() string {
  1841  	return r.JSON.raw
  1842  }
  1843  func (r *BetaManagedAgentsWorkspaceArchivedDeploymentPausedReasonError) UnmarshalJSON(data []byte) error {
  1844  	return apijson.UnmarshalRoot(data, r)
  1845  }
  1846  
  1847  type BetaManagedAgentsWorkspaceArchivedDeploymentPausedReasonErrorType string
  1848  
  1849  const (
  1850  	BetaManagedAgentsWorkspaceArchivedDeploymentPausedReasonErrorTypeWorkspaceArchivedError BetaManagedAgentsWorkspaceArchivedDeploymentPausedReasonErrorType = "workspace_archived_error"
  1851  )
  1852  
  1853  type BetaDeploymentNewParams struct {
  1854  	// Agent to deploy. Accepts the `agent` ID string, which pins the latest version,
  1855  	// or an `agent` object with both id and version specified. The agent must exist
  1856  	// and not be archived.
  1857  	Agent BetaDeploymentNewParamsAgentUnion `json:"agent,omitzero" api:"required"`
  1858  	// ID of the `environment` defining the container configuration for sessions
  1859  	// created from this deployment.
  1860  	EnvironmentID string `json:"environment_id" api:"required"`
  1861  	// Events to send to each session immediately after creation. At least 1,
  1862  	// maximum 50.
  1863  	InitialEvents []BetaManagedAgentsDeploymentInitialEventParamsUnion `json:"initial_events,omitzero" api:"required"`
  1864  	// Human-readable name for the deployment.
  1865  	Name string `json:"name" api:"required"`
  1866  	// Description of what the deployment does.
  1867  	Description param.Opt[string] `json:"description,omitzero"`
  1868  	WorkspaceID param.Opt[string] `header:"anthropic-workspace-id,omitzero" json:"-"`
  1869  	// A hard spend ceiling. The session stops issuing new model requests once the
  1870  	// tracked list cost reaches `max_list_cost`.
  1871  	Budget BetaManagedAgentsBudgetLimitParam `json:"budget,omitzero"`
  1872  	// Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up
  1873  	// to 512 chars.
  1874  	Metadata map[string]string `json:"metadata,omitzero"`
  1875  	// Resources (e.g. repositories, files) to mount into each session's container.
  1876  	// Maximum 500.
  1877  	Resources []BetaDeploymentNewParamsResourceUnion `json:"resources,omitzero"`
  1878  	// 5-field POSIX cron schedule. Literal wall-clock matching in the configured
  1879  	// timezone.
  1880  	Schedule BetaManagedAgentsScheduleParams `json:"schedule,omitzero"`
  1881  	// Vault IDs for stored credentials the agent can use during sessions created from
  1882  	// this deployment. Maximum 50.
  1883  	VaultIDs []string `json:"vault_ids,omitzero"`
  1884  	// Optional header to specify the beta version(s) you want to use.
  1885  	Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
  1886  	paramObj
  1887  }
  1888  
  1889  func (r BetaDeploymentNewParams) MarshalJSON() (data []byte, err error) {
  1890  	type shadow BetaDeploymentNewParams
  1891  	return param.MarshalObject(r, (*shadow)(&r))
  1892  }
  1893  func (r *BetaDeploymentNewParams) UnmarshalJSON(data []byte) error {
  1894  	return apijson.UnmarshalRoot(data, r)
  1895  }
  1896  
  1897  // Only one field can be non-zero.
  1898  //
  1899  // Use [param.IsOmitted] to confirm if a field is set.
  1900  type BetaDeploymentNewParamsAgentUnion struct {
  1901  	OfString                  param.Opt[string]             `json:",omitzero,inline"`
  1902  	OfBetaManagedAgentsAgents *BetaManagedAgentsAgentParams `json:",omitzero,inline"`
  1903  	paramUnion
  1904  }
  1905  
  1906  func (u BetaDeploymentNewParamsAgentUnion) MarshalJSON() ([]byte, error) {
  1907  	return param.MarshalUnion(u, u.OfString, u.OfBetaManagedAgentsAgents)
  1908  }
  1909  func (u *BetaDeploymentNewParamsAgentUnion) UnmarshalJSON(data []byte) error {
  1910  	return apijson.UnmarshalRoot(data, u)
  1911  }
  1912  
  1913  func (u *BetaDeploymentNewParamsAgentUnion) asAny() any {
  1914  	if !param.IsOmitted(u.OfString) {
  1915  		return &u.OfString.Value
  1916  	} else if !param.IsOmitted(u.OfBetaManagedAgentsAgents) {
  1917  		return u.OfBetaManagedAgentsAgents
  1918  	}
  1919  	return nil
  1920  }
  1921  
  1922  // Only one field can be non-zero.
  1923  //
  1924  // Use [param.IsOmitted] to confirm if a field is set.
  1925  type BetaDeploymentNewParamsResourceUnion struct {
  1926  	OfGitHubRepository *BetaManagedAgentsGitHubRepositoryResourceParams `json:",omitzero,inline"`
  1927  	OfFile             *BetaManagedAgentsFileResourceParams             `json:",omitzero,inline"`
  1928  	OfMemoryStore      *BetaManagedAgentsMemoryStoreResourceParam       `json:",omitzero,inline"`
  1929  	paramUnion
  1930  }
  1931  
  1932  func (u BetaDeploymentNewParamsResourceUnion) MarshalJSON() ([]byte, error) {
  1933  	return param.MarshalUnion(u, u.OfGitHubRepository, u.OfFile, u.OfMemoryStore)
  1934  }
  1935  func (u *BetaDeploymentNewParamsResourceUnion) UnmarshalJSON(data []byte) error {
  1936  	return apijson.UnmarshalRoot(data, u)
  1937  }
  1938  
  1939  func (u *BetaDeploymentNewParamsResourceUnion) asAny() any {
  1940  	if !param.IsOmitted(u.OfGitHubRepository) {
  1941  		return u.OfGitHubRepository
  1942  	} else if !param.IsOmitted(u.OfFile) {
  1943  		return u.OfFile
  1944  	} else if !param.IsOmitted(u.OfMemoryStore) {
  1945  		return u.OfMemoryStore
  1946  	}
  1947  	return nil
  1948  }
  1949  
  1950  // Returns a pointer to the underlying variant's property, if present.
  1951  func (u BetaDeploymentNewParamsResourceUnion) GetAuthorizationToken() *string {
  1952  	if vt := u.OfGitHubRepository; vt != nil {
  1953  		return &vt.AuthorizationToken
  1954  	}
  1955  	return nil
  1956  }
  1957  
  1958  // Returns a pointer to the underlying variant's property, if present.
  1959  func (u BetaDeploymentNewParamsResourceUnion) GetURL() *string {
  1960  	if vt := u.OfGitHubRepository; vt != nil {
  1961  		return &vt.URL
  1962  	}
  1963  	return nil
  1964  }
  1965  
  1966  // Returns a pointer to the underlying variant's property, if present.
  1967  func (u BetaDeploymentNewParamsResourceUnion) GetCheckout() *BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion {
  1968  	if vt := u.OfGitHubRepository; vt != nil {
  1969  		return &vt.Checkout
  1970  	}
  1971  	return nil
  1972  }
  1973  
  1974  // Returns a pointer to the underlying variant's property, if present.
  1975  func (u BetaDeploymentNewParamsResourceUnion) GetFileID() *string {
  1976  	if vt := u.OfFile; vt != nil {
  1977  		return &vt.FileID
  1978  	}
  1979  	return nil
  1980  }
  1981  
  1982  // Returns a pointer to the underlying variant's property, if present.
  1983  func (u BetaDeploymentNewParamsResourceUnion) GetMemoryStoreID() *string {
  1984  	if vt := u.OfMemoryStore; vt != nil {
  1985  		return &vt.MemoryStoreID
  1986  	}
  1987  	return nil
  1988  }
  1989  
  1990  // Returns a pointer to the underlying variant's property, if present.
  1991  func (u BetaDeploymentNewParamsResourceUnion) GetAccess() *string {
  1992  	if vt := u.OfMemoryStore; vt != nil {
  1993  		return (*string)(&vt.Access)
  1994  	}
  1995  	return nil
  1996  }
  1997  
  1998  // Returns a pointer to the underlying variant's property, if present.
  1999  func (u BetaDeploymentNewParamsResourceUnion) GetInstructions() *string {
  2000  	if vt := u.OfMemoryStore; vt != nil && vt.Instructions.Valid() {
  2001  		return &vt.Instructions.Value
  2002  	}
  2003  	return nil
  2004  }
  2005  
  2006  // Returns a pointer to the underlying variant's property, if present.
  2007  func (u BetaDeploymentNewParamsResourceUnion) GetType() *string {
  2008  	if vt := u.OfGitHubRepository; vt != nil {
  2009  		return (*string)(&vt.Type)
  2010  	} else if vt := u.OfFile; vt != nil {
  2011  		return (*string)(&vt.Type)
  2012  	} else if vt := u.OfMemoryStore; vt != nil {
  2013  		return (*string)(&vt.Type)
  2014  	}
  2015  	return nil
  2016  }
  2017  
  2018  // Returns a pointer to the underlying variant's property, if present.
  2019  func (u BetaDeploymentNewParamsResourceUnion) GetMountPath() *string {
  2020  	if vt := u.OfGitHubRepository; vt != nil && vt.MountPath.Valid() {
  2021  		return &vt.MountPath.Value
  2022  	} else if vt := u.OfFile; vt != nil && vt.MountPath.Valid() {
  2023  		return &vt.MountPath.Value
  2024  	}
  2025  	return nil
  2026  }
  2027  
  2028  func init() {
  2029  	apijson.RegisterUnion[BetaDeploymentNewParamsResourceUnion](
  2030  		"type",
  2031  		apijson.Discriminator[BetaManagedAgentsGitHubRepositoryResourceParams]("github_repository"),
  2032  		apijson.Discriminator[BetaManagedAgentsFileResourceParams]("file"),
  2033  		apijson.Discriminator[BetaManagedAgentsMemoryStoreResourceParam]("memory_store"),
  2034  	)
  2035  }
  2036  
  2037  type BetaDeploymentGetParams struct {
  2038  	WorkspaceID param.Opt[string] `header:"anthropic-workspace-id,omitzero" json:"-"`
  2039  	// Optional header to specify the beta version(s) you want to use.
  2040  	Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
  2041  	paramObj
  2042  }
  2043  
  2044  type BetaDeploymentUpdateParams struct {
  2045  	// Description. Omit to preserve; send empty string or null to clear.
  2046  	Description param.Opt[string] `json:"description,omitzero"`
  2047  	// ID of the `environment` where sessions run. Omit to preserve. Cannot be cleared.
  2048  	EnvironmentID param.Opt[string] `json:"environment_id,omitzero"`
  2049  	// Human-readable name. Must be non-empty. Omit to preserve. Cannot be cleared.
  2050  	Name        param.Opt[string] `json:"name,omitzero"`
  2051  	WorkspaceID param.Opt[string] `header:"anthropic-workspace-id,omitzero" json:"-"`
  2052  	// Metadata patch. Set a key to a string to upsert it, or to null to delete it.
  2053  	// Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars
  2054  	// each) with values up to 512 chars.
  2055  	Metadata map[string]string `json:"metadata,omitzero"`
  2056  	// Session resources. Full replacement. Omit to preserve; send empty array or null
  2057  	// to clear. Maximum 500.
  2058  	Resources []BetaDeploymentUpdateParamsResourceUnion `json:"resources,omitzero"`
  2059  	// Vault IDs. Full replacement. Omit to preserve; send empty array or null to
  2060  	// clear. Maximum 50.
  2061  	VaultIDs []string `json:"vault_ids,omitzero"`
  2062  	// Agent to deploy. Accepts the `agent` ID string, which re-pins to the latest
  2063  	// version, or an `agent` object with both id and version specified. Omit to
  2064  	// preserve. Cannot be cleared.
  2065  	Agent BetaDeploymentUpdateParamsAgentUnion `json:"agent,omitzero"`
  2066  	// A hard spend ceiling. The session stops issuing new model requests once the
  2067  	// tracked list cost reaches `max_list_cost`.
  2068  	Budget BetaManagedAgentsBudgetLimitParam `json:"budget,omitzero"`
  2069  	// Initial events. Full replacement. Omit to preserve. Cannot be cleared. At least
  2070  	// 1, maximum 50.
  2071  	InitialEvents []BetaManagedAgentsDeploymentInitialEventParamsUnion `json:"initial_events,omitzero"`
  2072  	// 5-field POSIX cron schedule. Literal wall-clock matching in the configured
  2073  	// timezone.
  2074  	Schedule BetaManagedAgentsScheduleParams `json:"schedule,omitzero"`
  2075  	// Optional header to specify the beta version(s) you want to use.
  2076  	Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
  2077  	paramObj
  2078  }
  2079  
  2080  func (r BetaDeploymentUpdateParams) MarshalJSON() (data []byte, err error) {
  2081  	type shadow BetaDeploymentUpdateParams
  2082  	return param.MarshalObject(r, (*shadow)(&r))
  2083  }
  2084  func (r *BetaDeploymentUpdateParams) UnmarshalJSON(data []byte) error {
  2085  	return apijson.UnmarshalRoot(data, r)
  2086  }
  2087  
  2088  // Only one field can be non-zero.
  2089  //
  2090  // Use [param.IsOmitted] to confirm if a field is set.
  2091  type BetaDeploymentUpdateParamsAgentUnion struct {
  2092  	OfString                  param.Opt[string]             `json:",omitzero,inline"`
  2093  	OfBetaManagedAgentsAgents *BetaManagedAgentsAgentParams `json:",omitzero,inline"`
  2094  	paramUnion
  2095  }
  2096  
  2097  func (u BetaDeploymentUpdateParamsAgentUnion) MarshalJSON() ([]byte, error) {
  2098  	return param.MarshalUnion(u, u.OfString, u.OfBetaManagedAgentsAgents)
  2099  }
  2100  func (u *BetaDeploymentUpdateParamsAgentUnion) UnmarshalJSON(data []byte) error {
  2101  	return apijson.UnmarshalRoot(data, u)
  2102  }
  2103  
  2104  func (u *BetaDeploymentUpdateParamsAgentUnion) asAny() any {
  2105  	if !param.IsOmitted(u.OfString) {
  2106  		return &u.OfString.Value
  2107  	} else if !param.IsOmitted(u.OfBetaManagedAgentsAgents) {
  2108  		return u.OfBetaManagedAgentsAgents
  2109  	}
  2110  	return nil
  2111  }
  2112  
  2113  // Only one field can be non-zero.
  2114  //
  2115  // Use [param.IsOmitted] to confirm if a field is set.
  2116  type BetaDeploymentUpdateParamsResourceUnion struct {
  2117  	OfGitHubRepository *BetaManagedAgentsGitHubRepositoryResourceParams `json:",omitzero,inline"`
  2118  	OfFile             *BetaManagedAgentsFileResourceParams             `json:",omitzero,inline"`
  2119  	OfMemoryStore      *BetaManagedAgentsMemoryStoreResourceParam       `json:",omitzero,inline"`
  2120  	paramUnion
  2121  }
  2122  
  2123  func (u BetaDeploymentUpdateParamsResourceUnion) MarshalJSON() ([]byte, error) {
  2124  	return param.MarshalUnion(u, u.OfGitHubRepository, u.OfFile, u.OfMemoryStore)
  2125  }
  2126  func (u *BetaDeploymentUpdateParamsResourceUnion) UnmarshalJSON(data []byte) error {
  2127  	return apijson.UnmarshalRoot(data, u)
  2128  }
  2129  
  2130  func (u *BetaDeploymentUpdateParamsResourceUnion) asAny() any {
  2131  	if !param.IsOmitted(u.OfGitHubRepository) {
  2132  		return u.OfGitHubRepository
  2133  	} else if !param.IsOmitted(u.OfFile) {
  2134  		return u.OfFile
  2135  	} else if !param.IsOmitted(u.OfMemoryStore) {
  2136  		return u.OfMemoryStore
  2137  	}
  2138  	return nil
  2139  }
  2140  
  2141  // Returns a pointer to the underlying variant's property, if present.
  2142  func (u BetaDeploymentUpdateParamsResourceUnion) GetAuthorizationToken() *string {
  2143  	if vt := u.OfGitHubRepository; vt != nil {
  2144  		return &vt.AuthorizationToken
  2145  	}
  2146  	return nil
  2147  }
  2148  
  2149  // Returns a pointer to the underlying variant's property, if present.
  2150  func (u BetaDeploymentUpdateParamsResourceUnion) GetURL() *string {
  2151  	if vt := u.OfGitHubRepository; vt != nil {
  2152  		return &vt.URL
  2153  	}
  2154  	return nil
  2155  }
  2156  
  2157  // Returns a pointer to the underlying variant's property, if present.
  2158  func (u BetaDeploymentUpdateParamsResourceUnion) GetCheckout() *BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnion {
  2159  	if vt := u.OfGitHubRepository; vt != nil {
  2160  		return &vt.Checkout
  2161  	}
  2162  	return nil
  2163  }
  2164  
  2165  // Returns a pointer to the underlying variant's property, if present.
  2166  func (u BetaDeploymentUpdateParamsResourceUnion) GetFileID() *string {
  2167  	if vt := u.OfFile; vt != nil {
  2168  		return &vt.FileID
  2169  	}
  2170  	return nil
  2171  }
  2172  
  2173  // Returns a pointer to the underlying variant's property, if present.
  2174  func (u BetaDeploymentUpdateParamsResourceUnion) GetMemoryStoreID() *string {
  2175  	if vt := u.OfMemoryStore; vt != nil {
  2176  		return &vt.MemoryStoreID
  2177  	}
  2178  	return nil
  2179  }
  2180  
  2181  // Returns a pointer to the underlying variant's property, if present.
  2182  func (u BetaDeploymentUpdateParamsResourceUnion) GetAccess() *string {
  2183  	if vt := u.OfMemoryStore; vt != nil {
  2184  		return (*string)(&vt.Access)
  2185  	}
  2186  	return nil
  2187  }
  2188  
  2189  // Returns a pointer to the underlying variant's property, if present.
  2190  func (u BetaDeploymentUpdateParamsResourceUnion) GetInstructions() *string {
  2191  	if vt := u.OfMemoryStore; vt != nil && vt.Instructions.Valid() {
  2192  		return &vt.Instructions.Value
  2193  	}
  2194  	return nil
  2195  }
  2196  
  2197  // Returns a pointer to the underlying variant's property, if present.
  2198  func (u BetaDeploymentUpdateParamsResourceUnion) GetType() *string {
  2199  	if vt := u.OfGitHubRepository; vt != nil {
  2200  		return (*string)(&vt.Type)
  2201  	} else if vt := u.OfFile; vt != nil {
  2202  		return (*string)(&vt.Type)
  2203  	} else if vt := u.OfMemoryStore; vt != nil {
  2204  		return (*string)(&vt.Type)
  2205  	}
  2206  	return nil
  2207  }
  2208  
  2209  // Returns a pointer to the underlying variant's property, if present.
  2210  func (u BetaDeploymentUpdateParamsResourceUnion) GetMountPath() *string {
  2211  	if vt := u.OfGitHubRepository; vt != nil && vt.MountPath.Valid() {
  2212  		return &vt.MountPath.Value
  2213  	} else if vt := u.OfFile; vt != nil && vt.MountPath.Valid() {
  2214  		return &vt.MountPath.Value
  2215  	}
  2216  	return nil
  2217  }
  2218  
  2219  func init() {
  2220  	apijson.RegisterUnion[BetaDeploymentUpdateParamsResourceUnion](
  2221  		"type",
  2222  		apijson.Discriminator[BetaManagedAgentsGitHubRepositoryResourceParams]("github_repository"),
  2223  		apijson.Discriminator[BetaManagedAgentsFileResourceParams]("file"),
  2224  		apijson.Discriminator[BetaManagedAgentsMemoryStoreResourceParam]("memory_store"),
  2225  	)
  2226  }
  2227  
  2228  type BetaDeploymentListParams struct {
  2229  	// Filter by agent ID.
  2230  	AgentID param.Opt[string] `query:"agent_id,omitzero" json:"-"`
  2231  	// Return deployments created at or after this time (inclusive).
  2232  	CreatedAtGte param.Opt[time.Time] `query:"created_at[gte],omitzero" format:"date-time" json:"-"`
  2233  	// Return deployments created at or before this time (inclusive).
  2234  	CreatedAtLte param.Opt[time.Time] `query:"created_at[lte],omitzero" format:"date-time" json:"-"`
  2235  	// When true, includes archived deployments. Default: false (exclude archived).
  2236  	IncludeArchived param.Opt[bool] `query:"include_archived,omitzero" json:"-"`
  2237  	// Maximum results per page. Default 20, maximum 100.
  2238  	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
  2239  	// Opaque pagination cursor.
  2240  	Page        param.Opt[string] `query:"page,omitzero" json:"-"`
  2241  	WorkspaceID param.Opt[string] `header:"anthropic-workspace-id,omitzero" json:"-"`
  2242  	// Filter by status: `active` or `paused`. Omit for both. To include archived
  2243  	// deployments, use `include_archived` instead; the two cannot be combined.
  2244  	//
  2245  	// Any of "active", "paused".
  2246  	Status BetaManagedAgentsDeploymentStatus `query:"status,omitzero" json:"-"`
  2247  	// Optional header to specify the beta version(s) you want to use.
  2248  	Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
  2249  	paramObj
  2250  }
  2251  
  2252  // URLQuery serializes [BetaDeploymentListParams]'s query parameters as
  2253  // `url.Values`.
  2254  func (r BetaDeploymentListParams) URLQuery() (v url.Values, err error) {
  2255  	return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
  2256  		ArrayFormat:  apiquery.ArrayQueryFormatBrackets,
  2257  		NestedFormat: apiquery.NestedQueryFormatBrackets,
  2258  	})
  2259  }
  2260  
  2261  type BetaDeploymentArchiveParams struct {
  2262  	WorkspaceID param.Opt[string] `header:"anthropic-workspace-id,omitzero" json:"-"`
  2263  	// Optional header to specify the beta version(s) you want to use.
  2264  	Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
  2265  	paramObj
  2266  }
  2267  
  2268  type BetaDeploymentPauseParams struct {
  2269  	WorkspaceID param.Opt[string] `header:"anthropic-workspace-id,omitzero" json:"-"`
  2270  	// Optional header to specify the beta version(s) you want to use.
  2271  	Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
  2272  	paramObj
  2273  }
  2274  
  2275  type BetaDeploymentRunParams struct {
  2276  	WorkspaceID param.Opt[string] `header:"anthropic-workspace-id,omitzero" json:"-"`
  2277  	// Optional header to specify the beta version(s) you want to use.
  2278  	Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
  2279  	paramObj
  2280  }
  2281  
  2282  type BetaDeploymentUnpauseParams struct {
  2283  	WorkspaceID param.Opt[string] `header:"anthropic-workspace-id,omitzero" json:"-"`
  2284  	// Optional header to specify the beta version(s) you want to use.
  2285  	Betas []AnthropicBeta `header:"anthropic-beta,omitzero" json:"-"`
  2286  	paramObj
  2287  }