Create a Java AI Agent Hub with Spring AI Agents – From Single Bots to Teams

Spring AI Agents brings a unified Java SDK that lets developers integrate, orchestrate, and run multiple AI coding agents—such as Claude, Gemini, and OpenAI Codex—directly within GitHub workflows, transforming development from single‑assistant Copilot models to collaborative AI team‑based architectures.

Java Architecture Diary
Java Architecture Diary
Java Architecture Diary
Create a Java AI Agent Hub with Spring AI Agents – From Single Bots to Teams

Spring AI Agents: Building a Java "Control Room"

GitHub’s recent announcement of Agent HQ at GitHub Universe 2025 introduced a platform‑wide AI hub that unifies the workflow for coordinating any number of agents at any time and place.

Agent HQ aims to turn GitHub into an open AI ecosystem by integrating mainstream agents from Anthropic, OpenAI, Google, Cognition, xAI, etc., as part of GitHub Copilot.

The core idea is not merely plugging agents into existing systems but natively integrating them into the familiar GitHub workflow, similar to the multi‑agent mode of Cursor 2.0, where developers can drive several AI agents for code review, test generation, documentation, and bug fixing.

This marks a shift from a “single AI assistant” to “AI team collaboration,” turning developers into commanders of an AI squad.

Spring AI Agents – a Java Control Room

Spring AI has already recognized this trend and offers the Spring AI Agents project, which provides a unified Java SDK for scheduling and orchestrating multiple AI coding agents, analogous to how JDBC standardized database access.

Supported agents include:

Claude Agent SDK – supported – Anthropic’s autonomous coding agent (formerly Claude Code SDK).

Gemini CLI Agent – supported – Google’s command‑line coding agent with multimodal capabilities.

Amp CLI – supported – Sourcegraph’s feature‑complete autonomous coding agent.

Amazon Q Developer – supported – AWS /dev agent supporting multi‑file and cross‑repo planning.

OpenAI Codex – supported – OpenAI’s GPT‑5‑Codex optimized for agent coding.

mini‑swe‑agent – supported – a lightweight 100‑line autonomous agent for benchmarking.

Goose – planning – Block’s open‑source extensible AI agent that can run locally.

GitHub Copilot Agent – planning – GitHub’s autonomous coding agent capable of creating PRs in Actions.

Note: The project currently requires manual download and compilation of Spring AI Agents; a Maven Central release is forthcoming.

Quick start: driving a single agent

1. Add the Claude agent dependency:

<!-- Claude Agent Model -->
<dependency>
    <groupId>org.springaicommunity.agents</groupId>
    <artifactId>spring-ai-starter-agent-claude</artifactId>
    <version>0.1.0-SNAPSHOT</version>
</dependency>

2. Create and configure the Claude client, then run a task:

// Create Claude CLI client
ClaudeAgentClient claudeClient = ClaudeAgentClient.create();

// Configure options
ClaudeAgentOptions options = ClaudeAgentOptions.builder()
        .executablePath("/usr/local/bin/claude")
        .yolo(true)
        .workingDirectory("/Users/lengleng/Downloads/cursor-web")
        .build();

LocalSandbox sandbox = new LocalSandbox();

// Build the agent model
ClaudeAgentModel agentModel = new ClaudeAgentModel(claudeClient, options, sandbox);

// Create the AgentClient
AgentClient agentClient = AgentClient.create(agentModel);

// Execute the goal
AgentClientResponse response = agentClient.run(
        "Based on the existing tech stack, implement a standalone CRUD feature"
);

Advanced: multi‑agent collaborative workflow

1. Add dependencies for multiple agents (e.g., CodeX and Gemini):

<dependency>
    <groupId>org.springaicommunity.agents</groupId>
    <artifactId>spring-ai-starter-agent-codex</artifactId>
    <version>0.1.0-SNAPSHOT</version>
</dependency>
<dependency>
    <groupId>org.springaicommunity.agents</groupId>
    <artifactId>spring-ai-starter-agent-gemini</artifactId>
    <version>0.1.0-SNAPSHOT</version>
</dependency>

2. Orchestrate the agents in a workflow:

public class MultiAgentWorkflow {
    private final AgentClient claudeAgent;
    private final AgentClient geminiAgent;

    public MultiAgentWorkflow(@Qualifier("claudeAgentClient") AgentClient claudeAgent,
                              @Qualifier("geminiAgentClient") AgentClient geminiAgent) {
        this.claudeAgent = claudeAgent;
        this.geminiAgent = geminiAgent;
    }

    public String collaborativeCodeReview(String pullRequestId) {
        // Detailed analysis with Claude
        String claudeAnalysis = claudeAgent.run(
                "Perform a detailed code review of PR " + pullRequestId +
                ". Focus on logical correctness and potential bugs."
        ).getResult();

        // Architectural review with Gemini
        String geminiAnalysis = geminiAgent.run(
                "Review architectural issues of PR " + pullRequestId +
                " and Google Cloud best practices."
        ).getResult();

        // Combine results
        String combinedPrompt = String.format(
                "Merge the two analyses into a comprehensive report:

" +
                "Analysis 1 (Logic & Bugs): %s

" +
                "Analysis 2 (Architecture): %s

" +
                "Create a prioritized issue list with actionable suggestions.",
                claudeAnalysis, geminiAnalysis
        );

        return claudeAgent.run(combinedPrompt).getResult();
    }

    public String distributeRefactoringTask(String className) {
        CompletableFuture<String> claudeTask = CompletableFuture.supplyAsync(() ->
                claudeAgent.run("Optimize methods in " + className +
                        " for readability and performance").getResult()
        );

        CompletableFuture<String> geminiTask = CompletableFuture.supplyAsync(() ->
                geminiAgent.run("Improve the architecture of " + className +
                        " according to SOLID principles").getResult()
        );

        return claudeTask.thenCombine(geminiTask, (claudeResult, geminiResult) ->
                claudeAgent.run("Merge these refactoring proposals:

" +
                        claudeResult + "

" + geminiResult).getResult()
        ).join();
    }
}

Conclusion

AI development has entered a new generation, moving from “code‑CLI battles” to collaborative AI teamwork. Spring AI Agents provides a unified abstraction layer that shifts software development from the “human‑Copilot pairing” model to a “human‑command, AI‑collaborative” team model, lowering the barrier for Java developers to build complex AI workflows.

JavaAI agentsSpring AIGitHubAgent orchestration
Java Architecture Diary
Written by

Java Architecture Diary

Committed to sharing original, high‑quality technical articles; no fluff or promotional content.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.