Skip to content

Add Spring AI integration documentation for Java SDK#4454

Open
donald-pinckney wants to merge 11 commits intomainfrom
docs/spring-ai-integration
Open

Add Spring AI integration documentation for Java SDK#4454
donald-pinckney wants to merge 11 commits intomainfrom
docs/spring-ai-integration

Conversation

@donald-pinckney
Copy link
Copy Markdown
Contributor

@donald-pinckney donald-pinckney commented Apr 20, 2026

Summary

Documents the new temporal-spring-ai module that landed in sdk-java#2829.

  • Adds docs/develop/java/integrations/spring-ai.mdx with setup, chat model usage, tool types (Activity stubs, Nexus stubs, @SideEffectTool, plain tools), and optional vector store / embedding / MCP integrations.
  • Restructures docs/develop/java/integrations/index.mdx to split framework integrations from AI integrations (matching the Python SDK integrations layout).
  • Adds a Java SDK entry to the top-level docs/develop/integrations.mdx.
  • Adds the new page to sidebars.js.

Why

The Spring AI integration just merged to master on sdk-java. Java users following the Spring Boot path need a landing page that explains how to make Spring AI calls durable through Temporal, which tool annotations to use for determinism, and what optional features auto-configure.

┆Attachments: EDU-6226 Add Spring AI integration documentation for Java SDK

Documents the new temporal-spring-ai module that makes Spring AI model
calls, tools, vector stores, embeddings, and MCP calls durable Temporal
primitives.
@donald-pinckney donald-pinckney requested a review from a team as a code owner April 20, 2026 17:04
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
temporal-documentation Ready Ready Preview, Comment May 4, 2026 8:35pm

Request Review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 20, 2026

📖 Docs PR preview links

Comment thread docs/develop/java/integrations/spring-ai.mdx
Comment thread docs/develop/java/integrations/spring-ai.mdx Outdated
Comment thread docs/develop/java/integrations/spring-ai.mdx
Comment thread docs/develop/java/integrations/spring-ai.mdx Outdated
Bump the documented Java SDK minimum to 1.35.0 (the version where the
spring-ai work landed) and add three sections that the original draft
predated:

- Activity options and retry behavior (#2853, #2855): defaults, the
  non-retryable-AI-error classification, ad-hoc forDefault(ActivityOptions),
  the ChatModelActivityOptions bean for configuration-driven per-model
  overrides, and the "default" catch-all key for compositional setups.
- Provider-specific chat options (#2857): AnthropicChatOptions extended-
  thinking example demonstrating that subclass-specific fields survive
  the Activity boundary.
- Media in messages (#2860): 1 MiB inline-bytes cap, URI-based alternative,
  io.temporal.springai.maxMediaBytes override.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Reframe the opener around Spring AI as an agent framework and the
integration as making agents durable, instead of describing it
mechanically as "wraps calls as Activities." Avoids overstating that
"every tool" goes through an Activity — the integration explicitly
supports Workflow-side tools (@SideEffectTool, plain @tool) alongside
Activity and Nexus stubs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Switches six extended code samples on the spring-ai integration page
from inline copies to snipsync references against samples-java markers
added in temporalio/samples-java#fbae80a. Snippets pulled:

- samples-java-spring-ai-chat-workflow-init
- samples-java-spring-ai-activity-tool
- samples-java-spring-ai-side-effect-tool
- samples-java-spring-ai-plain-tool
- samples-java-spring-ai-per-model-options
- samples-java-spring-ai-provider-options

Short single-purpose snippets (Maven dep, one-liner forDefault override,
Media URI line, plugin triplet) stay inline. The daily snipsync
workflow will fill the placeholders once the samples-java branch lands
on master.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@donald-pinckney
Copy link
Copy Markdown
Contributor Author

Now uses snipsync. Will wait on landing temporalio/samples-java#775 first, so the snippets are on main, then come back to finishing this PR.

@donald-pinckney
Copy link
Copy Markdown
Contributor Author

Snipsync has been completed, and has been synced


:::

## Compatibility
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reads more like Prerequisites than compatibility? Let's be a bit more explicit that the user needs all these to get the integration to work

Copy link
Copy Markdown
Contributor

@lennessyy lennessyy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just a few polish suggestions

description: Build durable AI agents in Java with the Temporal Spring AI integration.
---

[Spring AI](https://docs.spring.io/spring-ai/reference/) is an agent framework for Java applications — chat clients, tool calling, vector stores, embeddings, and MCP servers, all wired through Spring Boot. The [Temporal Spring AI integration](https://central.sonatype.com/artifact/io.temporal/temporal-spring-ai) makes Spring AI agents durable: model calls run through Temporal Activities recorded in Workflow history, and tools are dispatched per their type so each kind lands in the right place in Workflow execution — Activity stubs and Nexus stubs as durable operations, `@SideEffectTool` classes wrapped in `Workflow.sideEffect`, and plain tools running directly in Workflow code. Agents retry on failure and replay deterministically without changing how you write Spring AI code.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[Spring AI](https://docs.spring.io/spring-ai/reference/) is an agent framework for Java applications — chat clients, tool calling, vector stores, embeddings, and MCP servers, all wired through Spring Boot. The [Temporal Spring AI integration](https://central.sonatype.com/artifact/io.temporal/temporal-spring-ai) makes Spring AI agents durable: model calls run through Temporal Activities recorded in Workflow history, and tools are dispatched per their type so each kind lands in the right place in Workflow execution — Activity stubs and Nexus stubs as durable operations, `@SideEffectTool` classes wrapped in `Workflow.sideEffect`, and plain tools running directly in Workflow code. Agents retry on failure and replay deterministically without changing how you write Spring AI code.
[Spring AI](https://docs.spring.io/spring-ai/reference/) is an agent framework for Java applications — chat clients, tool calling, vector stores, embeddings, and MCP servers, all wired through Spring Boot.
The [Temporal Spring AI integration](https://central.sonatype.com/artifact/io.temporal/temporal-spring-ai) makes Spring AI agents durable: model calls run through Temporal Activities recorded in Workflow history, and tools are dispatched per their type so each kind lands in the right place in Workflow execution — Activity stubs and Nexus stubs as durable operations, `@SideEffectTool` classes wrapped in `Workflow.sideEffect`, and plain tools running directly in Workflow code. Agents retry on failure and replay deterministically without changing how you write Spring AI code.

This paragraph is a big long so could use a break here


`ActivityChatModel.forDefault()` resolves to the default Spring AI `ChatModel` bean. To target a specific model in a multi-model application, pass its bean name to `ActivityChatModel.forModel("openai")`.

:::note
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:::note
:::note

our prettier config would format the next line onto the :::note line if there is no space

Streaming responses are not currently supported.
:::

## Register tools
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we give a brief explanation of what it means to register tool and link to Spring AI docs?


`ActivityChatModel.forDefault()` and `forModel(name)` build the chat Activity stub with sensible defaults: a 2-minute start-to-close timeout, 3 attempts, and `org.springframework.ai.retry.NonTransientAiException` and `java.lang.IllegalArgumentException` classified as non-retryable so a bad API key or invalid prompt fails fast.

Pass an `ActivityOptions` directly when you need finer control — a specific Task Queue, heartbeats, priority, or a custom `RetryOptions`:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add some cross links to heartbeats and priority since these aren't 101 concepts.


`ActivityMcpClient` wraps a Spring AI MCP client so that remote MCP tool calls become durable Activity executions.

## Learn more
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Learn more
## Resources

Resources is the standard heading we use for this type of content

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants