---
title: "Observability Integration"
description: "Give Autohand your metrics, logs and traces through piped input or MCP servers, and keep a record of what Autohand itself does."
seo:
  description: "Give Autohand metrics, logs and traces from OpenTelemetry, Prometheus, Datadog, Kubernetes and CloudWatch through piped headless runs or MCP servers, and audit."
---

## Overview

Autohand Code CLI does not receive telemetry. It has no OpenTelemetry receiver, eBPF agent, metrics poller or alert listener, and no `sre` command. Your observability stack keeps collecting and storing signals. Autohand reads the slice of data that matters for a question and reasons about it alongside your code and runbooks.

There are three ways to get signals to Autohand:

- **Pipe them in**: query your backend with its own CLI or API and pipe the result into a headless run (`autohand -p`). Piped input is added to the prompt as context.
- **Add an MCP server**: register your vendor's or a community MCP server with `autohand mcp add` so Autohand can run queries itself.
- **Let it run your CLIs**: in a session, Autohand can run read-only commands such as `kubectl logs` or `promtool`, subject to your permission settings.

The same signal types apply either way: metrics, logs and traces.

## OpenTelemetry data [#opentelemetry]

Keep your OpenTelemetry Collector exporting to the backend you already use (Jaeger, Tempo, Prometheus, Loki, a vendor). Do not point an exporter at Autohand; there is nothing to receive it.

To investigate a slow or failing request, fetch its trace from the backend and pipe it in. For example, with Jaeger's query API:

```bash
curl -s "http://jaeger-query:16686/api/traces/$TRACE_ID" \
  | autohand -p "Find the span that accounts for most of this request's latency and the code path in this repository that produces it." \
      --restricted
```

If your trace backend has an MCP server, register it instead and refer to trace IDs in your prompt.

## eBPF and kernel-level data [#ebpf]

Autohand does not ship an eBPF agent. If you already run one (for example Pixie, Parca, Cilium Hubble or bpftrace scripts), export its output to a file and pipe it in like any other signal:

```bash
hubble observe --namespace production --since 5m --output json > flows.json

autohand -p "These are network flows from the last 5 minutes. Which service pairs show drops or retransmits, and is anything in our manifests in k8s/ likely to cause them?" \
  --restricted < flows.json
```

## Metrics

### Prometheus

Query the Prometheus HTTP API and pass the result to Autohand. Thresholds and alert rules stay in Prometheus or Alertmanager:

```bash
curl -s http://prometheus:9090/api/v1/query \
  --data-urlencode 'query=histogram_quantile(0.99, sum(rate(http_request_duration_seconds_bucket[5m])) by (le, service))' \
  | autohand -p "Which services have p99 latency above 2 seconds, and what changed in their code in the last day?" \
      --restricted
```

### Datadog

Autohand has no native Datadog integration yet; see [Datadog](/integrations/datadog). Use Datadog's API or an MCP server for Datadog, registered with `autohand mcp add`:

```bash
# Remote (HTTP) MCP server
autohand mcp add --transport http datadog https://<your-datadog-mcp-endpoint>

# Local (stdio) MCP server. The -- keeps Autohand from reading -y as its own --yes flag
autohand mcp add datadog -- npx -y <datadog-mcp-package>
```

Keep Datadog API and application keys in that server's own configuration or environment. Autohand does not read `DATADOG_API_KEY`.

## Logs

### Kubernetes logs

```bash
kubectl logs -n production deploy/payment-api --since=30m --tail=2000 \
  | autohand -p "Group these errors by root cause and point to the code that logs each one." \
      --restricted
```

### CloudWatch logs

```bash
aws logs filter-log-events \
  --log-group-name /aws/lambda/payment-processor \
  --filter-pattern "?ERROR ?Exception" \
  --start-time $(( ($(date +%s) - 3600) * 1000 )) \
  --query 'events[].message' --output text \
  | autohand -p "Summarize the failures in this Lambda's last hour of logs and suggest a fix." --restricted
```

Trim logs before piping them. Large inputs use more of the model's context window and cost more.

## Alert routing [#alerting]

Alert routing, acknowledgement and escalation stay in PagerDuty, Opsgenie or Alertmanager. To start an Autohand run from an alert, point a webhook at a small service or CI job you control, and have it call Autohand headlessly:

```bash
# Inside the webhook handler or CI job, with the alert payload in alert.json
cat alert.json \
  | autohand --bare --ephemeral -p "Triage this alert using runbooks/. Name the likely cause and the runbook that applies." \
      --restricted --max-duration 300
```

With `--bare`, Autohand reads credentials from `AUTOHAND_PROVIDER`, `AUTOHAND_API_KEY` and `AUTOHAND_AI_API_KEY`. The full flow, from diagnosis to a reviewed patch, is in [Incident Response](/guides/sre/incident-response).

## Signal correlation

Autohand has no correlation rules to configure. Instead, give one run several signals and ask it to connect them. `--output-schema` makes the answer a JSON document your tooling can use:

```bash
cat trace.json errors.log p99.json \
  | autohand --ephemeral -p "Correlate this trace, these error logs and these latency metrics. Find the component where they point to the same cause." \
      --restricted --output-schema correlation.schema.json --json local \
  | jq -r .content > correlation.json
```

For example, `correlation.schema.json` can ask for `component`, `evidence` (an array of trace IDs, log lines and metric names) and `confidence`. If the answer does not match the schema, the command exits with status 1.

## Observing Autohand itself [#agent-observability]

When Autohand runs as part of your operations, record what it does:

- **Agent traces**: `autohand traces on` turns on local agent monitoring and metadata sync to Autohand Console; `autohand traces status` and `autohand traces off` check and stop it. See [Agent Traces](/working-with-autohand-code/agent-traces).
- **Event stream**: `--output-format stream-json` writes every tool call and result of a headless run as JSON lines you can ship to your log pipeline.
- **Hooks**: a `post-tool` hook under the `hooks` config key runs after each tool call. Hooks do not run with `--bare`.

This hook in `~/.autohand/config.json` appends each tool call to a log file:

```json
{
  "hooks": {
    "enabled": true,
    "hooks": [
      {
        "event": "post-tool",
        "command": "echo \"$(date -u +%FT%TZ) $HOOK_SESSION_ID $HOOK_TOOL $HOOK_SUCCESS\" >> ~/.autohand/tool-audit.log",
        "description": "Audit every tool call"
      }
    ]
  }
}
```

See [Hooks](/working-with-autohand-code/hooks) for the other events and the variables each one receives.

## Verification

Check that Autohand can reach the MCP servers you added:

```bash
# List configured MCP servers
autohand mcp list

# Check the installation, including connections to configured MCP servers
autohand doctor

# Check agent trace monitoring
autohand traces status
```

Then replay a saved signal through a read-only run and check the answer before you wire it into alerting:

```bash
autohand --ephemeral -p "Triage this alert using runbooks/." --restricted < fixtures/high-latency-alert.json
```
