agent

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
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

func (r *MemoryRepository) Create(ctx context.Context, agent *core.Agent) error

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

func (r *MemoryRepository) Get(ctx context.Context, agentID string) (*core.Agent, error)

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.

func (*MemoryRepository) Update

func (r *MemoryRepository) Update(ctx context.Context, agent *core.Agent) error

Update updates an existing agent. Args: ctx - operation context. agent - the agent to update. Returns error if update fails.

type Service

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

Service provides agent management operations.

func NewService

func NewService(config *Config) (*Service, error)

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

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

DeleteAgent deletes an agent and its associated data. Args: ctx - operation context. agentID - the agent identifier. Returns error if deletion fails.

func (*Service) ExecuteTask

func (s *Service) ExecuteTask(ctx context.Context, task *core.Task) (*core.TaskResult, error)

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

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

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

func (s *Service) GetTaskResult(ctx context.Context, taskID string) (*core.TaskResult, error)

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.

Jump to

Keyboard shortcuts

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