You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(readme): document file-download return shape from tool execution
Add a "File Downloads" section covering the bytes-plus-metadata dict that
execute()/call() return for non-JSON responses, the Content-Type detection
rule, and the not-JSON-serializable caveat for LLM-facing re-serialization.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Glob pattern: `["*_list_employees"]` matches all tools ending with `_list_employees`
115
115
- Provider prefix: `["workday_*"]` matches all Workday tools
116
116
117
+
## File Downloads
118
+
119
+
Actions that return a file — e.g. `googledrive_unified_download_file`, `documents_download_file`, any `*_unified_download_file` — resolve to **raw bytes plus metadata**, not parsed JSON. The SDK decides this from the response `Content-Type`: a JSON content type is parsed as before; anything else is treated as a file download. This applies to both `tool.execute()` and `tool.call()`.
|`content`|`bytes`| Raw file bytes. **Not JSON-serializable** — see the caveat below. |
137
+
|`content_type`|`str`| The file's MIME type (e.g. `application/pdf`), or `application/octet-stream` if unspecified. |
138
+
|`status_code`|`int`| HTTP status of the download response. |
139
+
|`headers`|`dict`| Response headers. |
140
+
|`file_name`|`str \| None`| Filename from the `Content-Disposition` header (handles RFC 5987 `filename*`), else `None`. |
141
+
142
+
> **Caveat:**`content` holds raw bytes, which are not JSON-serializable. If you forward tool results to an LLM — or anywhere that re-serializes them to JSON — handle or strip the `content` key (for example, base64-encode it on the LLM-facing path).
143
+
144
+
JSON responses are unchanged: any action returning `application/json` (or a `…+json` type) is parsed and returned as a dict exactly as before.
145
+
117
146
## Implicit Feedback (Beta)
118
147
119
148
The Python SDK can emit implicit behavioral feedback to LangSmith so you can triage low-quality tool results without manually tagging runs.
0 commit comments