Skip to content

[Agents] Fix Think samples and add a Think memory and context page - #35055

Open
mattzcarey wants to merge 3 commits into
productionfrom
docs/agents-think-fixes
Open

mattzcarey wants to merge 3 commits into
productionfrom
docs/agents-think-fixes

Conversation

@mattzcarey

@mattzcarey mattzcarey commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Updates the Think pages for @cloudflare/think 0.24.0 and @cloudflare/computer 0.10, fixes samples that no longer compile, and adds a Think Memory and context page that replaces the "Session integration" section.

The Think pages still used APIs that Think no longer exports or has deprecated:

  • defineScheduledTasks and defineMessengers are gone, so those samples return plain objects (ThinkScheduledTasks for scheduled tasks)
  • context blocks move from the deprecated configureSession().withContext() chain to configureContext(), and the context tools are set_context and search_context
  • useAgentChat imports from @cloudflare/think/react, so @cloudflare/ai-chat is no longer installed
  • onStepFinish becomes onStepEnd, and the comparison with AIChatAgent no longer says Think has an onChatMessage to override

Think 0.24 needs Computer 0.10, so the workspace examples use CodemodeBackend from @cloudflare/computer/backends/codemode and codemode: host modules (codemode:tools, codemode:git) instead of WorkerJavaScriptBackend and ws:, with a short upgrade note.

The new page covers context blocks, compaction, message storage, media eviction, and prompt caching (truncationStep). The Tools page gains "Connect a workspace" and a fetch tool section (fetchTools, createFetchTools()), and the browser section moves to browserTool from agents/browser/ai-sdk.

Code samples typecheck against @cloudflare/computer@0.10.0. Merge with or after the @cloudflare/think@0.24.0 release (cloudflare/agents#2808). Internal links and anchors resolve, and the pages compile as MDX. Replaces the Think parts of #34718 and #34723.

@mattzcarey
mattzcarey requested review from a team, irvinebroque and rita3ko as code owners November 9, 2026 19:13
@github-actions github-actions Bot added the product:agents Build and deploy AI-powered Agents on Cloudflare that can act autonomously. label Nov 9, 2026
@cloudflare-docs-bot

cloudflare-docs-bot Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

AI Review

✅ Reviewed cd4325a · 0 findings · incremental

Commands
  • /review Run a review now.
  • /full-review Review the entire PR diff.
  • /disable-auto-review Stop automatic reviews.
  • /rebase Rebase against production.

@cloudflare-docs-bot

cloudflare-docs-bot Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Review coverage

✅ The ownership area is covered.

✅ 1 area already covered
Area Approved by
agents
9 files changed
irvinebroque
CODEOWNERS mappings for displayed areas (1)
Pattern Owners
/src/content/docs/agents/ @irvinebroque, @rita3ko, @cloudflare/ai-agents, @cloudflare/dev-plat-leads, @cloudflare/product-owners

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Worker Preview URL: https://gh-docs-agents-think-fixes.previews.developers.cloudflare.com
Worker Preview Deployment URL: https://7b1ed035.previews.developers.cloudflare.com

Files with changes (up to 15)

Original Link Updated Link
https://developers.cloudflare.com/agents/harnesses/think/tools/ https://gh-docs-agents-think-fixes.previews.developers.cloudflare.com/agents/harnesses/think/tools/
https://developers.cloudflare.com/agents/harnesses/think/memory-and-context/ https://gh-docs-agents-think-fixes.previews.developers.cloudflare.com/agents/harnesses/think/memory-and-context/
https://developers.cloudflare.com/agents/harnesses/think/configuration/ https://gh-docs-agents-think-fixes.previews.developers.cloudflare.com/agents/harnesses/think/configuration/
https://developers.cloudflare.com/agents/harnesses/think/getting-started/ https://gh-docs-agents-think-fixes.previews.developers.cloudflare.com/agents/harnesses/think/getting-started/
https://developers.cloudflare.com/agents/harnesses/think/messengers/ https://gh-docs-agents-think-fixes.previews.developers.cloudflare.com/agents/harnesses/think/messengers/
https://developers.cloudflare.com/agents/harnesses/think/ https://gh-docs-agents-think-fixes.previews.developers.cloudflare.com/agents/harnesses/think/
https://developers.cloudflare.com/agents/harnesses/think/lifecycle-hooks/ https://gh-docs-agents-think-fixes.previews.developers.cloudflare.com/agents/harnesses/think/lifecycle-hooks/
https://developers.cloudflare.com/agents/harnesses/think/scheduled-tasks/ https://gh-docs-agents-think-fixes.previews.developers.cloudflare.com/agents/harnesses/think/scheduled-tasks/
https://developers.cloudflare.com/agents/harnesses/think/recovery/ https://gh-docs-agents-think-fixes.previews.developers.cloudflare.com/agents/harnesses/think/recovery/

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://docs-agents-think-fixes.previews.developers.cloudflare.com (commit cd4325a)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://4a14df15.previews.developers.cloudflare.com cd4325a 2026-11-11T11:15:59.330Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://e3b9a62b.previews.developers.cloudflare.com b881fe8 2026-11-10T12:04:29.427Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://25fa9f5a.previews.developers.cloudflare.com 85d541e 2026-11-09T19:28:04.316Z Visit the dashboard ↗

Think splits memory into two parts:

- **The conversation.** Think stores every message in the agent's SQLite database, as a tree, so regenerated answers are kept as branches. `configureSession()` sets how long conversations are compacted and searched.
- **The system prompt.** Think builds the system prompt from context blocks: labelled sections such as a fixed identity, or a `memory` block the model can write to. `configureContext()` declares them.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

and lets you build the system prompt / keeping track of new sections.


Set `truncationStep` to `Infinity` to turn read-time truncation off. Pair that with compaction, so the context stays bounded.

## Upgrade from Think 0.17

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

nah remove this section imo not needed.

@neelakolkar-cf

Copy link
Copy Markdown
Collaborator

@mattzcarey All approved and ready, please merge whenever all changes are done, thanks! 🙌

mattzcarey added a commit that referenced this pull request Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product:agents Build and deploy AI-powered Agents on Cloudflare that can act autonomously. size/l

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants