{"record":{"id":"9be4e0d6821e9e4d","repo":"micro/go-micro","slug":"agent-resumestreamask-unsupported-by-implementati","errorCode":null,"errorMessage":"agent: ResumeStreamAsk unsupported by implementation","messagePattern":"agent: ResumeStreamAsk unsupported by implementation","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/stream.go","lineNumber":66,"sourceCode":"func StreamAsk(ctx context.Context, ag Agent, message string) (AgentStream, error) {\n\tstreamer, ok := ag.(interface {\n\t\tStreamAsk(context.Context, string) (AgentStream, error)\n\t})\n\tif !ok {\n\t\treturn nil, errors.New(\"agent: StreamAsk unsupported by implementation\")\n\t}\n\treturn streamer.StreamAsk(ctx, message)\n}\n\n// ResumeStreamAsk resumes a checkpointed agent run and emits the same event\n// shape as StreamAsk. Completed runs are streamed from the persisted response;\n// unfinished runs continue from their checkpoint and emit tool events for any\n// work that still needs to run. Tool calls already recorded as done in the\n// checkpoint are reused by the agent checkpoint wrapper and are not re-executed.\nfunc ResumeStreamAsk(ctx context.Context, ag Agent, runID string) (AgentStream, error) {\n\ta, ok := ag.(*agentImpl)\n\tif !ok {\n\t\treturn nil, errors.New(\"agent: ResumeStreamAsk unsupported by implementation\")\n\t}\n\treturn a.resumeStreamAsk(ctx, runID)\n}\n\n// StreamAsk runs tools like Ask, emits ToolStart/ToolEnd events as they execute,\n// then emits chunks of the final answer followed by a Done event.\nfunc (a *agentImpl) StreamAsk(ctx context.Context, message string) (AgentStream, error) {\n\tstreamCtx, cancel := context.WithCancel(ctx)\n\tevents := make(chan *StreamEvent, 16)\n\tdone := make(chan struct{})\n\ts := &agentStream{events: events, done: done, cancel: cancel}\n\n\tgo func() {\n\t\tdefer close(events)\n\t\tdefer close(done)\n\t\tresp, err := a.askWithStreamEvents(streamCtx, message, events)\n\t\tif err != nil {\n\t\t\ts.setErr(err)","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/micro/go-micro/blob/24529f140421a11a33b6999ab7944f2021cfd69c/agent/stream.go#L48-L84","documentation":"ResumeStreamAsk resumes a checkpointed agent run with streaming, but only for the concrete *agentImpl type. Any other Agent implementation causes this sentinel error because resume-from-checkpoint logic is implemented solely on agentImpl.","triggerScenarios":"Calling agent.ResumeStreamAsk(ctx, ag, runID) with an Agent that is not the library's *agentImpl concrete type (e.g. a wrapper, decorator, or custom implementation).","commonSituations":"Wrapping the agent in middleware/decorators that hide the concrete type; storing the agent behind a custom interface value; tests using mock agents.","solutions":["Pass the original *agentImpl returned by the library's constructor (not a wrapper)","Expose the underlying agent via a method like Unwrap() and resume on that","Create the agent directly from the library so the concrete type is preserved"],"exampleFix":"// before\nwrapped := loggingAgent{inner: ag}\nstream, err := agent.ResumeStreamAsk(ctx, wrapped, runID) // fails\n// after\nstream, err := agent.ResumeStreamAsk(ctx, ag, runID) // pass the concrete *agentImpl","handlingStrategy":"type-guard","validationCode":"if _, ok := ag.(*agent.AgentImpl); !ok { /* resume unsupported */ }","typeGuard":"func supportsResumeStream(ag agent.Agent) bool {\n    _, ok := ag.(*agent.AgentImpl) // concrete implementation check\n    return ok\n}","tryCatchPattern":"stream, err := agent.ResumeStreamAsk(ctx, ag, runID)\nif err != nil && strings.Contains(err.Error(), \"unsupported by implementation\") {\n    return fmt.Errorf(\"resume requires the concrete agent implementation\")\n}","preventionTips":["Never wrap the agent when you need checkpoint resume; keep the *agentImpl handy","Expose Unwrap() on decorators to reach the concrete agent","Document that checkpoint resume only works with library-provided agents"],"tags":["go","agent","streaming","checkpoint","type-assertion"],"backgroundTag":"operation-not-supported","analyzedSha":"24529f140421a11a33b6999ab7944f2021cfd69c","analyzedAt":"2026-09-01T02:52:24.923Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}