agents

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package agents provides ElevenAgents (Conversational AI) services.

This package handles all aspects of ElevenLabs' Conversational AI platform:

  • Agent management (create, update, delete, duplicate)
  • Agent branches and deployments for version control
  • Conversation history, transcripts, and analysis
  • Knowledge base document management
  • Agent testing with test folders and response tests
  • Conversation simulation (streaming and non-streaming)
  • Batch calling for outbound campaigns
  • Analytics and live call counts

Basic Usage

client, _ := elevenlabs.NewClient()
agentsSvc := client.Agents()

// List agents
agents, _ := agentsSvc.List(ctx, nil)

// Get conversation history
conversations, _ := agentsSvc.ListConversations(ctx, &agents.ListConversationsOptions{
    AgentID: "your-agent-id",
})

Knowledge Base

The knowledge base allows you to add documents that agents can reference:

// Create a text document
doc, _ := agentsSvc.CreateTextDocument(ctx, &agents.CreateTextDocumentRequest{
    Name:    "FAQ",
    Content: "Frequently asked questions...",
})

// Create a URL document (web page crawl)
doc, _ := agentsSvc.CreateURLDocument(ctx, &agents.CreateURLDocumentRequest{
    Name: "Documentation",
    URL:  "https://docs.example.com",
})

Conversation Simulation

Test your agent with simulated conversations:

// Non-streaming simulation
messages, _ := agentsSvc.SimulateConversation(ctx, "agent-id", &agents.SimulateConversationOptions{
    SimulationPersona: "A curious customer asking about products",
    MaxTurns:          5,
})

// Streaming simulation via WebSocket
conn, _ := agentsSvc.SimulateConversationStream(ctx, "agent-id", nil)
defer conn.Close()
for msg := range conn.Messages() {
    fmt.Printf("[%s]: %s\n", msg.Role, msg.Content)
}

Batch Calling

Create outbound calling campaigns:

batch, _ := agentsSvc.CreateBatchCall(ctx, &agents.CreateBatchCallRequest{
    AgentID: "your-agent-id",
    Name:    "Sales Campaign",
    Recipients: []agents.BatchCallRecipient{
        {PhoneNumber: "+1234567890"},
        {PhoneNumber: "+0987654321"},
    },
})

Package agents provides ElevenAgents (Conversational AI) services.

This package handles:

  • Agent management (create, update, delete, duplicate)
  • Agent branches and deployments
  • Conversations and transcripts
  • Knowledge base documents
  • Agent testing and simulation
  • Batch calling
  • Analytics

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

type APIClient interface {
	API() *api.Client
	APIKey() string
	BaseURL() string
}

APIClient is the interface required by the agents package.

type APIError

type APIError struct {
	StatusCode int
	Message    string
}

APIError represents an API error response.

func (*APIError) Error

func (e *APIError) Error() string

type Agent

type Agent struct {
	// AgentID is the unique identifier for the agent.
	AgentID string

	// Name is the display name of the agent.
	Name string

	// Tags are labels used to categorize the agent.
	Tags []string

	// CreatedAtUnixSecs is the creation time in unix seconds.
	CreatedAtUnixSecs int64

	// Archived indicates whether the agent is archived.
	Archived bool
}

Agent represents a conversational AI agent.

type AgentBranch

type AgentBranch struct {
	// ID is the unique identifier for the branch.
	ID string

	// Name is the display name of the branch.
	Name string

	// Description is the description of the branch.
	Description string

	// AgentID is the ID of the agent this branch belongs to.
	AgentID string

	// CreatedAt is the creation time in unix seconds.
	CreatedAt int64

	// LastCommittedAt is the time of the last commit in unix seconds.
	LastCommittedAt int64

	// IsArchived indicates whether the branch is archived.
	IsArchived bool

	// CurrentLivePercentage is the percentage of traffic this branch receives.
	CurrentLivePercentage float64

	// ParentBranchID is the ID of the parent branch, nil if none.
	ParentBranchID *string

	// ParentBranchName is the name of the parent branch, nil if none.
	ParentBranchName *string
}

AgentBranch represents a version branch for an agent.

