Skip to main content

LLM Python Agent Installation

The AI Agent Observability Python agent is installed via pip install whatap-python[llm] and applied by adding whatap-start-agent before your application's run command. This document guides you through the entire installation process, from activating a virtual environment to verifying the service.

Pre-installation checklist

Before installing the agent, verify the following:

Activate virtual environment

If your application uses virtualenv, run the bin/activate file to activate the virtual environment.

Download agent

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

pip install whatap-python[llm]
Tip

If you cannot install via the pip command, download the installation file from the pypi WhaTap page. Extract the downloaded file and proceed with installation.

tar xzvf whatap_python-2.x.x.tar.gz
cd whatap_python-2.X.Y.Z
python setup.py install
Note

The whatap-python[llm] package requires the external libraries datasketches>=5.2.0 and genai-prices. Missing dependencies may cause some data collection to be skipped. Include these dependencies even when installing manually.

Agent configuration files

The Python agent files consist of a tracer that extracts information required for application monitoring and sends it to the WhaTap collection server, along with supporting elements. See the following for the agent file structure.

Configure agent

Set WHATAP_HOME path

Specify the $WHATAP_HOME path for log and configuration file paths. Creating a new whatap directory is recommended.

$ export WHATAP_HOME=[PATH]

Set access key and collection server IP

Run the whatap-llm-setting-config command to set the access key and collection server IP.

$ whatap-llm-setting-config \
--host [ COLLECTION_SERVER_IP ] \
--license [ ACCESS_KEY ] \
--app_name [ USER_DEFINED_AGENT_NAME ] \
--app_process_name [ APPLICATION_PROCESS_NAME(uwsgi, gunicorn etc..) ]

Verify configuration

The whatap.conf file is created and configured at the path specified in $WHATAP_HOME. Run the following command to verify the whatap.conf file was created.

$ cat $WHATAP_HOME/whatap.conf
whatap.conf
llm_license=[ACCESS_KEY]
llm.whatap.server.host=[COLLECTION_SERVER_IP]

llm_enabled=true

# application name
app_name=[ USER_DEFINED_AGENT_NAME ]

# middleware process name ex)uwsgi, gunicorn ..
app_process_name=[ APPLICATION_PROCESS_NAME(uwsgi, gunicorn etc..) ]

Install the LLM-only module

To use Python AI Agent Observability, you must additionally install the Go module that WhaTap developed for LLM.

cd $WHATAP_HOME

curl -fsSL -O https://repo.whatap.io/python/llm/whatap-python-llm.tar.gz

tar -xzf whatap-python-llm.tar.gz

The whatap-python-llm directory created by extracting the archive must be located under the $WHATAP_HOME path you set earlier.

Note

If permission issues occur

  • Read and write permissions for the $WHATAP_HOME/whatap.conf file for WhaTap configuration

  • Read and write permissions for the $WHATAP_HOME/logs path and its sub-files for WhaTap logs

If permission issues occur for the $WHATAP_HOME path, run the following command to grant permissions.

echo `sudo chmod -R 777 $WHATAP_HOME`

Apply per server environment

Select the method that matches your server environment.

In a Command environment, add the whatap-start-agent command before the application start command as follows.

BASH
# $ whatap-start-agent [Application start command]
$ whatap-start-agent python manage.py runserver

Once you start the application server, the agent begins collecting monitoring data.

Verify service execution

Run the following command to verify the WhaTap Python service is running properly.

ps -ef | grep whatap_python