Documentation
¶
Index ¶
- type AgentMicroservice
- func (m *AgentMicroservice) GetAgent() *agent.Agent
- func (m *AgentMicroservice) GetPort() int
- func (m *AgentMicroservice) GetURL() string
- func (m *AgentMicroservice) IsRunning() bool
- func (m *AgentMicroservice) OnComplete(handler func()) *AgentMicroservice
- func (m *AgentMicroservice) OnContent(handler func(string)) *AgentMicroservice
- func (m *AgentMicroservice) OnError(handler func(error)) *AgentMicroservice
- func (m *AgentMicroservice) OnThinking(handler func(string)) *AgentMicroservice
- func (m *AgentMicroservice) OnToolCall(handler func(*interfaces.ToolCallEvent)) *AgentMicroservice
- func (m *AgentMicroservice) OnToolResult(handler func(*interfaces.ToolCallEvent)) *AgentMicroservice
- func (m *AgentMicroservice) RunStream(ctx context.Context, input string) (<-chan interfaces.AgentStreamEvent, error)
- func (m *AgentMicroservice) Start() error
- func (m *AgentMicroservice) Stop() error
- func (m *AgentMicroservice) Stream(ctx context.Context, input string) error
- func (m *AgentMicroservice) WaitForReady(timeout time.Duration) error
- type Config
- type HTTPServer
- type MicroserviceManager
- func (mm *MicroserviceManager) GetService(name string) (*AgentMicroservice, bool)
- func (mm *MicroserviceManager) ListServices() []string
- func (mm *MicroserviceManager) RegisterService(name string, service *AgentMicroservice) error
- func (mm *MicroserviceManager) StartAll() error
- func (mm *MicroserviceManager) StartService(name string) error
- func (mm *MicroserviceManager) StopAll() error
- func (mm *MicroserviceManager) StopService(name string) error
- type SSEEvent
- type StreamEventData
- type StreamRequest
- type ToolCallData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentMicroservice ¶
type AgentMicroservice struct {
// contains filtered or unexported fields
}
AgentMicroservice represents a microservice wrapping an agent
func CreateMicroservice ¶
func CreateMicroservice(agent *agent.Agent, config Config) (*AgentMicroservice, error)
CreateMicroservice creates a new agent microservice
func (*AgentMicroservice) GetAgent ¶
func (m *AgentMicroservice) GetAgent() *agent.Agent
GetAgent returns the underlying agent
func (*AgentMicroservice) GetPort ¶
func (m *AgentMicroservice) GetPort() int
GetPort returns the port the microservice is running on
func (*AgentMicroservice) GetURL ¶
func (m *AgentMicroservice) GetURL() string
GetURL returns the URL of the microservice
func (*AgentMicroservice) IsRunning ¶
func (m *AgentMicroservice) IsRunning() bool
IsRunning returns true if the microservice is currently running
func (*AgentMicroservice) OnComplete ¶ added in v0.0.34
func (m *AgentMicroservice) OnComplete(handler func()) *AgentMicroservice
OnComplete registers a handler for completion events
func (*AgentMicroservice) OnContent ¶ added in v0.0.34
func (m *AgentMicroservice) OnContent(handler func(string)) *AgentMicroservice
OnContent registers a handler for content events
func (*AgentMicroservice) OnError ¶ added in v0.0.34
func (m *AgentMicroservice) OnError(handler func(error)) *AgentMicroservice
OnError registers a handler for error events
func (*AgentMicroservice) OnThinking ¶ added in v0.0.34
func (m *AgentMicroservice) OnThinking(handler func(string)) *AgentMicroservice
OnThinking registers a handler for thinking events
func (*AgentMicroservice) OnToolCall ¶ added in v0.0.34
func (m *AgentMicroservice) OnToolCall(handler func(*interfaces.ToolCallEvent)) *AgentMicroservice
OnToolCall registers a handler for tool call events
func (*AgentMicroservice) OnToolResult ¶ added in v0.0.34
func (m *AgentMicroservice) OnToolResult(handler func(*interfaces.ToolCallEvent)) *AgentMicroservice
OnToolResult registers a handler for tool result events
func (*AgentMicroservice) RunStream ¶ added in v0.0.34
func (m *AgentMicroservice) RunStream(ctx context.Context, input string) (<-chan interfaces.AgentStreamEvent, error)
RunStream executes the agent with streaming response
func (*AgentMicroservice) Start ¶
func (m *AgentMicroservice) Start() error
Start starts the microservice
func (*AgentMicroservice) Stop ¶
func (m *AgentMicroservice) Stop() error
Stop stops the microservice
func (*AgentMicroservice) Stream ¶ added in v0.0.34
func (m *AgentMicroservice) Stream(ctx context.Context, input string) error
Stream executes the agent with registered event handlers
func (*AgentMicroservice) WaitForReady ¶
func (m *AgentMicroservice) WaitForReady(timeout time.Duration) error
WaitForReady waits for the microservice to be ready to serve requests
type Config ¶
type Config struct {
Port int // Port to run the service on (0 for auto-assign)
Timeout time.Duration // Request timeout
}
Config holds configuration for creating an agent microservice
type HTTPServer ¶ added in v0.0.34
type HTTPServer struct {
// contains filtered or unexported fields
}
HTTPServer provides HTTP/SSE endpoints for agent streaming
func NewHTTPServer ¶ added in v0.0.34
func NewHTTPServer(agent *agent.Agent, port int) *HTTPServer
NewHTTPServer creates a new HTTP server for agent streaming
func (*HTTPServer) Start ¶ added in v0.0.34
func (h *HTTPServer) Start() error
Start starts the HTTP server
type MicroserviceManager ¶
type MicroserviceManager struct {
// contains filtered or unexported fields
}
MicroserviceManager manages multiple agent microservices
func NewMicroserviceManager ¶
func NewMicroserviceManager() *MicroserviceManager
NewMicroserviceManager creates a new microservice manager
func (*MicroserviceManager) GetService ¶
func (mm *MicroserviceManager) GetService(name string) (*AgentMicroservice, bool)
GetService returns a service by name
func (*MicroserviceManager) ListServices ¶
func (mm *MicroserviceManager) ListServices() []string
ListServices returns all registered service names
func (*MicroserviceManager) RegisterService ¶
func (mm *MicroserviceManager) RegisterService(name string, service *AgentMicroservice) error
RegisterService registers a microservice with the manager
func (*MicroserviceManager) StartAll ¶
func (mm *MicroserviceManager) StartAll() error
StartAll starts all registered services
func (*MicroserviceManager) StartService ¶
func (mm *MicroserviceManager) StartService(name string) error
StartService starts a service by name
func (*MicroserviceManager) StopAll ¶
func (mm *MicroserviceManager) StopAll() error
StopAll stops all running services
func (*MicroserviceManager) StopService ¶
func (mm *MicroserviceManager) StopService(name string) error
StopService stops a service by name
type SSEEvent ¶ added in v0.0.34
type SSEEvent struct {
Event string `json:"event"`
Data interface{} `json:"data"`
ID string `json:"id,omitempty"`
Retry int `json:"retry,omitempty"`
Timestamp int64 `json:"timestamp"`
}
SSEEvent represents a Server-Sent Event
type StreamEventData ¶ added in v0.0.34
type StreamEventData struct {
Type string `json:"type"`
Content string `json:"content,omitempty"`
ThinkingStep string `json:"thinking_step,omitempty"`
ToolCall *ToolCallData `json:"tool_call,omitempty"`
Error string `json:"error,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
IsFinal bool `json:"is_final"`
Timestamp int64 `json:"timestamp"`
}
StreamEventData represents the data structure for streaming events
type StreamRequest ¶ added in v0.0.34
type StreamRequest struct {
Input string `json:"input"`
OrgID string `json:"org_id,omitempty"`
ConversationID string `json:"conversation_id,omitempty"`
Context map[string]string `json:"context,omitempty"`
MaxIterations int `json:"max_iterations,omitempty"`
}
StreamRequest represents the JSON request for streaming