type AgentLink struct {
	// AgentID is the ID of the agent.
	AgentID string

	// SignedURL is the signed URL for accessing the agent.
	SignedURL string

	// ExpiresAtUnixMillis is when the link expires.
	ExpiresAtUnixMillis int64
}

AgentLink contains information for sharing an agent.

type AgentSummary

type AgentSummary struct {
	// AgentID is the unique identifier for the agent.
	AgentID string

	// Name is the display name of the agent.
	Name string

	// Tags are labels used to categorize the agent.
	Tags []string

	// Archived indicates whether the agent is archived.
	Archived bool

	// CreatedAtUnixSecs is the creation time in unix seconds.
	CreatedAtUnixSecs int64

	// LastCallTimeUnixSecs is the time of the most recent call, nil if no calls.
	LastCallTimeUnixSecs *int64
}

AgentSummary is a lightweight agent listing.

type AgentTopic

type AgentTopic struct {
	// TopicID is the unique identifier for the topic.
	TopicID string

	// Label is the display label for the topic.
	Label string

	// Description is the description of the topic.
	Description string

	// ConversationCount is the number of conversations with this topic.
	ConversationCount int

	// ParentTopicID is the ID of the parent topic, nil if none.
	ParentTopicID *string
}

AgentTopic represents conversation topic analytics.

type BatchCall

type BatchCall struct {
	// ID is the unique identifier for the batch call.
	ID string

	// Name is the display name of the batch call.
	Name string

	// AgentID is the ID of the agent used for the calls.
	AgentID string

	// AgentName is the name of the agent.
	AgentName string

	// BranchID is the branch ID if applicable.
	BranchID string

	// BranchName is the branch name if applicable.
	BranchName string

	// Status is the batch call status: "pending", "running", "completed", "failed", "cancelled".
	Status string

	// TotalCallsScheduled is the total number of calls scheduled.
	TotalCallsScheduled int

	// TotalCallsDispatched is the number of calls dispatched.
	TotalCallsDispatched int

	// TotalCallsFinished is the number of finished calls.
	TotalCallsFinished int

	// RetryCount is the number of retries performed.
	RetryCount int

	// CreatedAtUnix is the creation time in unix seconds.
	CreatedAtUnix int

	// LastUpdatedAtUnix is the last update time in unix seconds.
	LastUpdatedAtUnix int

	// ScheduledTimeUnix is the scheduled start time in unix seconds.
	ScheduledTimeUnix int
}

BatchCall represents a batch calling job.

type BatchCallDetail

type BatchCallDetail struct {
	BatchCall

	// Recipients contains information about each call recipient.
	Recipients []*BatchCallRecipientStatus
}

BatchCallDetail contains detailed batch call information including recipients.

type BatchCallRecipient

type BatchCallRecipient struct {
	// PhoneNumber is the recipient's phone number in E.164 format.
	PhoneNumber string

	// ID is an optional custom identifier for this recipient.
	ID string

	// DynamicVariables are optional context variables for this recipient.
	DynamicVariables map[string]any
}

BatchCallRecipient represents a single call recipient for creating batch calls.

type BatchCallRecipientStatus

type BatchCallRecipientStatus struct {
	// ID is the unique identifier for this recipient.
	ID string

	// PhoneNumber is the recipient's phone number.
	PhoneNumber string

	// ConversationID is the ID of the conversation created for this call.
	ConversationID string

	// Status is the recipient call status.
	Status string

	// CreatedAtUnix is the creation time in unix seconds.
	CreatedAtUnix int

	// UpdatedAtUnix is the last update time in unix seconds.
	UpdatedAtUnix int
}

BatchCallRecipientStatus represents the status of a single recipient in a batch call.

type BulkMoveTestsRequest

type BulkMoveTestsRequest struct {
	TestIDs        []string
	TargetFolderID string
}

BulkMoveTestsRequest contains options for bulk moving tests.

type Conversation

type Conversation struct {
	ConversationID         string
	AgentID                string
	AgentName              string
	BranchID               string
	Status                 string
	StartTimeUnixSecs      int
	CallDurationSecs       int
	MessageCount           int
	CallSuccessful         string
	CallSummaryTitle       string
	TranscriptSummary      string
	Rating                 *float64
	MainLanguage           string
	TerminationReason      string
	Direction              string
	ConversationInitiation string
	ToolNames              []string
	VersionID              string
}

Conversation represents a conversation with an AI agent.

type ConversationAnalysis

type ConversationAnalysis struct {
	CallSuccessful    string
	TranscriptSummary string
	CallSummaryTitle  string
}

ConversationAnalysis represents analysis results for a conversation.

type ConversationDetail

type ConversationDetail struct {
	Conversation
	Transcript []TranscriptMessage
	Metadata   map[string]any
	Analysis   *ConversationAnalysis
	HasAudio   bool
	TagIDs     []string
}

ConversationDetail represents detailed conversation information including transcript.

type CreateAgentRequest

type CreateAgentRequest struct {
	// Name is the display name for the agent.
	Name string `json:"name,omitempty"`

	// Tags are labels for categorizing the agent.
	Tags []string `json:"tags,omitempty"`

	// ConversationConfig is the agent's conversation configuration.
	// This is a flexible map to accommodate the complex nested schema.
	ConversationConfig map[string]any `json:"conversation_config,omitempty"`

	// PlatformSettings are optional platform-specific settings.
	PlatformSettings map[string]any `json:"platform_settings,omitempty"`
}

CreateAgentRequest contains options for creating a new agent.

type CreateBatchCallRequest

type CreateBatchCallRequest struct {
	// AgentID is the ID of the agent to use for calls.
	AgentID string

	// Name is the display name for the batch call.
	Name string

	// Recipients is the list of call recipients.
	Recipients []BatchCallRecipient

	// AgentPhoneNumberID is the phone number ID to use for outbound calls.
	AgentPhoneNumberID string

	// BranchID specifies a specific branch to use.
	BranchID string

	// Environment specifies the environment for variable resolution.
	Environment string

	// ScheduledTimeUnix is an optional scheduled start time in unix seconds.
	ScheduledTimeUnix *int

	// TargetConcurrencyLimit limits the number of parallel calls.
	TargetConcurrencyLimit *int

	// Timezone for scheduling.
	Timezone string
}

CreateBatchCallRequest contains options for creating a batch call.

type CreateBranchRequest

type CreateBranchRequest struct {
	// Name is the display name for the branch.
	Name string `json:"name"`

	// Description is an optional description.
	Description string `json:"description,omitempty"`

	// BaseBranchID is the ID of the branch to fork from.
	BaseBranchID string `json:"base_branch_id,omitempty"`
}

CreateBranchRequest contains options for creating a branch.

type CreateFileDocumentRequest

type CreateFileDocumentRequest struct {
	// Name is the display name for the document.
	Name string

	// File is the file content to upload.
	File io.Reader

	// Filename is the original filename.
	Filename string

	// FolderID is the optional parent folder.
	FolderID string
}

CreateFileDocumentRequest contains options for creating a file document.

type CreateKnowledgeBaseFolderRequest

type CreateKnowledgeBaseFolderRequest struct {
	// Name is the display name for the folder.
	Name string

	// ParentFolderID is the optional parent folder.
	ParentFolderID string
}

CreateKnowledgeBaseFolderRequest contains options for creating a folder.

type CreateTestFolderRequest

type CreateTestFolderRequest struct {
	Name           string
	ParentFolderID string
}

CreateTestFolderRequest contains options for creating a test folder.

type CreateTextDocumentRequest

type CreateTextDocumentRequest struct {
	// Name is the display name for the document.
	Name string

	// Content is the text content.
	Content string

	// FolderID is the optional parent folder.
	FolderID string
}

CreateTextDocumentRequest contains options for creating a text document.

type CreateURLDocumentRequest

type CreateURLDocumentRequest struct {
	// Name is the display name for the document.
	Name string

	// URL is the source URL to crawl.
	URL string

	// FolderID is the optional parent folder.
	FolderID string

	// EnableAutoSync enables auto-sync for URL documents.
	EnableAutoSync bool

	// AutoRemove removes the document if URL becomes unavailable.
	AutoRemove bool
}

CreateURLDocumentRequest contains options for creating a URL document.

type DependentAgent

type DependentAgent struct {
	// ID is the ID of the dependent agent.
	ID string

	// Name is the name of the agent.
	Name string

	// Type is the agent type.
	Type string
}

DependentAgent represents an agent that depends on a knowledge base document.

type DeploymentRequest

type DeploymentRequest struct {
	// BranchID is the ID of the branch to deploy.
	BranchID string

	// Percentage is the traffic percentage for this branch (0-100).
	Percentage float64
}

DeploymentRequest specifies branch deployment configuration.

type Document

type Document struct {
	// ID is the unique identifier for the document.
	ID string

	// Name is the display name of the document.
	Name string

	// Type is the document type: "file", "text", "url", or "folder".
	Type string

	// FolderPath contains the path segment IDs to the document's folder.
	FolderPath []string
}

Document represents a knowledge base document.

type DocumentChunk

type DocumentChunk struct {
	// ID is the unique identifier for the chunk.
	ID string

	// Name is the chunk name.
	Name string

	// Content is the chunk text content.
	Content string
}

DocumentChunk represents a chunk of a document.

type DocumentSummary

type DocumentSummary struct {
	// ID is the unique identifier.
	ID string

	// Name is the display name.
	Name string

	// Type is the document type.
	Type string

	// FolderParentID is the ID of the parent folder.
	FolderParentID string
}

DocumentSummary is a lightweight document listing.

type KnowledgeBaseFolder

type KnowledgeBaseFolder struct {
	// ID is the unique identifier for the folder.
	ID string

	// Name is the display name of the folder.
	Name string

	// FolderPath contains the path segment IDs to the folder.
	FolderPath []string
}

KnowledgeBaseFolder represents a folder for organizing documents.

type ListAgentsOptions

type ListAgentsOptions struct {
	// PageSize is the maximum number of agents to return (max 100, default 30).
	PageSize int

	// Search filters by agent name.
	Search string

	// Archived filters by archived status.
	Archived *bool

	// SortBy specifies the field to sort by ("name", "created_at", etc.).
	SortBy string

	// SortDirection specifies the sort direction ("asc" or "desc").
	SortDirection string

	// Cursor is the pagination cursor from a previous response.
	Cursor string

	// CreatedByUserID filters to agents created by a specific user.
	// Use "@me" to filter to the authenticated user.
	CreatedByUserID string
}

ListAgentsOptions configures the List operation.

type ListAgentsResponse

type ListAgentsResponse struct {
	// Agents is the list of agent summaries.
	Agents []*AgentSummary

	// HasMore indicates if there are more results.
	HasMore bool

	// NextCursor is the cursor for the next page.
	NextCursor string
}

ListAgentsResponse contains paginated agent results.

type ListBatchCallsOptions

type ListBatchCallsOptions struct {
	// PageSize is the maximum number of batch calls to return (max 100).
	PageSize int

	// Cursor is the pagination cursor from a previous response.
	Cursor string

	// AgentID filters to a specific agent.
	AgentID string

	// Status filters by batch status.
	Status string
}

ListBatchCallsOptions configures the ListBatchCalls operation.

type ListBatchCallsResponse

type ListBatchCallsResponse struct {
	// BatchCalls is the list of batch calls.
	BatchCalls []*BatchCall

	// HasMore indicates if there are more results.
	HasMore bool

	// NextCursor is the cursor for the next page.
	NextCursor string
}

ListBatchCallsResponse contains paginated batch call results.

type ListConversationsOptions

type ListConversationsOptions struct {
	// Cursor for pagination
	Cursor string
	// Filter by agent ID
	AgentID string
	// Filter by call success result: "success", "failure", "unknown"
	CallSuccessful string
	// Filter conversations before this Unix timestamp
	CallStartBeforeUnix *int
	// Filter conversations after this Unix timestamp
	CallStartAfterUnix *int
	// Minimum call duration in seconds
	CallDurationMinSecs *int
	// Maximum call duration in seconds
	CallDurationMaxSecs *int
	// Minimum rating (1-5)
	RatingMin *int
	// Maximum rating (1-5)
	RatingMax *int
	// Filter by presence of feedback comments
	HasFeedbackComment *bool
	// Filter by user ID
	UserID string
	// Filter by branch ID
	BranchID string
	// Filter by topic IDs
	TopicIDs []string
	// Filter by tool names used
	ToolNames []string
	// Filter by main languages
	MainLanguages []string
	// Exclude conversations with these statuses
	ExcludeStatuses []string
	// Maximum conversations to return (max 100, default 30)
	PageSize int
	// Whether to include transcript summaries
	IncludeSummary bool
}

