Documentation
¶
Overview ¶
Package agent provides error definitions for agent service.
Package agent provides in-memory repository implementation for development/testing.
Package agent provides agent service implementation.
Index ¶
- Variables
- type Config
- type MemoryRepository
- func (r *MemoryRepository) Create(ctx context.Context, agent *core.Agent) error
- func (r *MemoryRepository) Delete(ctx context.Context, agentID string) error
- func (r *MemoryRepository) Get(ctx context.Context, agentID string) (*core.Agent, error)
- func (r *MemoryRepository) List(ctx context.Context, filter *core.AgentFilter) ([]*core.Agent, error)
- func (r *MemoryRepository) Update(ctx context.Context, agent *core.Agent) error
- type Service
- func (s *Service) CreateAgent(ctx context.Context, agentConfig *core.AgentConfig) (*core.Agent, error)
- func (s *Service) DeleteAgent(ctx context.Context, agentID string) error
- func (s *Service) ExecuteTask(ctx context.Context, task *core.Task) (*core.TaskResult, error)
- func (s *Service) GetAgent(ctx context.Context, agentID string) (*core.Agent, error)
- func (s *Service) GetTaskResult(ctx context.Context, taskID string) (*core.TaskResult, error)
- func (s *Service) ListAgents(ctx context.Context, filter *core.AgentFilter) ([]*core.Agent, *core.PaginationResponse, error)
- func (s *Service) UpdateAgent(ctx context.Context, agentID string, updates map[string]interface{}) (*core.Agent, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidAgentID is returned when agent ID is empty or invalid. ErrInvalidAgentID = errors.New("invalid agent ID") // ErrAgentNotFound is returned when agent does not exist. ErrAgentNotFound = errors.New("agent not found") // ErrAgentAlreadyExists is returned when trying to create duplicate agent. ErrAgentAlreadyExists = errors.New("agent already exists") // ErrInvalidTaskID is returned when task ID is empty or invalid. ErrInvalidTaskID = errors.New("invalid task ID") // ErrTaskNotFound is returned when task does not exist. ErrTaskNotFound = errors.New("task not found") // ErrInvalidConfig is returned when configuration is invalid. ErrInvalidConfig = errors.New("invalid configuration") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// BaseConfig is the base configuration.
BaseConfig *core.BaseConfig
// MemoryMgr is the memory manager instance.
MemoryMgr memory.MemoryManager
// Repo is the agent repository.
Repo core.AgentRepository
}
Config represents service configuration.
type MemoryRepository ¶
type MemoryRepository struct {
// contains filtered or unexported fields
}
MemoryRepository provides an in-memory implementation of AgentRepository. This is useful for development and testing without a database.
func NewMemoryRepository ¶
func NewMemoryRepository() *MemoryRepository
NewMemoryRepository creates a new in-memory agent repository. Returns new memory repository instance.
func (*MemoryRepository) Create ¶
Create creates a new agent. Args: ctx - operation context. agent - the agent to create. Returns error if creation fails.
func (*MemoryRepository) Delete ¶
func (r *MemoryRepository) Delete(ctx context.Context, agentID string) error
Delete deletes an agent by ID. Args: ctx - operation context. agentID - the agent identifier. Returns error if deletion fails.
func (*MemoryRepository) Get ¶
Get retrieves an agent by ID. Args: ctx - operation context. agentID - the agent identifier. Returns the agent or error if not found.
func (*MemoryRepository) List ¶
func (r *MemoryRepository) List(ctx context.Context, filter *core.AgentFilter) ([]*core.Agent, error)
List lists agents with optional filtering. Args: ctx - operation context. filter - optional filter criteria. Returns list of agents or error.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides agent management operations.
func NewService ¶
NewService creates a new agent service instance. Args: config - service configuration. Returns new agent service instance or error.
func (*Service) CreateAgent ¶
func (s *Service) CreateAgent(ctx context.Context, agentConfig *core.AgentConfig) (*core.Agent, error)
CreateAgent creates a new agent with the given configuration. Args: ctx - operation context. agentConfig - the agent configuration. Returns the created agent or error.
func (*Service) DeleteAgent ¶
DeleteAgent deletes an agent and its associated data. Args: ctx - operation context. agentID - the agent identifier. Returns error if deletion fails.
func (*Service) ExecuteTask ¶
ExecuteTask executes a task on an agent. Args: ctx - operation context. task - the task to execute. Returns the task result or error.
func (*Service) GetAgent ¶
GetAgent retrieves an agent by ID. Args: ctx - operation context. agentID - the agent identifier. Returns the agent or error if not found.
func (*Service) GetTaskResult ¶
GetTaskResult retrieves the result of a task. Args: ctx - operation context. taskID - the task identifier. Returns the task result or error if not found.
func (*Service) ListAgents ¶
func (s *Service) ListAgents(ctx context.Context, filter *core.AgentFilter) ([]*core.Agent, *core.PaginationResponse, error)
func (*Service) UpdateAgent ¶
func (s *Service) UpdateAgent(ctx context.Context, agentID string, updates map[string]interface{}) (*core.Agent, error)
UpdateAgent updates an existing agent. Args: ctx - operation context. agentID - the agent identifier. updates - the fields to update. Returns the updated agent or error.