CrewAI
CrewAI Adapter
Section titled “CrewAI Adapter”AgentRuntime for the CrewAI multi-agent framework. Java does not embed Python — instead the runtime talks to a CrewAI sidecar process over HTTP + SSE. This is the same pattern many JVM teams use to bring Python-native agent frameworks (CrewAI, AutoGen, LlamaIndex) into Java services without rewriting the agent logic.
Maven Coordinates
Section titled “Maven Coordinates”<dependency> <groupId>org.atmosphere</groupId> <artifactId>atmosphere-crewai</artifactId> <version>${project.version}</version></dependency>How It Works
Section titled “How It Works”Drop the dependency alongside atmosphere-ai and the framework auto-detects it via ServiceLoader. CrewAiAgentRuntime drives the sidecar; streamed tokens flow back to the StreamingSession:
@AiEndpoint(path = "/ai/chat", systemPrompt = "You are a helpful assistant")public class MyChat {
@Prompt public void onPrompt(String message, StreamingSession session) { session.stream(message); // dispatched to the CrewAI sidecar }}The Python sidecar (atmosphere-crewai-bridge, shipped in the module’s sidecar/ directory) speaks the wire protocol and materialises Java @AiTool descriptors as native crewai.tools.BaseTool subclasses.
Configuration — sidecar URL
Section titled “Configuration — sidecar URL”The runtime stays unavailable out of the box: isAvailable() returns false until you point ATMOSPHERE_CREWAI_SIDECAR_URL at a running sidecar that responds OK to GET /health. This is deliberate (Runtime Truth) — the runtime never advertises availability based on the classpath alone.
export ATMOSPHERE_CREWAI_SIDECAR_URL=http://localhost:8089Bidirectional Tool Bridge
Section titled “Bidirectional Tool Bridge”When CrewAI invokes a Java @AiTool, the sidecar POSTs back to a loopback-only ToolCallbackServer inside the JVM. Those calls route through ToolExecutionHelper.executeWithApproval, so approval gates, validation, and governance apply identically to the in-process tool path. context.systemPrompt() is threaded into every agent’s backstory inside a delimited block so the directive stays distinguishable from user prose.
Cancellation is process-less: cancelling the session issues a DELETE on the sidecar session id rather than killing a process.
Samples
Section titled “Samples”- Spring Boot AI Chat — drop
atmosphere-crewaion the classpath and pointATMOSPHERE_CREWAI_SIDECAR_URLat a running sidecar
See Also
Section titled “See Also”- AI Reference —
AgentRuntimeSPI,@AiEndpoint, capability matrix, tool calling - Module README — wire protocol, sidecar setup, test suites