Skip to content

Rename Counter class and update type references#28179

Merged
elithrar merged 2 commits intoproductionfrom
sync-docs-pr-867
Feb 8, 2026
Merged

Rename Counter class and update type references#28179
elithrar merged 2 commits intoproductionfrom
sync-docs-pr-867

Conversation

@agents-git-bot
Copy link
Copy Markdown
Contributor

@agents-git-bot agents-git-bot Bot commented Feb 8, 2026

Summary

Syncs documentation changes from cloudflare/agents PR #867: cloudflare/agents#867

This PR updates the Agents SDK documentation to reflect the renamed Counter class and improved TypeScript type exports:

  • Renamed Counter class to CounterAgent for better clarity
  • Exported CounterState type to allow reuse in client code
  • Updated useAgent hook examples to properly type both agent class and state parameters
  • Updated all code examples, configuration files, and references throughout the documentation

Changes

  • /agents/getting-started/quick-start.mdx - Updated main tutorial with new class name and type patterns
  • /agents/getting-started/add-to-existing-project.mdx - Updated integration guide examples
  • /agents/api-reference/callable-methods.mdx - Updated API reference examples

Benefits

This change improves the documentation by:

  1. Providing better type safety in client code through exported types
  2. Making class names more descriptive (CounterAgent vs Counter)
  3. Demonstrating best practices for TypeScript usage with the Agents SDK

🤖 Generated with Claude Code

Syncs changes from cloudflare/agents PR #867:
- Rename Counter class to CounterAgent
- Export CounterState type for reuse in client code
- Update useAgent type parameters to include both agent and state
- Update all code examples and configuration to use new names

This improves type safety and consistency in the agents SDK examples.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@github-actions github-actions Bot added product:agents Build and deploy AI-powered Agents on Cloudflare that can act autonomously. size/s labels Feb 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 8, 2026

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, @cloudflare/dev-plat-leads

@elithrar
Copy link
Copy Markdown
Collaborator

elithrar commented Feb 8, 2026

/bonk thou shalt review and give me a haiku about these docs

Co-authored-by: elithrar <elithrar@users.noreply.github.com>
@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk Bot commented Feb 8, 2026


Here's my review:

Review

Overall: Looks good. The rename from Counter to CounterAgent and the export of CounterState are clean, consistent, and improve both clarity and type safety. One issue found and fixed.

Issue found (fixed)

  • src/content/docs/agents/getting-started/add-to-existing-project.mdx:97 -- The "Key points" section still referenced env.Counter after all bindings were renamed to CounterAgent. Fixed to env.CounterAgent.

What's good

  • Consistent rename across all three files -- class names, bindings, migrations, exports, and client references all updated together.
  • Exported CounterState type -- eliminates the pattern of re-declaring the state type in client code, which was error-prone. The quick-start previously had CounterState defined separately in both server and client; now it's imported from one source.
  • useAgent generic parameters -- adding <CounterAgent, CounterState> to useAgent calls demonstrates proper TypeScript usage and gives readers typed agent.stub access.
  • No orphaned references to the old Counter name remain (after the fix above).

Counter renamed anew,
types exported, shared with care --
one env slipped through.

github run

@elithrar elithrar enabled auto-merge (squash) February 8, 2026 17:25
@elithrar elithrar merged commit 2e0dc1f into production Feb 8, 2026
9 checks passed
@elithrar elithrar deleted the sync-docs-pr-867 branch February 8, 2026 17:40
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