DEV Community

Alkademy
Alkademy

Posted on • Originally published at munonye.com

Event-Driven AI Agents with Axon and Spring AI (2026)

Canonical URL: Republished from munonye.com. Full code on GitHub.

Connect event-driven AI microservices using Axon Framework and Spring AI. Start with Axon CQRS tutorial and CQRS intro from the Microservices hub.

Flow

HTTP → CommandGateway → Aggregate → Event
EventHandler → ChatClient (classify / plan) → Follow-up Command
Enter fullscreen mode Exit fullscreen mode

Event handler example

@Component
public class SupportTicketAiHandler {
  private final ChatClient chatClient;
  private final CommandGateway gateway;

  @EventHandler
  public void on(TicketCreatedEvent event) {
    String priority = chatClient.prompt()
        .user("Classify priority 1-5 for: " + event.description())
        .call()
        .content();
    gateway.send(new SetTicketPriorityCommand(event.ticketId(), priority));
  }
}
Enter fullscreen mode Exit fullscreen mode

See AI Developer Tutorials for the full series.


Full tutorial: Event-Driven AI Agents with Axon and Spring AI (2026)

Kindson MunonyeGitHub · LinkedIn · About

Top comments (0)