Supported languages: TypeScript.
- Streaming responses with real-time tool execution
- React hooks for building AI UIs
- Multi-step tool calls with automatic handling
- Framework compatibility with Next.js, React, Vue, and more
Calling actions
1
Install
2
Fetch Tools
Two approaches to retrieving tools:
- Fetch Tools (with filtering) — fetch all tools upfront with optional filters applied.
- Search & Execute — hand the model just
tool_search+tool_executeand let the agent discover what it needs at runtime.
See Tool Discovery for more details on which may be best in your scenario.
- Fetch tools
- Search & execute
By default this fetches every tool enabled for the account. Narrow it by passing
providers (specific connectors) or actions — exact names or glob patterns (e.g. workday_*, or *_list_* for read-only tools).3
Run the agent loop
- Fetch tools
- Search & execute
Hand the tools to
generateText — the SDK handles multi-step tool calls automatically:Streaming responses
Build real-time AI applications with streaming:Multi-tenant support
Handle multiple customer accounts:Best practices
Account ID from context
Error handling
Example
File downloads (binary responses)
File downloads (binary responses)
Actions that download a file (for example The narrowed
googledrive_unified_download_file, documents_download_file, or any *_unified_download_file) return raw bytes plus metadata, not parsed JSON. The SDK decides from the response Content-Type: JSON is parsed as usual, and anything else is treated as a file download.Because execute() is typed to return a JSON object, use the exported isBinaryDownloadResult guard to narrow the result to the file shape.result describes the file:Troubleshooting
Execute a tool
Direct execution is useful for testing and debugging. In production, your agent framework handles tool calls automatically.Next steps
Observability
Diagnose failing calls and monitor what your agent runs.
Tool Defense
Protect your agent from malicious content in tool results.