This is a Spring Boot WebFlux application that demonstrates AI agent integration using both Semantic Kernel and Foundry Agent Service for intelligent task management. It provides a simple CRUD task list and two interactive chat agents.
- CRUD Operations: Create, Read, Update, Delete tasks using REST API.
- OpenAPI Documentation: Auto-generated OpenAPI schema at
/api/schemafor Foundry agent integration. - Semantic Kernel Agent: Local agent orchestration with automatic function calling.
- Foundry Agent: Cloud-hosted agent with managed function calling.
- Dual Agent UI: Compare and interact with both agent frameworks side-by-side.
- Azure Deployment: Azure Developer CLI (azd) template can create App Service with managed identity using
azd up.
The Semantic Kernel agent implementation uses the ChatCompletionAgent with automatic function calling:
- ChatCompletionAgent: Uses Microsoft's Semantic Kernel ChatCompletionAgent for intelligent task management.
- Automatic Function Calling: Configured with
FunctionChoiceBehavior.auto(true)to automatically call appropriate plugin functions. - Direct Plugin Integration: Uses
@DefineKernelFunctionannotations inTaskCrudPluginfor seamless integration. - Local Orchestration: Agent runs in the application with direct access to task database.
The Foundry Agent implementation uses the Azure AI Agents SDK with async clients:
- AgentsAsyncClient: Uses Azure's cloud-hosted agent service for intelligent task management.
- Managed Function Calling: Agent and tools configured in the Foundry portal using the OpenAPI schema.
- OpenAPI Integration: REST API endpoints are documented with OpenAPI annotations and exposed at
/api/schema. - Conversation Management: Each session maintains its own conversation thread.
- Cloud Orchestration: Agent runs in Azure with API-based access to task functions.
├── .devcontainer/
│ └── devcontainer.json # Codespace definition
├── azure.yaml # Azure Developer CLI configuration
├── pom.xml # Maven project configuration
├── infra/ # Azure Developer CLI configuration
│ ├── main.bicep
│ └── main.parameters.json
└── src/
└── main/
├── java/
│ └── com/example/crudtaskswithagent/
│ ├── CrudTasksWithAgentApplication.java # Main application class
│ ├── config/
│ │ └── OpenApiConfig.java # OpenAPI/Swagger configuration
│ ├── controller/
│ │ ├── TaskController.java # REST API endpoints
│ │ └── AgentController.java # AI agent endpoints (SK & Foundry)
│ ├── model/
│ │ └── TaskItem.java # Task entity
│ ├── plugin/
│ │ └── TaskCrudPlugin.java # Semantic Kernel plugin
│ ├── repository/
│ │ └── TaskRepository.java # Data repository
│ └── service/
│ ├── SemanticKernelAgentService.java # SK agent service
│ └── FoundryAgentService.java # Foundry Agent Service
└── resources/
├── application.properties # Application configuration
├── schema.sql # Database schema
└── static/
└── index.html # Frontend UI (dual agent)
The application requires configuration for both agent types:
The API schema is auto-generated and available at:
springdoc.api-docs.path=/api/schemaAccess the schema at http://localhost:8080/api/schema when running locally, or https://your-app.azurewebsites.net/api/schema when deployed.
azure.openai.endpoint=https://your-openai-resource.openai.azure.com/
azure.openai.deployment=gpt-4oazure.foundry.endpoint=https://<resource-name>.services.ai.azure.com/api/projects/<project-name>
azure.foundry.agent.name=your-agent-nameBoth agents use Azure managed identity for authentication.