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

# Logs

> Inspect activity and output from agents, instances, and tasks.

Logs capture what your agents, instances, and tasks do: their output and any errors. They are the first place to look when something does not behave as expected.

## What is logged

| Source          | Contains                                    |
| --------------- | ------------------------------------------- |
| Instances       | Startup, health checks, and runtime output. |
| Tasks           | Planning and execution activity.            |
| Tool executions | Calls made and their outcomes.              |

## Access

Logs are available in the Console under each resource — navigate to an agent, instance, or task and open its **Logs** tab. You can filter by time range and search by keyword.

<Note>
  Log retention varies by plan. Check the Console billing section for your organization's retention period.
</Note>

For structured debugging, correlate by `request_id`: when a Data Platform API call fails, the response includes a `request_id` in the error body. Match it in logs to find the exact failing operation.

## Debugging workflow

When something fails, follow this sequence:

<Steps>
  <Step title="Identify the error">
    Capture the error response. Note the `error_code` and, for Data Platform errors, the `request_id` field in the response body.
  </Step>

  <Step title="Open logs for the resource">
    Navigate to the failing agent, instance, or task in the Console. Open its **Logs** tab. Filter to the time window of the failure.
  </Step>

  <Step title="Search by request_id">
    If you have a `request_id`, search for it in the log stream. This pinpoints the exact operation that failed and shows surrounding context (what happened before and after).
  </Step>

  <Step title="Check auto-logged signals">
    Agent instances automatically log startup, health check results, request latency, and recovery attempts. Look for health check failures or elevated latency immediately before the error.
  </Step>

  <Step title="Escalate with context">
    If the root cause isn't clear, file a [support ticket](/docs/support) including: the `error_code`, `request_id`, `environment_id`, `workspace_id`, and the timestamp of the failure.
  </Step>
</Steps>

## Log structure

Logs from your agent code appear as plain text lines. Structure them to make filtering easier:

```python theme={"dark"}
# Unstructured — harder to search
print("Processing started")

# Structured — easy to filter by level, event, and ID
import json
print(json.dumps({"level": "info", "event": "processing_started", "task_id": task_id}))
```

Agent instances log the following automatically (you do not need to emit these):

* Container startup and health check results
* Requests received (method, path, latency)
* Health check failures and recovery attempts

## Common mistakes

* **Logging secrets from your agent.** Never write credentials or tokens to output.
* **Looking only at the latest line.** A failure's root cause is often earlier in the log.

## Best practices

* Emit structured, meaningful log lines from your agent code.
* Keep sensitive data out of logs.
* Correlate logs with [metrics](/docs/observability/metrics) and task events when debugging.

## Related pages

<CardGroup cols={2}>
  <Card title="Metrics" icon="chart-line" href="/docs/observability/metrics">
    Quantitative performance signals.
  </Card>

  <Card title="Runtime Lifecycle" icon="arrows-rotate" href="/docs/compute/runtime-lifecycle">
    Why an instance may be unhealthy.
  </Card>

  <Card title="Streaming & Replay" icon="play" href="/docs/orchestration/streaming-and-replay">
    Real-time task visibility.
  </Card>

  <Card title="Troubleshooting" icon="wrench" href="/docs/troubleshooting">
    Resolve common issues.
  </Card>
</CardGroup>
