> ## Documentation Index
> Fetch the complete documentation index at: https://agent-observability-docs.splunk.com/llms.txt
> Use this file to discover all available pages before exploring further.

# agent_control

## Module

Resolve Splunk AO context for Agent Control calls.

This module produces generic Agent Control targets from Splunk AO state. It does
not import the Agent Control SDK; callers wire the two SDKs together explicitly.

For Agent Control telemetry ingestion, use `splunk_ao.handlers.agent_control`.

## AgentControlTargetUnresolvedError

Raised when no Agent Control target can be resolved from available inputs.

## AgentControlTarget

A target identifier that can be passed to Agent Control.

**Arguments**

* `target_type`: Opaque Agent Control target type. Agent Control treats this value as
  deployer-defined; Splunk AO currently auto-resolves only `log_stream`
  targets.

* `target_id`: Opaque Agent Control target ID.

* `project_id`: Splunk AO project ID for logs, debugging, and audit context only. Agent
  Control resolves project ownership from `target_type` and
  `target_id`.

## get\_agent\_control\_target

```python theme={null}
def get_agent_control_target(*,
                             target_type: str=LOG_STREAM_TARGET_TYPE,
                             target_id: str | None=None,
                             agent_stream_id: str | None=None,
                             project_id: str | None=None) -> AgentControlTarget
```

Resolve an Agent Control target from explicit inputs or Splunk AO context.

Resolution order:

1. Explicit `target_id`.
2. Explicit `agent_stream_id` for `log_stream` targets.
3. `SPLUNK_AO_AGENT_STREAM_ID` for `log_stream` targets.
4. An already-initialized `splunk_ao_context` logger.

This helper does not resolve agent stream names over the network. If only an
agent stream name is available, resolve it with the Splunk AO SDK first and pass
the resulting ID explicitly.
