agents

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AvailableThinkingForModel added in v0.5.3

func AvailableThinkingForModel(model agentcore.ChatModel) []agentcore.ThinkingLevel

func ParseThinkingLevel added in v0.5.2

func ParseThinkingLevel(s string) (agentcore.ThinkingLevel, error)

ParseThinkingLevel 把配置字符串转 agentcore.ThinkingLevel。 "" 合法(= 不覆盖/继承);其余须是 off/low/medium/high/xhigh/max 之一, 否则返回 error(启动时降级当空并 warn,运行时把 error 回显给用户)。

func ResolveThinkingForModel added in v0.5.3

func ResolveThinkingForModel(model agentcore.ChatModel, level agentcore.ThinkingLevel) (agentcore.ThinkingLevel, bool)

Types

type ApplyThinking added in v0.5.2

type ApplyThinking func(role string, level agentcore.ThinkingLevel)

ApplyThinking 把某具体角色的推理强度应用到 live agent(运行时 /model 调整用)。 coordinator → Agent.SetThinkingLevel;architect → 两个 architect_* 子代理; writer/editor → 对应子代理。空 level = 沿用模型/provider 默认。其它 role 名忽略。

func BuildCoordinator

func BuildCoordinator(
	cfg bootstrap.Config,
	store *store.Store,
	models *bootstrap.ModelSet,
	bundle assets.Bundle,
	recordUsage UsageRecorder,
	onFlowBoundary FlowBoundaryHook,
	onGuardBlock reminder.BlockHook,
) (*agentcore.Agent, *tools.AskUserTool, *ctxpack.WriterRestorePack, *corecontext.ContextEngine, ApplyThinking)

BuildCoordinator 组装 Coordinator Agent 及其 SubAgent。 返回 Agent、AskUserTool、WriterRestorePack、Coordinator 的 ContextEngine 引用, 以及 ApplyThinking 闭包——Host 层 /model 切换时需要直接调 SetContextWindow + SetReserveTokens 联动新模型的窗口(writer/architect/editor 走 ContextManagerFactory 自动重建,不需要 ref;只有常驻的 coordinator 需要),并通过 ApplyThinking 联动各角色 推理强度。Host 层通过 Agent.Subscribe 获取事件流,不再需要 emit 回调。 onGuardBlock 可选(nil 安全):所有 StopGuard(coordinator + 各子代理)的拦截/升级 审计回调,Host 用它把拦截事实浮出到 TUI 事件流,见 reminder.BlockHook。

type FlowBoundaryHook added in v0.5.5

type FlowBoundaryHook func(toolName string)

FlowBoundaryHook runs synchronously after a Coordinator tool that advances the durable story state succeeds. Host uses it to queue the next flow instruction before the Coordinator gets another LLM turn.

type UsageRecorder added in v0.1.2

type UsageRecorder func(agentName, task string, msg agentcore.AgentMessage)

UsageRecorder 是 BuildCoordinator 可选的用量回调;签名与 OnMessage 一致, 每条 agent 消息都会调一次,由 Host 层负责聚合。task 是本次 spawn 的任务文本 (coordinator 无 spawn,恒为空),作为会话身份供缓存链断裂检测按会话重置基线。 nil 表示不追踪。

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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