10 Commits

Author SHA1 Message Date
Ran Shem Tov 927ceb7817 fix(showcase): make the Strands stub modules importable as packages
The instrumentor test serves `strands.*` stubs through a meta-path finder,
but the import machinery reads the parent module's `__path__` BEFORE it
consults any finder, so every submodule import died with "'strands' is not
a package" and the finder never ran. It only ever passed because earlier
test modules left `agents.*` cached in `sys.modules`, which skipped the
`from strands... import` lines entirely.

Adding `build_reasoning_agent()` at agent_server import time broke that
accident: its `from strands.models.openai_responses import ...` sits inside
the function body, so module caching cannot hide it and the whole suite
went red.

Give the three package-like stubs (`strands`, `strands.models`,
`strands.types`) an empty `__path__` so the finder is reached, and drop the
stub entries from `sys.modules` afterwards so the real-package probe later
in the file does not inherit a `strands` whose empty `__path__` hides the
installed submodules.

Suite is now green both as a whole and file by file, which it was not
before on either this branch or main.
2026-09-04 23:37:03 +02:00
Ran Shem Tov 9a12dcc345 fix(showcase): close the second review round on the Strands interrupt demos
Cancel handling was asymmetric in both languages: the TypeScript-shaped
sentinel was only recognised on the outer envelope, so a cancel that arrived
wrapped as {"response": {"status": "cancelled"}} was reported to the model as
"did not pick a time". Both tools now check the sentinel at both levels, and
the test matrix covers the shape it missed (three cases fail without the fix).
The TypeScript tool also coalesced the label with ?? where Python uses or, so
an empty label swallowed a valid time; both now fall back the same way.

Frontend and probes:

- The headless resume waited on a single animation frame, which never fires in
  a background tab, stranding the run. A timer races it and the resume fires
  once, whichever lands first.
- The picker latches after the first answer, so a second click cannot race the
  resume already in flight.
- A rejected resume now replaces the green "Booked" badge with a failure state
  instead of leaving a success the user never got.
- The headless probe searched the whole page for booking words, which the
  demo's own static copy already satisfies; it now reads assistant bubbles only
  and matches phrases the page does not contain.
- The pick-path spec asserted a bubble was visible, which the pre-pause bubble
  already satisfies; it now asserts the post-resume narration. The headless
  spec scopes the picker to the app-surface pane, which is the contract it
  claims to hold.

Prose and fixtures:

- The dedicated-mount rationale named the wrong tool: the in-chat demo
  registers book_call, and the real collision is the shared agent's own
  immediate schedule_meeting. Corrected in the parity notes and both tools.
- The TypeScript integration no longer cites Python API names, and the picker
  no longer cites a slot generator that does not exist.
- The shared docs no longer describe a hook the embedded snippet does not
  show, no longer place a standard interrupt's payload on event.value, and
  carry the correct RUN_FINISHED outcome shape.
- The d4 fixture edits are back to UTF-8 literals, dropping 86 lines of
  re-encoding noise so only the six intended key changes remain.
- The agent package exposes a test script, so the new unit test is runnable.
2026-09-04 23:00:27 +02:00
Ran Shem Tov 922ce030dd fix(showcase): correct the Strands interrupt resume path and its coverage
Review pass over the native-interrupt work. The load-bearing fix is the
resume envelope: the TypeScript tool read only the shape the Python bridge
produces, so a valid time pick came back to the model as "user did not pick
a time" and the meeting was never scheduled. Reproduced at the wire on a
real model, fixed with a normaliser that accepts both the wrapped and the
raw payload, and covered by a unit test that fails when the read is reverted.
The Python tool had the mirror-image gap and is fixed and tested the same way.

Also in this pass:

- Both demo pages read the interrupt payload without throwing during render,
  and a rejected resume is surfaced instead of leaving a green "Booked" badge.
- The e2e specs asserted the pre-pause assistant bubble, so a broken resume
  passed; they now assert the last bubble, plus a cancel-path narration guard.
- Fixture legs that gated on turn number now gate on whether the tool has
  already answered, matching the reference integration, and two bare D4 keys
  that shadowed D6 prompts are narrowed.
- The reasoning parameter is Responses-API only and the reasoning model id no
  longer reaches the Anthropic or Bedrock branches.
- Stale prose corrected in the parity notes, the setup docs, the shared
  human-in-the-loop pages, both probe docblocks and the agent server docstring.
2026-09-04 22:22:09 +02:00
Benjamin Taylor 38bb3f27e5 fix(showcase): give the strands A2UI tool its own module
Same defect as the mastra cell, same page: the `backend-render-operations`
marker is hoisted to the top of `agents/agent.py`, so
`/aws-strands/generative-ui/a2ui/fixed-schema` published 586 lines of a
1688-line module — the messages-snapshot wrapper, the weather/dice/query
tools, everything — instead of the A2UI tool the step is about.

Move `generate_a2ui` and its `_A2uiError` shape into
`agents/a2ui_generate.py`, which is what `gen_ui_agent.py` /
`a2ui_dynamic.py` already do for their own surfaces ("this module lives in
its own file so the surface area is reviewable in isolation"). `agent.py`
imports the tool back for the shared agent's tool list, so the wiring and
the tool id are unchanged; the published snippet is now 171 lines with its
own imports. `tools/generate_a2ui.py` joins the cell's highlighted files so
the guide also shows the helper the tool calls.

The error-handling suite patched `agents.agent.build_a2ui_operations_from_tool_call`,
which now lives on the new module — retargeted, and it still imports the
tool via `agents.agent` so the re-export stays covered.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-21 08:42:12 -05:00
github-actions[bot] 691c036789 style: auto-fix formatting 2026-06-19 20:54:20 +00:00
Jordan Ritter 12dd238fbc feat(cvdiag): backend 11-boundary instrumentation for strands + ag2 (L1-C) 2026-06-18 14:30:07 -07:00
Jordan Ritter 2482317ccc style: apply ruff format to Python codebase
320 files reformatted. One-time alignment to match the ruff format
check added to CI in #4812.
2026-05-13 23:10:35 -07:00
Jordan Ritter 1a64cd7539 fix(showcase): add mount method to _FakeFastAPI in strands test stub
The strands agent_server.py now calls app.mount() to attach the voice
sub-app. The test's _FakeFastAPI stub needed the mount method added.
2026-05-01 01:04:18 -07:00
Jordan Ritter e9a2e143de fix(showcase): add shared-tools symlinks and refactor imports
Replace sys.path.insert hacks in Python agent files with direct
imports via symlinks to shared/{python,typescript}/tools.
Update Dockerfiles, entrypoints, and configs to support the new
symlink-based tool resolution. Add PARITY_NOTES for frameworks
that have known gaps.
2026-04-28 07:50:03 -07:00
Jordan Ritter dd06dd89d1 refactor(showcase): rename packages/ to integrations/
The showcase framework directories better reflect their role as
integration examples rather than distributable packages.
Renames showcase/packages/ -> showcase/integrations/ and updates
the test docker-compose file reference accordingly.
2026-04-28 07:47:35 -07:00