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

# Agent ID in Tenant Logs

> Track agent activity through Auth0 tenant logs using `agent_id` or `external_agent_id`.

> [!WARNING]
>
> **The Agent as Principal feature is in [Early Access](/docs/docs/troubleshoot/product-lifecycle/product-release-stages).**
>
> To participate, contact Auth0 Support.
>
> By using this feature, you agree to the applicable Free Trial terms in Okta's [Master Subscription Agreement](https://www.okta.com/legal).

When a token is issued for an agentic interaction, Auth0 includes both the `agent_id` and `external_agent_id`, if set, in the resulting tenant log entry.

## Supported grant types

Auth0 records agent identity in logs for the following grant types:

* `client_credentials` grants from agent-linked clients
* `refresh_token` grants for agent-linked clients
* OBO token exchange grants
* Standard login grants where the client is agent-linked

## Query logs

You can query the `agent_id` via the Management API log endpoints, enabling per-agent audit and anomaly detection:

```http theme={null}
GET /api/v2/logs?q=agent_id:agt_72jbvv7LfRKYp59gtRLtkn
```

To learn more about querying and streaming tenant logs, read [Log Search Query Syntax](/docs/docs/deploy-monitor/logs/log-search-query-syntax) and [Log Streams](/docs/docs/customize/log-streams).
