adk

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentDevelopmentKit

type AgentDevelopmentKit struct {
	UTCP      utcp.UtcpClientInterface
	CodeMode  *codemode.CodeModeUTCP
	ChainMode *chain.UtcpChainClient
	// contains filtered or unexported fields
}

AgentDevelopmentKit orchestrates modules that provision models, memory, tools, sub-agents and runtime glue. It acts as a lightweight dependency injection container for agent deployments.

func New

func New(ctx context.Context, opts ...Option) (*AgentDevelopmentKit, error)

New constructs a kit, applies the provided options and bootstraps registered modules. Modules may in turn register providers that are later used to build agents.

func (*AgentDevelopmentKit) AgentOptions

func (k *AgentDevelopmentKit) AgentOptions() []AgentOption

AgentOptions returns a copy of the default agent options registered on the kit.

func (*AgentDevelopmentKit) Bootstrap

func (k *AgentDevelopmentKit) Bootstrap(ctx context.Context) error

Bootstrap executes all registered modules. The operation is idempotent, so calling it multiple times is safe. Modules are executed in the order they were registered.

func (*AgentDevelopmentKit) BuildAgent

func (k *AgentDevelopmentKit) BuildAgent(ctx context.Context, opts ...AgentOption) (*agent.Agent, error)

BuildAgent constructs a coordinator agent using the registered providers and optional overrides.

func (*AgentDevelopmentKit) CallTool

func (adk *AgentDevelopmentKit) CallTool(ctx context.Context, toolName string, args map[string]any) (any, error)

func (*AgentDevelopmentKit) CallToolStream

func (adk *AgentDevelopmentKit) CallToolStream(ctx context.Context, toolName string, args map[string]any) (transports.StreamResult, error)

func (*AgentDevelopmentKit) DefaultContextLimit

func (k *AgentDevelopmentKit) DefaultContextLimit() int

DefaultContextLimit returns the configured default context limit.

func (*AgentDevelopmentKit) DefaultSystemPrompt

func (k *AgentDevelopmentKit) DefaultSystemPrompt() string

DefaultSystemPrompt returns the system prompt applied to agents when no explicit prompt is provided.

func (*AgentDevelopmentKit) MemoryProvider

func (k *AgentDevelopmentKit) MemoryProvider() MemoryProvider

MemoryProvider returns the registered memory provider.

func (*AgentDevelopmentKit) ModelProvider

func (k *AgentDevelopmentKit) ModelProvider() ModelProvider

ModelProvider returns the currently registered model provider.

func (*AgentDevelopmentKit) Modules

func (k *AgentDevelopmentKit) Modules() []Module

Modules returns a copy of the registered modules in registration order.

func (*AgentDevelopmentKit) NewSharedSession

func (k *AgentDevelopmentKit) NewSharedSession(ctx context.Context, local string, spaces ...string) (*memory.SharedSession, error)

SharedSession returns a collaborative session view backed by the configured session memory. Agents created from the same kit can use this to read or write memories in shared spaces (for example, team channels). The factory is lazily initialised on first use so callers may request shared sessions before or after constructing the coordinator agent.

func (*AgentDevelopmentKit) RegisterModule

func (k *AgentDevelopmentKit) RegisterModule(module Module) error

RegisterModule appends a module to the bootstrapping sequence.

func (*AgentDevelopmentKit) SearchTools

func (adk *AgentDevelopmentKit) SearchTools(query string, limit int) ([]tools.Tool, error)

func (*AgentDevelopmentKit) SetDefaultContextLimit

func (k *AgentDevelopmentKit) SetDefaultContextLimit(limit int)

SetDefaultContextLimit updates the default retrieval window size.

func (*AgentDevelopmentKit) SetDefaultSystemPrompt

func (k *AgentDevelopmentKit) SetDefaultSystemPrompt(prompt string)

SetDefaultSystemPrompt overrides the default system prompt used when building agents.

func (*AgentDevelopmentKit) SubAgentProviders

func (k *AgentDevelopmentKit) SubAgentProviders() []SubAgentProvider

SubAgentProviders returns the registered sub-agent providers.

func (*AgentDevelopmentKit) ToolProviders

func (k *AgentDevelopmentKit) ToolProviders() []ToolProvider

ToolProviders returns the registered tool providers in order.

func (*AgentDevelopmentKit) UseAgentOption

func (k *AgentDevelopmentKit) UseAgentOption(opt AgentOption)

UseAgentOption appends a default agent option applied prior to constructing the coordinator agent.

func (*AgentDevelopmentKit) UseMemoryProvider

func (k *AgentDevelopmentKit) UseMemoryProvider(provider MemoryProvider)

