Skip to content

Document cacheTtl option and async query caching in useAgent hook#27029

Closed
agents-git-bot[bot] wants to merge 1 commit into
productionfrom
sync-docs-pr-726
Closed

Document cacheTtl option and async query caching in useAgent hook#27029
agents-git-bot[bot] wants to merge 1 commit into
productionfrom
sync-docs-pr-726

Conversation

@agents-git-bot

@agents-git-bot agents-git-bot Bot commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

Summary

This PR documents the cacheTtl option and async query caching behavior in the useAgent React hook, which was previously undocumented in the Cloudflare Agents API reference.

Changes

  • Added query, queryDeps, and cacheTtl options to the UseAgentOptions type definition
  • Added detailed documentation section explaining async query caching behavior
  • Included code examples showing how to use cacheTtl for custom cache durations and how to disable caching

Documentation Details

The documentation now clarifies:

  • Default cache behavior (5 minute TTL for async query results)
  • How to customize cache duration with the cacheTtl option
  • How to disable caching by setting cacheTtl: 0
  • How to use queryDeps for cache invalidation when dependencies change

Related Changes

This documentation update corresponds to a bug fix in the cloudflare/agents repository:

  • PR: fix cache ttl agents#726
  • Issue: Fixed incorrect behavior when cacheTtl was set to 0 (previously cached for 5 minutes instead of disabling cache)

The bug fix ensures that setting cacheTtl: 0 properly disables caching, and this documentation clarifies this behavior for users.


🤖 Generated with Claude Code

This update adds documentation for the cacheTtl option in the useAgent hook,
which was previously undocumented. The documentation clarifies:

- Default cache behavior (5 minute TTL)
- How to customize cache duration with cacheTtl
- How to disable caching by setting cacheTtl to 0
- Cache invalidation with queryDeps

This corresponds to a bug fix in cloudflare/agents PR #726 that corrected
the behavior when cacheTtl is set to 0 (previously incorrectly cached for
5 minutes instead of disabling cache).

Related: cloudflare/agents#726

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@agents-git-bot
agents-git-bot Bot requested a review from a team December 9, 2025 23:52
@github-actions github-actions Bot added size/s product:agents Build and deploy AI-powered Agents on Cloudflare that can act autonomously. labels Dec 9, 2025
@github-actions

github-actions Bot commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
/src/content/docs/agents/ @irvinebroque, @rita3ko, @elithrar, @thomasgauvin, @threepointone, @whoiskatrin, @cloudflare/pcx-technical-writing, @cloudflare/ai-agents

@github-actions

Copy link
Copy Markdown
Contributor

@github-actions
github-actions Bot deleted the sync-docs-pr-726 branch March 19, 2026 17:57
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/s

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants