A minimal Spring Boot application demonstrating the AgentCore starter with background task tracking.
- Basic AgentCore Integration: Uses
@AgentCoreInvocationannotation - Background Task Tracking: Demonstrates
AgentCoreTaskTrackerfor long-running tasks - AgentCore Context: Shows how to access session headers
- Health Monitoring: Built-in
/pingendpoint with HealthyBusy status
The application will be available at http://localhost:8080
The active @AgentCoreInvocation method demonstrates:
@AgentCoreInvocation
public String manualAsyncTaskHandling(MySimpleRequest request, AgentCoreContext context) {
agentCoreTaskTracker.increment(); // Tell runtime: background work starting
CompletableFuture.runAsync(() -> {
// 15-second background task simulation
Thread.sleep(15000);
}).thenRun(agentCoreTaskTracker::decrement); // Tell runtime: work completed
return "Something from Async Version";
}- Agent endpoint:
POST /invocations- Processes requests with background task tracking - Health endpoint:
GET /ping- Returns "HealthyBusy" during background processing
# Send a request (starts 15-second background task)
curl -X POST http://localhost:8080/invocations \
-H "Content-Type: application/json" \
-d '{"prompt": "Hello, how are you?"}'
# Check health status (will show "HealthyBusy" for 10 seconds)
curl http://localhost:8080/ping- Java 21
- Maven 3.6+
- Docker or Finch (optional, for
./run-local.sh docker) - jq (optional, for formatted JSON output)
For AWS deployment, use the deployment scripts:
./deploy.sh- Full deployment./deploy.sh build- Build container image./deploy.sh push- Push to ECR./deploy.sh agentcore- Just AgentCore deployment./deploy.sh test- Test deployment