intent

package module
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: BSD-3-Clause Imports: 17 Imported by: 0

README

intent

intent is a goal-driven agent framework for RonyKit. An Agent wraps a rony.Server and composes:

  • Knowledge — static catalog (prompts, facts) plus dynamic RAG retrieval
  • Skills — named capabilities loaded on demand via the activate_skill tool
  • LLM pool — pluggable model selection strategies
  • Memory — session-scoped search/save backends
  • MCP servers — external tool and context sources
  • Endpoints — rony services via ServiceDescriptor and EndpointMount
  • Tasks — task lifecycle via TaskExecutor (flow-backed durability later)
go get github.com/clubpay/ronykit/intent

Layout

Package / area Purpose
intent Agent wrapper, runtime loop, and all core types
intent/errs Shared error sentinels

Core types live in the root intent package:

Type group Examples
Embeddings Embedder
Knowledge Knowledge, StaticStore, Retriever, Indexer
LLM LLM, Pool, Selector, Message
Memory Memory, SessionMemory, MemoryRecord
MCP MCPServer, MCPRegistry, MCPTool
Tools LocalTool, ToolRegistry, ToolExecutor
Skills Skill, SkillCard, SkillRegistry
Sessions SessionManager, Session, LoadHistory
Endpoints ServiceDescriptor, EndpointMount, ServiceRegistry
Tasks TaskExecutor, TaskHandle, TaskState
Agent Agent, Option, RunTurn, TurnInput, TurnResult

Skills

A skill is a named capability the agent loads on demand instead of carrying in every prompt (progressive disclosure). Each turn the runtime advertises only a catalog of name: description cards plus a synthetic activate_skill tool. When the model calls activate_skill with a skill name, the runtime injects that skill's full instructions and unlocks any tools scoped to it; those tools stay hidden until activation.

skills := intent.NewSkillRegistry()
_ = skills.Register(intent.Skill{
Name:         "billing",
Description:  "Handle refunds and billing questions.",
Instructions: "Confirm the order ID before issuing a refund...",
Tools:        []string{"issue_refund"}, // hidden until activated
})

agent := intent.New(
intent.WithLLMPool(pool),
intent.WithTools(tools),
intent.WithSkills(skills),
)

File-based skills load through std/knowledge/static; each skills/*.md file may start with a YAML front-matter block (name, description, tools, triggers, examples) followed by the instructions body. Use store.Skills() to obtain the registry.

The skill catalog is appended to the user message on the first LLM iteration so routing hints stay adjacent to the request.

Status

Scaffold and interfaces only. See DESIGN.md for architecture, planned std/<kind>/<name> implementations, and phased rollout.

Documentation

Overview

Package intent provides a goal-driven agent framework built on RonyKit.

An Agent wraps a rony.Server and composes knowledge, LLM pools, memory, MCP servers, and rony endpoints. Agents expose HTTP/RPC handlers through ServiceDescriptor and EndpointMount without passing *rony.Server to user code.

Core types

All agent building blocks live in this package:

  • Embedder — vector embedding for memory and RAG backends
  • Knowledge, StaticStore, Retriever, Indexer — static catalog and RAG
  • LLM, Pool, Selector — language model backends and selection
  • Memory, SessionMemory — session-scoped conversation state
  • MCPServer, MCPRegistry — external MCP tool and context sources
  • LocalTool, ToolRegistry — local and MCP-backed executable tools
  • Skill, SkillRegistry — on-demand capabilities loaded via activate_skill
  • Agent — entry point for turns, sessions, and server lifecycle
  • ServiceDescriptor, EndpointMount, ServiceRegistry — rony endpoints
  • TaskExecutor, TaskHandle, TaskState — durable task lifecycle

Subpackages:

  • intent/errs — shared error sentinels

Index

Constants

View Source
const ActivateSkillTool = "activate_skill"

ActivateSkillTool is the reserved name of the synthetic tool the runtime advertises so the model can load a skill's full instructions on demand.

View Source
const SkillCatalogTitle = prompt.SkillCatalogTitle

SkillCatalogTitle is the heading injected with the per-turn skill catalog.

Variables

This section is empty.

Functions

func AppendHistory

func AppendHistory(ctx context.Context, s *Session, msgs ...Message) error

AppendHistory appends messages to stored session history.

func FormatSkillCatalog

func FormatSkillCatalog(cards []SkillCard) string

FormatSkillCatalog renders the advertised skill routing guide.

func SaveHistory

func SaveHistory(ctx context.Context, s *Session, msgs []Message) error

SaveHistory replaces the stored conversation history for the session.

func Setup

func Setup[S rony.State[A], A rony.Action](
	m EndpointMount,
	serviceName string,
	init rony.InitState[S, A],
	opts ...rony.SetupOption[S, A],
)

Setup registers a rony service on the agent server.

Types

type Agent

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

Agent wraps a rony.Server with agent capabilities: knowledge, LLMs, memory, MCP servers, and rony endpoints. Agent is the public entry point for running turns and serving endpoints.

func New

func New(opts ...Option) *Agent

New builds an Agent and mounts service descriptors on the underlying rony.Server.

func (*Agent) Config

func (a *Agent) Config() Config

Config returns a snapshot of the agent configuration.

func (*Agent) ExportDesc

func (a *Agent) ExportDesc() []desc.ServiceDesc

ExportDesc returns service descriptions from the underlying server.

func (*Agent) PrintRoutes

func (a *Agent) PrintRoutes(w io.Writer)

PrintRoutes writes registered routes to w.

func (*Agent) Run

func (a *Agent) Run(ctx context.Context, signals ...os.Signal) error

Run starts the agent in blocking mode.

func (*Agent) RunTurn

func (a *Agent) RunTurn(ctx context.Context, in TurnInput) (TurnResult, error)

RunTurn executes one agent loop turn for a session message.

func (*Agent) Server

func (a *Agent) Server() *rony.Server

Server returns the underlying rony.Server.

func (*Agent) Sessions

func (a *Agent) Sessions() *SessionManager

Sessions returns the configured session manager, if any.

func (*Agent) Start

func (a *Agent) Start(ctx context.Context) error

Start starts the underlying rony.Server.

func (*Agent) Stop

func (a *Agent) Stop(ctx context.Context, signals ...os.Signal)

Stop shuts down the underlying rony.Server.

type Choice

type Choice struct {
	Content          string
	ToolCalls        []ToolCall
	FinishReason     string
	ReasoningContent string
	GenerationInfo   map[string]any
}

Choice is one completion candidate.

type Chunk

type Chunk struct {
	Content          string
	ReasoningContent string
	ToolCalls        []ToolCall
	FinishReason     string
	Done             bool
}

Chunk is one streaming update.

type Config

type Config struct {
	Name            string
	Knowledge       Knowledge
	StaticKnowledge StaticStore
	Retriever       Retriever
	LLM             Pool
	Memory          Memory
	MCPServers      MCPRegistry
	Tools           ToolRegistry
	Skills          SkillRegistry
	Sessions        *SessionManager
	Services        ServiceRegistry
	Executor        TaskExecutor
}

Config exposes the agent's composed dependencies.

type DefaultLLMPool

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

DefaultLLMPool is a Pool backed by a Selector.

func NewLLMPool

func NewLLMPool(models []LLM, selector Selector) (*DefaultLLMPool, error)

NewLLMPool returns a pool with the given models and selector. When the selector is nil, StrategyFirst is used.

func (*DefaultLLMPool) Models

func (p *DefaultLLMPool) Models() []Model

func (*DefaultLLMPool) Select

func (p *DefaultLLMPool) Select(ctx context.Context, sel Selection) (LLM, error)

type DefaultSkillRegistry

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

DefaultSkillRegistry is an in-memory SkillRegistry.

func NewSkillRegistry

func NewSkillRegistry() *DefaultSkillRegistry

NewSkillRegistry returns an empty in-memory skill registry.

func (*DefaultSkillRegistry) Get

func (*DefaultSkillRegistry) List

func (*DefaultSkillRegistry) Register

func (r *DefaultSkillRegistry) Register(skill Skill) error

Register adds a skill to the registry. The skill name is required.

type DefaultToolRegistry

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

DefaultToolRegistry stores local tools and MCP server tools.

func NewToolRegistry

func NewToolRegistry() *DefaultToolRegistry

NewToolRegistry returns an empty tool registry.

func (*DefaultToolRegistry) Definitions

func (r *DefaultToolRegistry) Definitions(ctx context.Context) ([]ToolDefinition, error)

func (*DefaultToolRegistry) Execute

func (r *DefaultToolRegistry) Execute(ctx context.Context, call ToolCall) (Message, error)

func (*DefaultToolRegistry) Register

func (r *DefaultToolRegistry) Register(t LocalTool) error

func (*DefaultToolRegistry) RegisterMCP

func (r *DefaultToolRegistry) RegisterMCP(server MCPServer) error

type Document

type Document struct {
	ID       string
	Source   string
	Title    string
	Content  string
	MIMEType string
	Meta     map[string]string
}

Document is raw content to index for RAG retrieval.

type Embedder

type Embedder interface {
	Embed(ctx context.Context, texts []string) ([][]float32, error)
	Dimensions() int
}

Embedder produces vector embeddings for text. Adapters target github.com/tmc/langchaingo/embeddings.Embedder.

type EndpointMount

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

EndpointMount is the registration surface agents use to define rony services without holding a *rony.Server reference. The agent passes a mount during construction; implementations in std wire handlers through rony.Setup.

type Entry

type Entry struct {
	ID      string
	Kind    Kind
	Origin  Origin
	Name    string
	Content string
	Source  string // document URI, file path, collection name, etc.
	Score   float64
	Meta    map[string]string
}

Entry is a knowledge item from the static catalog or a RAG retrieval hit.

type Filter

type Filter struct {
	Kinds []Kind
	Names []string
}

Filter restricts static List results.

type GenerateOptions

type GenerateOptions struct {
	Model            string
	Temperature      *float64
	MaxTokens        *int
	StopWords        []string
	JSONMode         bool
	CandidateCount   int
	Streaming        bool
	ProviderSpecific any // opaque passthrough for adapter-specific options
}

GenerateOptions controls generation behavior. Adapters map these to langchaingo llms.CallOption values.

type Indexer

type Indexer interface {
	Index(ctx context.Context, docs []Document) error
	DeleteSource(ctx context.Context, source string) error
}

Indexer ingests documents into a dynamic knowledge backend. Separated from Retriever so ingestion pipelines can run independently of queries.

type Kind

type Kind string

Kind identifies the type of knowledge entry.

const (
	KindPrompt   Kind = "prompt"
	KindSkill    Kind = "skill"
	KindFact     Kind = "fact"
	KindDocument Kind = "document"
	KindChunk    Kind = "chunk"
)

type Knowledge

type Knowledge interface {
	StaticStore
	Retriever
}

Knowledge combines the static catalog and dynamic RAG retrieval. Implementations may embed only one side; callers should handle unsupported operations from partial implementations as needed.

type LLM

type LLM interface {
	Model() Model
	Generate(ctx context.Context, req Request) (Response, error)
	Stream(ctx context.Context, req Request) (Stream, error)
}

LLM is a single language-model backend. Adapters wrap github.com/tmc/langchaingo/llms.Model.

func ByPriority

func ByPriority(models []LLM) []LLM

ByPriority sorts models by descending priority.

func Select

func Select(ctx context.Context, models []LLM, sel Selection) (LLM, error)

Select dispatches to a built-in selector by strategy.

func SelectEnforced

func SelectEnforced(_ context.Context, models []LLM, sel Selection) (LLM, error)

SelectEnforced returns the model matching sel.ModelID.

func SelectFirst

func SelectFirst(_ context.Context, models []LLM, _ Selection) (LLM, error)

SelectFirst returns the first model in the pool.

func SelectPriority

func SelectPriority(_ context.Context, models []LLM, _ Selection) (LLM, error)

SelectPriority returns the model with the highest Priority value.

func SelectRandom

func SelectRandom(_ context.Context, models []LLM, _ Selection) (LLM, error)

SelectRandom returns a random model from the pool.

type LocalTool

type LocalTool interface {
	Definition() ToolDefinition
	Execute(ctx context.Context, args json.RawMessage) (Message, error)
}

LocalTool is a local executable tool registered on the agent.

type LocalToolFunc

type LocalToolFunc struct {
	Def ToolDefinition
	Fn  func(ctx context.Context, args json.RawMessage) (Message, error)
}

LocalToolFunc adapts functions to LocalTool.

func (LocalToolFunc) Definition

func (t LocalToolFunc) Definition() ToolDefinition

func (LocalToolFunc) Execute

func (t LocalToolFunc) Execute(ctx context.Context, args json.RawMessage) (Message, error)

type MCPClientFactory

type MCPClientFactory interface {
	NewServer(ctx context.Context, cfg MCPServerConfig) (MCPServer, error)
}

MCPClientFactory creates MCP server connections from configuration. Implementations use github.com/modelcontextprotocol/go-sdk/mcp.Client.

type MCPContentBlock

type MCPContentBlock struct {
	MIMEType string
	Text     string
	Binary   []byte
	URI      string
}

MCPContentBlock is an unstructured tool output. Adapters map from mcp.Content (TextContent, ImageContent, etc.).

type MCPPromptMessage

type MCPPromptMessage struct {
	Role     string
	Text     string
	MIMEType string
	Binary   []byte
}

MCPPromptMessage is one message returned by prompts/get.

type MCPPromptResult

type MCPPromptResult struct {
	Description string
	Messages    []MCPPromptMessage
}

MCPPromptResult is the resolved prompt from prompts/get.

type MCPPromptSummary

type MCPPromptSummary struct {
	Name        string
	Title       string
	Description string
}

MCPPromptSummary describes an MCP prompt listing entry.

type MCPRegistry

type MCPRegistry interface {
	List() []MCPServerConfig
	Get(name string) (MCPServer, bool)
	ConnectAll(ctx context.Context) error
	CloseAll() error
}

MCPRegistry holds MCP servers available to an agent.

type MCPResourceContent

type MCPResourceContent struct {
	URI      string
	MIMEType string
	Text     string
	Binary   []byte
}

MCPResourceContent is MCP resource payload.

type MCPResourceSummary

type MCPResourceSummary struct {
	URI         string
	Name        string
	Title       string
	Description string
	MIMEType    string
}

MCPResourceSummary describes an MCP resource listing entry.

type MCPServer

type MCPServer interface {
	Name() string
	Connect(ctx context.Context) error
	Close() error

	ListTools(ctx context.Context) ([]MCPTool, error)
	CallTool(ctx context.Context, name string, args json.RawMessage) (MCPToolResult, error)

	ListResources(ctx context.Context) ([]MCPResourceSummary, error)
	ReadResource(ctx context.Context, uri string) (MCPResourceContent, error)

	ListPrompts(ctx context.Context) ([]MCPPromptSummary, error)
	GetPrompt(ctx context.Context, name string, args map[string]string) (MCPPromptResult, error)
}

MCPServer is a connected MCP server an agent can call for tools and context. Adapters wrap mcp.ClientSession.

type MCPServerConfig

type MCPServerConfig struct {
	Name      string
	Transport MCPTransportKind
	URL       string   // HTTP/SSE/streamable HTTP endpoint
	Command   []string // stdio: command and args
	Meta      map[string]string
}

MCPServerConfig describes how to connect to an external MCP server.

type MCPTool

type MCPTool struct {
	Name         string
	Title        string
	Description  string
	InputSchema  json.RawMessage
	OutputSchema json.RawMessage
}

MCPTool is a tool exposed by an MCP server. Adapters map from mcp.Tool.

type MCPToolResult

type MCPToolResult struct {
	Content           []MCPContentBlock
	StructuredContent json.RawMessage
	IsError           bool
}

MCPToolResult is the outcome of a tool invocation. Adapters map from mcp.CallToolResult.

type MCPTransportKind

type MCPTransportKind string

MCPTransportKind selects how to connect to an MCP server. Adapters map to github.com/modelcontextprotocol/go-sdk/mcp transports.

const (
	MCPTransportStreamableHTTP MCPTransportKind = "streamable-http"
	MCPTransportSSE            MCPTransportKind = "sse"
	MCPTransportStdio          MCPTransportKind = "stdio"
)

type MapServiceRegistry

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

MapServiceRegistry is an in-memory service registry.

func NewMapServiceRegistry

func NewMapServiceRegistry() *MapServiceRegistry

NewMapServiceRegistry returns an empty service registry.

func (*MapServiceRegistry) All

func (*MapServiceRegistry) Get

func (*MapServiceRegistry) Register

func (r *MapServiceRegistry) Register(desc ServiceDescriptor) error

type Memory

type Memory interface {
	ForSession(sessionID string) SessionMemory
}

Memory provides session-scoped storage backends. Implementations may use in-memory storage, Postgres, embedded vector DBs (e.g. chromem-go), or external vector stores (e.g. Milvus).

type MemoryQuery

type MemoryQuery struct {
	Text     string
	Filter   map[string]string
	Limit    int
	MinScore float64
}

MemoryQuery describes a memory lookup within a session.

type MemoryRecord

type MemoryRecord struct {
	ID        string
	Key       string
	Content   []byte
	Metadata  map[string]string
	Embedding []float32
	CreatedAt time.Time
	UpdatedAt time.Time
}

MemoryRecord is a stored memory item within a session.

type MemoryResult

type MemoryResult struct {
	Record MemoryRecord
	Score  float64
}

MemoryResult is a memory search hit.

type Message

type Message struct {
	Role  Role   `json:"role"`
	Parts []Part `json:"parts,omitempty"`

	// ToolCalls is set on assistant messages when the model requests tool.
	ToolCalls []ToolCall `json:"toolCalls,omitempty"`

	// ToolCallID and ToolName are set on tool-result messages.
	ToolCallID string `json:"toolCallId,omitempty"`
	ToolName   string `json:"toolName,omitempty"`
}

Message is a chat turn. Multipart and tool-result messages are supported.

func LoadHistory

func LoadHistory(ctx context.Context, s *Session) ([]Message, error)

LoadHistory returns conversation messages stored on the session.

type Model

type Model struct {
	ID       string
	Name     string
	Priority int
}

Model describes a connected LLM endpoint.

type Option

type Option func(cfg *agentConfig)

Option configures an Agent.

func WithExecutor

func WithExecutor(exec TaskExecutor) Option

func WithKnowledge

func WithKnowledge(k Knowledge) Option

func WithLLMPool

func WithLLMPool(pool Pool) Option

func WithLogger

func WithLogger(logger *slog.Logger) Option

func WithMCPServers

func WithMCPServers(reg MCPRegistry) Option

func WithMaxToolIterations

func WithMaxToolIterations(limit int) Option

func WithMemory

func WithMemory(m Memory) Option

func WithName

func WithName(name string) Option

func WithRetriever

func WithRetriever(retriever Retriever) Option

func WithServer

func WithServer(srv *rony.Server) Option

WithServer uses an existing rony.Server instead of creating one in New.

func WithServerOption

func WithServerOption(opts ...rony.ServerOption) Option

WithServerOption forwards options to the underlying rony.Server. Ignored when WithServer supplies an existing server.

func WithService

func WithService(desc ServiceDescriptor) Option

func WithServiceRegistry

func WithServiceRegistry(reg ServiceRegistry) Option

func WithSessions

func WithSessions(mgr *SessionManager) Option

func WithSkills

func WithSkills(reg SkillRegistry) Option

func WithStaticKnowledge

func WithStaticKnowledge(store StaticStore) Option

func WithTools

func WithTools(reg ToolRegistry) Option

type Origin

type Origin string

Origin distinguishes configured knowledge from RAG-retrieved knowledge.

const (
	OriginStatic  Origin = "static"
	OriginDynamic Origin = "dynamic"
)

type Part

type Part struct {
	Text       string `json:"text,omitempty"`
	MIMEType   string `json:"mimeType,omitempty"`
	Binary     []byte `json:"binary,omitempty"`
	ToolCallID string `json:"toolCallId,omitempty"`
}

Part is one segment of a message. Text-only agents use TextPart. Adapters map richer SDK parts (e.g. langchaingo ContentPart) into this shape.

func TextPart

func TextPart(text string) Part

TextPart builds a single-text message part.

type Pool

type Pool interface {
	Models() []Model
	Select(ctx context.Context, sel Selection) (LLM, error)
}

Pool is the set of LLMs available to an agent together with a selection strategy.

type Request

type Request struct {
	Messages []Message
	Tools    []ToolDefinition
	Options  GenerateOptions
}

Request is an LLM completion request.

type Response

type Response struct {
	Content          string
	ToolCalls        []ToolCall
	FinishReason     string
	ReasoningContent string
	GenerationInfo   map[string]any
	Choices          []Choice
}

Response is a non-streaming LLM completion result. When the backend returns multiple candidates, implementations should populate Choices; the first choice mirrors the top-level fields for convenience.

type RetrieveQuery

type RetrieveQuery struct {
	Text     string
	Filter   map[string]string
	Limit    int
	MinScore float64
}

RetrieveQuery describes a dynamic RAG lookup over indexed corpora.

type Retriever

type Retriever interface {
	Retrieve(ctx context.Context, q RetrieveQuery) ([]Entry, error)
}

Retriever performs dynamic knowledge lookup (RAG) at the request time. Implementations may use embedded vector DBs (e.g. chromem-go) or external stores (e.g. Milvus) over document corpora.

type Role

type Role string

Role identifies who produced a message. Values align with github.com/tmc/langchaingo/llms.ChatMessageType.

const (
	RoleSystem  Role = "system"
	RoleHuman   Role = "human"
	RoleAI      Role = "ai"
	RoleTool    Role = "tool"
	RoleGeneric Role = "generic"
)

type Selection

type Selection struct {
	Strategy Strategy
	ModelID  string
}

Selection describes how to pick an LLM from a pool. ModelID is required when Strategy is StrategyEnforced.

type Selector

type Selector interface {
	Select(ctx context.Context, models []LLM, sel Selection) (LLM, error)
}

Selector picks one LLM from a pool.

type SelectorFunc

type SelectorFunc func(ctx context.Context, models []LLM, sel Selection) (LLM, error)

SelectorFunc adapts a function to Selector.

func (SelectorFunc) Select

func (f SelectorFunc) Select(ctx context.Context, models []LLM, sel Selection) (LLM, error)

type ServiceDescriptor

type ServiceDescriptor struct {
	Name  string
	Mount func(m EndpointMount) error
}

ServiceDescriptor binds a named rony service to the agent server.

type ServiceRegistry

type ServiceRegistry interface {
	Register(desc ServiceDescriptor) error
	Get(name string) (ServiceDescriptor, bool)
	All() []ServiceDescriptor
}

ServiceRegistry holds service descriptors registered on an agent.

type Session

type Session struct {
	ID        string
	Memory    SessionMemory
	Metadata  map[string]string
	Selection Selection
}

Session is one conversation or task run.

type SessionManager

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

SessionManager creates and tracks agent sessions.

func NewSessionManager

func NewSessionManager(mem Memory) *SessionManager

NewSessionManager returns a session manager backed by mem.

func (*SessionManager) Close

func (m *SessionManager) Close(ctx context.Context, id string) error

Close removes a session from the active set and clears its memory.

func (*SessionManager) Create

func (m *SessionManager) Create(_ context.Context, opts ...SessionOption) (*Session, error)

Create opens a new session.

func (*SessionManager) Get

func (m *SessionManager) Get(_ context.Context, id string) (*Session, error)

Get returns an active session by ID.

type SessionMemory

type SessionMemory interface {
	SessionID() string
	Save(ctx context.Context, rec MemoryRecord) error
	Search(ctx context.Context, q MemoryQuery) ([]MemoryResult, error)
	Delete(ctx context.Context, id string) error
	Clear(ctx context.Context) error
}

SessionMemory stores and retrieves context for a single agent session. Conversation turns, tool results, and task notes for one session belong here.

type SessionOption

type SessionOption func(*sessionCreateConfig)

SessionOption configures session creation.

func SessionWithID

func SessionWithID(id string) SessionOption

SessionWithID sets an explicit session ID.

func SessionWithMetadata

func SessionWithMetadata(metadata map[string]string) SessionOption

SessionWithMetadata attaches metadata to the session.

func SessionWithSelection

func SessionWithSelection(sel Selection) SessionOption

SessionWithSelection sets the LLM selection strategy for the session.

type Skill

type Skill struct {
	Name         string            // unique key; the enum value the model selects
	Description  string            // short summary; always advertised in the catalog
	Instructions string            // full body; injected only on activation
	Tools        []string          // tool names unlocked while the skill is active
	Triggers     []string          // keywords/phrases that suggest this skill (shown in catalog)
	Examples     []string          // example user requests (shown in catalog)
	Meta         map[string]string // optional adapter metadata
}

Skill is a named capability the agent can activate on demand.

Only Name and Description are advertised to the model up front (progressive disclosure); Instructions and skill-scoped Tools enter the turn only after the model activates the skill via the ActivateSkillTool.

func (Skill) Card

func (s Skill) Card() SkillCard

Card returns the cheap advertisement view of the skill.

type SkillCard

type SkillCard struct {
	Name        string
	Description string
	Triggers    []string
	Examples    []string
}

SkillCard is the cheap metadata advertised for a Skill in the catalog.

type SkillRegistry

type SkillRegistry interface {
	// List returns the advertisement cards for all available skills.
	List(ctx context.Context) ([]SkillCard, error)
	// Get returns the full skill, including Instructions and Tools.
	Get(ctx context.Context, name string) (Skill, error)
}

SkillRegistry provides skill discovery (cheap cards) and activation (full body).

type StaticStore

type StaticStore interface {
	List(ctx context.Context, filter Filter) ([]Entry, error)
	Get(ctx context.Context, id string) (Entry, error)
}

StaticStore holds configured prompts, skills, and facts. These entries are loaded at setup time and do not change during a session.

type Strategy

type Strategy string

Strategy names built-in LLM selection behavior.

const (
	StrategyRandom   Strategy = "random"
	StrategyFirst    Strategy = "first"
	StrategyPriority Strategy = "priority"
	StrategyEnforced Strategy = "enforced"
)

type Stream

type Stream interface {
	Recv(ctx context.Context) (Chunk, error)
	Close() error
}

Stream delivers incremental LLM output. langchaingo adapters typically buffer WithStreamingFunc callbacks into Recv.

type TaskExecutor

type TaskExecutor interface {
	Start(ctx context.Context, name string, input any) (TaskHandle, error)
	Get(ctx context.Context, id string) (TaskHandle, error)
	Signal(ctx context.Context, id string, signal any) error
	Cancel(ctx context.Context, id string) error
}

TaskExecutor runs task lifecycles. A flow-backed implementation will provide durable state transitions later.

type TaskHandle

type TaskHandle interface {
	ID() string
	Name() string
	State() TaskState
}

TaskHandle is a running or completed task instance.

type TaskState

type TaskState string

TaskState is the lifecycle state of a task execution.

const (
	TaskStatePending   TaskState = "pending"
	TaskStateRunning   TaskState = "running"
	TaskStateWaiting   TaskState = "waiting"
	TaskStateCompleted TaskState = "completed"
	TaskStateFailed    TaskState = "failed"
	TaskStateCancelled TaskState = "cancelled"
)

type ToolCall

type ToolCall struct {
	ID        string `json:"id,omitempty"`
	Type      string `json:"type,omitempty"`
	Name      string `json:"name,omitempty"`
	Arguments string `json:"arguments,omitempty"`
}

ToolCall is a model-initiated tool invocation. Adapters map to langchaingo llms.ToolCall.

type ToolDefinition

type ToolDefinition struct {
	Name        string
	Description string
	Parameters  any
	Strict      bool
}

ToolDefinition describes a tool the model may call. Parameters hold JSON Schema (object). Adapters map to langchaingo FunctionDefinition.

type ToolExecutor

type ToolExecutor interface {
	Definitions(ctx context.Context) ([]ToolDefinition, error)
	Execute(ctx context.Context, call ToolCall) (Message, error)
}

ToolExecutor resolves and runs tool calls.

type ToolRegistry

type ToolRegistry interface {
	ToolExecutor
	Register(t LocalTool) error
	RegisterMCP(server MCPServer) error
}

ToolRegistry holds local and MCP-backed tools.

type TurnInput

type TurnInput struct {
	Session       *Session
	UserMessage   Message
	RetrieveQuery string
}

TurnInput is one user turn inside a session.

type TurnResult

type TurnResult struct {
	Response Response
	Messages []Message
}

TurnResult is the outcome of a completed turn.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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