{"record":{"id":"2f73b7f6b20fb69b","repo":"micro/go-micro","slug":"agent-streamask-unsupported-by-implementation","errorCode":null,"errorMessage":"agent: StreamAsk unsupported by implementation","messagePattern":"agent: StreamAsk unsupported by implementation","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/stream.go","lineNumber":53,"sourceCode":"\tResult   ai.ToolResult\n\tResponse *Response\n}\n\n// AgentStream is a stream of tool execution events followed by final-answer chunks.\ntype AgentStream interface {\n\tRecv() (*StreamEvent, error)\n\tClose() error\n}\n\n// StreamAsk runs an agent Ask turn with tool start/end events and streams the final answer.\n// It is additive for callers that hold the public Agent interface; concrete agents also\n// expose the same method directly.\nfunc 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,","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/micro/go-micro/blob/24529f140421a11a33b6999ab7944f2021cfd69c/agent/stream.go#L35-L71","documentation":"StreamAsk is a helper that streams agent responses only when the underlying Agent implementation also implements a StreamAsk(context.Context, string) (AgentStream, error) method via an anonymous interface check. If the agent does not support streaming, this sentinel error is returned instead of a stream. It exists to let callers opt into streaming without requiring every Agent to implement it.","triggerScenarios":"Calling agent.StreamAsk(ctx, ag, message) where ag is an Agent whose concrete type does not define a StreamAsk method (only plain Ask).","commonSituations":"Wrapping or decorating an agent with a custom type that forwards Ask but not StreamAsk; using an older or custom agent implementation predating streaming support; passing a mock/stub agent in tests.","solutions":["Use an agent implementation that supports streaming (e.g. the library's agentImpl)","Check support first with a type assertion to interface{ StreamAsk(context.Context, string) (AgentStream, error) } and fall back to Ask","Wrap custom agent types to forward StreamAsk to the inner agent"],"exampleFix":"// before\nstream, err := agent.StreamAsk(ctx, myWrapper{inner: ag}, \"hi\")\n// after\nstreamer, ok := ag.(interface{ StreamAsk(context.Context, string) (AgentStream, error) })\nif !ok {\n    resp, err := agent.Ask(ctx, ag, \"hi\") // fallback\n} else {\n    stream, err := streamer.StreamAsk(ctx, \"hi\")\n}","handlingStrategy":"type-guard","validationCode":"streamer, ok := ag.(interface{ StreamAsk(context.Context, string) (AgentStream, error) })\nif !ok { /* fallback to Ask */ }","typeGuard":"func supportsStreamAsk(ag agent.Agent) bool {\n    _, ok := ag.(interface{ StreamAsk(context.Context, string) (AgentStream, error) })\n    return ok\n}","tryCatchPattern":"stream, err := agent.StreamAsk(ctx, ag, msg)\nif err != nil && strings.Contains(err.Error(), \"unsupported by implementation\") {\n    resp, err := agent.Ask(ctx, ag, msg) // non-streaming fallback\n}","preventionTips":["Type-assert streaming support before calling StreamAsk","Keep custom agent wrappers forwarding StreamAsk to the inner agent","Prefer the library's concrete agent when streaming is required"],"tags":["go","agent","streaming","capability-detection"],"backgroundTag":"operation-not-supported","analyzedSha":"24529f140421a11a33b6999ab7944f2021cfd69c","analyzedAt":"2026-09-01T02:52:24.923Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}