Skip to content

feat(examples): modernize all 26 existing examples to current framework majors and the 0.6.0-dev API - #252

Merged
johnymontana merged 7 commits into
mainfrom
update-existing-examples
Sep 11, 2026
Merged

johnymontana merged 7 commits into
mainfrom
update-existing-examples

Conversation

@johnymontana

Copy link
Copy Markdown
Collaborator

Summary

One PR for every existing example (21 Python, 5 TypeScript), their smoke tests, and the docs pages that pair with them. This is Phase 2 of the examples review (examples-review-and-improvement-plan.md). The seven new examples, the examples index, the CI/Makefile gates, and the nav entries follow in two separate PRs.

492 files, +107,270 / −38,867. Most of the volume is regenerated lockfiles in the app backends and frontends and the domain-schemas consolidation; the per-example logic changes are listed below.

Dependencies

Framework Was Now
PydanticAI (full-stack-chat-agent, lennys-memory, pydantic_ai_agent.py) >=0.0.39 >=2.0,<3 via the library adapter
Google ADK + google-genai (google_adk_demo, google_cloud_integration, FSA google-cloud) >=0.3.0 >=2.0,<3 / >=1.66
Microsoft Agent Framework (retail assistant) Feb-2026 preview agent-framework-core>=1.13,<2
Strands (FSA aws, strands-session-manager, strands-memory-store) >=0.1.0 >=1.52,<2
LangChain (langchain_agent.py, nams-langchain) >=0.2.0 >=1.0,<2 with the new create_agent middleware adapter
FastMCP (google_cloud_integration mcp demo) 2.x 4.x
Vercel AI SDK (ts vercel-ai) ai ^4 ai ^7 + @ai-sdk/openai ^4, V4 middleware
@strands-agents/sdk / @modelcontextprotocol/sdk ^1.2 / ^1.0 ^1.16 / ^1.30
ts langchain / ts mastra shape-only, no framework dep runnable on @langchain/core ^1.2 and @mastra/core ^1.66
Next.js / React (chat agent, lennys, microsoft frontends) 14 / 18 16.3 / 19.2
Vite / react-router / framer-motion (FSA frontends) 5 / 6 / 11–12
neo4j-agent-memory in every manifest >=0.1.0 or git+main >=0.5.0,<0.7 with the editable path source; duplicate requirements.txt removed

Memory usage

  • Examples use the library's framework adapters instead of hand-rolled gey write (search_entities, get_context, get_similar_traces) so each demo proves its claim.
  • Reasoning traces carry triggered_by_message_id, touched_entities, t.query.cypherreplaces ~80client.client.execute*` reach-throughs.
  • Features advertised in READMEs are now actually exercised: MemoryIntegration in the chat backend, DeduplicationConfig in the retail assistant, long-term memory in
    the FSA aws backend, a measured speedup in buffered-writes, all three evble preference case.
  • The NAMS trio showcases workspace addressing, bulk_add_messages, wait_for_extraction / get_extraction_status, observations and reflections, and expand_graph.

Safety fixes

  • existing-graph seed and the FSA loader no longer MATCH (n) DETACH Ddatabase they are pointed at (explicit --reset`, scoped to seededlabels).
  • Microsoft retail backend validates relationship types instead of inter into Cypher.
  • Full-stack chat backend's read-only Cypher guard is fixed.

Structure and hygiene

  • domain-schemas: eight near-identical scripts become one parametrizedsamples; the old filenames remain as thin wrappers for one release.
  • Shared examples/_env.py (loads examples/.env.example) replaces copy-pasted env loading; retired model ids (gpt-4o, claude-3-*, text-embedding-004) replaced by
    env-driven ids with current defaults; Neo4j images standardized on `neo4C.
  • Tracked artifacts removed (tsconfig.tsbuildinfo); Lenny's data/README.md documents transcript acquisition and a synthetic sample.
  • Scope decisions left to the maintainer were implemented conservativelyes/components are kept and marked, the two FSA apps stay separate,adk_memory_service.py is reduced to a pointer rather than deleted.

Tests

  • Every example has an executing smoke test; new modules for nams-quickams-langchain (respx-mocked NAMS) and lennys-memory (loader dry-run on the synthetic sample).
  • test_no_phantom_methods.py resolves calls against both the bolt and rejects private client._client reach-through and adapter phantoms inexamples/.
  • Every README has the Labs badges, disclaimer, expected output, and a "library 0.6.0-dev, framework versions, 2026-09-10).

Verification

Applied on top of main in a clean worktree: make check clean; tests/unit 1,794 passed; tests/examples against Neo4j 5.26 693 passed, 31 skipped, 1 expected xfail
(pin sweep, cleared by this PR's manifests once the wiring PR removes thuick selection 681 passed. All nine TypeScript examplestypecheck/test/build and all five frontends build (verified on the full tree in the final round; this PR's copies are identical).

Fires

ci-python.yml on examples/**, tests/**, docs/**; ci-typescript.es/**. The frontend build job and the ruff/mypy coverage ofexamples/ arrive in the wiring PR; one file (aws-financial-services-advisor/backend/handler.py:6) has an import-sort finding under that future gate.

… majors and the 0.6.0-dev API

One commit for all 26 existing examples (21 Python, 5 TypeScript), their
smoke tests, and the docs pages that pair with them. New examples land
separately.

Dependencies: pydantic-ai 2.x (full-stack-chat-agent, lennys-memory,
pydantic_ai_agent.py), google-adk 2.x + google-genai (google_adk_demo,
google_cloud_integration, FSA google-cloud), agent-framework-core 1.13+
(microsoft retail assistant), strands-agents 1.52+ (FSA aws, strands
examples), langchain 1.x (langchain_agent.py, nams-langchain), fastmcp 4
(mcp_server_demo), ai 7 / @ai-sdk/openai 4 (ts vercel-ai), @strands-agents/sdk
1.16, @modelcontextprotocol/sdk 1.30, @langchain/core 1.2 and @mastra/core 1.66
(ts langchain and mastra are now runnable, not shape-only). Frontends on
Next 16 / React 19 (three apps) and Vite 8 / react-router 7 / motion 13 (two
apps); NVL 1.2, Chakra 3.37. Library pinned >=0.5.0,<0.7 everywhere with the
editable path source; duplicate requirements.txt files removed.

Memory usage: examples use the library adapters instead of hand-rolled glue,
read back what they write (search_entities, get_context, get_similar_traces),
record reasoning traces with triggered_by_message_id, touched_entities and
TraceOutcome, use client.query.cypher instead of client._client.execute_*,
and exercise the features their READMEs advertise (MemoryIntegration,
DeduplicationConfig, extraction, buffered-write measurement, all three eval
dimensions). The NAMS trio showcases workspace addressing, bulk_add_messages,
wait_for_extraction/get_extraction_status, observations/reflections and
expand_graph.

Safety: seed scripts no longer DETACH DELETE the whole database (existing-graph,
FSA loader); the Microsoft backend validates relationship types instead of
interpolating them into Cypher; the chat backend's read-only guard is fixed.

Structure: domain-schemas collapses eight near-identical scripts into one
parametrized runner with thin wrappers; shared examples/_env.py and
examples/.env.example replace copy-pasted env loading; retired model ids
(gpt-4o, claude-3-*, text-embedding-004) replaced by env-driven ids with
current defaults; Neo4j images standardized on 5.26-community with APOC.

Tests: every example has an executing smoke test (new modules for
nams-quickstart, nams-fastapi, nams-langchain, lennys-memory); NAMS paths run
against respx-mocked transports; the phantom-method guard now resolves against
both bolt and NAMS classes and additionally rejects private client
reach-through and adapter phantoms. READMEs carry Labs badges, disclaimer,
expected output, and a "verified against" footer (0.6.0-dev, 2026-09-10).
Comment thread typescript/examples/mastra/src/index.ts Fixed
Comment thread typescript/examples/strands/src/index.ts Fixed
Comment thread typescript/examples/vercel-ai/src/index.ts Fixed
johnymontana and others added 6 commits September 11, 2026 14:21
…f sensitive information'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…f sensitive information'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…f sensitive information'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…alues in logs

- microsoft retail frontend: generate the shopping session id with
  crypto.randomUUID() instead of Math.random() (js/insecure-randomness).
- ts mastra / strands / vercel-ai: stop echoing DEMO_USER_ID and the
  Mastra resourceId in log output (js/clear-text-logging); the re-run
  hint names the variable without its value. Strands test updated to
  assert the id is not printed.
…ce id

On the bridge transport the adapter synthesizes thread ids from the
resource id, which the example reads from DEMO_USER_ID, so CodeQL
(js/clear-text-logging) traced the environment value into the log.
@johnymontana
johnymontana merged commit cd9aa1b into main Sep 11, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants