agentctx

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package agentctx defines per-Run context types shared by the agent loop and the providers it pulls context from. Kept separate from internal/runtime/agent so context-producing packages (state, channels, integrations, etc.) can satisfy the provider contract without depending on the agent package itself, which would create import cycles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithPromptMode

func WithPromptMode(ctx context.Context, mode PromptMode) context.Context

WithPromptMode annotates ctx with the system-prompt shape for the run.

Types

type ContextRequest

type ContextRequest struct {
	UserMessage   string
	ActiveTags    map[string]bool
	IncludeAlways bool
}

ContextRequest carries everything a context provider might need during system-prompt assembly. Always-on providers ignore ActiveTags; tagged providers ignore UserMessage when they don't need it; the semantic-search providers (contacts, knowledge subjects, archive prewarm) read UserMessage to surface relevant content.

IncludeAlways gates the always-on bucket inside the assembler; it's set true for main-loop runs (include presence, episodic memory, working memory, notification history, etc.) and false for delegate runs that should see only tag-scoped context appropriate to the bounded child task.

type PromptMode

type PromptMode string

PromptMode names the system-prompt shape used for an agent run.

const (
	// PromptModeFull is the default Thane prompt: persona, ego,
	// configured inject files, talents, generated runtime context, and
	// conversation history.
	PromptModeFull PromptMode = "full"

	// PromptModeTask is a compact worker prompt for bounded child
	// tasks. It preserves tool contracts and tag-scoped context while
	// omitting full identity and continuity material.
	PromptModeTask PromptMode = "task"
)

func ParsePromptMode

func ParsePromptMode(value string) (PromptMode, error)

ParsePromptMode validates a wire value and returns the corresponding prompt mode. An empty value resolves to the full default.

func PromptModeFromContext

func PromptModeFromContext(ctx context.Context) PromptMode

PromptModeFromContext returns the requested prompt mode, defaulting to full when no request-scoped mode has been set.

func (PromptMode) OrDefault

func (m PromptMode) OrDefault() PromptMode

OrDefault returns m when set, otherwise the full prompt mode.

func (PromptMode) Valid

func (m PromptMode) Valid() bool

Valid reports whether m is a supported prompt mode.

Jump to

Keyboard shortcuts

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