Agents
ListAuditLogs
List agent audit logs
Returns agent statement audit entries for the project, newest first, with optional credential, event, decision, source and date-range filters.
Usage
result, err := client.Agents.ListAuditLogs(ctx, "prj_xxx", nil)Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| ctx | context.Context | Yes | Request context |
| projectID | string | Yes | Unique project identifier (prefixed, e.g. prj_xxx). |
| params | *pgbeam.ListAuditLogsParams | No | Query parameters |
| params.CredentialID | string | No | Filter to a single agent credential. |
| params.Event | string | No | Filter to a single event type (e.g. blocked, masked, query). |
| params.Decision | pgbeam.AuditDecision | No | Coarse outcome filter that groups events. allow = query; block = blocked, budget_exhausted, auth_failed, credential_expired; mask = masked; truncate = truncated. |
| params.Source | pgbeam.AuditSource | No | Filter by statement origin (wire, mcp, or control). |
| params.Start | string | No | Return entries at or after this timestamp (inclusive lower bound). |
| params.End | string | No | Return entries strictly older than this timestamp (cursor / upper bound). |
| params.Before | string | No | Return entries strictly older than this timestamp (keyset pagination cursor). |
| params.PageSize | int | No | Maximum number of items to return (1-100, default 20). |
Response
(*pgbeam.ListAuditLogsResponse, error) — page of audit entries.
Example
import pgbeam "go.pgbeam.com/sdk"
client := pgbeam.NewClient(&pgbeam.ClientOptions{
APIKey: "pgb_your_api_key",
})
result, err := client.Agents.ListAuditLogs(ctx, "prj_xxx", &pgbeam.ListAuditLogsParams{
CredentialID: "...",
Event: "blocked",
Decision: "...",
Source: "...",
})
if err != nil {
log.Fatal(err)
}
fmt.Println(result)Errors
| Status | Description |
|---|---|
| 400 | Invalid request parameters. |
| 401 | Missing or invalid authentication. |
| 403 | Operation not allowed by current plan limits. |
| 404 | Resource not found. |
| 429 | Rate limited. Try again later. |