ListConversationsOptions contains options for listing conversations.

type ListConversationsResponse

type ListConversationsResponse struct {
	Conversations []*Conversation
	HasMore       bool
	NextCursor    string
}

ListConversationsResponse contains the paginated list of conversations.

type ListDocumentsOptions

type ListDocumentsOptions struct {
	// PageSize is the maximum number of documents to return (max 100).
	PageSize int

	// Search filters by document name prefix.
	Search string
}

ListDocumentsOptions configures the ListDocuments operation.

type ListDocumentsResponse

type ListDocumentsResponse struct {
	// Documents is the list of document summaries.
	Documents []*DocumentSummary

	// HasMore indicates if there are more results.
	HasMore bool

	// NextCursor is the cursor for the next page.
	NextCursor string
}

ListDocumentsResponse contains paginated document results.

type ListTestsOptions

type ListTestsOptions struct {
	PageSize       int
	Cursor         string
	ParentFolderID string
	Search         string
}

ListTestsOptions contains options for listing tests.

type ListTestsResponse

type ListTestsResponse struct {
	Tests      []*TestSummary
	HasMore    bool
	NextCursor string
}

ListTestsResponse contains the paginated list of tests.

type ResponseTest

type ResponseTest struct {
	ID       string
	Name     string
	Type     string // "llm", "tool", "simulation"
	FolderID string
}

ResponseTest represents a response test for an agent.

type ResponseTestSummary

type ResponseTestSummary struct {
	ID       string
	Name     string
	FolderID string
}

ResponseTestSummary represents a summary of a response test.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service provides access to ElevenAgents (Conversational AI) operations.

func New

func New(client APIClient) *Service

New creates a new agents Service.

func (*Service) BulkMoveDocuments

func (s *Service) BulkMoveDocuments(ctx context.Context, documentIDs []string, targetFolderID string) error

BulkMoveDocuments moves multiple documents to a folder.

func (*Service) BulkMoveTests

func (s *Service) BulkMoveTests(ctx context.Context, req *BulkMoveTestsRequest) error

BulkMoveTests moves multiple tests to a folder.

func (*Service) CancelBatchCall

func (s *Service) CancelBatchCall(ctx context.Context, batchCallID string) error

CancelBatchCall cancels a running batch call.

func (*Service) Create

func (s *Service) Create(ctx context.Context, req *CreateAgentRequest) (*Agent, error)

Create creates a new agent.

func (*Service) CreateBatchCall

func (s *Service) CreateBatchCall(ctx context.Context, req *CreateBatchCallRequest) (*BatchCall, error)

CreateBatchCall creates a new batch calling job.

func (*Service) CreateBranch

func (s *Service) CreateBranch(ctx context.Context, agentID string, req *CreateBranchRequest) (*AgentBranch, error)

CreateBranch creates a new branch for an agent.

func (*Service) CreateFileDocument

func (s *Service) CreateFileDocument(ctx context.Context, req *CreateFileDocumentRequest) (*Document, error)

CreateFileDocument creates a document from a file upload.

func (*Service) CreateKnowledgeBaseFolder

func (s *Service) CreateKnowledgeBaseFolder(ctx context.Context, req *CreateKnowledgeBaseFolderRequest) (*KnowledgeBaseFolder, error)

CreateKnowledgeBaseFolder creates a folder for organizing documents.

func (*Service) CreateTestFolder

func (s *Service) CreateTestFolder(ctx context.Context, req *CreateTestFolderRequest) (*TestFolder, error)

CreateTestFolder creates a new test folder.

func (*Service) CreateTextDocument

func (s *Service) CreateTextDocument(ctx context.Context, req *CreateTextDocumentRequest) (*Document, error)

CreateTextDocument creates a document from text content.

func (*Service) CreateURLDocument

func (s *Service) CreateURLDocument(ctx context.Context, req *CreateURLDocumentRequest) (*Document, error)

CreateURLDocument creates a document from a URL.

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, agentID string) error

Delete deletes an agent.

func (*Service) DeleteBatchCall

func (s *Service) DeleteBatchCall(ctx context.Context, batchCallID string) error

DeleteBatchCall deletes a batch call.

func (*Service) DeleteConversation

func (s *Service) DeleteConversation(ctx context.Context, conversationID string) error

DeleteConversation removes a conversation.

func (*Service) DeleteDocument

func (s *Service) DeleteDocument(ctx context.Context, documentID string) error

DeleteDocument removes a document.

func (*Service) DeleteTest

func (s *Service) DeleteTest(ctx context.Context, testID string) error

DeleteTest deletes a test.

func (*Service) DeleteTestFolder

func (s *Service) DeleteTestFolder(ctx context.Context, folderID string) error

DeleteTestFolder deletes a test folder.

func (*Service) Deploy

func (s *Service) Deploy(ctx context.Context, agentID string, deployments []DeploymentRequest) error

Deploy deploys branches with specified traffic percentages.

func (*Service) Duplicate

func (s *Service) Duplicate(ctx context.Context, agentID string, name string) (*Agent, error)

Duplicate creates a copy of an agent.

func (*Service) Get

func (s *Service) Get(ctx context.Context, agentID string) (*Agent, error)

Get retrieves an agent by ID.

func (*Service) GetBatchCall

func (s *Service) GetBatchCall(ctx context.Context, batchCallID string) (*BatchCallDetail, error)

GetBatchCall retrieves a batch call by ID.

func (*Service) GetBranch

func (s *Service) GetBranch(ctx context.Context, agentID, branchID string) (*AgentBranch, error)

GetBranch retrieves a specific branch.

func (*Service) GetConversation

func (s *Service) GetConversation(ctx context.Context, conversationID string) (*ConversationDetail, error)

GetConversation retrieves a specific conversation by ID.

func (*Service) GetConversationAudio

func (s *Service) GetConversationAudio(ctx context.Context, conversationID string) (io.ReadCloser, error)

GetConversationAudio retrieves the audio recording for a conversation.

func (*Service) GetDocument

func (s *Service) GetDocument(ctx context.Context, documentID string) (*Document, error)

GetDocument retrieves a document by ID.

func (*Service) GetDocumentChunk

func (s *Service) GetDocumentChunk(ctx context.Context, documentID, chunkID string) (*DocumentChunk, error)

GetDocumentChunk retrieves a specific chunk from a document by chunk ID.

func (*Service) GetDocumentChunks

func (s *Service) GetDocumentChunks(ctx context.Context, documentID string) ([]*DocumentChunk, error)

GetDocumentChunks retrieves all chunks for a document.

func (*Service) GetDocumentContent

func (s *Service) GetDocumentContent(ctx context.Context, documentID string) (io.ReadCloser, error)

GetDocumentContent retrieves the content of a document.

func (*Service) GetDocumentDependentAgents

func (s *Service) GetDocumentDependentAgents(ctx context.Context, documentID string) ([]*DependentAgent, error)

GetDocumentDependentAgents retrieves agents that depend on a document.

func (*Service) GetKnowledgeBaseSize

func (s *Service) GetKnowledgeBaseSize(ctx context.Context, agentID string) (float64, error)

GetKnowledgeBaseSize retrieves the knowledge base size for an agent.

func (s *Service) GetLink(ctx context.Context, agentID string) (*AgentLink, error)

GetLink returns the shareable link for an agent.

func (*Service) GetLiveCount

func (s *Service) GetLiveCount(ctx context.Context) (int, error)

GetLiveCount returns the number of active ongoing conversations.

func (*Service) GetResponseTest

func (s *Service) GetResponseTest(ctx context.Context, testID string) (*ResponseTest, error)

GetResponseTest retrieves a response test by ID.

func (*Service) GetResponseTestSummaries

func (s *Service) GetResponseTestSummaries(ctx context.Context, testIDs []string) (map[string]*ResponseTestSummary, error)

GetResponseTestSummaries retrieves summaries for multiple response tests.

func (*Service) GetTestFolder

func (s *Service) GetTestFolder(ctx context.Context, folderID string) (*TestFolder, error)

GetTestFolder retrieves a test folder by ID.

func (*Service) GetTopics

func (s *Service) GetTopics(ctx context.Context, agentID string) ([]*AgentTopic, error)

GetTopics returns conversation topic analytics for an agent.

func (*Service) GetWidget

func (s *Service) GetWidget(ctx context.Context, agentID string) (*WidgetConfig, error)

GetWidget retrieves the widget configuration for an agent.

func (*Service) List

List returns a paginated list of agents.

func (*Service) ListBatchCalls

func (s *Service) ListBatchCalls(ctx context.Context, opts *ListBatchCallsOptions) (*ListBatchCallsResponse, error)

ListBatchCalls returns a paginated list of batch calls.

func (*Service) ListBranches

func (s *Service) ListBranches(ctx context.Context, agentID string) ([]*AgentBranch, error)

ListBranches returns all branches for an agent.

func (*Service) ListConversations

func (s *Service) ListConversations(ctx context.Context, opts *ListConversationsOptions) (*ListConversationsResponse, error)

ListConversations returns a paginated list of conversations.

func (*Service) ListDocuments

func (s *Service) ListDocuments(ctx context.Context, opts *ListDocumentsOptions) (*ListDocumentsResponse, error)

ListDocuments returns a paginated list of documents.

func (*Service) ListTests

func (s *Service) ListTests(ctx context.Context, opts *ListTestsOptions) (*ListTestsResponse, error)

ListTests lists tests and folders.

func (*Service) MergeBranch

func (s *Service) MergeBranch(ctx context.Context, agentID, sourceBranchID, targetBranchID string) error

MergeBranch merges a source branch into a target branch.

func (*Service) MoveDocument

func (s *Service) MoveDocument(ctx context.Context, documentID, targetFolderID string) error

MoveDocument moves a document to a different folder.

func (*Service) RefreshURLDocument

func (s *Service) RefreshURLDocument(ctx context.Context, documentID string) error

RefreshURLDocument refreshes the content of a URL document.

func (*Service) RetryBatchCall

func (s *Service) RetryBatchCall(ctx context.Context, batchCallID string) (*BatchCall, error)

RetryBatchCall retries failed calls in a batch.

func (*Service) RunConversationAnalysis

func (s *Service) RunConversationAnalysis(ctx context.Context, conversationID string) error

RunConversationAnalysis triggers analysis on a conversation.

func (*Service) SearchConversations

func (s *Service) SearchConversations(ctx context.Context, query string, opts *ListConversationsOptions) (*ListConversationsResponse, error)

SearchConversations performs a text search across conversation transcripts.

func (*Service) SimulateConversation

func (s *Service) SimulateConversation(ctx context.Context, agentID string, opts *SimulateConversationOptions) ([]*SimulationMessage, error)

SimulateConversation runs a non-streaming conversation simulation.

func (*Service) SimulateConversationStream

func (s *Service) SimulateConversationStream(ctx context.Context, agentID string, opts *SimulateConversationOptions) (*SimulationConnection, error)

SimulateConversationStream opens a streaming simulation connection.

func (*Service) SubmitConversationFeedback

func (s *Service) SubmitConversationFeedback(ctx context.Context, conversationID string, feedback string) error

SubmitConversationFeedback submits user feedback for a conversation. Feedback must be "like" or "dislike".

func (*Service) Update

func (s *Service) Update(ctx context.Context, agentID string, req *UpdateAgentRequest) (*Agent, error)

Update updates an existing agent.

func (*Service) UpdateBranch

func (s *Service) UpdateBranch(ctx context.Context, agentID, branchID string, req *UpdateBranchRequest) (*AgentBranch, error)

UpdateBranch updates a branch.

func (*Service) UpdateTestFolder

func (s *Service) UpdateTestFolder(ctx context.Context, folderID string, req *UpdateTestFolderRequest) (*TestFolder, error)

UpdateTestFolder updates a test folder.

func (*Service) UploadAvatar

func (s *Service) UploadAvatar(ctx context.Context, agentID string, avatarData io.Reader) error

UploadAvatar uploads an avatar image for an agent.

type SimulateConversationOptions

type SimulateConversationOptions struct {
	// SimulationPersona describes the simulated user persona.
	SimulationPersona string

	// InitialMessage is the first message to send.
	InitialMessage string

	// MaxTurns limits the conversation length.
	MaxTurns int

	// IncludeAudio requests audio output.
	IncludeAudio bool
}

SimulateConversationOptions configures the simulation.

type SimulationConnection

type SimulationConnection struct {
	// contains filtered or unexported fields
}

SimulationConnection represents a streaming conversation simulation.

func (*SimulationConnection) Close

func (sc *SimulationConnection) Close() error

Close closes the WebSocket connection.

func (*SimulationConnection) Errors

func (sc *SimulationConnection) Errors() <-chan error

Errors returns a channel that receives errors from the connection.

func (*SimulationConnection) Messages

func (sc *SimulationConnection) Messages() <-chan *SimulationMessage

Messages returns a channel that receives simulation messages.

func (*SimulationConnection) SendMessage

func (sc *SimulationConnection) SendMessage(content string) error

SendMessage sends a user message in the simulation.

type SimulationMessage

type SimulationMessage struct {
	// Role indicates who sent the message ("user" or "agent").
	Role string

	// Content is the text content of the message.
	Content string

	// Audio contains optional audio data (base64 encoded).
	Audio []byte

	// Metadata contains additional message metadata.
	Metadata map[string]any
}

SimulationMessage represents a message in the simulation.

type TestFolder

type TestFolder struct {
	ID            string
	Name          string
	ChildrenCount int
	Path          []TestFolderSegment
}

TestFolder represents a folder for organizing tests.

type TestFolderSegment

type TestFolderSegment struct {
	ID   string
	Name string
}

TestFolderSegment represents a segment in the folder path.

type TestSummary

type TestSummary struct {
	ID            string
	Name          string
	FolderID      string
	CreatedAtUnix int
	EntityType    string
	Path          []TestFolderSegment
}

TestSummary represents a summary of a test (used for listing).

type ToolCall

type ToolCall struct {
	ToolName  string
	RequestID string
	Params    map[string]any
}

ToolCall represents a tool invocation in a conversation.

type TranscriptMessage

type TranscriptMessage struct {
	Role           string
	Message        string
	TimeInCallSecs int
	Interrupted    bool
	ToolCalls      []ToolCall
}

TranscriptMessage represents a message in the conversation transcript.

type UpdateAgentRequest

type UpdateAgentRequest struct {
	// Name is the new display name for the agent.
	Name string `json:"name,omitempty"`

	// Tags are the new labels for the agent.
	Tags []string `json:"tags,omitempty"`

	// ConversationConfig is the agent's conversation configuration.
	ConversationConfig map[string]any `json:"conversation_config,omitempty"`

	// PlatformSettings are optional platform-specific settings.
	PlatformSettings map[string]any `json:"platform_settings,omitempty"`
}

UpdateAgentRequest contains options for updating an agent.

type UpdateBranchRequest

type UpdateBranchRequest struct {
	// Name is the new display name for the branch.
	Name string `json:"name,omitempty"`

	// Description is the new description.
	Description string `json:"description,omitempty"`

	// IsArchived sets the archived status.
	IsArchived *bool `json:"is_archived,omitempty"`
}

UpdateBranchRequest contains options for updating a branch.

type UpdateTestFolderRequest

type UpdateTestFolderRequest struct {
	Name string
}

UpdateTestFolderRequest contains options for updating a test folder.

type WidgetConfig

type WidgetConfig struct {
	// AgentID is the ID of the agent.
	AgentID string `json:"agent_id"`

	// WidgetConfig contains widget settings.
	WidgetConfig map[string]any `json:"widget_config,omitempty"`
}

WidgetConfig contains agent widget configuration.

Jump to

Keyboard shortcuts

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