manager

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithOutputDimensionality

func WithOutputDimensionality(dim uint) opt.Opt

WithOutputDimensionality sets the output dimensionality for embedding requests

func WithTaskType

func WithTaskType(taskType string) opt.Opt

WithTaskType sets the task type for embedding requests

func WithTitle

func WithTitle(title string) opt.Opt

WithTitle sets the title for the agent, which may be used in embedding requests

Types

type Manager

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

func NewManager

func NewManager(opts ...Opt) (*Manager, error)

func (*Manager) Ask

func (m *Manager) Ask(ctx context.Context, request schema.AskRequest, fn opt.StreamFn) (*schema.AskResponse, error)

Ask processes a message and returns a response, outside of a session context (stateless). If fn is non-nil, text chunks are streamed to the callback as they arrive.

func (*Manager) Chat

func (m *Manager) Chat(ctx context.Context, request schema.ChatRequest, fn opt.StreamFn) (*schema.ChatResponse, error)

Chat processes a message within a session context (stateful). If fn is non-nil, text chunks are streamed to the callback as they arrive.

func (*Manager) Close

func (m *Manager) Close() error

func (*Manager) CreateAgent

func (m *Manager) CreateAgent(ctx context.Context, meta schema.AgentMeta) (*schema.Agent, error)

CreateAgent creates a new agent from the given metadata.

func (*Manager) CreateAgentSession

CreateAgentSession resolves an agent by ID or name, validates input against the agent's schema, executes the agent's template, and creates a new session with merged GeneratorMeta and agent labels. If Parent is provided, the parent session's GeneratorMeta is used as defaults (agent fields take precedence). The returned response contains the session ID, rendered text, and tools, which the caller can pass to Chat.

func (*Manager) CreateSession

func (m *Manager) CreateSession(ctx context.Context, meta schema.SessionMeta) (*schema.Session, error)

CreateSession creates a new session for the given model.

func (*Manager) DeleteAgent

func (m *Manager) DeleteAgent(ctx context.Context, id string) (*schema.Agent, error)

DeleteAgent deletes an agent by ID or name and returns it.

func (*Manager) DeleteSession

func (m *Manager) DeleteSession(ctx context.Context, session string) (*schema.Session, error)

DeleteSession deletes a session by ID and returns it.

func (*Manager) Embedding

func (m *Manager) Embedding(ctx context.Context, request *schema.EmbeddingRequest) (*schema.EmbeddingResponse, error)

func (*Manager) GetAgent

func (m *Manager) GetAgent(ctx context.Context, id string) (*schema.Agent, error)

GetAgent retrieves an agent by ID or name.

func (*Manager) GetModel

func (m *Manager) GetModel(ctx context.Context, req schema.GetModelRequest) (*schema.Model, error)

func (*Manager) GetSession

func (m *Manager) GetSession(ctx context.Context, session string) (*schema.Session, error)

GetSession retrieves a session by ID.

func (*Manager) GetTool

func (m *Manager) GetTool(_ context.Context, name string) (*schema.ToolMeta, error)

GetTool returns tool metadata by name.

func (*Manager) ListAgents

ListAgents returns agents with pagination support.

func (*Manager) ListModels

func (*Manager) ListSessions

ListSessions returns sessions with pagination support.

func (*Manager) ListTools

ListTools returns paginated tool metadata.

func (*Manager) UpdateAgent

func (m *Manager) UpdateAgent(ctx context.Context, id string, meta schema.AgentMeta) (*schema.Agent, error)

UpdateAgent updates an agent's metadata and creates a new version. If Model or Provider are changed, they are validated against the registered providers first.

func (*Manager) UpdateSession

func (m *Manager) UpdateSession(ctx context.Context, id string, meta schema.SessionMeta) (*schema.Session, error)

UpdateSession updates a session's metadata. If Model or Provider are changed, they are validated against the registered providers first.

type Opt

type Opt func(*Manager) error

Opt is a functional option for configuring an agent

func WithAgentStore

func WithAgentStore(store schema.AgentStore) Opt

WithAgentStore sets the agent storage backend for the manager. If not set, an in-memory store is used by default.

func WithClient

func WithClient(client llm.Client) Opt

WithClient adds an LLM client to the agent

func WithSessionStore

func WithSessionStore(store schema.SessionStore) Opt

WithSessionStore sets the session storage backend for the manager. If not set, an in-memory store is used by default.

func WithTool

func WithTool(t tool.Tool) Opt

WithTool registers a single tool with the manager's toolkit.

func WithToolkit

func WithToolkit(toolkit *tool.Toolkit) Opt

WithToolkit sets the toolkit for the manager.

Jump to

Keyboard shortcuts

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