micro/go-micro · error
agent pending: unsupported agent implementation %T
Error message
agent pending: unsupported agent implementation %T
What it means
agent.Pending (agent/agent.go:339) only supports the internal *agentImpl concrete type. If you pass any other implementation of the Agent interface (a custom wrapper, mock, or decorator), Pending refuses it with this error because it needs access to unexported checkpoint internals that only *agentImpl has.
Source
Thrown at agent/agent.go:339
}
if err != nil {
return err
}
if chunk == nil || chunk.Reply == "" {
continue
}
if err := stream.Send(&pb.ChatResponse{Reply: chunk.Reply, Agent: a.opts.Name}); err != nil {
return err
}
}
}
// Pending returns checkpointed agent runs that have not completed. It mirrors
// flow.Pending for startup recovery loops that drain durable agent work.
func Pending(ctx context.Context, ag Agent) ([]flow.Run, error) {
a, ok := ag.(*agentImpl)
if !ok {
return nil, fmt.Errorf("agent pending: unsupported agent implementation %T", ag)
}
return a.pending(ctx)
}
// ResumePending resumes every checkpointed agent run that has not completed
// yet, in the same oldest-first order returned by Pending.
//
// It is a convenience for service startup and recovery loops: after recreating
// an agent with the same checkpoint store, call ResumePending to drain the
// durable backlog without listing and resuming each run manually. If any run
// fails again, ResumePending stops and returns that run id with the error so
// callers can log, alert, or retry later without hiding the failing run.
func ResumePending(ctx context.Context, ag Agent) (string, error) {
a, ok := ag.(*agentImpl)
if !ok {
return "", fmt.Errorf("agent resume pending: unsupported agent implementation %T", ag)
}
runs, err := a.pending(ctx)View on GitHub (pinned to 24529f1404)
Solutions
- Pass the original un-wrapped agent instance returned by the library constructor to Pending
- Keep a reference to the concrete agent before wrapping it, and call Pending on that reference
- Add the pending capability to your wrapper by delegating internally to the concrete agent
- If you own a custom implementation, use the library's agentImpl instead of a bespoke Agent type
Example fix
// before
ag := loggingWrapper{inner: agent.New(...)}
runs, err := agent.Pending(ctx, ag) // unsupported implementation
// after
ag := agent.New(...)
runs, err := agent.Pending(ctx, ag) // pass the concrete *agentImpl
Defensive patterns
Strategy: type-guard
Type guard
func isConcreteAgent(ag agent.Agent) bool {
_, ok := ag.(interface {
Agent
pending(context.Context) ([]flow.Run, error)
})
return ok
}
// or simply: _, ok := ag.(*agentImpl); use ok before calling Pending Try / catch
runs, err := agent.Pending(ctx, ag)
if err != nil && strings.Contains(err.Error(), "unsupported agent implementation") {
return fmt.Errorf("pass the concrete agent, not a wrapper: %w", err)
} Prevention
- Never pass wrapped/decorated agents to package-level Pending/Resume helpers
- Store the concrete agent reference before applying decorators
- Avoid custom Agent implementations unless you also implement pending support
- Document that Pending requires the library's concrete agent type
When it happens
Trigger: Calling agent.Pending(ctx, ag) where ag is an Agent interface value that is not the *agentImpl returned by the library's constructor — e.g. a wrapped/decorated agent, a test fake, or a proxy.
Common situations: Wrapping an agent in middleware/decorators for logging or tracing and then passing the wrapper to Pending; using a mock Agent in tests; mixing agents from different library versions where the concrete type differs.
Related errors
- agent: ResumeStreamAsk unsupported by implementation
- agent resume pending: unsupported agent implementation %T
- agent resume: unsupported agent implementation %T
- agent: StreamAsk unsupported by implementation
- agent: ResumeStreamAsk requires a checkpoint
AI-assisted analysis of micro/go-micro@24529f1404 (2026-09-01).
Data as JSON: /api/errors/d1c5fa2f1728993d.
Report an issue: GitHub.