#1330·eino

[Bug] adk: DesignateAgent is ignored when resuming an interrupted agent

Author: vitolee-1018Created Sep 28, 2026Updated Sep 28, 2026

Describe the bug

flowAgent.Run passes the options through filterOptions(agentName, opts) before calling the wrapped agent (adk/flow.go:389), so an option created with .DesignateAgent("B") only reaches agent B. flowAgent.Resume does not filter them when the agent itself was interrupted:

go
aIter := ra.Resume(withCancelContext(ctx, cancelCtx), info, opts...)

This is adk/flow.go:423. typedFlowAgent.Resume has the same line at adk/flow.go:696. The resumed agent therefore receives every option passed to Runner.Resume, including options designated to other agents. Implementation-specific options are applied in order, so an option meant for another agent can override the agent's own one. For example, WithChatModelOptions(...).DesignateAgent("B") changes the model options of a ChatModelAgent named A after its tool interrupt is resumed.

The callback setup in the same function already uses filterOptions(agentName, opts) (adk/flow.go:409). The workflow agent branch forwards the options to its sub-agents, which filter them by their own names, the same as in Run. Only the call into the resumed agent is affected.

To Reproduce

go
type valueOptions struct{ value string }

func withValue(v string) adk.AgentRunOption {
	return adk.WrapImplSpecificOptFn(func(o *valueOptions) { o.value = v })
}

// agentA interrupts on Run and prints the option value it receives.
type agentA struct{}

func (agentA) Name(context.Context) string        { return "A" }
func (agentA) Description(context.Context) string { return "agent A" }

func (agentA) Run(ctx context.Context, _ *adk.AgentInput, opts ...adk.AgentRunOption) *adk.AsyncIterator[*adk.AgentEvent] {
	fmt.Println("Run:   ", adk.GetImplSpecificOptions[valueOptions](nil, opts...).value)
	iter, gen := adk.NewAsyncIteratorPair[*adk.AgentEvent]()
	gen.Send(adk.StatefulInterrupt(ctx, "need input", "state"))
	gen.Close()
	return iter
}

func (agentA) Resume(_ context.Context, _ *adk.ResumeInfo, opts ...adk.AgentRunOption) *adk.AsyncIterator[*adk.AgentEvent] {
	fmt.Println("Resume:", adk.GetImplSpecificOptions[valueOptions](nil, opts...).value)
	iter, gen := adk.NewAsyncIteratorPair[*adk.AgentEvent]()
	gen.Close()
	return iter
}

// store is an in-memory adk.CheckPointStore.
type store map[string][]byte

func (s store) Get(_ context.Context, k string) ([]byte, bool, error) {
	v, ok := s[k]
	return v, ok, nil
}

func (s store) Set(_ context.Context, k string, v []byte) error {
	s[k] = v
	return nil
}

func main() {
	ctx := context.Background()
	runner := adk.NewRunner(ctx, adk.RunnerConfig{Agent: agentA{}, CheckPointStore: store{}})

	forA := withValue("for A").DesignateAgent("A")
	forB := withValue("for B").DesignateAgent("B")

	iter := runner.Query(ctx, "hi", adk.WithCheckPointID("1"), forA, forB)
	for _, ok := iter.Next(); ok; _, ok = iter.Next() {
	}
	iter, _ = runner.Resume(ctx, "1", forA, forB)
	for _, ok := iter.Next(); ok; _, ok = iter.Next() {
	}
}

On alpha/10 @ 58daeda this prints:

Run:    for A
Resume: for B

Expected behavior

On Resume, the interrupted agent only receives options that are not designated or are designated to it, as on Run. The example prints Resume: for A.

Version:

alpha/10 @ 58daeda (adk/flow.go:423, adk/flow.go:696). The same lines exist on main @ ba04fde.