runtime

package module
v0.0.0-...-790ab80 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: Apache-2.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package runtime wires the pieces — an agentkit LLM, a toolset, skills, permission gating and session defaults — into ready-to-run sessions. Build a Runtime once, then start Sessions or one-shot Once calls that all share its policy, grants, approver and tools. It is the composition root: the plumbing lives here so a consumer configures, not wires.

Share the tools, not a snapshot of them: a Runtime holds the toolset as a function its sessions ask at the start of every turn (see WithToolsFunc). A consumer whose available tools change while conversations are open therefore answers the next turn with the new set, without reopening anything — and a turn still works with one fixed set from beginning to end.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Runtime)

Option configures a Runtime.

func WithContext

func WithContext(fn func(context.Context) context.Context) Option

WithContext adds fn to what every session's ctx passes through when the session is built, before the gate is installed on it. A consumer uses it to put on the ctx what its policy reads — who the work is for, say — so every tool call of the session, and of its sub-agents, carries it. Several apply in the order given.

func WithGate

func WithGate(policy gate.Policy, grants gate.Grants, approver gate.Approver) Option

WithGate installs permission gating: a Policy plus a Grants store (nil = in-memory) and an Approver (nil = unattended, so any Ask is denied). Without WithGate or WithoutGate no machinery is installed, and every action a tool checks is denied (gate.ErrDeniedUnconfigured).

func WithGateLogger

func WithGateLogger(log agentkit.Logger) Option

WithGateLogger sets the logger that traces gate decisions (allow/deny/ask/grant). Pass the same logger the sessions use so the lines carry ws/chat/component; nil (the default) traces nothing.

func WithResultFilter

func WithResultFilter(f agentkit.ResultFilter) Option

WithResultFilter installs f on every session's ctx (agentkit.WithResultFilter): every tool result, in this session and its sub-agents, passes through it before the model sees it.

func WithSession

func WithSession(opts ...agentkit.Option) Option

WithSession adds default agentkit session options — system prompt, timeout, token limit, tokenizer, store — applied when each Session/Once is BUILT.

Applied once is not the same as fixed once, and the difference matters here: an option installs whatever the session then consults. WithTimeout and WithStore install values, read as they are for the session's life. WithSystem installs a function that returns a constant, and WithSystemFunc one that need not — either way the session asks it at the start of every turn, so a consumer folding in mutable context is answered by the next turn rather than the next session.

Tools and skills do NOT come through here: they are the Runtime's own, see WithToolsFunc.

func WithSkills

func WithSkills(ss agentkit.SkillSet) Option

WithSkills sets a fixed skill set.

func WithSkillsFunc

func WithSkillsFunc(fn func() agentkit.SkillSet) Option

WithSkillsFunc is WithToolsFunc for the skill catalog.

func WithTools

func WithTools(ts agentkit.ToolSet) Option

WithTools sets a fixed toolset. When gating is configured (WithGate), each call is gated on its name; a tool that self-checks a runtime target (a host) is checked on that too — classify its target axis, not its name, so the name check just passes.

func WithToolsFunc

func WithToolsFunc(fn func() agentkit.ToolSet) Option

WithToolsFunc sets the toolset through a function the session evaluates once per turn, for a consumer whose available tools change while conversations are open. Gating still applies: it rides the session's ctx (gate.With installs the name check as agentkit's CallGuard), so tools that appear later are gated exactly like the ones that were there at the start.

func WithoutGate

func WithoutGate() Option

WithoutGate runs the sessions ungated, on purpose: every action a tool checks is allowed (gate.Open). For tests, examples and consumers that gate on their own. WithGate wins over it.

type Runtime

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

Runtime holds the shared configuration for a set of sessions.

func New

func New(llm agentkit.LLM, opts ...Option) *Runtime

New builds a Runtime over an LLM. Any adapter satisfying agentkit.LLM works.

func (*Runtime) Once

func (r *Runtime) Once(ctx context.Context, input string, opts ...agentkit.Option) (string, error)

Once runs a one-shot to a final answer with the same wiring.

func (*Runtime) Session

func (r *Runtime) Session(ctx context.Context, opts ...agentkit.Option) *agentkit.Session

Session starts a live session: the runtime's LLM and gated tools, with the permission machinery installed on its ctx (so it reaches every tool call and sub-agent). Extra options override the runtime defaults.

Jump to

Keyboard shortcuts

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