This project is Alibaba's AI plan execution and management system, built with Spring Boot. It supports plan generation, asynchronous execution, status tracking, and configuration management. Below is a guide for developers to quickly debug and understand the core entry points and interfaces.
- All core REST APIs are located in
src/main/java/com/alibaba/cloud/ai/lynxe/runtime/controller/andconfig/directories. - Recommended starting points:
LynxeController.java,PlanTemplateController.java, andConfigController.javafor the main business logic.
Important: Before using synchronous/asynchronous execution endpoints, you must complete the following steps:
-
Create Func-Agent
- Create and configure a Func-Agent (plan template) in the system interface
- Define plan steps, agent configuration, tool selection, etc.
-
Publish as Tool
- In the Func-Agent configuration interface, click the "Publish Service" button
- Select "Publish as Internal Method Call"
- Set tool name (toolName), tool description, parameter definitions, etc.
-
Publish as HTTP Service (Optional but Recommended)
- In the publish service interface, select "Publish as HTTP Service"
- The system will generate corresponding HTTP API call examples
Only after completing the above steps can you call the Func-Agent via executeByToolNameAsync or executeByToolNameSync endpoints.
Frontend implementation reference:
ui-vue3/src/components/sidebar/ExecutionController.vue: Execution controller with publish service buttonui-vue3/src/components/publish-service-modal/PublishServiceModal.vue: Publish service modal
-
API File:
LynxeController.java -
Main Endpoint:
POST /api/executor/executeByToolNameAsync -
Request Parameters:
{ "toolName": "my-tool", "serviceGroup": "research", // Required "replacementParams": { // Optional, for replacing <<param>> placeholders in plan template "param1": "value1", "param2": "value2" }, "uploadedFiles": ["file1.pdf", "file2.txt"], // Optional, list of uploaded file names "uploadKey": "upload-1234567890_1234_1", // Optional, unique identifier for file upload session "conversationId": "xxx" // Optional, conversation ID (for memory management) } -
File Upload Parameters:
-
uploadedFiles: String array, containing original file names of uploaded files- Obtained after uploading files via
POST /api/file-upload/uploadendpoint - Backend appends file names to each execution step's
stepRequirementfor LLM use - Example:
["report.pdf", "data.csv"]
- Obtained after uploading files via
-
uploadKey: String, unique identifier for file upload session- Automatically generated and returned by backend when uploading files (format:
upload-{timestamp}_{random}_{threadId}) - Used to identify files from the same upload batch and sync files to plan directory during execution
- Backend uses
uploadKeyto callsyncUploadedFilesToPlan()to copy files to plan working directory - Example:
"upload-1703123456789_5678_42"
- Automatically generated and returned by backend when uploading files (format:
-
Parameter Usage:
- Recommended to use both
uploadedFilesanduploadKeytogether:uploadedFileslets LLM know which files are available (via stepRequirement)uploadKeyensures files are synced to plan working directory, making them accessible to agents- Using both together provides the best experience
- Can also be used separately:
- Only
uploadedFiles: LLM will know file names, but files may not be in plan directory - Only
uploadKey: Files will be synced to plan directory, but LLM may not know which files are available
- Only
- Recommended to use both
-
File Upload Workflow:
- Call
POST /api/file-upload/uploadto upload files (use FormData with field name:files) - Backend returns
FileUploadResultcontaining:uploadKey: Upload session identifieruploadedFiles: File information array (each containsoriginalName,size,type, etc.)
- When calling execution endpoint, pass both
uploadKeyanduploadedFiles(file name list) - Backend automatically syncs files to plan directory during execution, making them accessible to agents
- Call
-
-
Response Example:
{ "planId": "plan-123456", "status": "processing", "message": "Task submitted, processing", "conversationId": "conv-123", "toolName": "my-tool", "planTemplateId": "template-456" } -
Function: Executes plan tasks asynchronously, immediately returns
planId, task runs in background. Suitable for long-running tasks.
- API File:
LynxeController.java - Main Endpoint:
POST /api/executor/executeByToolNameSync - Request Parameters: Same as asynchronous execution
- Response: Returns execution result directly (waits for task completion)
- Function: Executes plan tasks synchronously, waits for completion before returning result. Suitable for quick tasks.
-
API File:
LynxeController.java -
Main Endpoint:
GET /api/executor/details/{planId} -
Function: Get complete execution record and status for specified planId
-
Response Structure:
PlanExecutionRecordobject, containing:currentPlanId: Current plan IDrootPlanId: Root plan ID (for sub-plans)title: Plan titlestatus: Execution status (pending/running/completed/failed)completed: Whether completedsummary: Execution summaryagentExecutionSequence: Agent execution sequence (core data)- Each element contains:
agentName,agentRequest,result,status,stepId, etc.
- Each element contains:
userInputWaitState: User input wait state (e.g., when task requires user form input)structureResult: Structured result (extracted last tool call result when task completes)subPlanExecutionRecords: Sub-plan execution records (supports nesting)
-
Use Cases:
- Frontend polls this endpoint to track task progress
- Get complete execution history
- Check if user input is required
-
API File:
LynxeController.java -
Main Endpoint:
GET /api/executor/agent-execution/{stepId} -
Function: Get detailed step information for specified stepId
-
Response Structure:
AgentExecutionRecordobject, containing:agentName: Agent nameagentRequest: Agent request contentagentDescription: Agent descriptionresult: Execution resulterrorMessage: Error messagestatus: Status (RUNNING/FINISHED/IDLE)thinkActRecords: Think-Act record list- Each record contains:
thinkInput,thinkOutput,inputCharCount,outputCharCount,actToolInfoList, etc.
- Each record contains:
-
Use Cases:
- Display detailed step execution information in right panel
- View thinking process and tool calls for each step
-
Delete Execution Record:
DELETE /api/executor/details/{planId}- Function: Delete execution record for specified planId (does not actually delete from database, only marks)
-
Submit User Input:
POST /api/executor/submit-input/{planId}- Function: When task is waiting for user input (e.g., form filling), submit user input data
- Request Body:
{ "field1": "value1", "field2": "value2" }
Refer to ui-vue3/src/components/sidebar/ExecutionController.vue:
- Call
executeByToolNameAsyncto initiate task - Get returned
planId - Use
planIdfor status tracking
Refer to ui-vue3/src/composables/usePlanExecution.ts:
- Use
CommonApiService.getDetails(planId)to poll execution status - Default polling interval: 1 second
- Automatically handles retries and error recovery
Refer to ui-vue3/src/components/chat/ExecutionDetails.vue:
- Displays complete structure of
PlanExecutionRecord - Supports nested sub-plan display
- Supports step selection and detail viewing
Refer to ui-vue3/src/composables/useRightPanel.ts:
- Handles step selection events
- Calls
fetchAgentExecutionDetail(stepId)to get step details - Displays detailed execution information in right panel
-
API File:
ConfigController.java -
Main Endpoints:
GET /api/config/group/{groupName}: Get configuration items by groupPOST /api/config/batch-update: Batch update configuration items
-
Configuration Entity:
ConfigEntity -
Service:
ConfigService
-
API File:
PlanTemplateController.java -
Main Endpoints:
POST /api/plan-template/generate: Generate a new plan templatePOST /api/plan-template/executePlanByTemplateId: Execute plan by template IDPOST /api/plan-template/save: Save plan versionPOST /api/plan-template/versions: Get plan version historyPOST /api/plan-template/get-version: Get a specific version of a planGET /api/plan-template/list: Get all plan templatesPOST /api/plan-template/update: Update plan templatePOST /api/plan-template/delete: Delete plan template
-
Plan generation, version management, and execution are coordinated by
PlanTemplateService,PlanIdDispatcher, andPlanningFactory.
This is the core data structure of the system. All execution feedback is returned through this object to simplify integration. Main fields:
- Identification:
currentPlanId,rootPlanId,parentPlanId - Execution Status:
status,completed,currentStepIndex - Execution Content:
agentExecutionSequence(agent execution sequence) - User Interaction:
userInputWaitState(user input wait state) - Result Data:
summary,structureResult(structured result)
For detailed field descriptions, please refer to the source code comments in src/main/java/com/alibaba/cloud/ai/lynxe/recorder/entity/vo/PlanExecutionRecord.java.
Execution record for a single agent, containing:
- Basic Information:
agentName,agentRequest,agentDescription - Execution Result:
result,errorMessage - Status Information:
status,stepId - Sub-plans:
subPlanExecutionRecords(supports nested sub-plans) - Think-Act Records:
thinkActRecords(obtained via/api/executor/agent-execution/{stepId})
-
After starting the service, use Postman or curl to test endpoints:
# 1. Upload files (optional) curl -X POST http://localhost:8080/api/file-upload/upload \ -F "files=@/path/to/file1.pdf" \ -F "files=@/path/to/file2.txt" # Returns: {"uploadKey": "upload-xxx", "uploadedFiles": [{"originalName": "file1.pdf", ...}, ...]} # 2. Asynchronous execution (with uploaded files) curl -X POST http://localhost:8080/api/executor/executeByToolNameAsync \ -H "Content-Type: application/json" \ -d '{ "toolName": "my-tool", "serviceGroup": "research", "replacementParams": {"param1": "value1"}, "uploadedFiles": ["file1.pdf", "file2.txt"], "uploadKey": "upload-xxx" }' # 3. Get execution details (use returned planId) curl http://localhost:8080/api/executor/details/{planId} # 4. Get step details curl http://localhost:8080/api/executor/agent-execution/{stepId}
-
Track asynchronous task progress via
/api/executor/details/{planId}:- Frontend polls every 1 second by default
- Can be called manually to check current status
- Returns complete execution tree structure (including sub-plans)
-
Use
/api/config/batch-updateto modify configuration without restarting the service -
All plan template operations can be performed via
/api/plan-template/*endpoints -
View frontend implementation:
ExecutionController.vue: Task initiation exampleExecutionDetails.vue: Execution details displayusePlanExecution.ts: Status polling implementationuseRightPanel.ts: Step detail retrieval
For more detailed interface parameters, return structures, or business logic, please refer to the corresponding Controller source code and Service layer implementations.