conversation

package
v0.2.21 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentResolver added in v0.2.1

type AgentResolver func(ctx context.Context, id string) (*agentdef.Agent, error)

AgentResolver resolves agent definitions by ID during runtime.

type Manager

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

Manager coordinates multi-turn conversations. It keeps track of conversation history via the provided memory.History and delegates the heavy lifting to a QueryHandler.

The goal is to decouple I/O adapters (CLI, REST, WebSocket, …) from the underlying agent orchestration so that they only need to call Accept().

func New

func New(handler QueryHandler, opts ...Option) *Manager

New returns a new Manager instance. If history is nil an in-memory store is created. If idGen is not supplied uuid.NewString() is used.

func (*Manager) Accept

func (m *Manager) Accept(ctx context.Context, input *agentpkg.QueryInput) (*agentpkg.QueryOutput, error)

Accept processes a user query within a conversation.

  1. Ensures ConversationID is present (generates if empty).
  2. Delegates to the configured QueryHandler.
  3. Returns the handler's output.

func (*Manager) ResolveAgent added in v0.2.1

func (m *Manager) ResolveAgent(ctx context.Context, id string) (*agentdef.Agent, error)

ResolveAgent returns the Agent configuration for the provided name using the resolver when set.

type Option

type Option func(*Manager)

Option allows to customise Manager behaviour.

func WithAgentResolver added in v0.2.1

func WithAgentResolver(r AgentResolver) Option

WithAgentResolver installs a resolver used by ResolveAgent.

func WithIDGenerator

func WithIDGenerator(f func() string) Option

WithIDGenerator overrides the default conversation-ID generator.

type QueryHandler

type QueryHandler func(ctx context.Context, input *agentpkg.QueryInput, output *agentpkg.QueryOutput) error

QueryHandler is a thin adapter used by the Manager to delegate the actual query processing (LLM, tool-orchestration, etc.). A production implementation would typically be a wrapper around *agent.Service, but tests can provide a lightweight stub.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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