# Prompt Logs

## List prompt logs for a workspace

> Lists \`\`prompt\_log\`\` events emitted by agent-engine — full system prompt, conversation history, tool catalog, LLM model, and response — for auditing and debugging. Reads the Delta \`\`world\_events\`\` ledger via Databricks SQL; typical latency is 1-5s with a 15s ceiling on cold-start.\
> \
> \*\*Conversation filter\*\*: pass \`\`conversation\_id\`\` for the canonical mental model. Text conversations resolve from \`\`world.conversations\`\`; voice/call IDs resolve through the projected conversation entity. \`\`call\_sid\`\` is the legacy direct-SID filter (Twilio CA-SID for voice, session\_id UUID otherwise) and is mutually exclusive with \`\`conversation\_id\`\`.\
> \
> \*\*Other filters\*\*: \`\`prompt\_type\`\`, \`\`state\_name\`\`, \`\`from\_ts\`\`, \`\`to\_ts\`\`. When no selectivity-bearing filter (conversation\_id / call\_sid / time range) is supplied, the query is auto-capped to the last 7 days; the applied window is reported in \`\`applied\_time\_window\_days\`\`.\
> \
> \*\*Pagination\*\*: peek-ahead — \`\`has\_more\`\` is true when more rows exist; use \`\`next\_offset\`\` to fetch the next page.\
> \
> \*\*Auth\*\*: admin or owner role required. Reads are audit-logged (\`\`prompt\_logs.queried\`\`); responses can include PHI from prompt history.

```json
{"openapi":"3.1.0","info":{"title":"Platform API","version":"1.0.0"},"servers":[{"url":"https://api.platform.amigo.ai","description":"Production"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"API key issued via `POST /v1/{workspace_id}/api-keys`. Pass the returned `api_key` value as a Bearer token."}},"schemas":{"PromptLogListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/PromptLogEntry"},"type":"array","title":"Items"},"count":{"type":"integer","minimum":0,"title":"Count"},"has_more":{"type":"boolean","title":"Has More"},"next_offset":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Next Offset","description":"Pass back as offset to fetch the next page; null when has_more is false"},"applied_time_window_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Applied Time Window Days","description":"Auto-applied time bound (in days) when no call_sid/from_ts/to_ts was passed. Null when the caller supplied an explicit selectivity-bearing filter."},"resolved_call_sid":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Resolved Call Sid","description":"When ``conversation_id`` was supplied, this is the underlying ``call_sid`` that the lookup resolved to. Useful for callers that want to drill into per-call surfaces afterward without re-querying ``world.entities``. Null when the caller filtered by ``call_sid`` directly or did not filter by conversation."},"resolved_conversation_kind":{"anyOf":[{"type":"string","enum":["call","conversation"]},{"type":"null"}],"title":"Resolved Conversation Kind","description":"``entity_type`` of the conversation entity when ``conversation_id`` was supplied (``call`` for voice/sim, ``conversation`` for text/sms/whatsapp/email). Null otherwise."}},"type":"object","required":["items","count","has_more"],"title":"PromptLogListResponse"},"PromptLogEntry":{"properties":{"event_id":{"type":"string","format":"uuid","title":"Event Id"},"call_sid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Call Sid"},"workspace_id":{"type":"string","format":"uuid","title":"Workspace Id"},"effective_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Effective At"},"ingested_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ingested At"},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source"},"source_system":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source System"},"prompt_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prompt Type"},"turn_index":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Turn Index"},"system_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"System Prompt"},"history":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"History"},"full_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Full Prompt"},"llm_model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Llm Model"},"llm_response":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Llm Response"},"state_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"State Name"},"action":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Action"},"tool_names":{"items":{"type":"string"},"type":"array","title":"Tool Names"},"has_tools":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Has Tools"},"service_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Service Id"},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"},"data_parse_error":{"type":"boolean","title":"Data Parse Error","default":false}},"type":"object","required":["event_id","workspace_id"],"title":"PromptLogEntry","description":"One ``prompt_log`` event projection — full LLM input + output for a turn.\n\nUnbounded string fields (``system_prompt``, ``full_prompt``,\n``llm_response``) reflect the producer's payload as-is — typically\n1-50 KB each, occasionally larger for long histories. SDK consumers\nshould not assume a max length."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v1/{workspace_id}/prompt-logs":{"get":{"tags":["Prompt Logs"],"summary":"List prompt logs for a workspace","description":"Lists ``prompt_log`` events emitted by agent-engine — full system prompt, conversation history, tool catalog, LLM model, and response — for auditing and debugging. Reads the Delta ``world_events`` ledger via Databricks SQL; typical latency is 1-5s with a 15s ceiling on cold-start.\n\n**Conversation filter**: pass ``conversation_id`` for the canonical mental model. Text conversations resolve from ``world.conversations``; voice/call IDs resolve through the projected conversation entity. ``call_sid`` is the legacy direct-SID filter (Twilio CA-SID for voice, session_id UUID otherwise) and is mutually exclusive with ``conversation_id``.\n\n**Other filters**: ``prompt_type``, ``state_name``, ``from_ts``, ``to_ts``. When no selectivity-bearing filter (conversation_id / call_sid / time range) is supplied, the query is auto-capped to the last 7 days; the applied window is reported in ``applied_time_window_days``.\n\n**Pagination**: peek-ahead — ``has_more`` is true when more rows exist; use ``next_offset`` to fetch the next page.\n\n**Auth**: admin or owner role required. Reads are audit-logged (``prompt_logs.queried``); responses can include PHI from prompt history.","operationId":"list-prompt-logs","parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Workspace Id"}},{"name":"conversation_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"description":"Conversation entity UUID (canonical identifier across all modalities — voice, text/web, sms, sim). Resolves text conversations through the durable ``world.conversations`` row, then falls back to the voice/call entity projection. Mutually exclusive with the ``call_sid`` query parameter.","title":"Conversation Id"},"description":"Conversation entity UUID (canonical identifier across all modalities — voice, text/web, sms, sim). Resolves text conversations through the durable ``world.conversations`` row, then falls back to the voice/call entity projection. Mutually exclusive with the ``call_sid`` query parameter."},{"name":"call_sid","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"description":"Direct conversation identifier as stored on the prompt-log event: Twilio CA-SID for voice calls, session_id UUID for text/sim sessions. Most callers should use ``conversation_id`` instead — this is kept for legacy callers and external systems that hold the SID directly. Mutually exclusive with ``conversation_id``.","title":"Call Sid"},"description":"Direct conversation identifier as stored on the prompt-log event: Twilio CA-SID for voice calls, session_id UUID for text/sim sessions. Most callers should use ``conversation_id`` instead — this is kept for legacy callers and external systems that hold the SID directly. Mutually exclusive with ``conversation_id``."},{"name":"prompt_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"description":"Filter by prompt_type (e.g. engage_user, navigation, tool)","title":"Prompt Type"},"description":"Filter by prompt_type (e.g. engage_user, navigation, tool)"},{"name":"state_name","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}],"description":"Filter by HSM state_name at render time","title":"State Name"},"description":"Filter by HSM state_name at render time"},{"name":"from_ts","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Inclusive lower bound on effective_at","title":"From Ts"},"description":"Inclusive lower bound on effective_at"},{"name":"to_ts","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Exclusive upper bound on effective_at","title":"To Ts"},"description":"Exclusive upper bound on effective_at"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"description":"Max rows to return (default 20, max 200)","default":20,"title":"Limit"},"description":"Max rows to return (default 20, max 200)"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","maximum":10000,"minimum":0,"description":"Offset for pagination (max 10000)","default":0,"title":"Offset"},"description":"Offset for pagination (max 10000)"}],"responses":{"200":{"description":"Prompt log entries (newest first)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PromptLogListResponse"}}}},"400":{"description":"Mutually exclusive filters supplied"},"403":{"description":"Caller is not admin/owner"},"404":{"description":"conversation_id does not match any conversation in this workspace"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"503":{"description":"Raw world event reads disabled or warehouse unavailable"}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.amigo.ai/api-reference/readme/platform/prompt-logs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
