Repository navigation
feat(examples): agent memory demo — short-term, long-term and reasoning traces from agent_events - #512
Conversation
…ng traces from agent_events Add examples/agent_memory/, a runnable demo of the three agent memory layers that neo4j-agent-memory describes. Each layer is read from the agent_events rows the ADK BigQueryAgentAnalyticsPlugin already writes, using one Client.list_traces(TraceFilter(user_id=..., start_time=...)) call: - Short-term: per-session conversations (USER_MESSAGE_RECEIVED plus the text parts of LLM_RESPONSE) and a newest-first session list. - Long-term: ADK user:-scoped state, read from STATE_DELTA rows as a version history with as_of reads; session-scoped keys are ignored. Also entities taken from tool arguments the app maps to a type. - Reasoning: one trace per ADK invocation with a step per model turn and its tool calls (success, error, or pending if no completion row). Each trace gets a derived outcome status (answered, answered_with_errors, unanswered) and metrics. Also outcome-filtered listing, lexical similar-task lookup and per-tool stats. - get_context(): one prompt block combining the layers. Each line names the session/span or session/trace it came from. Offline mode replays a committed SYNTHETIC fixture of 65 plugin-shaped rows (two users, five sessions) through the real SDK Client. A stand-in for bigquery.Client serves only the list-traces statement with the user_id, start_time and limit filters. It raises NotImplementedError for any other statement or predicate. Live mode (--project-id/--dataset-id) runs the same code on a real table; it was not run against BigQuery in this change. success_only is applied after the fetch. TraceFilter(has_error=False) is a row-level predicate in the session-anchor query, so it still returns sessions that contain error rows. Tests: tests/examples/test_agent_memory_demo.py, 46 hermetic tests (no network or credentials). examples/README.md lists the new bundle. No src/ changes. Refs GoogleCloudPlatform#511
caohy1988
left a comment
There was a problem hiding this comment.
VERDICT: REQUEST_CHANGES @ cbae07f
Astra technical review of #512 against #511. Rejection criteria recorded before reading the diff: (1) incorrect event reconstruction/provenance or overstated Neo4j parity; (2) broken user isolation or a stand-in accepting SQL it cannot implement; (3) failure of the hermetic demo/tests or divergence from the promised SDK path.
Four concrete findings:
-
[P2] Streaming response rows are treated as complete model turns and successful answers.
examples/agent_memory/memory_layers.py:405–411selects the lastLLM_RESPONSEirrespective of whether it is a streaming fragment;:324–334emits every fragment as a separate assistant message, and:476counts rows as model calls. I replayed payloads produced by the installed google-adk 2.11.0 callback body for one model span: partial"Hello ", partial"world.", terminal"Hello world.". With only the first fragment, this demo reportsoutcome_status="answered",success=True,completed_at=None. With the full stream it returns three assistant messages, two reasoning steps andllm_calls=3for one model call. An interrupted stream therefore enterssuccess_only=Trueretrieval, and a completed one duplicates prompt history. Normalize streaming events by model span and require evidence of a final answer before declaring success; add interrupted and completed-stream regressions. The README's “cannot be left without an outcome” claim also needs to distinguish a derived status from an actual recorded answer. -
[P2] Literal response text can fabricate a tool action and lose the answer.
memory_layers.py:281–294splits on| call:even inside the plugin's quoted text summary. The ADK formatter turns the ordinary single text partThe log format is text: message | call: tool_name.intotext: 'The log format is text: message | call: tool_name.'. This demo reconstructs onlyThe log format is text: message, invents actioncall: tool_name.', and marks the invocationunanswered. There was no function call. Preserve quoted text/ambiguous summaries and use recorded tool evidence instead of treating an unescaped delimiter inside text as proof of a tool request. Cover literal delimiters and apostrophes in response text. -
[P2] The offline client's advertised fail-closed statement contract is not enforced.
examples/agent_memory/offline_bigquery.py:118–123,173–193validates a marker and two WHERE substrings, then ignores the rest of the statement. Starting with the SDK's actual_LIST_TRACES_QUERYforTraceFilter(user_id="u-ana"), both appending outerLIMIT 0and changing the join toON FALSE AND e.session_id = ts.session_idreturn 51 rows without raising. Both queries require zero rows. This means SQL changes outside the extracted predicates can pass the offline tests with incorrect semantics, despite #511 and the README explicitly promising rejection of unsupported queries/predicates. Validate the entire supported statement shape (including join, projection, ordering and limit), rejecting deviations; add these negative cases. -
[P2] Combined entity context drops the promised event provenance.
memory_layers.py:809–814formats only aggregate session names and discards everyEntityMention.span_id. The unmodified default demo prints- Kyoto (LOCATION): 3 tool calls in s-102, s-103, with no source span references; all four entity lines have this problem. #511 requires a sourcesession_id/span_idon each memory line, andget_contextdocuments that guarantee. Render source references from the retained mentions and assert them in the context test; its current assertion locks in the missing provenance.
The overall scope is appropriate: seven example/test/doc files, no src/ changes, one Client.list_traces entry point, and live CLI wiring uses the same reader. Preference history/as-of, mapped entities, lexical retrieval and tool aggregates work on the supplied fixture. My extra cross-user test reused Ana's session ID for Ben and still excluded Ben's rows; a preference tombstone at the exact as-of boundary also passed. The README explicitly distinguishes lexical retrieval, inferred outcomes, entity extraction and missing graph/write capabilities from Neo4j. This is consistent with the primary memory-types documentation, reasoning lifecycle, preference API and combined-context contract; the findings above concern the BQAA demo's own guarantees.
VERIFIED:
- Python 3.13.7 ARM64, google-adk 2.11.0, google-cloud-bigquery 3.46.1.
pytest tests/examples/test_agent_memory_demo.py -q -p no:cacheprovider -W error: 46 passed. The documented offline CLI exits successfully and prints all four sections. - Those runs and the five additional assertion probes used
GOOGLE_APPLICATION_CREDENTIALS=/nonexistentand a Python audit hook denying socket connection/DNS/bind operations. A DNS-denial control fired. The additional probes produced 5 assertion failures, covering the four findings above (two streaming assertions). - The plugin-shape probes execute the exact installed formatter and
after_model_callbackfunction bodies, with logging/span lifecycle replaced by local stubs. This is a source-level offline probe, not an ADK agent run; direct plugin import lacks its optional BigQuery Storage dependency in this environment. bash autoformat.shwith pyink 25.12.0/isort 9.0.2: 371 files unchanged; notebooks skipped because Jupyter formatting dependencies are absent.git diff --checkand tracked-worktree cleanliness passed.- Full suite under the same Python network guard, after using a native ARM64 interpreter for child processes: 5325 passed, 83 skipped, 5 failed, 20 warnings (59.78 s). The five failures are environment limitations in unchanged tests: three
tests/test_grafana_local_runner.pycases cannot executeps(Operation not permitted), and twotests/test_looker_studio_dashboard.pybrowser-server cases are blocked by the socket/DNS guard. I do not claim a green full-suite result and do not use these five failures as evidence against this PR. The initial run also had architecture-related import failures; those disappeared in the native-interpreter rerun.
NOT VERIFIED: live BigQuery, live ADK ingestion, Neo4j execution, other Python versions, and independent execution of the README's BigQuery tool-stats SQL. I inspected that SQL and the SDK query source, but DuckDB/sqlglot are not installed here. The Neo4j reasoning-search/stats and trace-reference page fetches failed, so those exact pages remain a source-verification gap. Nested sandbox-exec is denied by this environment; the Python network guard is not an OS-level network sandbox.
Process qualification: the initial mandatory vault-policy read exposed historical review summaries about unrelated PRs. I did not open #512 review threads or another reviewer's #512 feedback. Under the vault's stricter rule, this technical review must not count toward the strict blind-review gate.
CHANGED: no tracked repository changes. RISKS: the four reproductions above. APPROVAL NEEDED: none to submit this requested COMMENT; this review neither approves/requests changes in GitHub's review state nor authorizes a merge.
VERDICT: REQUEST_CHANGES @ cbae07f
Extend examples/agent_memory with a real end-to-end path.
- live_agent.py: an ADK trip-planner agent on gemini-3.8-flash (Vertex AI
location global), logged by the BigQueryAgentAnalyticsPlugin with
enable_otel_correlation=True. Five scripted sessions for two users
cover:
- multi-turn context within a session;
- preferences saved as ADK user: state, one of them later replaced;
- a simulated tool outage, recorded as TOOL_ERROR and then retried;
- a recall_memory tool that reads earlier sessions back from BigQuery
through load_user_memory() and get_context().
- export_memory.py: writes the memory layers to the JSON the web view
reads, including a per-invocation timeline of model and tool calls. The
project is shown as <project> unless --show-project is passed.
- viz/: a dependency-free static page, served with python -m http.server.
It shows a session panel, a long-term memory graph linking preference
versions and entities to sessions, a reasoning waterfall per turn,
table views and the get_context() block. record_demo.py records
demo.mp4 and a screenshot in headless Chromium via Playwright.
- recorded_run/: the run of 2026-10-07 on a scratch dataset (5 sessions,
119 rows, all with OTel IDs; 18 model calls). It holds the run record,
the demo output for both users, and a labeled note with the real
project ID and the approximate cost (about $0.04).
- memory_layers.py: spans_by_invocation() and response_parts() are now
public, for the export.
- agent_memory_demo.py: the CLI prints a 0 ms average latency as 0.0
instead of "-". Live in-process tools exposed this.
- README: end-to-end reproduction steps with placeholders, and the web
view.
Tests: tests/examples/test_agent_memory_live_agent.py covers the agent
tools and tests/examples/test_agent_memory_export.py the export, plus a
regression test for the zero-latency average. All hermetic. No src/
changes.
Refs GoogleCloudPlatform#511
Addresses the four P2 findings of review 5438195112 on GoogleCloudPlatform#512 (refs GoogleCloudPlatform#511). - Streaming: LLM_RESPONSE rows are grouped per span into one model call. A call is complete only with a terminal response row (google-adk 2.11 writes cache_type / finish_reason on it) or, for producers without those markers, a following non-error row. The fragments of a stream that never finished are joined and flagged incomplete, and never count as an answer. llm_calls and total_tokens count each call once. - Parsing: response_parts() reads the plugin's part format structurally. A quote closes a text part only before " | " or the end of the response. When text can be read more than one way, the TOOL_STARTING rows that follow the call choose the reading; with no such rows the text stays whole and no call is invented. Truncated payloads keep the plugin's marker, and the search is bounded so crafted text cannot stall it. - Offline stand-in: the SDK list-traces statement is pinned and must match in full, with the same table in both FROM clauses and exactly the expected query parameters. Anything else raises NotImplementedError. - Provenance: every get_context() line names its source rows. Entity lines list [session/span] for their newest mentions (older ones as "+N earlier"), and similar-task lines cite the span of the answer (ReasoningTrace.outcome_span_id). The CLI, export and web view mark incomplete replies. The recorded-run demo outputs, export, video and screenshot were regenerated from the same 119 live rows; the agent did not run again.
Replace the small trip-planner live run with an ADK data-analyst agent.
Six analysts ask it questions about bigquery-public-data.thelook_ecommerce
over five simulated business days, and it builds its memory only from the
rows that BigQueryAgentAnalyticsPlugin logs. The offline fixture and its
tests are unchanged.
- analyst_agent.py: the agent (gemini-3.8-flash) and its tools. run_sql
dry-runs each query first and allows only SELECT, at most 2 GB, and
tables in TheLook's dataset; its jobs are labeled. describe_table,
save_preference (ADK user: state) and recall_memory complete the set.
It also has the harness for the week, the memory-off control sessions
and the run record.
- analyst_scenario.py: six analysts, five days, 36 scripted sessions.
- memory_consolidation.py: the nightly pass in BigQuery. AI.GENERATE with
a typed output_schema extracts entities and facts from each logged user
message, and AI.EMBED embeds it; recall ranks similar past tasks with
ML.DISTANCE.
- memory_layers.py: facts and extracted entities in long-term memory,
logged session state, and tool results that report {"status": "error"}.
get_context() gains embedding scores and lines that show the SQL a
similar past task ran.
- export_memory.py and viz/: export schema 2 with run totals and
before/after pairs. A pair is flagged when its memory-off run's SQL read
the memory dataset. The page adds the before/after panel, the week view
and a knowledge graph.
- viz/record_demo.py: narrated recordings, with a macOS say voiceover, an
.srt file, and captions burned in with ffmpeg.
- recorded_run/: the live run record (36 sessions with memory, 6 without,
1,606 rows), demo output, narration, captions and a 1 min 41 s video.
In the run, three of the six memory-off sessions read the memory tables
through run_sql; the scope check was added afterwards. The export and the
README flag those three comparisons, and the other three are clean.
Refs GoogleCloudPlatform#511
caohy1988
left a comment
There was a problem hiding this comment.
VERDICT: REQUEST_CHANGES @ 1202616
Blind review of this exact head against #511 and the requested narrated-demo checks. I did not consult the vault or other PR reviews/comments. Two P2 findings meet rejection criteria 1 and 3 below. The recorded run is genuine and substantially more realistic than the offline fixture; the request for changes concerns failure handling, not fabricated demo evidence.
Before reading the diff, I recorded these rejection criteria in /Users/haiyuancao/Documents/bqaa-512-r2/rejection-criteria.md:
- The credential-free CLI or documented real
Client.list_tracespath fails, or a required memory view is incorrect, loses provenance, crosses user scope, or accepts unsupported fixture SQL/predicates. - Required hermetic coverage, the full test suite, or
bash autoformat.shfails or changes tracked files. - The README mapping, PR claims, or narrated visualization overstates implemented behavior or recorded evidence: real agent/tools, cross-session memory, volumes, extraction, or what the screen actually shows.
P2 — Propagate tool-reported errors into the reasoning outcome and waterfall.
Locations: export_memory.py:160–164, memory_layers.py:768–774.
_tool_call() recognizes TOOL_COMPLETED results containing {"status":"error"}, but these two consumers still consider only event-level errors. Consequently, the real failed SQL calls are green “ok” bars, their traces are answered with empty errors, and list_traces(success_only=True) includes them. This contradicts the README's promise that failed calls receive an error color/icon/label and makes the successful-trace retrieval inconsistent with its own tool-error metrics.
A credential-free reproduction from the committed artifact:
python3 - <<'PY'
import json
p = 'examples/agent_memory/viz/data/memory_export.json'
for u in json.load(open(p))['users']:
for t in u['traces']:
for step in t['steps']:
for c in step['tool_calls']:
if c['status'] == 'error':
bar = next(x for x in t['timeline']
if x['span_id'] == c['span_id'])
print(t['session_id'], c['span_id'],
'tool=' + c['status'],
'trace=' + t['outcome_status'],
'timeline=' + bar['status'])
PYOutput:
an-20261007t0834-d1-priya-1 642fe623c7024f4c tool=error trace=answered timeline=success
an-20261007t0834-d3-priya-1 2871ce7060a24f41 tool=error trace=answered timeline=success
I fetched the actual BigQuery rows and rebuilt the export: the same mismatch occurs. The errors are Column name user_id is ambiguous at [19:19] and Aggregate function MIN not allowed in WHERE clause at [17:29]. I also changed the fixture's sp-103-tool-2 completion to return a synthetic error and reran the SDK/memory/export path:
Synthetic tool status: error
Synthetic trace status/errors: answered []
Selected by success_only=True: True
Synthetic failed tool timeline: [('success', '{"status": "error", "message": "review-injected SQL failure"}')]
Probe: venv/bin/python probe_errors.py from the review evidence directory. Apply one consistent failure classification to tool calls, trace errors/outcomes, and timeline entries; add assertions for all three and regenerate the export. The existing result-error test checks the call, stats and context, but misses these consumers.
P2 — Do not permanently mark failed consolidation rows as processed.
Locations: memory_consolidation.py:159–177, memory_consolidation.py:275.
_EXTRACT appends unsuccessful per-row results, while _NEW_MESSAGES excludes every span present in the destination, regardless of its status. _EMBED discards the status altogether and likewise saves an unusable embedding as a processed span. A transient row-level AI failure therefore permanently removes that message's facts/entities or similar-task recall from later consolidation attempts. Re-running the same pass does not recover it; empty embeddings are also excluded by the recall query.
These are supported response shapes: both AI.GENERATE and AI.EMBED return per-row status fields, with an empty status indicating success.
I executed the actual _NEW_MESSAGES SQL against read-only BigQuery CTE fixtures: three input messages (new, failed, succeeded), and destination rows for failed (RESOURCE_EXHAUSTED, empty embedding) and succeeded (successful, nonempty embedding). Command and output:
venv/bin/python probe_consolidation_retry.py
Fixture: 3 input messages; existing done rows = failed (RESOURCE_EXHAUSTED, empty embedding), succeeded (OK).
Actual _NEW_MESSAGES eligible spans: ['new']
Expected after a recoverable row failure: new, failed
The generated query is saved as retry-probe.sql beside that probe. No failing model call was induced and no tables were mutated. Make successful processing the exclusion condition, preserve/check embedding status, and allow a later pass to repair failed rows without duplicating successful memory items. Add a failure-then-retry case; current tests cover SQL construction and successful jobs.
Contract and break attempts that passed.
- Credential-free run:
GOOGLE_APPLICATION_CREDENTIALS=/nonexistent/review-no-creds venv/bin/python examples/agent_memory/agent_memory_demo.pycompleted and printed all three layers and combined context. The implemented entry point isagent_memory_demo.py, rather than the issue's proposedrun_demo.py; the README documents the actual name. - Live CLI: the documented
--project-id/--dataset-id,--table-id analyst_events, user/session path read Maya's 9 sessions and 11 invocation traces through the real SDK. Nosrc/changes are present. - All four agent-memory test files: 172 passed. Their cases cover conversations, preference history/as-of/deletion, entities, reasoning, lexical and supplied similarity scores, stats, combined context, scope, and rejected fixture SQL mutations. The additional error and retry probes above expose gaps outside those assertions.
- Full suite:
venv/bin/python -m pytest -q→ 5572 passed, 67 skipped, 21 warnings in 247.76 s. I installed the repository's dashboard extras to resolve the initial collection dependencies. Environment: Python 3.13, ADK 2.11.0. - Formatting: with CI's
pyink>=24.3.0,<26constraint (25.12.0) and isort 9.0.2,bash autoformat.sh→ 379 files left unchanged.git diff --checkpassed and the worktree is clean. An initial run with unbounded pyink 26 reformatted only pre-existing files; I restored those changes before the CI-version check. - SQL boundary: I exercised
Warehouse.run_sqlagainst real BigQuery.SELECT 1succeeded; attempts to read the memory table, its foreignINFORMATION_SCHEMA.TABLES, and the project'sINFORMATION_SCHEMA.JOBS_BY_USERwere rejected after the dry run. I found no bypass in these attempts. This verifies the added guard, not six newly clean control runs.
Recorded data, screenshot, and narrated demo.
I queried the dataset named in recorded_run/README.md, rather than relying only on the checked-in summary. The 42 recorded sessions have exactly 1,606 rows, 46 user turns, 343 model calls, 220 SQL calls, and OTel trace/span attributes on every row. The extra 32-row partial control rerun is separate, as disclosed. Logged token counts match the run record. There are 23 facts, 62 entity mentions, 19 preference versions, and 40 task embeddings of 768 dimensions. All 15 recorded nightly extraction/items/embedding jobs exist, completed without job errors, and contain the claimed AI.GENERATE, MERGE, or AI.EMBED SQL; their billed-byte records match.
All six user exports rebuilt exactly from live rows plus live extracted items. All 37 recalled-context strings match the corresponding real recall_memory tool results, and preference provenance checks passed. The three flagged controls have the disclosed 2 / 10 / 8 memory-table queries. Those are contaminated comparisons, not evidence of a memory-free baseline; the README and comparison tabs disclose this, and the recording selects Maya and Diego instead.
I reran the logged SELECT queries underlying Maya's screenshot, Lena's lead-time answer, and Diego's weekly comparison. Every returned row matched the recorded tool results, including $39,355.24 / +20.78%, 32.22 / 30.08 hours, and the Brazil/Spain weekly series. The earlier preference values and reusable SQL are present in the actual recall results. This supports real memory-conditioned answers, while the one-sample comparisons do not establish a general quality/latency improvement.
Video inspection:
ffprobe -v error -show_entries format=duration,size:stream=codec_name,codec_type,width,height,sample_rate,channels,duration -of json examples/agent_memory/recorded_run/demo.mp4
video: H.264, 1280×800, 100.680000 s
audio: AAC, mono, 44100 Hz, 100.658503 s
file: 4,448,106 bytes
I extracted and viewed frames at five-second intervals with ffmpeg -vf fps=1/5, inspected the contact sheet and full-resolution comparison, week, reasoning, and recall frames, and opened viz/screenshot.png. The captions are visibly burned in. All 16 SRT texts match the narration script; timings are ordered, non-overlapping, and hold each scene through its relevant lines. As an independent audio check, I regenerated each line with the documented local voice/rate and compared it with the MP4's decoded audio: waveform correlations 0.9979–0.9999, aligned at the caption start, with approximately 250 ms caption tails. The audio is not merely an empty track.
The screenshot is readable and shows the verified comparison. The video has a coherent progression from answer differences to recall links, facts, preference versions, reasoning, and the actual recalled context. Dense SQL/context and some tables need pausing or horizontal scrolling, but the headline evidence is legible. The confirmed green-bar error above is a substantive visualization defect.
On realism, this is a real ADK agent with schema inspection, warehouse SQL, preference writes and memory recall, serving six personas across 36 memory-enabled sessions and five simulated business days. It is a credible workload demonstration; it is neither a production deployment nor a multi-day durability/scale benchmark. Compared with Neo4j Labs' two-session ADK example, it exercises more sessions and real analytical queries. Its three-layer presentation is comparable in purpose to their full-stack chat demo, while their financial-services demo offers richer domain graph traversal and explicit reasoning/provenance relationships. The README appropriately identifies those parity gaps.
I did not rerun the full model-driven week, induce remote AI failures, independently verify the whole-day Monitoring/billing estimate, or treat skipped integration tests as passing. The decoded audio was verified by waveform comparison rather than a listening session. Browser automation was unavailable, so the visual assessment uses the recorded frames and screenshot. Evidence, probes, extracted frames and logs are under /Users/haiyuancao/Documents/bqaa-512-r2/. No code was pushed or changed.
VERDICT: REQUEST_CHANGES @ 1202616
caohy1988
left a comment
There was a problem hiding this comment.
VERDICT: APPROVE @ 1202616
Blind review of head 1202616 (round 2). I did not read the vault or any other review or comment on this PR. Disclosure: my session's memory index contained one line noting that fork PRs for this repo ran CI promptly (citing PR 512); nothing about findings.
Rejection criteria (written before reading the diff, from #511's done-when)
- R1 The offline entry point needs credentials or does not print all three layers plus the combined context; or the hermetic tests miss one of the nine listed areas; or the stand-in does not fail closed.
- R2 The live path does not reuse the same code through
Client.list_traces, or the README fails to map each neo4j-agent-memory concept/API and list the gaps (or claims parity). - R3
bash autoformat.shleaves a diff, the full suite fails, or the tests reach the network. - R4 (review brief) Video, captions, screenshot, README or PR-body claims are not backed by the committed run record or the BigQuery data, or the demo is a toy.
None of the four is met. Evidence below.
What I tried (and the result)
R1, offline run with no credentials and no network. sandbox-exec with (deny network*), HOME and CLOUDSDK_CONFIG pointed at an empty dir, GOOGLE_APPLICATION_CREDENTIALS unset:
env -u GOOGLE_APPLICATION_CREDENTIALS CLOUDSDK_CONFIG=/tmp/empty HOME=/tmp/empty \
sandbox-exec -f nonet.sb .venv/bin/python examples/agent_memory/agent_memory_demo.py
exit: 0 (71 lines: "== 1. Short-term memory ==", "== 2. Long-term memory ==",
"== 3. Reasoning memory ==", "== 4. get_context() for the next model call ==")
The sandbox really blocks the network (socket.create_connection → gaierror). The nine test areas each have at least one named test in tests/examples/test_agent_memory_demo.py (conversation 329, preference history/as_of 389/449, entities 455, steps/outcome 484–563, similar traces 947–969, tool stats 997, combined context 1057/1099, user scoping 1121/1175, stand-in failing closed 243–314). The stand-in pins the SDK statement byte for byte (test_offline_client_pins_the_sdk_statement) and six mutated statement shapes plus an extra query parameter all raise NotImplementedError.
R2, live path through Client.list_traces. I re-ran the documented live command against the real table:
agent_memory_demo.py --project-id test-project-0728-467323 --dataset-id bqaa_agent_memory_demo \
--table-id analyst_events --memory-tables analyst_ --user-id maya.chen \
--session-id an-20261007t0834-d3-maya-2 --location US
Output is byte-identical to the committed recorded_run/demo_output_maya.chen.txt apart from the now/TraceFilter timestamp lines (diff rc 0). The README maps short-term, preferences, facts, entities, reasoning, similarity and combined context to the neo4j APIs and has an explicit "does not claim parity" list (graph queries, entity resolution, write APIs/outcomes, integrations). See P3-1 for two read APIs it skips.
R3, format and tests. Full suite in a fresh arm64 venv (.[dev,streamlit], Python 3.13.7): 5456 passed, 83 skipped in 169.81s, junit shows 172 agent-memory items, 0 failures. The four agent-memory test files pass under the network-denied sandbox (172 passed in 2.65s). Format: with the CI-pinned pyink>=24.3.0,<26 (25.12.0 installed into a --target) pyink --check on src/ tests/ examples/ scripts/ dashboards/ reports 379 files would be left unchanged; isort --check-only is clean; ruff check --select F,E9,B on the 8 modules and 4 test files passes; node --check viz/app.js passes. CI run 37606019859 on this exact head: all jobs success. (Note for others: pyink 26.x would reformat 35 pre-existing files in the tree, none of them in this PR.)
R4a, the numbers are real. Against test-project-0728-467323.bqaa_agent_memory_demo:
| Claim | Query result |
|---|---|
1,606 rows for 42 sessions; +32-row ctl2 session in the table |
1,638 rows, 43 sessions, 12 user ids (6 analysts + 6 +no-memory); 1,638 − 32 = 1,606 |
| all rows have OTel ids | 0 rows with NULL trace_id/span_id |
| 220 SQL (171 with memory), 37 recalls, 19 preference versions, 5 failed SQL | run_sql TOOL_STARTING 225 (= 220 + 5 in ctl2), 171 for thelook_analyst; recall_memory 37; user: keys in STATE_DELTA 19 (16 rows); 5 result.status="error", 0 TOOL_ERROR rows |
| 23 facts, 62 entity mentions, 40 embeddings; 3 facts dropped for empty object | analyst_memory_items: fact 23, entity 62; analyst_task_embeddings: 40 rows × 768 dims; extractions 26 facts, 3 with empty object |
memory sessions never named the memory dataset, INFORMATION_SCHEMA or a region view |
0 of 171 |
| controls: Lena 2, Raj 10, Tom 8 memory-dataset queries; Maya/Diego/Priya clean | 2 / 10 / 8; Maya 0, Diego 0, Priya 0 (Priya's one INFORMATION_SCHEMA query is TheLook's own TABLES) |
| agent tokens 2,123,529 in / 83,977 out / 101,938 thinking, 343 calls | plugin usage_metadata sums: 286 + 57 calls, 1,286,623 + 836,906 in, 71,811 + 12,166 out, 90,652 + 11,286 thinking |
| 369 BigQuery jobs, 4.5 GB in the run window | JOBS_BY_USER 08:34–09:35 UTC: 370 jobs, 4.47 GB billed, 223 labeled bqaa_demo |
README tool-stats SQL agrees with get_tool_stats() for 6 analysts × 4 tools |
ran the README query grouped by user_id: 24 rows, 0 mismatches vs memory_export.json |
recall_memory ≈ 4 s, run_sql ≈ 1.3 s |
export tool stats, call-weighted: 4.03 s and 1.34 s |
I re-ran the SQL Maya's with-memory session logged (span at 08:59:57 UTC) on TheLook today: sep_net_revenue 39355.24, sep_units 389, aug_net_revenue 32584.56, mom_pct_change 20.78. TheLook has exactly 26 product categories and the control's answer table has 26 category rows plus a total, so "all 26 categories" is right.
R4b, the recording. ffprobe: h264 1280×800 25 fps, 2517 frames, 100.68 s; aac mono 44.1 kHz, 100.66 s. silencedetect (−35 dB, 0.6 s) finds speech onsets at 1.07, 15.48, 20.22, 31.04, 41.40, 47.96, 54.90, 65.31, 73.46, 85.03, 93.95 s, each 5–26 ms after the matching SRT cue start. I extracted a frame every 3 s (34 frames) and looked at them: the captions are burned in at the bottom, their text equals the SRT cues, and each scene shows what the line says (Maya tab with 26-row control table vs 2-row memory answer; Diego tab; the "flawed control" tabs; week arcs from Maya's Day 3 session back to Day 1/2; Maya's graph with Dresses/Jeans/Swim/net revenue; Raj's struck-through 0.92 EUR per USD; Lena's Day 4 waterfall with recall + 4 run_sql; the recalled-memory block with reuse: SQL; Diego's page under TraceFilter(user_id='diego.alvarez')). Lena's Day 4 recall text in the export does cite her Thursday sessions (d1-lena-1, d1-lena-2) with reuse: run_sql(...) lines, as the narration says. test_the_committed_captions_are_the_narration_in_order and test_the_committed_export_matches_the_committed_run_record pass. The screenshot (1440×900) is the comparison panel on the same export; exported_at 09:55:54 UTC matches the page header. The export contains no project id (<project>).
Realism vs the Neo4j Labs demos. This is not a toy: a real ADK agent (google-adk 2.11, gemini-3.8-flash) with four real tools, real warehouse SQL over TheLook, six users, 36 memory sessions over five simulated days, extraction and embeddings in BigQuery, reasoning traces whose SQL is recalled and adapted in later sessions, and three clean before/after pairs where memory changes the answer. Compared with the Neo4j Labs examples (Lenny's podcast explorer, full-stack chat agent, the ADK demos), it has less corpus volume but a more complete agent loop and provenance on every item. Caveats are disclosed in the README: the days are simulated inside one hour, the questions are scripted, it is one run, and three of six controls are contaminated.
Findings
No P0/P1.
P2-1 Repository weight (maintainers' call). recorded_run/demo.mp4 4,448,106 B, viz/data/memory_export.json 987,286 B, viz/screenshot.png 238,098 B land in git history for an SDK repo. The PR already offers to drop the video; I'd host the mp4 as a release asset or a link and keep the export, or accept consciously.
P2-2 Evidence strength of "memory changes the answer". Only Maya, Diego and Priya are clean pairs; the --rerun-controls pass under the new scope check stopped after one session (an-20261007t0834-d3-maya-2-ctl2, in the table, not in the record). The README and video disclose this correctly, so this is not a blocker, but a finished re-run would make the headline table whole. I confirmed the new guard would hold: dry-run referenced_tables lists INFORMATION_SCHEMA views too (test-project….region-us.INFORMATION_SCHEMA.JOBS_BY_USER, ….bqaa_agent_memory_demo.INFORMATION_SCHEMA.TABLES, ….INFORMATION_SCHEMA.SCHEMATA), so run_sql now refuses the exact routes the first-pass controls used, while bigquery-public-data.thelook_ecommerce.INFORMATION_SCHEMA.COLUMNS stays allowed.
P3-1 README mapping omits two read APIs from #511. search_messages (short-term) and search_steps (reasoning) appear in the issue's table but not in examples/agent_memory/README.md (0 occurrences of either). One line each ("not provided; use TraceFilter/SQL over content") would complete the mapping the done-when asks for.
P3-2 Outcome status vs reported tool errors (memory_layers.py:657-668 vs :768-774). A TOOL_COMPLETED whose result is {"status": "error"} is an error ToolCall and counts in ToolStats and metrics["tool_errors"], but outcome_status only looks at is_error rows, so Priya's Day 1 and Day 3 traces (one failed run_sql each) are answered, success=True, and eligible for get_similar_traces(success_only=True). The README's wording ("no error rows") is technically consistent, and in this run there are no TOOL_ERROR rows at all, so answered_with_errors never occurs live. Worth one sentence in "How outcome_status is derived" so readers do not expect a reported error to change the status.
P3-3 Issue vs implementation. #511 says python examples/agent_memory/run_demo.py; the CLI is agent_memory_demo.py. #511 also lists "an ADK agent", "embedding or LLM calls", "new tables" and "running against live BigQuery" as out of scope, and the fourth commit does all four. "Closes #511" is fine, but a line in the issue or README saying the scope was widened would keep the record straight.
P3-4 Video polish. (a) At scene starts the voice begins 0.4 s after the scene while the click + scroll take 1–2 s, so e.g. "On Tuesday, Lena asked…" (73.5 s) plays over Raj's page for about a second. (b) In the reasoning scene (≈75–80 s) the hover tooltip on the recall_memory bar overlaps the legend and "Turn 1" text and is hard to read. (c) The cursor dot sits on top of the "Sessions" label in the opening frame. None affects the claims.
P3-5 Wording. "32 distinct entities" is the sum of per-analyst distinct entities (7+5+4+5+5+6); table-wide there are 31 distinct name/type pairs because net revenue (METRIC) belongs to both Maya and Raj. "32 entities across six analysts" would be exact.
P3-6 Hardening note for run_sql. The byte cap and table scope do not bound the cost of SELECT statements that call AI functions (AI.GENERATE over TheLook rows would pass the dry run). Not reachable in the scripted run; a maximum_bytes_billed-style guard does not exist for that, so just document it or deny AI./ML. functions in the tool.
Not verified by me
- Cloud Monitoring token totals for the whole day and the $2.72 / $2.76 figures (I verified the plugin-logged tokens and the BigQuery bytes only).
- Re-recording the video or re-running the agent (would cost money and change the dataset); I checked the committed artifacts against the data instead.
- The web view in browsers other than the frames rendered by headless Chromium.
- neo4j-agent-memory itself was not installed; the comparison is against its docs and the examples index of its repository.
VERDICT: APPROVE @ 1202616
…idation Fixes the two P2 findings of review 5441028847 on PR GoogleCloudPlatform#512. A tool result that reports {"status": "error"}, the way run_sql returns bad SQL, already made the tool call fail. The trace outcome and the export's timeline looked only at error rows, though. Now memory_layers.row_error() is the one failure rule: it sets each tool call's status, the trace's errors and outcome_status, and the status of each tool bar in the export. A turn that recovered from a failed query is now answered_with_errors, and list_traces(success_only=True) and get_similar_traces() leave it out. Consolidation counted a message as processed whenever its table held any row for it. So a failed AI.GENERATE row, or an AI.EMBED row with an empty vector, was never tried again, and the empty embedding was left out of recall for good. Now a message counts as processed only with a successful row: an extraction with an empty status, or an embedding with an empty status and a non-empty vector. - Embeddings keep AI.EMBED's status, in a new column that older tables gain with ALTER TABLE ... ADD COLUMN IF NOT EXISTS. - Items, recall and the pass totals read the first successful row of each message, so a retry never duplicates memory. - The totals count the messages still failing: failed and embeddings_failed. - Messages without text are not tried. Tests: - A tool-reported error checked in the trace outcome, in list_traces and get_similar_traces, and in the export timeline. - A failed pass, then a retry, then a no-op pass, on a fail-closed in-memory warehouse. It reads what counts as processed from the generated SQL. - The structure of the generated SQL. viz/data/memory_export.json is regenerated from the recorded run's rows. Priya's two turns with a failed query, and two memory-off runs, are now answered with errors. No scene of demo.mp4 shows those, so the video is unchanged; the recorded run's README says which export time the video shows. Refs GoogleCloudPlatform#511
caohy1988
left a comment
There was a problem hiding this comment.
VERDICT: REQUEST_CHANGES @ 8918af5
Blind attempted-disproof review of this exact checkout. Inputs were issue #511, the PR body and commit messages, code, artifacts, and independent warehouse reads. No vault, other review, or PR comment was opened. No code or warehouse schema was changed.
Rejection criteria, recorded before reading the diff:
- The credential-free CLI or real
Client.list_tracespath cannot produce the promised memory layers/context correctly, or violates provenance, user scoping, or fail-closed fixture behavior. - Missing cases break conversation reconstruction, preference history/as-of, entities, reasoning/outcomes, retrieval, statistics, or combined context; or the required tests/format checks fail.
- Required mappings/gaps are missing, or material README/demo claims exceed reproducible code, artifact, or live-data evidence. The requested realistic narrated demo is assessed in addition to the issue's narrower original scope.
Findings
P2 — The documented memory-enabled live reader fails on the recorded dataset at this head. examples/agent_memory/memory_consolidation.py:155 introduces the mandatory status reference, used by _SIMILAR_TASKS at lines 335–341. The existing analyst_task_embeddings table has 40 rows and ten columns, ending in embedded_at; it has no status. The migration at line 151 runs through ensure_tables() in the writer, but the read CLI calls similar_task_scores() directly (agent_memory_demo.py:425–428). Consequently the committed live CLI demonstration cannot be reproduced against its own recorded tables:
PYTHONPATH=src python examples/agent_memory/agent_memory_demo.py \
--project-id test-project-0728-467323 \
--dataset-id bqaa_agent_memory_demo --table-id analyst_events \
--memory-tables analyst_ --user-id maya.chen \
--session-id an-20261007t0834-d3-maya-2 --now 2026-10-07T12:00:00ZObserved: google.api_core.exceptions.BadRequest: 400 Unrecognized name: status at [10:18], job e7e33c5a-705a-4c33-ba2e-c5e269dc433b. The same command without --memory-tables succeeds. Support the prior embedding schema in read mode, or provide and verify an explicit migration prerequisite for existing/recorded datasets before advertising this command. A test should exercise a reader against the prior schema, not merely assert that the writer contains ALTER TABLE. Meets criteria 1 and 3.
P2 — Failed messages are never retried on the next simulated night. examples/agent_memory/analyst_agent.py:700–702 passes only today to consolidation; _NEW_MESSAGES restricts candidates to those session IDs (memory_consolidation.py:176). The new success predicates let a caller retry the same session list, but the actual week runner never supplies yesterday's failed sessions again. This contradicts README's “tried again the next night” claim and silently omits facts/entities/task embeddings after a transient model failure.
I exercised the real _run_days orchestration for two days, with its model turns stubbed and the PR's fail-closed test warehouse. Day one had sp-flaky fail both AI operations; the failure was removed before day two. Command:
/Users/haiyuancao/Documents/bqaa-512-r2/astra-r3-evidence/py313/bin/python \
/Users/haiyuancao/Documents/bqaa-512-r2/astra-r3-evidence/probe_retry.pyObserved:
night_session_ids= [['s-1'], ['s-2']]
day2_AI_calls= [('AI.GENERATE', 'sp-other'), ('AI.EMBED', 'sp-other')]
flaky_extractions= [('sp-flaky', 'RESOURCE_EXHAUSTED: quota exceeded')]
flaky_embeddings= [('sp-flaky', 'RESOURCE_EXHAUSTED: quota exceeded', [])]
day2_reported_failures= 0 0
flaky_memory_items= []
Carry unresolved earlier sessions into later passes, or consolidate the accumulated eligible sessions with the existing success-based deduplication. Cover consecutive different days in the regression test; the current retry test repeats ['s-1'] three times. Meets criteria 2 and 3.
P2 — Denied memory reads still invalidate a clean control. examples/agent_memory/export_memory.py:410–413 counts any run_sql whose SQL mentions the dataset, including calls with status == 'error'. build_comparisons() turns that into control_read_memory, and viz/app.js:476 labels the pair “flawed control.” This conflicts directly with the new SQL guard: a control can be correctly denied access and nevertheless be reported as having read memory.
Command: /Users/haiyuancao/Documents/bqaa-512-r2/astra-r3-evidence/py313/bin/python /Users/haiyuancao/Documents/bqaa-512-r2/astra-r3-evidence/probe_control.py. The probe changes the fixture control's tool calls into memory-table queries with the guard's {"status":"error", "message":"Only tables in ... can be read here"} result, then runs the real memory reconstruction and build_comparisons():
tool_statuses= ['error', 'error']
returned_memory_data= False
control_read_memory= True
Track attempted/denied reads separately; confirmed contamination should require a successful read. This does not exonerate the three original contaminated controls—their disclosed problem is real—but it makes the proposed guarded rerun's evaluation incorrect. Meets criteria 2 and 3.
P3 — Tooltip styling is outside its theme scope, obscuring the narrated reasoning scene. The tooltip is a sibling of .viz-root (examples/agent_memory/viz/index.html:382), while its colors are defined only under .viz-root (line 25). Its rules at lines 273–281 therefore resolve without --surface, --ink, or --hair. The 82-second video frame visibly draws the tool-result text over the reasoning labels without an opaque background. A fresh Chromium hover reproduces it:
TOOLTIP_CSS {'background': 'rgba(0, 0, 0, 0)', 'color': 'rgb(0, 0, 0)',
'surface': '', 'insideTheme': False}
DARK_TOOLTIP_CSS {'background': 'rgba(0, 0, 0, 0)', 'color': 'rgb(0, 0, 0)'}
Command: /Users/haiyuancao/Documents/bqaa-512-r2/astra-r3-evidence/py313/bin/python /Users/haiyuancao/Documents/bqaa-512-r2/astra-r3-evidence/probe_viz.py. Move the tooltip inside the theme scope or give it the same variables; verify both themes and refresh the affected footage. This is a concrete readability defect, not a request for a different visual style.
Contract and disproof attempts that passed
- Offline CLI runs and prints the three layers and combined context through the real SDK client. Its filename is
agent_memory_demo.py, rather than the issue's proposedrun_demo.py. The base live path also runs. Nosrc/files change. - All 176 agent-memory tests pass on Python 3.13.5 with released
google-adk==2.11.0. These cover response parsing/stream interruption, temporal preferences/deletion, provenance, error results, similarity, user collisions/scoping, unsupported-query rejection, export, and recording. The cross-day retry and denied-control cases above are additional failing probes outside that suite. bash autoformat.sh: 379 Python files unchanged;git status --shortempty.ruff check --select F,E9,B examples/agent_memory/*.py tests/examples/test_agent_memory*.pyandnode --check examples/agent_memory/viz/app.jspass.- Full suite:
python -m pytest tests/ -qcompleted with 5,578 passed, 65 skipped, 24 warnings in 301.04 s at this head. No test failures. - Ran the README tool-statistics SQL against the live table for all six analysts: 24 user/tool groups, zero mismatches in total/successful/failed counts and average latency against the verified export.
- Live
Warehouse.run_sqlprobes reject direct reads of the memory-items table andregion-us.INFORMATION_SCHEMA.JOBS_BY_USER. The scope guard worked on both actual BigQuery dry runs; the problem above is export classification after denial. - README maps the three layers, preference history, trace lifecycle/steps/outcomes, embedding retrieval, statistics, and combined context, and explains graph/entity-resolution/write-API/integration gaps and derived success. The original issue explicitly excluded a live agent, new tables, and model calls; these are clearly documented scope extensions in this PR and are not treated as defects merely for exceeding that scope.
Recorded data, narrated demo, and visualization assessment
This is a substantive small workload demo, not a canned trip-planner video. Independent queries of the record's exact session IDs returned 1,606 rows, 42 sessions, 46 invocations, 220 SQL calls, five tool-reported SQL errors, and zero missing logged OTel trace IDs. The table also has the disclosed extra 32-row control, bringing its unfiltered total to 1,638 rows/43 sessions. There are 62 extracted entity mentions and 23 facts. I reconstructed each of the six users' exports from live events/items: all six match the committed export exactly; all six reconstructed comparison pairs also match. Recorded final replies match the live final responses. These checks used reads, not regenerated agent conversations.
I reran the recorded SQL through the current Warehouse implementation. Maya's September results exactly match the logged result and screenshot: Dresses $22,212.13, Jeans $17,143.11, total $39,355.24 / 389 units / +20.78%. Lena's October result also exactly matches: Memphis 366 items / 32.22 hours, Chicago 406 items / 30.08 hours. Her actual recalled text includes the earlier Thursday analysis and its SQL. The 19 preference versions include Raj's exchange-rate replacement. Together with the clean Maya, Diego, and Priya pairs, this supports the claim that remembered scope/definitions visibly change answers. The three other controls cannot establish a memory effect and are appropriately disclosed as contaminated in the existing recording.
Media checks:
ffprobe -v error -show_entries format=duration,size:stream=codec_name,codec_type,width,height,duration,sample_rate,channels -of json examples/agent_memory/recorded_run/demo.mp4reports 100.680 seconds, H.264 1280×800, AAC mono 44.1 kHz, 4,448,106 bytes.- Extracted and visually inspected a frame every five seconds, plus full-resolution frames at 25, 68, and 82 seconds and
viz/screenshot.png. Burned-in captions are present, the analyst/scene selections agree with the narration, and the screenshot is the real Maya comparison. The older export timestamp in the footage is disclosed; its displayed figures match the current data. - Read all 16 SRT cues and
narration.md. Timing is sensible: approximately 12.5–16.6 characters/second, no overlapping cues, and short scene transitions.silencedetectputs speech onsets within approximately 4–26 ms of their captions; mean audio volume is −16.6 dB, peak −1.5 dB. - Independently regenerated all 16 caption lines with the declared Samantha voice/rate and matched their PCM waveforms against the video's audio. Correlations are 0.980–1.000, supporting that the actual narration says the script. This checks the audio content as well as the existence of an audio track.
- The side-by-side answers and struck-through preference history communicate memory well. The week links and reasoning waterfall expose sources and tool timing. The tooltip defect above impairs that last scene; the raw context text is also dense at video scale, although available in the export.
Compared with the Neo4j Labs ADK example, which demonstrates two sessions, this records substantially more multi-user activity. Compared with its full-stack chat example and Lenny's Memory Explorer, this is a narrower static replay: it lacks their interactive chat/graph expansion and richer entity exploration. Its six analysts, 36 memory sessions, five simulated business dates, real SQL tools, warehouse extraction, and cross-session SQL recall are credible demo scale. They do not establish production-scale memory performance or persistence across five actual wall-clock days. Those limitations are disclosed.
Limits and evidence
I did not rerun the paid agent week, deploy anything, mutate the recorded tables, verify the billing estimate against an invoice, or execute the Neo4j applications. The complete suite result is reported above separately from the focused tests. Initial test attempts encountered local editable-ADK/optional-dashboard dependency problems; the released-ADK environment and installed dashboard dependencies were used for the final checks, so those initial failures are not PR findings.
Reproduction scripts, test output, live-query evidence, audio comparisons, and extracted frames are saved under /Users/haiyuancao/Documents/bqaa-512-r2/astra-r3-evidence/. The rejection criteria are in rejection-criteria.txt; key receipts are live-check.txt, probe-live-sql.txt, live-cli-maya.txt, probe-retry.txt, probe-control.txt, probe-viz.txt, audio-match.txt, and the test logs. The findings meet the predeclared rejection criteria despite the authentic recorded workload and passing focused tests.
VERDICT: REQUEST_CHANGES @ 8918af5
…eads Fixes the three P2 findings and the P3 of review 5441966969 on PR GoogleCloudPlatform#512. - Reading memory no longer needs the embeddings' status column. The similar-task query reads the table's schema first (has_status_column). On a table written before that column, such as the recorded run's, a non-empty embedding counts as successful. Readers never alter a table; only the runner's ensure_tables adds the column. The documented live command runs against the recorded dataset again. - The week runner consolidates every memory session so far each night, not only the day's. Only messages without a successful row are sent to the models, so a message that failed one night is tried again the next, and nothing is extracted twice. The night's totals cover the run so far. - A query of the memory dataset counts as a memory read only if it returned rows. Queries that failed or that the guard refused are exported as memory_table_attempts and do not set control_read_memory. The web view notes them instead of flagging the pair. In the recorded run, Raj's and Tom's controls had one failed query each that was counted before. They keep 9 and 7 reads and stay flagged. - The tooltip now sits inside .viz-root, where the theme's colors are defined, so it is drawn on the surface color in light and dark mode. It stays outside #app, which the load-error notice replaces. Tests: - Similar-task reads on the old and the new schema, through the CLI and through recall. - The real week runner over two different days: night 1 fails, night 2 retries, with no duplicates. - Refused and successful memory queries in a control run. - Where the tooltip sits in the page. viz/data/memory_export.json is regenerated from the recorded rows. The video was not recorded again. It predates the tooltip fix, and no scene shows the changed export fields; the recorded run's README says so. Refs GoogleCloudPlatform#511
caohy1988
left a comment
There was a problem hiding this comment.
VERDICT: APPROVE @ 1e4e93a
Independent attempted-disproof review of the specified head. I read issue #511, the PR body, commits, code and artifacts, and queried the recorded BigQuery dataset. I did not fetch other PR reviews/comments or read the context vault. The worktree and remote PR head both remained at the reviewed SHA; no code was changed or pushed.
Rejection criteria, recorded before reading the diff
- Reject if the credential-free CLI or same-code live read path fails, or required conversation, preference/as-of, entity, reasoning/outcome, similarity, tool-stat or combined-context behavior is incorrect, loses provenance/user isolation, or the fixture stand-in accepts unsupported predicates.
- Reject if the concept/API mapping overclaims support or misses material gaps, or required hermetic tests, formatting or the full suite fail because of this change.
- Reject if the recorded evidence does not substantiate the advertised memory behavior: real ADK/tools, multiple users/sessions/days, extraction, cross-session recall, memory-dependent answers, and faithful video/screenshot/captions.
These criteria did not produce a blocking finding. The original issue's offline CLI is named agent_memory_demo.py here, rather than its proposed run_demo.py; the documented command works. The real agent, extraction tables and narrated recording extend the original issue's narrower scope, as requested for this review. The merge-base diff contains examples/tests and the examples index, with no src/ changes.
Findings
- P0/P1/P2: none established.
- P3, nonblocking — refresh the recorded tooltip scene. In
examples/agent_memory/recorded_run/demo.mp4, around 80–84 seconds, the tooltip text overlaps the waterfall because its background is transparent.recorded_run/README.md:109–112discloses this. I reproduced it withffmpeg -ss 81 -i examples/agent_memory/recorded_run/demo.mp4 -frames:v 1 /tmp/astra-512-tooltip.pngand inspected the extracted frames. The current page's tooltip has an opaque background in both themes, verified in Chromium. Re-recording would improve the delivered video; the disclosed defect does not invalidate the data or answer comparisons.
What I ran and tried to break
Local environment: Python 3.13.5, ADK 2.11.0, pyink 25.12.0, isort 9.0.2, an isolated environment with the repository's development and dashboard dependencies.
-
python -m pytest tests/ -q→ 5585 passed, 64 skipped, 21 warnings, exit 0. The initial attempt lacked dashboard dependencies; after installing them the full suite completed. The four agent-memory files separately produced 182 passed. -
PATH=<review-venv>/bin:$PATH bash autoformat.sh→ 379 files left unchanged;git status --shortempty.node --check examples/agent_memory/viz/app.jspassed. -
GOOGLE_APPLICATION_CREDENTIALS=/nonexistent python examples/agent_memory/agent_memory_demo.py→ exit 0, all three memory sections and combined context. -
Live CLI against the recorded tables, including the old embeddings schema:
python examples/agent_memory/agent_memory_demo.py \ --project-id test-project-0728-467323 \ --dataset-id bqaa_agent_memory_demo --table-id analyst_events \ --memory-tables analyst_ --user-id maya.chen \ --session-id an-20261007t0834-d3-maya-2 \ --now 2026-10-07T12:00:00Z
Exit 0; embedding-ranked matches 0.90, 0.83, 0.81. The existing embeddings table has 40 rows, 768-dimensional vectors and no
statuscolumn; the reader works without migrating it. -
Independent fixture probes: assigned the other user's rows the same session ID as Ana's current session; the load still returned 51 rows, all
u-ana. Deleted and recreated a preference and checked exactas_ofboundaries. Mutated the pinned SQL withOR TRUE, a commented-out user pin, a row-scope predicate and an appendedUNION; all four were refused withNotImplementedError. -
Real
Warehouse.run_sqlprobes: direct reads ofanalyst_events, reads ofregion-us.INFORMATION_SCHEMA.JOBS_BY_USER, andSELECT 1; SELECT 2;were refused. The latter returned “Only SELECT statements may run here, not SCRIPT.” -
Chromium: switched all six comparisons and all 36 memory sessions, exercised all three chart/table toggles, checked light/dark tooltip colors, injected an HTML event-handler payload into an answer, and requested a missing export. The payload remained literal text, the load-error notice worked, and there were no page errors.
The hermetic suite also exercises incomplete streams, ambiguous response delimiters, pending/error tool calls, preference history, similarity filtering, extraction retries across nights, older embeddings schemas, and failed/refused control queries. I inspected those paths rather than treating the aggregate test count as their specification.
The recorded evidence is real and internally consistent
Local credentials successfully queried test-project-0728-467323.bqaa_agent_memory_demo; the connector itself required authentication. I restricted event evidence to the record's 42 sessions, excluding the disclosed stopped -ctl2 rerun.
- 1606 rows, 36 memory sessions + 6 controls, 46 user turns, 220 SQL calls, 37 recalls, and no missing OTel trace/span IDs. Every recorded per-session row count matches BigQuery.
- 40 successful extraction rows, 40 embeddings, 23 facts + 62 entity mentions, and 19 preference versions. All 85 stored items resolve to their own user's source messages; extraction and embedding input texts equal the logged messages. The UI's 32 entities are counted within user memories.
- All 572 source citations found in recorded recall outputs resolve to already logged rows of the same user. All 37 exported recall blocks equal the live
recall_memorytool outputs byte for byte. All 12 comparison answers equal their terminal live model-response text. - Regenerated the export with
export_memory.py --memory-tables analyst_ --run-record ... --out <separate-file>: equal to the committed JSON exceptexported_at. - Re-executed the recorded final SQL for Maya's Monday and Lena's Tuesday sessions through the current warehouse tool. Results matched the recorded rows: Maya $39,355.24, 389 units, 20.78% month-on-month; Lena 32.22 / 30.08 hours for Memphis/Chicago. The query service returned cached results on these reruns.
- Executed the README's tool-stat aggregation, grouped by analyst: totals, successes, failures, mean duration and last use match all 24 user/tool pairs.
Useful BigQuery evidence jobs: raw events 06454228-f5d3-4b1a-a850-11743654f01c; aggregate counts a0f3f761-5cf8-427e-a989-0e8f162ab0cf; tool statistics 1300fb88-5aff-4684-a87c-bf63e74c7f02.
Narrated demo, screenshot and realism
ffprobe reports 100.680 s, H.264 1280×800, and an AAC 44.1 kHz mono audio stream lasting 100.659 s. I extracted frames every five seconds and at the midpoint of all 16 SRT cues, inspected every cue image and the screenshot, and checked the caption text against narration.md. Captions are visibly burned in, ordered without overlaps, and align with the relevant comparison, week, graph, preference, reasoning and recall scenes. A silence-detection probe placed speech onsets about 4–26 ms after cue starts; mean audio level was −16.6 dB. This verifies media/timing, not an independent speech transcription.
The screenshot's side-by-side answer comparison is clear and supported by actual logged answers and query results. The week arcs, preference replacement and waterfall communicate the memory mechanisms. Small provenance text and the raw recall block need full-size viewing; the reused SQL would be easier to follow if a future recording scrolled to the reuse: lines. The existing tooltip defect is the P3 above.
This is a substantive scripted demo: a real ADK agent, four functional tools, six analyst personas, 36 sessions across five simulated business days, real SQL over TheLook, warehouse extraction/embeddings and recalled executable SQL from earlier sessions. It visibly changes the scope of answers for Maya and Diego; Priya supplies a third clean comparison. Lena's recall really contains Thursday SQL, and her Tuesday tool calls adapt the analysis to October. The run is not evidence of five elapsed production days or of repeatable performance improvements.
The three contaminated controls remain excluded from my causal assessment: Lena/Raj/Tom made 2/9/7 successful memory-table queries, with one additional failed attempt each for Raj and Tom. Their labels and disclosures agree with the data. The final narration's user-filter language should be understood as the memory read path; the README correctly states that it is not an authorization boundary.
Compared with the Neo4j ADK demo, whose documented example uses two fresh sessions, this shows substantially more session/user activity. Compared with the full-stack news agent and Lenny's Memory, it has a narrower workload and simpler visualization: no equivalent interactive graph expansion, enrichment or large transcript corpus. Those are not claimed capabilities; the README explicitly distinguishes graph traversal, entity resolution, write APIs, declared outcomes and framework coverage. I reviewed those reference applications' documentation, not a running Neo4j deployment.
Limits and evidence
I did not run another complete paid agent week, induce live model/extraction failures, validate an invoice, or test other browsers. Cross-night failure/retry behavior is covered hermetically; the committed run contains no failed extraction/embedding. Approval applies to this head and the disclosed demo scope, not production authorization or benchmark claims.
Local probe scripts, SQL/job receipts, logs, regenerated export and extracted frames are under /Users/haiyuancao/Documents/bqaa-512-r2/astra-r4-evidence/. The pre-diff rejection criteria are saved there as rejection-criteria.md.
VERDICT: APPROVE @ 1e4e93a
…umns (#514) * chore(release): 0.6.0 — span OTel correlation, ViewManager denied_columns Bump [project].version from 0.5.4 to 0.6.0 and cut CHANGELOG.md for the 10 PRs merged since v0.5.4 (#502, #504–#510, #512, #513). [Unreleased] becomes [0.6.0] - 2026-10-08 with a release-highlights lead, and a new empty [Unreleased] sits above it. The #510 entries already under [Unreleased] are kept and checked against the code: denied_columns is keyword-only and exact-case, a bare string raises TypeError, the six per-event views it skips are named, the CLI exits 2 on an invalid name, and the event-specific view columns move two positions later. The SDK.md correlation guide moves to Documentation. Every other PR in the range gets an entry marked as in the wheel or repo side; the Removed entry lists the incidental module attributes #504 dropped. 0.6.0 rather than 0.5.5: besides new public API, per-event views now select two more columns ahead of the event-specific ones, and over an events table without an attributes column they deploy only with denied_columns=["attributes"]. No code, dependency or workflow change. * docs(changelog): scope the non-string ID guarantee to the attributes fallback The [0.6.0] Span entry said the three correlation IDs stay None on rows "with non-string values". Span.from_bigquery_row() applies that check only to values it reads from attributes: a truthy same-named column value is returned unchanged ({"otel_span_id": 123} gives 123), while a non-string value in attributes is ignored and gives None. Say that the attributes fallback ignores non-string values, and that the fields stay None on rows without those columns or keys. CHANGELOG wording only; the version stays 0.6.0.
Summary
Adds
examples/agent_memory/, a demo of the three agent memory layers that neo4j-agent-memory documents: short-term, long-term and reasoning traces. Here every layer is built from the rows the ADKBigQueryAgentAnalyticsPluginwrites. Conversations, preferences and reasoning are read back through existing SDK APIs, with oneClient.list_traces(TraceFilter(user_id=..., start_time=...))call per user. Facts, entities and task embeddings are extracted from those rows in BigQuery withAI.GENERATEandAI.EMBED. Nosrc/changes.The PR has six commits:
c1cc382): the four P2 findings of review 5438195112.1202616): an ADK data-analyst agent answers six analysts' questions overbigquery-public-data.thelook_ecommercefor five simulated business days. It adds nightly extraction and embeddings in BigQuery, before/after comparisons against the same agent without memory, and a narrated video; see End-to-end live run.8918af5): the two P2 findings of review 5441028847.1e4e93a): the three P2 findings and the P3 of review 5441966969.All three reviews' fixes are summarized under Review fixes.
Closes #511
USER_MESSAGE_RECEIVED, text parts ofLLM_RESPONSEshort_term.get_conversation,list_sessionsshort_term.get_conversation,list_sessionsSTATE_DELTArows for ADKuser:keyslong_term.get_preference_history,get_preferences(as_of=)add_preference,supersede_preference,get_preferences_for(as_of=)AI.GENERATE(typedoutput_schema) overUSER_MESSAGE_RECEIVEDrows, each item keyed to its span; alsoTOOL_STARTINGargs mapped to a typelong_term.get_facts,long_term.get_entitiesadd_fact,add_entity, extraction pipelineLLM_RESPONSE,TOOL_*,INVOCATION_COMPLETED; one trace per invocationreasoning.get_trace_with_steps,get_session_traces,list_traces(success_only=, since=, until=),get_similar_traces(scores=),get_tool_statsstart_trace/add_step/record_tool_call/complete_traceand the same-named readsAI.EMBEDper task,ML.DISTANCEat recallget_similar_traces(task, scores=...)get_context(query, session_id=, scores=, reuse_tools=): each line tagged[session/span]MemoryClient.get_contextEnd-to-end live run: TheLook analyst week
Video:
examples/agent_memory/recorded_run/demo.mp4. It runs 1 min 41 s (ffprobe: 100.68 s): 1280×800 H.264 with an AAC mono voiceover, 4.4 MB. The voiceover was generated locally with macOSsay(voice Samantha, no paid TTS) fromnarration.md. Its 16 captions are indemo.srtand burned in with ffmpeg.viz/record_demo.py --narrationdrives the web view in headless Chromium and holds each scene until its lines end.The video and screenshot predate the last two review rounds. They were recorded at
1202616, from the export made at 09:55 UTC.recorded_run/README.mdlists what changed.What ran
analyst_agent.py, on google-adk 2.11.0 withgemini-3.8-flash(Vertex AI, locationglobal). The plugin is configured withenable_otel_correlation=True, create_views=False.run_sql: real BigQuery SQL on TheLook. A dry run first allows onlySELECT, at most 2 GB, and only tables in TheLook's dataset; jobs are labeledbqaa_demo=agent_memory.describe_table.save_preference: ADKuser:state.recall_memory: reads this analyst's memory from BigQuery and returnsget_context().analyst_scenario.py. Six analysts (merchandising, FP&A, operations, growth, customer insights, category management) work five simulated business days, Thursday 2026-10-01 to Wednesday 2026-10-07. Each session carries its date in ADK session state, which the plugin logs on every row. The questions are scripted; the answers, the SQL and every row are real.memory_consolidation.pyruns after each day.AI.GENERATEextracts entities and facts from user messages, andAI.EMBEDembeds them, all in BigQuery.SELECTjobs that append to a destination table, because oneAI.GENERATEinside aMERGEstalled for over 10 minutes in a probe.bqaa_agent_memory_demo(US) in the team test project; tablesanalyst_events,analyst_memory_extractions,analyst_memory_itemsandanalyst_task_embeddings. The project ID appears only inrecorded_run/.20261007t0834, 2026-10-07 08:34:04 to 09:34:50 UTC.Volume: 36 sessions with memory and 6 without, 46 turns, and 1,606 rows (all with OTel trace and span ids). The agent ran 220 SQL queries: 171 in the sessions with memory, 2 of which failed with BigQuery errors and were fixed by the agent. Memory: 23 facts and 62 entity mentions (32 distinct entities) extracted, 19 preference versions saved, and 37
recall_memorycalls.Memory changes the answer
Six questions were also asked, on the same day, of the same agent without its memory tools.
Three of the six controls are not memory-free. The memory-off agents for Lena, Raj and Tom listed datasets and tables through
INFORMATION_SCHEMA, foundbqaa_agent_memory_demo, and read its tables withrun_sql. Raj's and Tom's also read the logged rows of the session with memory that had just answered, and repeated its numbers.control_read_memoryand the web view marks those tabs "flawed control". The video shows only the clean pairs (Maya and Diego).memory_table_attemptsand does not flag a pair. Raj's and Tom's each made one.run_sqlnow refuses any table outside TheLook's dataset, using the tables the dry run lists. The README turns this into guidance: memory is data, so scope the agent's tools.--rerun-controls) stopped after Maya's. That session,an-20261007t0834-d3-maya-2-ctl2(32 rows), is in the table but not in the run record, which keeps the first-pass controls.Total GCP spend
About $2.76 for the whole day on the project, and about $2.35 for the recorded run itself. These are list-price estimates; the project has no billing export, so they are not invoice figures. The budget was $50.
aiplatform.googleapis.com/publisher/online_serving/token_countfor the project on 2026-10-07 counts 2,423,338 input and 240,884 output tokens ofgemini-3.8-flash. Priced at $0.75 / $3.75 per 1M input / output tokens, with thinking billed as output. This covers the run, two smoke runs, the second commit's trip-planner recording, probes and the stopped re-run.INFORMATION_SCHEMA.JOBS_BY_USER).text-embedding-005read about 2,000 tokens, which is negligible.AI.GENERATE$0.03, and its 369 BigQuery jobs (4.5 GB) $0.03. Logged usage accounts for about 97% of the day's Gemini tokens; the rest is a smoke run whose scratch table was dropped, and probes.Review fixes
Review 5438195112 (third commit,
c1cc382)Four P2 findings:
LLM_RESPONSErows are grouped per span into one model call (model_calls()). A call is complete only with a terminal response row (google-adk 2.11 writescache_type/finish_reasonon it) or, for producers without those markers, a following non-error row. The fragments of a stream that never finished are joined and flagged incomplete, and never become the answer.response_parts()reads the part format structurally, uses the followingTOOL_STARTINGrows to choose between ambiguous readings, keeps truncated payloads, and bounds the search.NotImplementedError.get_context()line ends with[session/span]references.Its verification (on
c1cc382): full suite 5388 passed, 83 skipped; a mutation check of 23 mutants, each caught.Review 5441028847 (fifth commit,
8918af5){"status": "error"}(howrun_sqlreturns bad SQL) already failed the tool call. Nowmemory_layers.row_error()also drives the trace'serrorsandoutcome_status, and the export's tool bars.run_sqlbars.list_traces(success_only=True)andget_similar_traces()leave those turns out.AI.EMBED's status. Items, recall and the totals read the first success per message, so a retry never duplicates memory.Review 5441966969 (sixth commit,
1e4e93a)statuscolumn, a non-empty embedding counts as successful. Readers never alter a table; only the runner'sensure_tablesadds the column.control_read_memory. Failed or refused ones are exported asmemory_table_attempts, and the web view notes them instead of flagging the pair. In the recorded run, Raj's and Tom's controls each had one failed query that was counted before; they keep 9 and 7 reads and stay flagged..viz-root, where the theme's colors are defined. It stays outside#app, which the load-error notice replaces.VERIFIED (on
1e4e93a)pytest tests/; the warnings come from existing tests). The four agent-memory test files hold 141 test functions (test_agent_memory_analyst.py28,_demo.py68,_export.py28,_recording.py17), 182 collected items, all hermetic.status, through the CLI and through recall; plus reads on a table with it._run_daysrunner over two different days, with model turns stubbed: one message fails on night 1 and is retried on night 2, with no duplicate items or embeddings. On the old runner, night 2 sends only the new day's message..viz-rootand outside#app../autoformat.shrun twice leaves all 379 files unchanged.ruff check --select F,E9,Bpasses on the changed Python files, andnode --check viz/app.jspasses.agent_memory_demo.py --project-id test-project-0728-467323 --dataset-id bqaa_agent_memory_demo --table-id analyst_events --memory-tables analyst_ --user-id maya.chen --session-id an-20261007t0834-d3-maya-2 --now 2026-10-07T12:00:00Z.recorded_run/demo_output_maya.chen.txtexcept for the read time.analyst_task_embeddingsstill has its 10 columns and 40 rows, so the reader changed nothing.run_sqlbar:rgb(255, 255, 255)with textrgb(29, 39, 51), the theme's--surfaceand--ink.data-theme: backgroundrgb(26, 26, 25)with textrgb(242, 244, 246).memory_table_attemptsfield, and the export time changed. Nothing else.silencedetectstarts 4 to 17 ms after its SRT cue; mean volume is −16.6 dB.test_the_committed_export_matches_the_committed_run_record):test_agent_memory_recording.py). Each number in the narration was checked against the exported answers.analyst_eventsagrees withget_tool_stats()for all six analysts and their four tools: total, successful and failed calls, and average duration (24 rows).run_sqlqueries named the memory dataset, a region view orINFORMATION_SCHEMA.agent_memory_demo.py --memory-tables analyst_against the tables for Maya's Monday and Lena's Tuesday sessions; output inrecorded_run/demo_output_*.txt.INFORMATION_SCHEMA.JOBS_BY_USER, as listed above.pull_request, tested as a merge with main1fdc9d7). Every check passes: Format check, Build package, Test on Python 3.10, 3.11, 3.12, 3.13 and 3.14, Configurator browser smoke, cla/google and scan-pr; the zizmor jobs were skipped. Each test job reports 5647 passed and 81 skipped. The previous head8918af5, merged with the same main, reported 5641. The +6 difference equals the six new test items.NOT VERIFIED
CREATE PROPERTY GRAPHworks on this project, but GQL queries need an Enterprise or Enterprise Plus reservation, so multi-hop graph queries are not shown.ghcannot upload PR attachments; it is linked above.Risks
recorded_run/demo.mp4if maintainers prefer media outside the repo.analyst_agent.pyneeds Vertex AI andgoogle-adk[bigquery-analytics](not an SDK dependency). The recorded run cost about $2.35.APPROVAL NEEDED
Merge is the maintainers' call; this PR is not merged.