{"record":{"id":"d397c9f5934469af","repo":"micro/go-micro","slug":"agent-resume-unsupported-agent-implementation-t","errorCode":null,"errorMessage":"agent resume: unsupported agent implementation %T","messagePattern":"agent resume: unsupported agent implementation %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/checkpoint.go","lineNumber":73,"sourceCode":"\t\tstage := run.State.Stage\n\t\tif stage == \"\" && len(run.Steps) > 0 {\n\t\t\tstage = run.Steps[0].Name\n\t\t}\n\t\ta.recordTimelineEvent(ctx, RunEvent{\n\t\t\tTime: time.Now(), RunID: info.RunID, ParentID: info.ParentID, Agent: info.Agent,\n\t\t\tKind: \"checkpoint\", Name: stage, Status: run.Status,\n\t\t})\n\t}\n\treturn nil\n}\n\n// Resume returns the response for a checkpointed agent run. Completed runs are\n// returned from the checkpoint without calling the model or replaying tool\n// calls; failed or in-progress runs continue from the saved input message.\nfunc Resume(ctx context.Context, ag Agent, runID string) (*Response, error) {\n\ta, ok := ag.(*agentImpl)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"agent resume: unsupported agent implementation %T\", ag)\n\t}\n\treturn a.resume(ctx, runID)\n}\n\nfunc (a *agentImpl) resume(ctx context.Context, runID string) (*Response, error) {\n\tif a.opts.Checkpoint == nil {\n\t\treturn nil, fmt.Errorf(\"agent %s has no checkpoint configured\", a.opts.Name)\n\t}\n\trun, ok, err := a.opts.Checkpoint.Load(ctx, runID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"agent run %s not found\", runID)\n\t}\n\tif run.Status == \"paused\" {\n\t\tif run.State.Stage == agentInputStep {\n\t\t\treturn nil, fmt.Errorf(\"agent run %s is input-required; resume with ResumeInput\", runID)","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/micro/go-micro/blob/24529f140421a11a33b6999ab7944f2021cfd69c/agent/checkpoint.go#L55-L91","documentation":"The package-level agent.Resume (agent/checkpoint.go:73) returns the response for a checkpointed run, but it only accepts the internal *agentImpl concrete type. Any other Agent implementation fails this type assertion and gets this error, since resume needs unexported checkpoint state.","triggerScenarios":"Calling agent.Resume(ctx, ag, runID) where ag is a wrapped, decorated, mocked, or otherwise custom Agent rather than the concrete agent value produced by the library.","commonSituations":"Passing a logging/tracing wrapper into resume flows in tests or recovery loops; using a fake Agent in unit tests like the ones listed; mixing agent implementations across package versions.","solutions":["Pass the original concrete agent (not a wrapper) to Resume","Keep the unwrapped agent reference before decorating and use it for Resume calls","Delegate resume inside your wrapper to the concrete agent's Resume","Use the library's agent constructor output directly instead of custom Agent implementations"],"exampleFix":"// before\nvar ag agent.Agent = withTracing(agent.New(...))\nresp, err := agent.Resume(ctx, ag, runID) // unsupported\n// after\nconcrete := agent.New(...)\nresp, err := agent.Resume(ctx, concrete, runID)\n","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"func supportsResume(ag agent.Agent) bool {\n    _, ok := ag.(*concreteAgentType) // the type returned by the library constructor\n    return ok\n}","tryCatchPattern":"resp, err := agent.Resume(ctx, ag, runID)\nif err != nil && strings.Contains(err.Error(), \"unsupported agent implementation\") {\n    return fmt.Errorf(\"Resume needs the concrete agent, not a wrapper: %w\", err)\n}","preventionTips":["Call package-level Resume only on the constructor's concrete agent","Keep unwrapped references for checkpoint APIs","Prefer method-level resume on the concrete type over interface wrappers"],"tags":["go","agent","type-assertion","resume"],"backgroundTag":"unsupported-implementation-type","analyzedSha":"24529f140421a11a33b6999ab7944f2021cfd69c","analyzedAt":"2026-09-01T02:52:24.923Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}