MCPcopy Index your code
hub / github.com/docker/docker-agent / executeTurnStartHooks

Method executeTurnStartHooks

pkg/runtime/hooks.go:159–163  ·  view source on GitHub ↗

executeTurnStartHooks fires turn_start before each model call and returns its AdditionalContext as transient system messages. Like session_start the result is never persisted, but turn_start runs every iteration so its content is recomputed each turn — the right semantics for fast-changing context l

(ctx context.Context, sess *session.Session, a *agent.Agent, events EventSink)

Source from the content-addressed store, hash-verified

157// semantics for fast-changing context like the current date or the
158// contents of a prompt file the user might be editing mid-session.
159func (r *LocalRuntime) executeTurnStartHooks(ctx context.Context, sess *session.Session, a *agent.Agent, events EventSink) []chat.Message {
160 return contextMessages(r.dispatchHook(ctx, a, hooks.EventTurnStart, &hooks.Input{
161 SessionID: sess.ID,
162 }, events))
163}
164
165// Reason values reported in [hooks.Input.Reason] when [hooks.EventTurnEnd]
166// fires. The runtime guarantees that turn_end runs once per turn that

Callers 2

runHarnessAgentMethod · 0.95
runTurnMethod · 0.95

Calls 2

dispatchHookMethod · 0.95
contextMessagesFunction · 0.85

Tested by

no test coverage detected