Skip to content

add subagent personal assistant#449

Open
junxwang wants to merge 9 commits intospring-ai-alibaba:mainfrom
junxwang:main
Open

add subagent personal assistant#449
junxwang wants to merge 9 commits intospring-ai-alibaba:mainfrom
junxwang:main

Conversation

@junxwang
Copy link

What does this PR do?

feat: add subagent personal assistant

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Spring Boot example module demonstrating a “supervisor + subagents” personal assistant built on Spring AI Alibaba ReactAgent, including calendar/email tooling and a basic HITL (human-in-the-loop) approval flow.

Changes:

  • Introduces a new subagent-personal-assistant-example module with Supervisor/Calendar/Email agents and tool-callback implementations.
  • Adds a streaming REST endpoint to drive the supervisor agent and handle HITL interruptions/resume.
  • Adds module docs/config (README, application.yml, Maven module wiring).

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
spring-ai-alibaba-agent-example/subagent-personal-assistant-example/src/main/resources/application.yml Adds Spring Boot + DashScope model configuration for the new example app.
spring-ai-alibaba-agent-example/subagent-personal-assistant-example/src/main/java/com/cloud/alibaba/ai/example/agent/SubAgentPersonalAssistantApplication.java New Spring Boot entrypoint for the example module.
spring-ai-alibaba-agent-example/subagent-personal-assistant-example/src/main/java/com/cloud/alibaba/ai/example/agent/config/AgentConfig.java Wires supervisor + subagents, tools, and HITL hook configuration.
spring-ai-alibaba-agent-example/subagent-personal-assistant-example/src/main/java/com/cloud/alibaba/ai/example/agent/controller/PersonalAssistantController.java Exposes SSE endpoint for streaming agent output and HITL resume flow.
spring-ai-alibaba-agent-example/subagent-personal-assistant-example/src/main/java/com/cloud/alibaba/ai/example/agent/HITLHelper.java Utility helpers to approve/reject/edit tool calls during HITL.
spring-ai-alibaba-agent-example/subagent-personal-assistant-example/src/main/java/com/cloud/alibaba/ai/example/agent/tool/UserDataTool.java Tool to lookup users by username/department and return JSON-like results.
spring-ai-alibaba-agent-example/subagent-personal-assistant-example/src/main/java/com/cloud/alibaba/ai/example/agent/tool/SendEmailTool.java Tool to validate and simulate sending outbound emails.
spring-ai-alibaba-agent-example/subagent-personal-assistant-example/src/main/java/com/cloud/alibaba/ai/example/agent/tool/DateTimeTools.java Tool for returning the current date/time (currently returns date only).
spring-ai-alibaba-agent-example/subagent-personal-assistant-example/src/main/java/com/cloud/alibaba/ai/example/agent/tool/CreateCalendarEventTool.java Tool to validate/simulate calendar event creation.
spring-ai-alibaba-agent-example/subagent-personal-assistant-example/src/main/java/com/cloud/alibaba/ai/example/agent/tool/AvailableTimeSlotsTool.java Tool to validate input and return mocked available meeting slots.
spring-ai-alibaba-agent-example/subagent-personal-assistant-example/src/main/java/com/cloud/alibaba/ai/example/agent/model/UserInfo.java DTO for user lookup tool input/output.
spring-ai-alibaba-agent-example/subagent-personal-assistant-example/src/main/java/com/cloud/alibaba/ai/example/agent/model/EmailInfo.java DTO for email tool input.
spring-ai-alibaba-agent-example/subagent-personal-assistant-example/src/main/java/com/cloud/alibaba/ai/example/agent/model/CalendarInfo.java DTO for calendar creation tool input.
spring-ai-alibaba-agent-example/subagent-personal-assistant-example/src/main/java/com/cloud/alibaba/ai/example/agent/model/AvailableTimeInfo.java DTO for available time slots tool input.
spring-ai-alibaba-agent-example/subagent-personal-assistant-example/README.md Adds usage instructions, tool list, and example conversation.
spring-ai-alibaba-agent-example/subagent-personal-assistant-example/pom.xml New module POM with Spring Boot + agent framework dependencies.
pom.xml Adds the new example module to the root multi-module build.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +74 to +86
if (nodeId != null && TOOL_FEEDBACK_MAP.containsKey(nodeId)) {
System.out.println("人工介入开始...");
// Human intervention using checkpoint mechanism.
// You must provide a thread ID to associate execution with a session thread,
// so that conversations can be paused and resumed (required for human review).
InterruptionMetadata metadata = InterruptionMetadata.builder().toolFeedbacks(TOOL_FEEDBACK_MAP.get(nodeId)).build();
InterruptionMetadata approvalMetadata = HITLHelper.approveAll(metadata);
// Resume execution using approval decision
config = RunnableConfig.builder()
.threadId(threadId) // Same thread ID
.addHumanFeedback(approvalMetadata)
.build();
TOOL_FEEDBACK_MAP.remove(nodeId);
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When resuming from a HITL interruption you rebuild InterruptionMetadata with only toolFeedbacks; nodeId/state are not set, but HITLHelper.approveAll() copies node/state from the provided metadata. This likely produces feedback metadata with null nodeId/state and can break resume execution. Store the original InterruptionMetadata (or at least nodeId + state) in the map and use it when creating the approval metadata.

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在println(NodeOutput nodeOutput) 方法中有存储元数据

Comment on lines +18 to +29
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
* @author wangjx
* @since 2026-02-13
*/
@SpringBootApplication
public class SubAgentPersonalAssistantApplication {
public static void main(String[] args) {
SpringApplication.run(SubAgentPersonalAssistantApplication.class, args);
}
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other agent example modules include at least a basic @SpringBootTest contextLoads test, but this new module has no src/test at all (despite depending on spring-boot-starter-test). Adding a minimal context-load test would help catch wiring/config regressions (e.g., bean creation for supervisorAgent).

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

当前项目为使用示例,README.md中已提供使用方法,无需在提供 test用例

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants