Skip to content

Conversation

@agents-git-bot
Copy link
Contributor

@agents-git-bot agents-git-bot bot commented Nov 28, 2025

Summary

Syncs documentation for agents PR #688: add attachments

Source PR: cloudflare/agents#688

Changes

This PR documents the new file attachment capabilities for AI chat agents.

New Features Documented

  • File attachments in AI chat: Added complete documentation for sending images and files to vision-capable AI models
  • filesToParts() function: Documents the utility function that converts JavaScript File objects to AI SDK format
  • Client-side example: Shows how to build a React chat interface with file upload using useAgentChat
  • Server-side handling: Explains how AIChatAgent automatically processes file attachments
  • Storage optimization: Documents how files are automatically stripped from SQLite storage to prevent size limit issues

Documentation Updates

Updated /agents/api-reference/using-ai-models.mdx:

  • Added new "File attachments in AI chat" section under the AI SDK documentation
  • Included React client example showing file upload with filesToParts()
  • Included server-side example using AIChatAgent with vision-capable models
  • Explained automatic file stripping mechanism for storage optimization

What changed in the source PR

PR #688 added file attachment support to the Agents SDK:

  • New filesToParts() utility in agents/ai-react package
  • Enhanced sendMessage() method to accept optional files parameter
  • Renamed and enhanced resumable-stream-chat example to ai-chat with full file upload UI
  • Automatic file content stripping before SQLite storage to avoid size limits

This enables developers to build chat agents that can receive and process images and documents from users, particularly useful for vision-capable models like GPT-4o.

🤖 Generated with Claude Code

Documents the new file attachment capabilities added in PR #688:
- Added filesToParts() helper function documentation
- Added sendMessage() method to useAgentChat return type
- Added comprehensive example showing how to send messages with file attachments

This enables users to build chat interfaces with image and file upload support.

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

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions bot added size/m product:agents Build and deploy AI-powered Agents on Cloudflare that can act autonomously. labels Nov 28, 2025
@github-actions
Copy link
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, @cloudflare/pcx-technical-writing

Documents the new file attachment feature added in cloudflare/agents#688.
This includes:
- The filesToParts() function for converting File objects to AI SDK format
- Example of using file attachments in React clients with useAgentChat
- Server-side handling with AIChatAgent and vision-capable models
- Storage optimization details (files are stripped to avoid SQLite limits)

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

Co-Authored-By: Claude <noreply@anthropic.com>
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/m

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants