# agent **Repository Path**: SuNan202011/agent ## Basic Information - **Project Name**: agent - **Description**: No description available - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-04-13 - **Last Updated**: 2026-04-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Spring Boot + Agent + Skills Demo (LLM Function Calling) This project is a runnable end-to-end demo with: - Spring Boot REST API - Agent orchestration (`plan -> choose skill -> execute`) - Pluggable skills (`Skill` interface) - Real LLM function-calling router (OpenAI or Tongyi) - Automatic fallback to local routing rules ## 1. Requirements - JDK 17+ - Maven 3.9+ ## 2. Run ```bash mvn spring-boot:run ``` Default port: `8080` ## 3. Modes ### 3.1 Local mode (default) ```yaml agent: planner: mode: local ``` The agent selects skills by local rules only. ### 3.2 LLM function-calling mode ```yaml agent: planner: mode: llm llm: provider: openai # openai or tongyi ``` Set API key env vars: ```bash # OpenAI set OPENAI_API_KEY=your_openai_key # Tongyi (DashScope compatibility mode) set TONGYI_API_KEY=your_tongyi_key ``` ## 4. LLM Config ```yaml agent: planner: mode: local # local | llm llm: provider: openai # openai | tongyi timeout-seconds: 30 openai: base-url: https://api.openai.com/v1 api-key: ${OPENAI_API_KEY:} model: gpt-4.1-mini tongyi: base-url: https://dashscope.aliyuncs.com/compatible-mode/v1 api-key: ${TONGYI_API_KEY:} model: qwen-plus ``` ## 5. API ### 5.1 List skills ```bash curl http://localhost:8080/api/skills ``` ### 5.2 Chat with agent ```bash curl -X POST http://localhost:8080/api/agent/chat \ -H "Content-Type: application/json" \ -d "{\"message\":\"please calculate 12 * 8\"}" ``` Response includes: - `answer`: final result - `trace`: steps (`thought` / `llm` / `plan` / `observation` / `final`) ## 6. Built-in Skills - `time_skill`: time query - `math_skill`: arithmetic - `weather_skill`: weather (demo data) - `fallback_skill`: fallback response ## 7. Add a New Skill 1. Implement `com.demo.agent.skill.Skill` 2. Add `@Component` 3. Implement methods: - `name()` - `description()` - `supports(String message)` - `execute(String message)` Spring auto-discovers it and injects it into the agent. ## 8. Test ```bash mvn test ```