@@ -65,6 +65,17 @@ import (
6565)
6666
6767type (
68+ // HintOverrideFunc can override the call hint for a tool invocation.
69+ //
70+ // Contract:
71+ // - Returning (hint, true) selects hint as the DisplayHint, even when a DSL
72+ // template exists.
73+ // - Returning ("", false) indicates no override applies and the runtime should
74+ // use its default behavior.
75+ // - The payload value is the typed payload decoded via the tool payload codec
76+ // when possible; it may be nil when decoding fails.
77+ HintOverrideFunc func (ctx context.Context , tool tools.Ident , payload any ) (hint string , ok bool )
78+
6879 // Runtime orchestrates agent workflows, policy enforcement, memory persistence,
6980 // and event streaming. It serves as the central registry for agents, toolsets,
7081 // and models. All public methods are thread-safe and can be called concurrently.
@@ -150,6 +161,8 @@ type (
150161 // It is used to require explicit operator approval before executing certain tools.
151162 // See ToolConfirmationConfig for details.
152163 toolConfirmation * ToolConfirmationConfig
164+
165+ hintOverrides map [tools.Ident ]HintOverrideFunc
153166 }
154167
155168 // Options configures the Runtime instance. All fields are optional except Engine
@@ -194,6 +207,10 @@ type (
194207 // tools (for example, requiring explicit operator approval before executing
195208 // additional tools that are not marked with design-time Confirmation).
196209 ToolConfirmation * ToolConfirmationConfig
210+
211+ // HintOverrides optionally overrides DSL-authored call hints for specific tools
212+ // when streaming tool_start events.
213+ HintOverrides map [tools.Ident ]HintOverrideFunc
197214 }
198215
199216 // RuntimeOption configures the runtime via functional options passed to NewWith.
@@ -662,6 +679,7 @@ func newFromOptions(opts Options) *Runtime {
662679 workers : opts .Workers ,
663680 reminders : reminder .NewEngine (),
664681 toolConfirmation : opts .ToolConfirmation ,
682+ hintOverrides : opts .HintOverrides ,
665683 }
666684 rt .PromptRegistry .SetObserver (rt .onPromptRendered )
667685 // Install runtime-owned toolsets before any agent registration so planners
@@ -906,6 +924,14 @@ func WithToolConfirmation(cfg *ToolConfirmationConfig) RuntimeOption {
906924 return func (o * Options ) { o .ToolConfirmation = cfg }
907925}
908926
927+ // WithHintOverrides configures per-tool call hint overrides.
928+ //
929+ // When provided, overrides take precedence over DSL-authored CallHint templates
930+ // when streaming tool_start events. Only tools present in the map are considered.
931+ func WithHintOverrides (m map [tools.Ident ]HintOverrideFunc ) RuntimeOption {
932+ return func (o * Options ) { o .HintOverrides = m }
933+ }
934+
909935// WithWorker configures the worker for a specific agent. Engines that support
910936// worker polling use this configuration to bind the agent to a specific queue.
911937// If unspecified, a default worker configuration is used.
0 commit comments