Skip to main content

LLM Java SDK Installation

The AI Agent Observability Java SDK traces Spring AI-based LLM calls. Download the agent JAR, add the -javaagent option to your JVM startup, and specify the Spring AI version via the weaving option in whatap.conf. For supported environments, see AI Agent Observability Supported Environment.

Download agent​

After issuing an access key, go to the Download agent section. Run the following command to download the agent.

wget https://api.whatap.io/agent/whatap.agent.java.tar.gz
Tip

If you cannot download via the wget command, use the download button in the console to get the installation file. Extract the downloaded file.

tar xzvf whatap.agent.java.tar.gz

Set JVM options​

In Java 9 or later, some agent features may be restricted due to module security policies. Add the following to the JVM startup options.

--add-opens=java.base/java.lang=ALL-UNNAMED

Add the -javaagent option according to your OS.

########## WHATAP START ############
WHATAP_HOME={extracted path}/whatap
WHATAP_JAR=`ls ${WHATAP_HOME}/whatap.agent-*.jar | sort -V | tail -1`
JAVA_OPTS="${JAVA_OPTS} -javaagent:${WHATAP_JAR} "
########## WHATAP END ############

Or you can specify the path directly.

-javaagent:{agent installation path}/whatap.agent-X.Y.Z.jar

Configure agent​

Set access key and collection server IP​

Set the access key and collection server IP in the whatap.conf file.

whatap.conf
license={ACCESS_KEY}
whatap.server.host={COLLECTION_SERVER_IP}

Set weaving by Spring AI version​

Add the weaving option matching your Spring AI version to whatap.conf.

whatap.conf
# Spring AI 2.0.0 M1 ~ M2
weaving=spring-ai-2.0

# Spring AI 2.0.0 M3
weaving=spring-ai-2.0-m3

After completing the configuration, restart the application.