From 10fb8bfa697f61e8269c55ef083492872df7efe3 Mon Sep 17 00:00:00 2001 From: Andrew Brookins Date: Mon, 26 Oct 2026 17:07:42 -0700 Subject: [PATCH] Avoid listing all hook statuses when inspecting one event --- .../agent-memory/ingestion-webhooks.md | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/content/develop/ai/context-engine/agent-memory/ingestion-webhooks.md b/content/develop/ai/context-engine/agent-memory/ingestion-webhooks.md index df29eb329f..041725f35f 100644 --- a/content/develop/ai/context-engine/agent-memory/ingestion-webhooks.md +++ b/content/develop/ai/context-engine/agent-memory/ingestion-webhooks.md @@ -274,6 +274,7 @@ async def main(): event_id=os.environ["HOOK_EVENT_ID"], http_headers=headers, ) print(event.model_dump_json(by_alias=True)) + return cursor = None while True: page = await memory.list_ingestion_hook_statuses_async( @@ -302,7 +303,10 @@ async function main() { const memory = new AgentMemory({ serverURL: AGENT_MEMORY_URL, storeId: STORE_ID, apiKey: API_KEY }); const headers: Record = USER_TOKEN ? { "X-Iris-User-Token": USER_TOKEN } : {}; const options = { headers }; - if (HOOK_EVENT_ID) console.dir(await memory.getIngestionHookStatus(HOOK_EVENT_ID, options), { depth: null }); + if (HOOK_EVENT_ID) { + console.dir(await memory.getIngestionHookStatus(HOOK_EVENT_ID, options), { depth: null }); + return; + } let cursor: string | undefined; do { const page = await memory.listIngestionHookStatuses(20, cursor, options); @@ -322,18 +326,19 @@ if [ -n "${HOOK_EVENT_ID:-}" ]; then --header "Authorization: Bearer $API_KEY" \ --header "X-Iris-User-Token: ${USER_TOKEN:-}" \ "$AGENT_MEMORY_URL/v1/stores/$STORE_ID/ingestion-hooks/events/$HOOK_EVENT_ID" | jq +else + cursor='' + while :; do + page=$(curl --fail-with-body --silent --show-error --get \ + --header "Authorization: Bearer $API_KEY" \ + --header "X-Iris-User-Token: ${USER_TOKEN:-}" \ + --data-urlencode 'limit=20' --data-urlencode "cursor=$cursor" \ + "$AGENT_MEMORY_URL/v1/stores/$STORE_ID/ingestion-hooks/events") || exit 1 + printf '%s\n' "$page" | jq .statuses + cursor=$(printf '%s' "$page" | jq -r '.nextCursor // empty') + [ -n "$cursor" ] || break + done fi -cursor='' -while :; do - page=$(curl --fail-with-body --silent --show-error --get \ - --header "Authorization: Bearer $API_KEY" \ - --header "X-Iris-User-Token: ${USER_TOKEN:-}" \ - --data-urlencode 'limit=20' --data-urlencode "cursor=$cursor" \ - "$AGENT_MEMORY_URL/v1/stores/$STORE_ID/ingestion-hooks/events") || exit 1 - printf '%s\n' "$page" | jq .statuses - cursor=$(printf '%s' "$page" | jq -r '.nextCursor // empty') - [ -n "$cursor" ] || break -done ``` {{< /multitabs >}}