This module contains the runnable REST server example.
- Spring Boot auto-configuration from the SDK starter
- a single
AgentCardbean with explicit sample prompts - a dedicated
AgentExecutorSpring component with hello/help/stream/cancel branches - a model-backed
helpbranch driven byOPENROUTER_API_KEYand the A2Ahelpflow - REST transport endpoints exposed by the server module
- discovery through
GET /.well-known/agent-card.json - message exchange through
POST /message:send - streaming task exchange through
POST /message:stream - task lookup through
GET /tasks/{taskId}and task listing throughGET /tasks - task cancellation through
POST /tasks/{taskId}:cancel - task subscription through
POST /tasks/{taskId}:subscribe - push notification config management through the
/tasks/{taskId}/pushNotificationConfigsendpoints - a direct response for greetings
- a help response that shows how the server calls a model inside A2A
- a streaming task flow for
stream - a cancellable task flow for
cancel
When the server is running, GET /.well-known/agent-card.json should return the public agent card.
If you send the messages below through the client or the A2A transport, you should see:
hello- a direct reply from the agent;stream this- a streaming task with task updates and a final artifact;help- a model-backed help response returned through the A2A executor;cancel this- a cancellable task that can be canceled through the REST transport.
If OPENROUTER_API_KEY is not configured, help still returns Mock response from LLM and the app keeps running.
mvn -pl examples/spring-boot/rest/server -am spring-boot:runSet OPENROUTER_API_KEY before starting the app if you want the help flow to call the model.
The server starts on port 18080.
mvn -pl examples/spring-boot/rest/server -am testsrc/main/resources/application.yml- setOPENROUTER_API_KEYthrough the environment, or keep it empty to use the fallback branch.SpringBootRestServerExampleConfiguration- change theAgentCardname, description, skills, or examples.SpringBootRestServerAgentExecutor- change howhello,stream, orhelpbehave.SpringBootRestServerAiService- change the model prompt used by thehelpflow.