runagent

package
v0.26.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	APIKey  string
	BaseURL string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(httpClient core.HTTPContext, ctx core.IntegrationContext) (*Client, error)

func (*Client) AddSessionResource added in v0.26.0

func (c *Client) AddSessionResource(sessionID string, resource FileResource) error

UploadFile uploads a file to the Anthropic Files API and returns its ID. The file can then be mounted into a session via CreateManagedSessionRequest.Resources. AddSessionResource attaches a file resource to an existing session. POST /v1/sessions/{id}/resources

func (*Client) CleanupFiles added in v0.26.0

func (c *Client) CleanupFiles(fileIDs []string, logWarn func(string, ...any))

CleanupFiles deletes a list of uploaded files, logging failures.

func (*Client) CreateEnvVarCredential added in v0.26.0

func (c *Client) CreateEnvVarCredential(vaultID, displayName, envName, secretValue string, allowedHosts []string) error

CreateEnvVarCredential adds an environment_variable credential to a vault. The secret is injected at the network egress layer; the agent never sees the raw value.

func (*Client) CreateManagedSession

func (c *Client) CreateManagedSession(req CreateManagedSessionRequest) (*ManagedSession, error)

CreateManagedSession creates a Managed Agents session.

func (*Client) CreateVault added in v0.26.0

func (c *Client) CreateVault(displayName string, metadata map[string]string) (string, error)

CreateVault creates a temporary vault and returns its ID.

func (*Client) DeleteFile added in v0.26.0

func (c *Client) DeleteFile(fileID string) error

DeleteFile removes an uploaded file (DELETE /v1/files/{id}).

func (*Client) DeleteManagedSession

func (c *Client) DeleteManagedSession(sessionID string) error

DeleteManagedSession removes a session (DELETE /v1/sessions/{id}). The API does not allow deleting a running session without interrupting first.

func (*Client) DeleteVault added in v0.26.0

func (c *Client) DeleteVault(vaultID string) error

DeleteVault removes a vault and its credentials.

func (*Client) GetLastManagedSessionAgentMessage deprecated

func (c *Client) GetLastManagedSessionAgentMessage(sessionID string) (string, []ManagedSessionEvent, error)

Deprecated: use GetSessionMessages instead.

func (*Client) GetLastManagedSessionAgentMessageWithRetry

func (c *Client) GetLastManagedSessionAgentMessageWithRetry(sessionID string, attempts int, delay time.Duration) (string, []ManagedSessionEvent, error)

func (*Client) GetManagedSession

func (c *Client) GetManagedSession(sessionID string) (*ManagedSession, error)

GetManagedSession retrieves a session by ID (GET /v1/sessions/{id}).

func (*Client) GetSessionMessages added in v0.26.0

func (c *Client) GetSessionMessages(sessionID string) (*SessionMessages, error)

func (*Client) GetSessionMessagesWithRetry added in v0.26.0

func (c *Client) GetSessionMessagesWithRetry(sessionID string, attempts int, delay time.Duration) (*SessionMessages, error)

GetSessionMessagesWithRetry polls until events are fully written (session.status_idle present) or retries are exhausted.

func (*Client) SendManagedSessionInterrupt

func (c *Client) SendManagedSessionInterrupt(sessionID string) error

SendManagedSessionInterrupt sends a user.interrupt event (stop agent mid-execution).

func (*Client) SendManagedSessionUserMessage

func (c *Client) SendManagedSessionUserMessage(sessionID, text string) error

SendManagedSessionUserMessage appends a user.message event to the session. The events endpoint uses ?beta=true per the Managed Agents API.

func (*Client) UploadFile added in v0.26.0

func (c *Client) UploadFile(content io.Reader, filename string) (string, error)

type CreateManagedSessionRequest

type CreateManagedSessionRequest struct {
	// Agent is the agent ID string, or the ID used with AgentVersion for a specific version.
	Agent         string
	AgentVersion  *int
	EnvironmentID string
	VaultIDs      []string
	Resources     []FileResource
}

CreateManagedSessionRequest is the body for POST /v1/sessions.

type ExecutionMetadata

type ExecutionMetadata struct {
	Session *SessionMetadata `json:"session,omitempty" mapstructure:"session,omitempty"`
}

ExecutionMetadata is persisted for the run.

type FileResource added in v0.26.0

type FileResource struct {
	FileID    string
	MountPath string
}

FileResource is a file uploaded via the Files API to mount into the session.

type ManagedSession

type ManagedSession struct {
	ID     string `json:"id"`
	Status string `json:"status"`
}

ManagedSession is a subset of the session resource returned by the API.

type ManagedSessionContentBlock

type ManagedSessionContentBlock struct {
	Type string `json:"type"`
	Text string `json:"text,omitempty"`
}

type ManagedSessionEvent

type ManagedSessionEvent struct {
	Type    string                       `json:"type"`
	Content []ManagedSessionContentBlock `json:"content"`
}

type OutputPayload

type OutputPayload struct {
	Status      string   `json:"status"`
	SessionID   string   `json:"sessionId"`
	LastMessage string   `json:"lastMessage"`
	Messages    []string `json:"messages"`
}

OutputPayload is emitted on the default channel when the run completes.

type RunAgent

type RunAgent struct{}

func (*RunAgent) Cancel

func (a *RunAgent) Cancel(ctx core.ExecutionContext) error

func (*RunAgent) Cleanup

func (a *RunAgent) Cleanup(ctx core.SetupContext) error

func (*RunAgent) Color

func (a *RunAgent) Color() string

func (*RunAgent) Configuration

func (a *RunAgent) Configuration() []configuration.Field

func (*RunAgent) Description

func (a *RunAgent) Description() string

func (*RunAgent) Documentation

func (a *RunAgent) Documentation() string

func (*RunAgent) ExampleOutput

func (a *RunAgent) ExampleOutput() map[string]any

func (*RunAgent) Execute

func (a *RunAgent) Execute(ctx core.ExecutionContext) error

func (*RunAgent) HandleHook

func (a *RunAgent) HandleHook(ctx core.ActionHookContext) error

func (*RunAgent) HandleWebhook

HandleWebhook — Managed Agents completion is observed via polling, not webhooks.

func (*RunAgent) Hooks

func (a *RunAgent) Hooks() []core.Hook

func (*RunAgent) Icon

func (a *RunAgent) Icon() string

func (*RunAgent) Label

func (a *RunAgent) Label() string

func (*RunAgent) Name

func (a *RunAgent) Name() string

func (*RunAgent) OutputChannels

func (a *RunAgent) OutputChannels(config any) []core.OutputChannel

func (*RunAgent) ProcessQueueItem

func (a *RunAgent) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*RunAgent) Setup

func (a *RunAgent) Setup(ctx core.SetupContext) error

type SecretBinding added in v0.26.0

type SecretBinding struct {
	EnvName      string    `json:"envName" mapstructure:"envName"`
	Value        SecretRef `json:"value" mapstructure:"value"`
	AllowedHosts []string  `json:"allowedHosts" mapstructure:"allowedHosts"`
}

SecretBinding maps a SuperPlane secret to an environment variable in the agent session.

type SecretRef added in v0.26.0

type SecretRef struct {
	Secret string `json:"secret" mapstructure:"secret"`
	Key    string `json:"key" mapstructure:"key"`
}

SecretRef references a SuperPlane secret by name and key.

type SessionMessages added in v0.26.0

type SessionMessages struct {
	Messages    []string // all agent.message texts in chronological order
	LastMessage string   // the final agent.message text
	Complete    bool     // true if session.status_idle or session.status_terminated is in the events
}

SessionMessages holds all agent messages and completion status from a session's events.

type SessionMetadata

type SessionMetadata struct {
	ID     string `json:"id" mapstructure:"id"`
	Status string `json:"status" mapstructure:"status"`
}

SessionMetadata tracks the Managed Agents session.

type Spec

type Spec struct {
	// Agent is the managed agent id (use latest if Version is nil, else pin to Version).
	Agent         string          `json:"agent" mapstructure:"agent"`
	Version       *int            `json:"version" mapstructure:"version"`
	EnvironmentID string          `json:"environmentId" mapstructure:"environmentId"`
	Prompt        string          `json:"prompt" mapstructure:"prompt"`
	VaultIDs      []string        `json:"vaultIds" mapstructure:"vaultIds"`
	Files         []string        `json:"files" mapstructure:"files"`
	Secrets       []SecretBinding `json:"secrets" mapstructure:"secrets"`
}

Spec is the workflow node configuration for claude.runAgent.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL