Skip to content

Conversation

@agents-git-bot
Copy link
Contributor

@agents-git-bot agents-git-bot bot commented Dec 4, 2025

Summary

Documents that getCurrentAgent() properly propagates connection context through async operations, including tool execution functions. This sync reflects the bug fix from cloudflare/agents#712.

Changes

  • Updated /agents/concepts/agent-class.mdx: Enhanced Context Management section to clarify that getCurrentAgent() works inside nested async functions
  • Added practical example: Shows how to use getCurrentAgent() inside AI SDK tool execution to access the connection that triggered the chat

Related PR

Technical Context

The original PR fixed a bug where getCurrentAgent() was not returning the connection context inside tool execution functions called from onChatMessage. The fix wraps onChatMessage execution in agentContext.run() to properly propagate the connection context to nested async functions.

This documentation update ensures users understand that getCurrentAgent() reliably works in tool execution and other nested async contexts.

🤖 Generated with Claude Code

Updates documentation to clarify that getCurrentAgent() properly works
inside nested async functions like AI SDK tool execution. This reflects
the bug fix in cloudflare/agents#712 that ensures connection context
is properly propagated to tool execute functions called from onChatMessage.

Adds a practical example showing how to use getCurrentAgent() inside
tool execution to access the triggering connection.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <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 Dec 4, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2025

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
Contributor

github-actions bot commented Dec 4, 2025

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