Skip to content

Use agentic contexts in the Bedrock agentic accelerator - #1898

Draft
jborlase-snowplow wants to merge 3 commits into
mainfrom
update/accelerator-agentic-context
Draft

Use agentic contexts in the Bedrock agentic accelerator#1898
jborlase-snowplow wants to merge 3 commits into
mainfrom
update/accelerator-agentic-context

Conversation

@jborlase-snowplow

Copy link
Copy Markdown
Contributor

What changed?

Retrofits tutorials/signals-agentic-accelerator/ (all six pages + the notebook, 31→36 cells): keeps get_signals for profile attributes and adds a get_session_activity tool calling get_agentic_context(format="narrative") for in-session activity, with the profile-vs-activity contrast in the intro (per product direction). Also fixes cleanup code in the shipped tutorial that never worked (a service must be deleted before its group can be unpublished).

Why?

Completes the agentic-contexts adoption across the customer-facing agent tutorials (with the Vercel and ADK retrofits).

Reviewer guidance

  • Verified in a fresh venv up to the Bedrock model invocation: both tools' Signals calls ran for real with exact-value assertions (page_view_count 10, 15 buffered events in order). The agent-response cells couldn't be re-captured (no AWS credentials; none substituted) — pre-existing response examples left untouched, no invented outputs.
  • The notebook is unpinned and resolves snowplow-signals 0.4.6, so no pin bump was needed.
  • Product findings from verification, for separate follow-ups: the event-log buffer collapses identical events sharing a derived_tstamp (the notebook spaces its tracker calls to avoid a degenerate narrative), started_at_ms isn't the earliest buffered event, and the narrative's summary line renders differently from the docs example.
  • Console screenshots for the new step were deliberately not added (notebook-driven tutorial; SDK-only step). An optional Console pass can add parity with the other retrofits if wanted.

🤖 Generated with Claude Code

The accelerator wrapped `get_service_attributes` in a bespoke `get_signals`
Strands tool, predating agentic contexts. Add the second data source as its
own tool and frame the two as complements throughout: profile attributes are
the computed aggregates the session adds up to, while the agentic context is
what the user has just been doing, event by event.

Notebook:
- new `get_session_activity` tool calling `get_agentic_context(format="narrative")`
- new cells defining and publishing an `EventLog` over `domain_sessionid`,
  capturing page_view, filter_tag_applied, and experience_filter
- new cell reading the narrative back, and a query that exercises event order
- system prompt and both agent constructions updated for five tools
- tracker cell now pauses a second between events, so the buffer records a
  sequence instead of one simultaneous burst
- cleanup cell fixed: an attribute group can't be unpublished while a service
  still references it, so the service must be deleted first

Pages: agentic-context definition step, real captured narrative and attribute
outputs replacing values that no longer matched a real run, and the
attributes-vs-activity framing in the introduction, agent, memory, and
conclusion steps. Terminology follows the Vercel AI SDK tutorial.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 30, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
documentation 0c199a0 Commit Preview URL

Branch Preview URL
Jul 31 2026, 03:50 PM

@claude

claude Bot commented Jul 30, 2026

Copy link
Copy Markdown

Docs style review

Scope: writing quality, style guide compliance, terminology, structure, frontmatter, and links in the diff. Technical correctness not assessed.

The prose is generally strong — the profile-attributes vs. session-activity contrast is explained clearly and consistently, the marketing word "seamlessly" was correctly dropped from add-memory.md, and lists, tables, and admonition titles mostly follow the guide. Ten items below, roughly most to least significant.

1. date frontmatter bumped on six pre-existing pages

All six pages change date: "2026-03-27"date: "2026-07-29".

date is documented as the creation date, not a last-updated date — CLAUDE.md ("date: "2025-09-09" # Creation date (YYYY-MM-DD)") and tutorial-requirements/README.md:113 ("date: "2025-09-09" # The date the file was created"). These pages were not created on 2026-07-29.

Fix: revert date to "2026-03-27" in all six files.

2. configure-signals.md now has seven H2 sections

H2s at lines 17, 28, 64, 81, 96, 106, 201 — the new "Define an agentic context" pushes the page from six to seven, at ~290 lines.

CLAUDE.md: "Limit pages to 3-5 H2 sections. Create a new page if content exceeds this."

Fix: split the agentic-context work into its own tutorial page (e.g. configure-agentic-context.md between configure-signals.md and add-memory.md), or move "Validate what Signals computes" onto its own page. The page was already over the limit, but this PR is the natural point to split it.

3. Bare :::tip with no title (configure-signals.md:289)

:::tip
Both tools use the same Signals credentials you configured earlier in the notebook.
:::

Style guide, Markdown formatting: "Always set custom headings using bracket syntax: :::note[Title]." The PR rewrites this admonition's body, so it's in scope.

Fix: :::tip[Signals credentials].

4. "explain how what they returned" (create-agent.md:61)

"tells the agent to draw on both Signals tools, then explain how what they returned influenced the recommendation"

Two stacked relative clauses make this hard to parse on first read. The same construction appears in the notebook's "Test personalized responses" markdown cell ("explain how what they returned shaped its recommendations").

Fix: "…then explain how the returned context influenced the recommendation."

5. "what the session adds up to" is colloquial, and repeated

configure-signals.md:15 ("Attributes tell your agent what the session adds up to"), conclusion.md:13 ("to understand what the user's session adds up to"), plus both new tool docstrings in the notebook ("what the user's behavior adds up to", "the profile attributes it adds up to").

CLAUDE.md: "Use professional, technical tone." The phrase is idiomatic rather than technical, and using it four times makes it read as a stock phrase.

Fix: vary and sharpen, e.g. "Attributes describe the session in aggregate, while the agentic context records what the user has just been doing, event by event." Applies to all four occurrences.

6. Marketing-flavored closing sentence (configure-signals.md:287)

"That sequence is what makes a recommendation feel like it follows the conversation the user is already having with your site."

Style guide: "Never use marketing language." The preceding two sentences already make the point factually.

Fix: cut it, or replace with something concrete: "The narrative lets the agent respond to the user's immediate journey rather than aggregate counts alone."

7. "Here's a real capture from the test events" (configure-signals.md:256)

Informal, and "real" implies the other example outputs on the page aren't. Two paragraphs earlier the page already uses the right pattern: "You should see a response similar to the following".

Fix: "Signals returns output similar to the following:".

8. "At the time of writing" (conclusion.md:49, and the notebook cleanup cell comment)

"At the time of writing, the Python SDK's unpublish() returns a 409 error for a published agentic context, so Console is the reliable route."

Style guide, Writing style: "Stay in the present tense. Never use 'currently', 'now', 'in the future', 'latest'." Time-relative hedging is the same pattern that rule rules out, and it dates the page.

Fix: "The Python SDK's unpublish() returns a 409 error for a published agentic context, so use Console." Same edit in the notebook comment.

9. Link text doesn't match target (conclusion.md:49)

"See deleting an agentic context."

Style guide, Links: "Describe links clearly. Use the target page name where possible." The target page is titled "Define agentic contexts in Signals"; the relevant content is a specific section on it.

Fix: /docs/signals/agentic-contexts/#deleting-an-agentic-context (that H2 exists on the page).

10. Split terminology: "profile attributes" vs "behavioral attributes"

The PR standardizes the body prose on "profile attributes", but leaves the older term in place nearby: configure-signals.md:6 keywords still list "behavioral attributes", and conclusion.md:55 still reads "Define additional [behavioral attributes]". Note also that neither term appears anywhere in /docs/signals/ — those pages just say "attributes".

Fix: pick one term, apply it to keywords and the Next steps bullet too, and ideally confirm "profile attributes" is the term the Signals docs want to standardize on. Also in configure-signals.md:6, keywords say "Profile API" — the API is the Profiles API everywhere else; worth fixing since that line is already being touched.

Links checked

All internal link targets in the diff exist: /docs/signals/agentic-contexts/, /docs/signals/applications/agentic-contexts/, /docs/signals/attributes/attribute-groups/, /docs/signals/applications/services/, /docs/signals/setup/, /docs/signals/introduction/, /docs/testing/snowplow-micro/, /tutorials/signals-ai-agent-context/introduction. The define/retrieve split between the two agentic-contexts pages is used correctly throughout.

Both external URLs added by this PR resolve (no 404s): https://snowplow.io/get-started/snowplow-free-trial and https://docs.snowplow.io/docs/signals/agentic-contexts/ (in the notebook).

No action needed on that second one: CLAUDE.md bans docs.snowplow.io links to internal pages, but the notebook is opened in Colab where relative paths can't resolve, and it already contains one such link.

sp_signals.delete([session_attributes_group])
```

:::note[Removing the agentic context]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

Remove the SDK unpublish workaround from the cleanup guidance and teach
the plain removal sequence instead, drop the event-spacing and buffer
observations from our own runs, and rephrase the sample narrative so it
no longer refers to a test capture.
@jborlase-snowplow

Copy link
Copy Markdown
Contributor Author

Pushed 27b71685 — editorial sweep per product direction: the cleanup guidance now teaches the plain working sequence (service first, then group) without SDK-behavior narration, and notebook comments are cleaned with all code unchanged.

🤖 Generated with Claude Code

Split the oversized Configure Signals page: "Validate what Signals computes"
moves to a new validate-signals.md at position 4, with downstream pages
renumbered. Merging the service and publish steps brings the remaining page
within the 3-5 H2 guidance.

Featured the AI-assisted route: the Console-alternative panel is replaced with
prose offering the Snowplow Assistant or an MCP-connected assistant, plus a
copy/paste prompt that creates and publishes the agentic context.

Trimmed to the owner's lens: dropped the Micro/"full pipeline" panel for a
minimal prerequisite, converted the schema, model-choice, creation-time and
demo-app panels to prose, removed the marketing close and the restatements of
the attributes-vs-narrative contrast, and reframed the demo-app configuration
check positively.

Standardized on "profile attributes" in the keywords and Next steps, corrected
"Profile API" to "Profiles API", and pointed the deletion link at its section
anchor. Notebook markdown cells and both Signals tool docstrings reworded off
"adds up to".

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jborlase-snowplow

Copy link
Copy Markdown
Contributor Author

Pushed 0c199a08 — owner-lens edit round: Micro panel out, the Assistant route replaces the Console-definition panel ahead of the notebook's EventLog cell, validation split onto its own page (positions renumbered), admonitions reduced to prose, restatement/marketing cuts, and "behavioral attributes" → "profile attributes" for internal consistency. Note for the docs team: "profile attributes" appears in these tutorials but not yet in /docs/signals/ — worth adding to the product pages.

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants