{"record":{"id":"08c484c674f008bc","repo":"alibaba/spring-ai-alibaba","slug":"a2aremoteagent-has-not-support-schedule","errorCode":null,"errorMessage":"A2aRemoteAgent has not support schedule.","messagePattern":"A2aRemoteAgent has not support schedule\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spring-ai-alibaba-agent-framework/src/main/java/com/alibaba/cloud/ai/graph/agent/a2a/A2aRemoteAgent.java","lineNumber":86,"sourceCode":"\t\t\tthis.keyStrategyFactory = () -> {\n\t\t\t\tHashMap<String, KeyStrategy> keyStrategyHashMap = new HashMap<>();\n\t\t\t\tkeyStrategyHashMap.put(\"messages\", new AppendStrategy());\n\t\t\t\treturn keyStrategyHashMap;\n\t\t\t};\n\t\t}\n\n\t\tStateGraph graph = new StateGraph(name, this.keyStrategyFactory);\n\t\tgraph.addNode(\"A2aNode\", AsyncNodeActionWithConfig.node_async(\n\t\t\t\tnew A2aNodeActionWithConfig(agentCard, name, includeContents, outputKey, instruction, streaming,\n\t\t\t\t\t\tthis.shareState, this.compileConfig)));\n\t\tgraph.addEdge(StateGraph.START, \"A2aNode\");\n\t\tgraph.addEdge(\"A2aNode\", StateGraph.END);\n\t\treturn graph;\n\t}\n\n\t@Override\n\tpublic ScheduledAgentTask schedule(ScheduleConfig scheduleConfig) {\n\t\tthrow new UnsupportedOperationException(\"A2aRemoteAgent has not support schedule.\");\n\t}\n\n\tpublic static Builder builder() {\n\t\treturn new Builder();\n\t}\n\n\t@Override\n\tpublic Node asNode(boolean includeContents, boolean returnReasoningContents) {\n\t\treturn new A2aRemoteAgentNode(this.name, includeContents, returnReasoningContents, this.instruction, this.agentCard, this.streaming, this.shareState, this.getAndCompileGraph());\n\t}\n\n\t/**\n\t * Internal class that adapts an A2aRemoteAgent to be used as a Node.\n\t * Similar to AgentSubGraphNode but uses A2aNodeActionWithConfig internally.\n\t * Implements SubGraphNode interface to provide subgraph functionality.\n\t */\n\tprivate class A2aRemoteAgentNode extends Node implements SubGraphNode {\n","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-agent-framework/src/main/java/com/alibaba/cloud/ai/graph/agent/a2a/A2aRemoteAgent.java#L68-L104","documentation":"A2aRemoteAgent represents a remote A2A agent proxied over the network; it does not own a local StateGraph that can be scheduled, so its schedule(ScheduleConfig) override is intentionally unimplemented and throws UnsupportedOperationException. Scheduling is only supported by agents backed by a local graph (e.g. scheduled subgraphs). Calling schedule() on a remote agent is a design-time mistake, not a transient failure.","triggerScenarios":"Calling schedule(config) on an A2aRemoteAgent instance built via A2aRemoteAgent.builder().build(), or invoking it generically on an Agent reference that is actually a remote A2A agent.","commonSituations":"Developers porting scheduling code written for local graph agents to remote A2A agents, or iterating over a mixed collection of agents and applying schedule() uniformly without checking the agent type.","solutions":["Remove the schedule() call for A2aRemoteAgent instances; schedule the local orchestrating agent/graph instead.","Guard with `if (agent instanceof ScheduledAgentTask && !(agent instanceof A2aRemoteAgent))` before calling schedule().","Wrap the call in try-catch for UnsupportedOperationException if mixed agent lists are unavoidable.","Track A2A remote agents separately from local agents so scheduling logic only targets the local ones."],"exampleFix":"// before\nagent.schedule(scheduleConfig); // throws for A2aRemoteAgent\n\n// after\nif (!(agent instanceof A2aRemoteAgent)) {\n    agent.schedule(scheduleConfig);\n}","handlingStrategy":"try-catch","validationCode":"if (agent instanceof A2aRemoteAgent) {\n    throw new IllegalStateException(\"Remote A2A agents do not support scheduling\");\n}","typeGuard":"boolean isSchedulable(Object agent) {\n    return agent instanceof ScheduledAgentTask && !(agent instanceof A2aRemoteAgent);\n}","tryCatchPattern":"try {\n    agent.schedule(config);\n} catch (UnsupportedOperationException e) {\n    log.warn(\"{} does not support scheduling\", agent.getClass().getSimpleName(), e);\n}","preventionTips":["Check the concrete agent type before applying lifecycle operations like schedule().","Keep remote A2A agents in a separate collection from local graph agents.","Document that scheduling applies only to locally backed agents."],"tags":["a2a","unsupported-operation","scheduling"],"backgroundTag":"unsupported-operation","analyzedSha":"f82da0b50f35744c13968191be2b1cd2452ef550","analyzedAt":"2026-09-09T15:32:42.421Z","contentChangedAt":"2026-09-09T15:32:42.421Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}