How to Deploy Production‑Ready AI Agents with Spring AI Alibaba and LoongSuite Observability

This article explains the challenges of moving AI agents from demo to production, compares native framework and non‑intrusive observability solutions, and provides a step‑by‑step guide to integrate Spring AI Alibaba with LoongSuite's Java agent for OpenTelemetry‑based monitoring.

Alibaba Cloud Observability
Alibaba Cloud Observability
Alibaba Cloud Observability
How to Deploy Production‑Ready AI Agents with Spring AI Alibaba and LoongSuite Observability

Introduction

Since the rise of GPT‑3.5, AI applications have rapidly evolved from experimental demos to potential enterprise products, but most remain stuck at the demo stage. Deploying AI agents in production requires addressing development efficiency, business capability, deployment ease, debugging, cost control, generation quality, and security compliance.

Solution Categories

Framework‑native capabilities such as AI gateways, AI Runtime, and Agent markets improve development speed, business integration, and deployment.

Observability approaches include manual instrumentation, framework‑native observability (Micrometer + OpenTelemetry), and non‑intrusive probes that automatically collect metrics and traces.

Spring AI Alibaba Overview

Spring AI provides a simple API to build intelligent agents. A basic chat example can be written in a few lines of code.

public Flux<String> streamChat(String chatId, String userMessageContent) {<br/>    return this.chatClient.prompt()<br/>        .system("你是一个提供预定服务的chatbot")<br/>        .user(userMessageContent)<br/>        .toolNames("getBookingDetails")<br/>        .stream()<br/>        .content();<br/>}

However, the original framework lacks workflow orchestration, rich ecosystem integration, and enterprise‑grade features.

Enhanced Capabilities with Spring AI Alibaba

Graph framework : DAG‑based multi‑agent orchestration with conditional branches and parallel execution.

DSL converter : Compatibility with low‑code platforms such as Dify, enabling “low‑code design → high‑code deployment”.

Alibaba Cloud ecosystem integration : Built‑in RAG, Bailei platform connectivity, and observability extensions accelerate industrial deployment.

Observability Integration – Native

Spring AI uses Micrometer (the Spring‑recommended observability middleware) to auto‑instrument key calls (model inference, tool invocation, external requests). The data is exported via OpenTelemetry SDK in OTLP format and can be stored in Prometheus, Jaeger, Langfuse, etc.

Observability Integration – Non‑Intrusive Probe

LoongSuite provides a Java agent that instruments applications without code changes. It supports Java, Go, and Python, automatically creating spans, recording metrics, propagating context, and capturing exceptions. The probe follows OpenTelemetry semantics, offering a more complete and standard view of AI workloads.

java \<br/>  -javaagent:{PATH_TO_JAVA_AGENT} \<br/>  -Dprofiler.jdk21.async.context.propagation.enable=true \<br/>  -Darms.licenseKey={YOUR_LICENSE_KEY} \<br/>  -Darms.appName={YOUR_APP_NAME} \<br/>  -Darms.workspace={YOUR_WORKSPACE} \<br/>  -Daliyun.javaagent.regionId={YOUR_REGION} \<br/>  -jar spring-ai-demo.jar

Replace the placeholders with actual values from the Alibaba Cloud Monitoring console.

Step‑by‑Step Guide

Step 1: Prepare Agent Application

Clone the Spring AI Alibaba flight‑booking example from GitHub: https://github.com/spring-ai-alibaba/examples/tree/main/spring-ai-alibaba-agent-example/playground-flight-booking .

Step 2: Download Probe

Download the LoongSuite commercial Java agent (version 4.6.0) from http://arms-apm-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/4.6.0/AliyunJavaAgent.zip and unzip it.

Step 3: Modify Startup Command

Use the command shown above, ensuring {PATH_TO_JAVA_AGENT}, {YOUR_LICENSE_KEY}, {YOUR_APP_NAME}, {YOUR_WORKSPACE}, and {YOUR_REGION} are replaced with your actual values.

Step 4: View Observability Data

Log into Alibaba Cloud Monitoring (Cloud Native) and open the tracing dashboard. You will see spans for each LLM call, tool execution, and associated metadata such as input/output, token usage, and timestamps.

Kubernetes Deployment

When running in a K8s cluster, you can inject the probe via pod labels instead of modifying the startup command, simplifying the integration process.

Future Outlook

Open‑source the LoongSuite Java agent to the community and OpenTelemetry.

Integrate Spring AI observability into AgentScope Studio for a unified UI.

Enrich multi‑agent tracing to provide agent‑level metrics and detailed call graphs.

References

AI Gateway – https://help.aliyun.com/zh/api-gateway/ai-gateway/product-overview/what-is-an-ai-gateway

AgentScope Tracing – https://doc.agentscope.io/tutorial/task_tracing.html

Spring AI Observability – https://docs.spring.io/spring-ai/reference/observability/index.html

LoongSuite Python Agent – https://github.com/alibaba/loongsuite-python-agent

OpenTelemetry Java Instrumentation – https://github.com/open-telemetry/opentelemetry-java-instrumentation

图片
图片
图片
图片
图片
图片
图片
图片
图片
图片
图片
图片
图片
图片
图片
图片
图片
图片
图片
图片
图片
图片
图片
图片
JavaAI agentsOpenTelemetrySpring AI
Alibaba Cloud Observability
Written by

Alibaba Cloud Observability

Driving continuous progress in observability technology!

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.