UseMemoryProvider registers the provider that builds session memory instances.

func (*AgentDevelopmentKit) UseModelProvider

func (k *AgentDevelopmentKit) UseModelProvider(provider ModelProvider)

UseModelProvider registers the provider responsible for constructing the coordinator language model.

func (*AgentDevelopmentKit) UseSubAgentProvider

func (k *AgentDevelopmentKit) UseSubAgentProvider(provider SubAgentProvider)

UseSubAgentProvider appends a sub-agent provider to the kit.

func (*AgentDevelopmentKit) UseToolProvider

func (k *AgentDevelopmentKit) UseToolProvider(provider ToolProvider)

UseToolProvider appends a tool provider to the kit.

type AgentOption

type AgentOption func(*agent.Options)

AgentOption is applied to the low-level agent options prior to constructing the coordinator agent instance.

type MemoryBundle

type MemoryBundle struct {
	Session *memory.SessionMemory
	Shared  SharedSessionFactory
}

MemoryBundle groups the session memory used by the coordinator together with an optional shared-session factory so callers can join collaborative spaces.

type MemoryProvider

type MemoryProvider func(ctx context.Context) (MemoryBundle, error)

MemoryProvider provisions the conversational memory layer used by agents and optionally exposes helper factories to construct shared sessions.

type ModelProvider

type ModelProvider func(ctx context.Context) (models.Agent, error)

ModelProvider constructs a language model used by the coordinator agent.

type Module

type Module interface {
	// Name returns a human-friendly identifier used purely for debugging
	// and log messages. Names do not need to be unique, but providing
	// descriptive names makes it easier to understand bootstrapping
	// failures.
	Name() string

	// Provision attaches functionality to the kit. Implementations may call
	// the various Use* helpers to register providers or mutate defaults.
	Provision(ctx context.Context, kit *AgentDevelopmentKit) error
}

Module represents a pluggable unit that can provision capabilities on the AgentDevelopmentKit. Modules are executed during bootstrapping and can install model providers, memory backends, tool registries, sub-agents, or any other integration required by the host application.

type Option

type Option func(*AgentDevelopmentKit) error

Option configures the AgentDevelopmentKit during construction.

func WithAgentOptions

func WithAgentOptions(opts ...AgentOption) Option

WithAgentOptions registers default agent options that will be applied to every agent created via BuildAgent.

func WithChainModeUtcp added in v0.8.3

func WithChainModeUtcp(client utcp.UtcpClientInterface) Option

func WithCodeModeUtcp added in v0.8.0

func WithCodeModeUtcp(client utcp.UtcpClientInterface, model models.Agent) Option

func WithDefaultContextLimit

func WithDefaultContextLimit(limit int) Option

WithDefaultContextLimit overrides the default context window size used when constructing agents.

func WithDefaultSystemPrompt

func WithDefaultSystemPrompt(prompt string) Option

WithDefaultSystemPrompt overrides the default system prompt used by the kit.

func WithModule

func WithModule(module Module) Option

WithModule registers a single module with the kit.

func WithModules

func WithModules(modules ...Module) Option

WithModules registers multiple modules using a single option invocation.

func WithSubAgents

func WithSubAgents(subAgents ...agent.SubAgent) Option

WithSubAgents registers one or more sub-agents directly on the kit. The sub-agents are appended to the aggregated set before the coordinator agent is constructed. Nil entries are ignored to simplify conditional wiring.

func WithUTCP

func WithUTCP(client utcp.UtcpClientInterface) Option

type SharedSessionFactory

type SharedSessionFactory func(local string, spaces ...string) *memory.SharedSession

SharedSessionFactory builds collaborative session views on top of the base session memory. It mirrors memory.NewSharedSession but lets providers expose preconfigured factories (for example to reuse ACL registries or custom defaults).

type SubAgentBundle

type SubAgentBundle struct {
	Directory agent.SubAgentDirectory
	SubAgents []agent.SubAgent
}

SubAgentBundle exposes delegated agents and an optional directory.

type SubAgentProvider

type SubAgentProvider func(ctx context.Context) (SubAgentBundle, error)

SubAgentProvider returns the sub-agent bundle to merge into the agent.

type ToolBundle

type ToolBundle struct {
	Catalog agent.ToolCatalog
	Tools   []agent.Tool
}

ToolBundle describes the tool catalog and the concrete tool instances contributed by a module. Catalog may be nil meaning the default catalog should be used.

type ToolProvider

type ToolProvider func(ctx context.Context) (ToolBundle, error)

ToolProvider returns a ToolBundle to be merged into the agent configuration.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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