Skip to main content

Overview

This tutorial will guide you through initializing the Splunk Agent Observability Logger and Agent Control SDK, running your agent with the Splunk Agent Observability Logger, and decorating your LLM and tool calls. By the end of this guide, you’ll be ready to start monitoring your controls.

Before you begin

This tutorial assumes you have completed the following procedures:
  1. Install the dependencies for Agent Control
  2. Create a control

Steps

1

Set the required environment variables

2

Initialize the Splunk Agent Observability Logger and the Agent Control SDK

Use the Splunk Agent Observability Logger around the agent run to write traces, spans, and control spans to the configured project and Agent Stream. The exact logger API may differ depending on your SDK version. You must initialize Splunk Agent Observability with the same project and Agent Stream that you plan to create controls for.The following example shows how to initialize the Splunk Agent Observability Logger.Note that:
  • The value for target_id should be logger.agent_stream_id, not the Agent Stream name. The logger resolves the human-readable project and Agent Stream names to IDs, and Agent Control uses that resolved agent_stream_id to fetch the controls.
  • You must use the same API key unless your deployment has a separate Agent Control key. The key must be valid for your targeted Splunk Agent Observability environment.
3

Run your agent with the Splunk Agent Observability Logger

4

Decorate your LLM and tool calls

Wrap LLM and tool Steps with the SDK decorator so controls can evaluate the right Steps. Use @control() on the function that performs the LLM call.
For tool call examples and more details, see Decorate LLM and tool calls.

Next steps

Learn how to monitor controls using the Controls View and investigate how a control executed using the Traces tab. See Monitor a control.