Documentation
¶
Index ¶
- type CompletionRequest
- type CrewServerAgent
- func (agent *CrewServerAgent) AddChatAgentToCrew(id string, chatAgent *chat.Agent) error
- func (agent *CrewServerAgent) AddMessage(role roles.Role, content string)
- func (agent *CrewServerAgent) CompressChatAgentContext() (int, error)
- func (agent *CrewServerAgent) CompressChatAgentContextIfOverLimit() (int, error)
- func (ca *CrewServerAgent) DetectTopicThenGetAgentId(query string) (string, error)
- func (agent *CrewServerAgent) ExportMessagesToJSON() (string, error)
- func (agent *CrewServerAgent) GenerateCompletion(userMessages []messages.Message) (*chat.CompletionResult, error)
- func (agent *CrewServerAgent) GenerateCompletionWithReasoning(userMessages []messages.Message) (*chat.ReasoningResult, error)
- func (agent *CrewServerAgent) GenerateStreamCompletion(userMessages []messages.Message, callback chat.StreamCallback) (*chat.CompletionResult, error)
- func (agent *CrewServerAgent) GenerateStreamCompletionWithReasoning(userMessages []messages.Message, reasoningCallback chat.StreamCallback, ...) (*chat.ReasoningResult, error)
- func (agent *CrewServerAgent) GetChatAgents() map[string]*chat.Agent
- func (agent *CrewServerAgent) GetCompressorAgent() *compressor.Agent
- func (agent *CrewServerAgent) GetConfirmationPromptFn() func(string, string) tools.ConfirmationResponse
- func (agent *CrewServerAgent) GetContextSize() int
- func (agent *CrewServerAgent) GetContextSizeLimit() int
- func (agent *CrewServerAgent) GetMaxSimilarities() int
- func (agent *CrewServerAgent) GetMessages() []messages.Message
- func (agent *CrewServerAgent) GetModelID() string
- func (agent *CrewServerAgent) GetName() string
- func (agent *CrewServerAgent) GetOrchestratorAgent() agents.OrchestratorAgent
- func (agent *CrewServerAgent) GetPort() string
- func (agent *CrewServerAgent) GetRagAgent() *rag.Agent
- func (agent *CrewServerAgent) GetSelectedAgentId() string
- func (agent *CrewServerAgent) GetSimilarityLimit() float64
- func (agent *CrewServerAgent) GetToolsAgent() *tools.Agent
- func (agent *CrewServerAgent) Kind() agents.Kind
- func (agent *CrewServerAgent) RemoveChatAgentFromCrew(id string) error
- func (agent *CrewServerAgent) ResetMessages()
- func (agent *CrewServerAgent) SetChatAgents(chatAgents map[string]*chat.Agent)
- func (agent *CrewServerAgent) SetCompressorAgent(compressorAgent *compressor.Agent)
- func (agent *CrewServerAgent) SetConfirmationPromptFn(fn func(string, string) tools.ConfirmationResponse)
- func (agent *CrewServerAgent) SetContextSizeLimit(limit int)
- func (agent *CrewServerAgent) SetExecuteFunction(fn func(string, string) (string, error))
- func (agent *CrewServerAgent) SetMaxSimilarities(n int)
- func (agent *CrewServerAgent) SetOrchestratorAgent(orchestratorAgent agents.OrchestratorAgent)
- func (agent *CrewServerAgent) SetPort(port string)
- func (agent *CrewServerAgent) SetRagAgent(ragAgent *rag.Agent)
- func (agent *CrewServerAgent) SetSelectedAgentId(agentId string) error
- func (agent *CrewServerAgent) SetSimilarityLimit(limit float64)
- func (agent *CrewServerAgent) SetToolsAgent(toolsAgent *tools.Agent)
- func (agent *CrewServerAgent) StartServer() error
- func (agent *CrewServerAgent) StopStream()
- type CrewServerAgentOption
- func AfterCompletion(fn func(*CrewServerAgent)) CrewServerAgentOption
- func BeforeCompletion(fn func(*CrewServerAgent)) CrewServerAgentOption
- func WithAgentCrew(agentCrew map[string]*chat.Agent, selectedAgentId string) CrewServerAgentOption
- func WithCompressorAgent(compressorAgent *compressor.Agent) CrewServerAgentOption
- func WithCompressorAgentAndContextSize(compressorAgent *compressor.Agent, contextSizeLimit int) CrewServerAgentOption
- func WithConfirmationPromptFn(fn func(string, string) tools.ConfirmationResponse) CrewServerAgentOption
- func WithExecuteFn(fn func(string, string) (string, error)) CrewServerAgentOption
- func WithMatchAgentIdToTopicFn(fn func(string, string) string) CrewServerAgentOption
- func WithOrchestratorAgent(orchestratorAgent agents.OrchestratorAgent) CrewServerAgentOption
- func WithPort(port int) CrewServerAgentOption
- func WithRagAgent(ragAgent *rag.Agent) CrewServerAgentOption
- func WithRagAgentAndSimilarityConfig(ragAgent *rag.Agent, similarityLimit float64, maxSimilarities int) CrewServerAgentOption
- func WithSingleAgent(chatAgent *chat.Agent) CrewServerAgentOption
- func WithTLSCert(certData, keyData []byte) CrewServerAgentOption
- func WithTLSCertFromFile(certPath, keyPath string) CrewServerAgentOption
- func WithToolsAgent(toolsAgent *tools.Agent) CrewServerAgentOption
- type MemoryResponse
- type OperationRequest
- type PendingOperation
- type TokensResponse
- type ToolCallNotification
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompletionRequest ¶
type CompletionRequest = serverbase.CompletionRequest
Re-export types from serverbase for backward compatibility
type CrewServerAgent ¶
type CrewServerAgent struct {
*serverbase.BaseServerAgent
// HTTP server multiplexer for custom routes
Mux *http.ServeMux
// contains filtered or unexported fields
}
CrewServerAgent wraps BaseServerAgent with crew-specific functionality
func NewAgent ¶
func NewAgent(ctx context.Context, options ...CrewServerAgentOption) (*CrewServerAgent, error)
NewAgent creates a new crew server agent with options
Available options:
- WithAgentCrew(agentCrew, selectedAgentId) - Sets the crew of agents and the selected agent ID
- WithSingleAgent(chatAgent) - Creates a crew with a single agent (key: "single", selectedAgentId: "single")
- WithPort(port) - Sets the HTTP server port as int (default: 3500)
- WithMatchAgentIdToTopicFn(fn) - Sets the function to match agent ID to topic for routing
- WithExecuteFn(fn) - Sets the custom function executor for tool execution
- WithToolsAgent(toolsAgent) - Attaches a tools agent for function calling capabilities
- WithCompressorAgent(compressorAgent) - Attaches a compressor agent for context compression
- WithCompressorAgentAndContextSize(compressorAgent, contextSizeLimit) - Attaches a compressor agent and sets the context size limit
- WithRagAgent(ragAgent) - Attaches a RAG agent for document retrieval
- WithRagAgentAndSimilarityConfig(ragAgent, similarityLimit, maxSimilarities) - Attaches a RAG agent and configures similarity settings
- WithConfirmationPromptFn(fn) - Sets a custom confirmation prompt function for tool call confirmation
- WithTLSCert(certData, keyData) - Enables HTTPS with PEM-encoded certificate and key data
- WithTLSCertFromFile(certPath, keyPath) - Enables HTTPS with certificate and key files
- WithOrchestratorAgent(orchestratorAgent) - Attaches an orchestrator agent for routing/topic detection
- BeforeCompletion(fn) - Sets a hook called before each handleCompletion call
- AfterCompletion(fn) - Sets a hook called after each handleCompletion call
At least one of WithAgentCrew or WithSingleAgent must be provided.
func (*CrewServerAgent) AddChatAgentToCrew ¶
func (agent *CrewServerAgent) AddChatAgentToCrew(id string, chatAgent *chat.Agent) error
AddChatAgentToCrew adds a new chat agent to the crew
func (*CrewServerAgent) AddMessage ¶
func (agent *CrewServerAgent) AddMessage(role roles.Role, content string)
AddMessage adds a message to the conversation history
func (*CrewServerAgent) CompressChatAgentContext ¶
func (agent *CrewServerAgent) CompressChatAgentContext() (int, error)
CompressChatAgentContext compresses the chat agent context.
func (*CrewServerAgent) CompressChatAgentContextIfOverLimit ¶
func (agent *CrewServerAgent) CompressChatAgentContextIfOverLimit() (int, error)
CompressChatAgentContextIfOverLimit compresses the chat agent context if it exceeds the size limit.
func (*CrewServerAgent) DetectTopicThenGetAgentId ¶
func (ca *CrewServerAgent) DetectTopicThenGetAgentId(query string) (string, error)
DetectTopicThenSetCurrentAgent sets the current active chat agent based on the detected topic from the query. query -> user message
func (*CrewServerAgent) ExportMessagesToJSON ¶
func (agent *CrewServerAgent) ExportMessagesToJSON() (string, error)
ExportMessagesToJSON exports the conversation history to JSON
func (*CrewServerAgent) GenerateCompletion ¶
func (agent *CrewServerAgent) GenerateCompletion(userMessages []messages.Message) (*chat.CompletionResult, error)
GenerateCompletion sends messages and returns the completion result
func (*CrewServerAgent) GenerateCompletionWithReasoning ¶
func (agent *CrewServerAgent) GenerateCompletionWithReasoning(userMessages []messages.Message) (*chat.ReasoningResult, error)
GenerateCompletionWithReasoning sends messages and returns the completion result with reasoning
func (*CrewServerAgent) GenerateStreamCompletion ¶
func (agent *CrewServerAgent) GenerateStreamCompletion( userMessages []messages.Message, callback chat.StreamCallback, ) (*chat.CompletionResult, error)
GenerateStreamCompletion sends messages and streams the response via callback
func (*CrewServerAgent) GenerateStreamCompletionWithReasoning ¶
func (agent *CrewServerAgent) GenerateStreamCompletionWithReasoning( userMessages []messages.Message, reasoningCallback chat.StreamCallback, responseCallback chat.StreamCallback, ) (*chat.ReasoningResult, error)
GenerateStreamCompletionWithReasoning sends messages and streams both reasoning and response
func (*CrewServerAgent) GetChatAgents ¶
func (agent *CrewServerAgent) GetChatAgents() map[string]*chat.Agent
GetChatAgents returns the map of chat agents
func (*CrewServerAgent) GetCompressorAgent ¶
func (agent *CrewServerAgent) GetCompressorAgent() *compressor.Agent
GetCompressorAgent returns the compressor agent
func (*CrewServerAgent) GetConfirmationPromptFn ¶ added in v1.2.9
func (agent *CrewServerAgent) GetConfirmationPromptFn() func(string, string) tools.ConfirmationResponse
GetConfirmationPromptFn returns the confirmation prompt function
func (*CrewServerAgent) GetContextSize ¶
func (agent *CrewServerAgent) GetContextSize() int
GetContextSize returns the approximate size of the current context
func (*CrewServerAgent) GetContextSizeLimit ¶
func (agent *CrewServerAgent) GetContextSizeLimit() int
GetContextSizeLimit returns the context size limit for compression
func (*CrewServerAgent) GetMaxSimilarities ¶
func (agent *CrewServerAgent) GetMaxSimilarities() int
GetMaxSimilarities returns the maximum number of similar documents to retrieve
func (*CrewServerAgent) GetMessages ¶
func (agent *CrewServerAgent) GetMessages() []messages.Message
GetMessages returns all conversation messages
func (*CrewServerAgent) GetModelID ¶
func (agent *CrewServerAgent) GetModelID() string
GetModelID returns the model ID
func (*CrewServerAgent) GetName ¶
func (agent *CrewServerAgent) GetName() string
GetName returns the agent name
func (*CrewServerAgent) GetOrchestratorAgent ¶ added in v1.0.0
func (agent *CrewServerAgent) GetOrchestratorAgent() agents.OrchestratorAgent
GetOrchestratorAgent returns the orchestrator agent
func (*CrewServerAgent) GetPort ¶
func (agent *CrewServerAgent) GetPort() string
GetPort returns the HTTP port
func (*CrewServerAgent) GetRagAgent ¶
func (agent *CrewServerAgent) GetRagAgent() *rag.Agent
GetRagAgent returns the RAG agent
func (*CrewServerAgent) GetSelectedAgentId ¶ added in v1.1.4
func (agent *CrewServerAgent) GetSelectedAgentId() string
GetSelectedAgentId returns the currently selected agent ID
func (*CrewServerAgent) GetSimilarityLimit ¶
func (agent *CrewServerAgent) GetSimilarityLimit() float64
GetSimilarityLimit returns the similarity limit for document retrieval
func (*CrewServerAgent) GetToolsAgent ¶
func (agent *CrewServerAgent) GetToolsAgent() *tools.Agent
GetToolsAgent returns the tools agent
func (*CrewServerAgent) Kind ¶
func (agent *CrewServerAgent) Kind() agents.Kind
Kind returns the agent type
func (*CrewServerAgent) RemoveChatAgentFromCrew ¶
func (agent *CrewServerAgent) RemoveChatAgentFromCrew(id string) error
RemoveChatAgentFromCrew removes a chat agent from the crew
func (*CrewServerAgent) ResetMessages ¶
func (agent *CrewServerAgent) ResetMessages()
ResetMessages clears all messages except the system instruction
func (*CrewServerAgent) SetChatAgents ¶
func (agent *CrewServerAgent) SetChatAgents(chatAgents map[string]*chat.Agent)
SetChatAgents sets the map of chat agents
func (*CrewServerAgent) SetCompressorAgent ¶
func (agent *CrewServerAgent) SetCompressorAgent(compressorAgent *compressor.Agent)
SetCompressorAgent sets the compressor agent
func (*CrewServerAgent) SetConfirmationPromptFn ¶ added in v1.2.9
func (agent *CrewServerAgent) SetConfirmationPromptFn(fn func(string, string) tools.ConfirmationResponse)
SetConfirmationPromptFn sets the confirmation prompt function for tool call confirmation
func (*CrewServerAgent) SetContextSizeLimit ¶
func (agent *CrewServerAgent) SetContextSizeLimit(limit int)
SetContextSizeLimit sets the context size limit for compression
func (*CrewServerAgent) SetExecuteFunction ¶
func (agent *CrewServerAgent) SetExecuteFunction(fn func(string, string) (string, error))
SetExecuteFunction allows the user to set a custom execute function
func (*CrewServerAgent) SetMaxSimilarities ¶
func (agent *CrewServerAgent) SetMaxSimilarities(n int)
SetMaxSimilarities sets the maximum number of similar documents to retrieve
func (*CrewServerAgent) SetOrchestratorAgent ¶
func (agent *CrewServerAgent) SetOrchestratorAgent(orchestratorAgent agents.OrchestratorAgent)
SetOrchestratorAgent sets the orchestrator agent
func (*CrewServerAgent) SetPort ¶
func (agent *CrewServerAgent) SetPort(port string)
SetPort sets the HTTP port
func (*CrewServerAgent) SetRagAgent ¶
func (agent *CrewServerAgent) SetRagAgent(ragAgent *rag.Agent)
SetRagAgent sets the RAG agent
func (*CrewServerAgent) SetSelectedAgentId ¶ added in v1.1.4
func (agent *CrewServerAgent) SetSelectedAgentId(agentId string) error
func (*CrewServerAgent) SetSimilarityLimit ¶
func (agent *CrewServerAgent) SetSimilarityLimit(limit float64)
SetSimilarityLimit sets the similarity limit for document retrieval
func (*CrewServerAgent) SetToolsAgent ¶
func (agent *CrewServerAgent) SetToolsAgent(toolsAgent *tools.Agent)
SetToolsAgent sets the tools agent
func (*CrewServerAgent) StartServer ¶
func (agent *CrewServerAgent) StartServer() error
StartServer starts the HTTP server with all routes
func (*CrewServerAgent) StopStream ¶
func (agent *CrewServerAgent) StopStream()
StopStream interrupts the current streaming operation
type CrewServerAgentOption ¶ added in v1.2.3
type CrewServerAgentOption func(*CrewServerAgent) error
CrewServerAgentOption is a function that configures a CrewServerAgent
func AfterCompletion ¶ added in v1.2.9
func AfterCompletion(fn func(*CrewServerAgent)) CrewServerAgentOption
AfterCompletion sets a hook that is called after each handleCompletion call
func BeforeCompletion ¶ added in v1.2.9
func BeforeCompletion(fn func(*CrewServerAgent)) CrewServerAgentOption
BeforeCompletion sets a hook that is called before each handleCompletion call
func WithAgentCrew ¶ added in v1.2.3
func WithAgentCrew(agentCrew map[string]*chat.Agent, selectedAgentId string) CrewServerAgentOption
WithAgentCrew sets the crew of agents and the selected agent ID
func WithCompressorAgent ¶ added in v1.2.3
func WithCompressorAgent(compressorAgent *compressor.Agent) CrewServerAgentOption
WithCompressorAgent sets the compressor agent
func WithCompressorAgentAndContextSize ¶ added in v1.2.3
func WithCompressorAgentAndContextSize(compressorAgent *compressor.Agent, contextSizeLimit int) CrewServerAgentOption
WithCompressorAgentAndContextSize sets the compressor agent and context size limit
func WithConfirmationPromptFn ¶ added in v1.2.9
func WithConfirmationPromptFn(fn func(string, string) tools.ConfirmationResponse) CrewServerAgentOption
WithConfirmationPromptFn sets the confirmation prompt function for tool call confirmation. When provided, this function is used instead of the default web-based confirmation prompt. When combined with ParallelToolCalls enabled on the tools agent, DetectParallelToolCallsWithConfirmation is used.
func WithExecuteFn ¶ added in v1.2.3
func WithExecuteFn(fn func(string, string) (string, error)) CrewServerAgentOption
WithExecuteFn sets the custom function executor
func WithMatchAgentIdToTopicFn ¶ added in v1.2.3
func WithMatchAgentIdToTopicFn(fn func(string, string) string) CrewServerAgentOption
WithMatchAgentIdToTopicFn sets the function to match agent ID to topic
func WithOrchestratorAgent ¶ added in v1.2.3
func WithOrchestratorAgent(orchestratorAgent agents.OrchestratorAgent) CrewServerAgentOption
WithOrchestratorAgent sets the orchestrator agent for routing/topic detection
func WithPort ¶ added in v1.2.3
func WithPort(port int) CrewServerAgentOption
WithPort sets the HTTP server port (default: 3500)
func WithRagAgent ¶ added in v1.2.3
func WithRagAgent(ragAgent *rag.Agent) CrewServerAgentOption
WithRagAgent sets the RAG agent
func WithRagAgentAndSimilarityConfig ¶ added in v1.2.3
func WithRagAgentAndSimilarityConfig(ragAgent *rag.Agent, similarityLimit float64, maxSimilarities int) CrewServerAgentOption
WithRagAgentAndSimilarityConfig sets the RAG agent, similarity limit and max similarities
func WithSingleAgent ¶ added in v1.2.3
func WithSingleAgent(chatAgent *chat.Agent) CrewServerAgentOption
WithSingleAgent creates a crew with a single agent with the key "single"
func WithTLSCert ¶ added in v1.3.1
func WithTLSCert(certData, keyData []byte) CrewServerAgentOption
WithTLSCert sets the TLS certificate and key data for HTTPS support. When provided, the server will use HTTPS instead of HTTP. certData and keyData should be PEM-encoded certificate and private key.
func WithTLSCertFromFile ¶ added in v1.3.1
func WithTLSCertFromFile(certPath, keyPath string) CrewServerAgentOption
WithTLSCertFromFile sets the TLS certificate and key file paths for HTTPS support. When provided, the server will use HTTPS instead of HTTP. certPath and keyPath should point to PEM-encoded certificate and private key files.
func WithToolsAgent ¶ added in v1.2.3
func WithToolsAgent(toolsAgent *tools.Agent) CrewServerAgentOption
WithToolsAgent sets the tools agent
type MemoryResponse ¶
type MemoryResponse = serverbase.MemoryResponse
Re-export types from serverbase for backward compatibility
type OperationRequest ¶
type OperationRequest = serverbase.OperationRequest
Re-export types from serverbase for backward compatibility
type PendingOperation ¶
type PendingOperation = serverbase.PendingOperation
Re-export types from serverbase for backward compatibility
type TokensResponse ¶
type TokensResponse = serverbase.ContextSizeResponse
Re-export types from serverbase for backward compatibility
type ToolCallNotification ¶
type ToolCallNotification = serverbase.ToolCallNotification
Re-export types from serverbase for backward compatibility