Documentation
¶
Index ¶
Constants ¶
const ( // AdvisorSystemPrompt steers the nested advisor model to help the parent // agent rather than speaking directly to the end user. AdvisorSystemPrompt = `` /* 426-byte string literal not displayed */ // ParentGuidanceBlock is a reusable prompt block for teaching parent agents // when to invoke the built-in advisor tool. ParentGuidanceBlock = `` /* 482-byte string literal not displayed */ )
const ToolName = "advisor"
ToolName is the identifier the advisor tool registers under. The parent agent's exclusive-tool policy and the advisor-guidance block both reference this name, so keeping them synchronized requires a single source of truth.
Variables ¶
This section is empty.
Functions ¶
func BuildAdvisorMessages ¶
func BuildAdvisorMessages( question string, conversationSnapshot []fantasy.Message, ) []fantasy.Message
BuildAdvisorMessages prepares a nested advisor prompt using the recent chat context plus the explicit advisor question.
func Tool ¶
func Tool(opts ToolOptions) fantasy.AgentTool
Tool returns a fantasy.AgentTool that asks a nested model for concise strategic guidance. The nested advisor sees recent conversation context, runs without tools, and is limited to a single model step.
Types ¶
type AdvisorArgs ¶
type AdvisorArgs struct {
Question string `` /* 155-byte string literal not displayed */
}
AdvisorArgs contains the tool-visible advisor question.
type AdvisorResult ¶
type AdvisorResult struct {
Type ResultType `json:"type"`
Advice string `json:"advice,omitempty"`
Error string `json:"error,omitempty"`
AdvisorModel string `json:"advisor_model,omitempty"`
RemainingUses int `json:"remaining_uses"`
}
AdvisorResult is the structured result returned by the advisor runtime.
type ResultType ¶
type ResultType string
ResultType is the tagged variant of AdvisorResult. Callers should compare against the exported constants rather than string literals.
const ( // ResultTypeAdvice indicates the advisor returned guidance. ResultTypeAdvice ResultType = "advice" // ResultTypeLimitReached indicates the per-run advisor budget is exhausted. ResultTypeLimitReached ResultType = "limit_reached" // ResultTypeError indicates the nested advisor run failed. ResultTypeError ResultType = "error" )
type RunAdvisorOptions ¶
type RunAdvisorOptions struct {
OnAdviceDelta func(delta string)
OnAdviceReset func()
}
RunAdvisorOptions carries optional streaming callbacks for a single RunAdvisor invocation.
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime executes nested, tool-less advisor runs against the configured language model.
Each Runtime instance is scoped to a single outer chat run. The MaxUsesPerRun counter increments on every successful advisor call and is never reset, so callers must construct a fresh Runtime (via NewRuntime) for each outer run. There is intentionally no Reset method: the per-run quota is a safety bound on a single run, not a rolling window.
func NewRuntime ¶
func NewRuntime(cfg RuntimeConfig) (*Runtime, error)
NewRuntime validates and normalizes advisor runtime configuration.
func (*Runtime) MaxOutputTokens ¶
MaxOutputTokens reports the resolved output-token cap applied to each advisor call. NewRuntime validates that this value is positive and that it matches ModelConfig.MaxOutputTokens when both are set, so the accessor always returns the value the runtime will actually send.
func (*Runtime) ProviderOptions ¶
func (rt *Runtime) ProviderOptions() fantasy.ProviderOptions
ProviderOptions reports the resolved provider options applied to each advisor call. NewRuntime clones the supplied options so the returned map reflects what nested calls will actually receive; callers must not mutate the map or its entries.
func (*Runtime) RemainingUses ¶
RemainingUses reports how many advisor calls are still available for the current runtime.
func (*Runtime) RunAdvisor ¶
func (rt *Runtime) RunAdvisor( ctx context.Context, question string, conversationSnapshot []fantasy.Message, opts *RunAdvisorOptions, ) (AdvisorResult, error)
RunAdvisor executes a single, tool-less nested advisor call.
type RuntimeConfig ¶
type RuntimeConfig struct {
Model fantasy.LanguageModel
ModelConfig codersdk.ChatModelCallConfig
ProviderOptions fantasy.ProviderOptions
MaxUsesPerRun int
MaxOutputTokens int64
}
RuntimeConfig configures a single advisor runtime instance.