Skip to content
Proyek

Tentang

Spring Boot integrations for Amazon Bedrock AgentCore

Pengembangan web dan aplikasi

Cara angka ini diukur

Pertumbuhan bintang terukur

dalam 24 jam
0
dalam 7 hari
0
dalam 15 hari
Mengumpulkan riwayat
dalam 1 bulan
Mengumpulkan riwayat

Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.

README.md

Asli

Spring AI AgentCore SDK

Maven Central

📖 Documentation

An open-source library that brings Amazon Bedrock AgentCore capabilities into Spring AI through familiar patterns: annotations, auto-configuration, and composable advisors.

Modules

Module Description
Runtime Starter Auto-configures /invocations and /ping endpoints, SSE streaming, health checks, rate limiting
Identity Workload tokens, API keys, OAuth 2.0 credentials, Runtime header integration, reactive propagation
Payments x402 payments for paid APIs and content: paying tool wrapper, paid HTTP tool, payment session budgets
Memory Short-term (conversation history) and long-term memory (semantic, preferences, summaries, episodic)
Browser Web navigation, content extraction, screenshots, form interaction via Playwright
Code Interpreter Secure Python/JavaScript/TypeScript execution with file retrieval
Artifact Store Session-scoped, TTL-based storage for generated files
Common Shared utilities — automatic User-Agent tagging for AWS SDK clients
BOM Bill of Materials for version alignment

Quick Start

Add the BOM (use the latest version from the Maven Central badge above) and the modules you need. Importing the BOM aligns every module version, so the module dependencies below are declared without a <version>:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springaicommunity</groupId>
            <artifactId>spring-ai-agentcore-bom</artifactId>
            <version>LATEST_VERSION</version> <!-- see the Maven Central badge above -->
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
    <dependency>
        <groupId>org.springaicommunity</groupId>
        <artifactId>spring-ai-agentcore-runtime-starter</artifactId>
    </dependency>
    <!-- Add as needed -->
    <dependency>
        <groupId>org.springaicommunity</groupId>
        <artifactId>spring-ai-agentcore-identity</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springaicommunity</groupId>
        <artifactId>spring-ai-agentcore-memory</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springaicommunity</groupId>
        <artifactId>spring-ai-agentcore-browser</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springaicommunity</groupId>
        <artifactId>spring-ai-agentcore-code-interpreter</artifactId>
    </dependency>
</dependencies>

Create an agent with memory, browser, and code interpreter:

@Service
public class MyAgent {

    private final ChatClient chatClient;
    private final AgentCoreMemory agentCoreMemory;

    public MyAgent(
            ChatClient.Builder builder,
            AgentCoreMemory agentCoreMemory,
            @Qualifier("browserToolCallbackProvider") ToolCallbackProvider browserTools,
            @Qualifier("codeInterpreterToolCallbackProvider") ToolCallbackProvider codeInterpreterTools) {
        this.agentCoreMemory = agentCoreMemory;
        this.chatClient = builder
                .defaultToolCallbacks(browserTools, codeInterpreterTools)
                .build();
    }

    @AgentCoreInvocation
    public Flux<String> chat(PromptRequest request, AgentCoreContext context) {
        String sessionId = context.getHeader(AgentCoreHeaders.SESSION_ID);

        return chatClient.prompt()
                .user(request.prompt())
                .advisors(agentCoreMemory.advisors)
                .advisors(a -> a.param(ChatMemory.CONVERSATION_ID,
                        AgentCoreMemoryConversationIdParser.of("user", sessionId)))
                .stream()
                .content();
    }
}

record PromptRequest(String prompt) {}

This gives you a production-ready agent with streaming, conversation memory, web browsing, and code execution — deployed to AgentCore Runtime or standalone.

For the new Spring AI Session API path (opt-in), see the "Session API" section of the memory module README.

Deployment

The SDK supports two deployment models:

  • AgentCore Runtime — Fully managed: package as ARM64 container, push to ECR, create a runtime. Scales to zero, pay-per-use.
  • Standalone — Use any module independently on EKS, ECS, EC2, or on-premises.

See examples/terraform/ for infrastructure-as-code with IAM and OAuth2 authentication.

Examples

Example Description
simple-spring-boot-app Minimal agent with request handling
spring-ai-sse-chat-client Streaming responses with SSE
spring-ai-memory-integration Short-term and long-term memory
spring-ai-identity Standalone JWT exchange, API-key retrieval, and OAuth credential retrieval
spring-ai-identity-agentcore Ambient Runtime workload-token and API-key retrieval
spring-ai-extended-chat-client OAuth auth with per-user memory isolation
spring-ai-browser Web browsing and screenshots
spring-ai-payments Paying for x402 APIs: interceptor, paidHttpRequest tool and own integration
spring-ai-simple-chat-client Traditional Spring AI (without runtime starter)
spring-ai-reactive-runtime AgentCore runtime on a reactive (Netty) server with reactive throttling

Requirements

  • Java 17+
  • Spring Boot 4.x
  • An AWS account

Development

mvn clean install              # Build
mvn test                       # Unit tests
mvn spring-javaformat:apply    # Format (required before commit)

Building the examples

The examples/ tree is a separate multi-module Maven build that depends on the AgentCore modules. Run mvn -DskipTests install at the repo root first so the examples can resolve the locally built snapshot artifacts, then:

mvn clean verify -f examples/pom.xml

Each module also has an AGENTS.md file providing context for AI coding assistants (project structure, conventions, key classes).

License

Apache License 2.0

Jelajahi proyek terkait

Memuat…