Documentation
¶
Overview ¶
Package strategy 提供统一 agent loop 的可选执行策略。
三种策略(ReAct / PlanExecute / Reflection)都实现 runtime.Strategy 接口, 以「提示词引导 + 共享回合循环」的方式表达各自模式——运行在同一个统一 runtime 回合循环上,而非各自独立的 loop 实现。经 agent.WithStrategy 选用。
这是「统一 agent loop」的轻量落点:同一个 ReActAgent 通过切换 Strategy 即可 表现为 ReAct / 先规划后执行 / 自检反思。功能更丰富的多调用编排(独立的 PlanExecuteAgent / ReflectionAgent)与本路径并存,互不影响。
Index ¶
- func All() []hruntime.Strategy
- func ByName(name string) (hruntime.Strategy, bool)
- type PlanExecute
- func (PlanExecute) AfterLLM(context.Context, *hruntime.State) error
- func (PlanExecute) BeforeTurn(context.Context, *hruntime.State) error
- func (PlanExecute) BuildSystemPrefix(context.Context, hruntime.Request) string
- func (PlanExecute) Finalize(context.Context, *hruntime.State) error
- func (PlanExecute) Name() string
- func (PlanExecute) ShouldContinue(context.Context, *hruntime.State) bool
- type ReAct
- func (ReAct) AfterLLM(context.Context, *hruntime.State) error
- func (ReAct) BeforeTurn(context.Context, *hruntime.State) error
- func (ReAct) BuildSystemPrefix(context.Context, hruntime.Request) string
- func (ReAct) Finalize(context.Context, *hruntime.State) error
- func (ReAct) Name() string
- func (ReAct) ShouldContinue(context.Context, *hruntime.State) bool
- type Reflection
- func (Reflection) AfterLLM(context.Context, *hruntime.State) error
- func (Reflection) BeforeTurn(context.Context, *hruntime.State) error
- func (Reflection) BuildSystemPrefix(context.Context, hruntime.Request) string
- func (Reflection) Finalize(context.Context, *hruntime.State) error
- func (Reflection) Name() string
- func (Reflection) ShouldContinue(context.Context, *hruntime.State) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type PlanExecute ¶
type PlanExecute struct{}
PlanExecute asks the model to plan before executing.
func (PlanExecute) BeforeTurn ¶
func (PlanExecute) BuildSystemPrefix ¶
func (PlanExecute) Name ¶
func (PlanExecute) Name() string
func (PlanExecute) ShouldContinue ¶
type ReAct ¶
type ReAct struct{}
ReAct is the default reasoning/action strategy.
func (ReAct) BuildSystemPrefix ¶
type Reflection ¶
type Reflection struct{}
Reflection asks the model to self-check before finalizing.
func (Reflection) BeforeTurn ¶
func (Reflection) BuildSystemPrefix ¶
func (Reflection) Name ¶
func (Reflection) Name() string
func (Reflection) ShouldContinue ¶
Click to show internal directories.
Click to hide internal directories.