[PORT] Vended tool: http_request (TS→Py)
⚠️ Filed by Strandly as part of the #2498 parity audit. Source feature verified merged + unit-tested + integ-tested + documented in
strands-ts. Agent-produced — confirm before implementing. (Noportlabel yet — a maintainer should add it.)
Parent: #2498
Source SDK
strands-ts
Target SDK
strands-py
Related Files
strands-ts/src/vended-tools/http-request/http-request.ts
strands-ts/src/vended-tools/http-request/types.ts
strands-ts/src/vended-tools/http-request/index.ts
strands-ts/src/vended-tools/http-request/README.md
strands-ts/src/vended-tools/index.ts
strands-ts/src/vended-tools/http-request/__tests__/http-request.test.ts
strands-ts/test/integ/tools/http-request.test.ts
site/src/content/docs/user-guide/concepts/tools/vended-tools.mdx
site/src/content/docs/user-guide/concepts/tools/vended-tools.ts
site/src/content/docs/user-guide/concepts/tools/vended-tools-imports.ts
What needs to be migrated
The http_request vended tool (http-request.ts:39). Python vended_tools/ has only bash + file_editor.
Input schema (http-request.ts:7): method (required enum GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS), url (required, URL-validated), headers (optional Record<string,string>), body (optional string), timeout (optional positive number, seconds, default 30).
Behavior: builds abort signal from timeout*1000 combined with the agent cancel signal; fetch(url, {method, signal, headers?, body?}); reads body as text; flattens response headers; throws HTTP {status} {statusText}: {method} {url} on non-2xx; timeout/cancel error messages.
Output (types.ts:34): {status, statusText, headers, body}.
Python landing points
New package strands-py/src/strands/vended_tools/http_request/ (snake_case), mirroring bash/: __init__.py (exports http_request), http_request.py (@tool(name="http_request", ...) with type-hinted params — Literal[...] for method, int=30 for timeout), types.py (TypedDict output). Register in vended_tools/__init__.py (__all__). Update vended-tools.mdx support matrix (currently TS-only) + add a Python tab. Not sandbox-routed; no make_* factory needed.
Gotchas / open questions
- HTTP client: TS uses native
fetch; Python has no stdlib async client. Best fit ishttpx(async) — confirm adding it as a dependency (requestsis sync, would block the loop). Decorator supportsasync def. - Redirects:
fetchfollows redirects by default;httpxdoes not — setfollow_redirects=Truefor parity. response.ok: replicate as200<=status<300, raise otherwise (mirrorbash.pyRuntimeErroridiom).- Cancellation: TS combines timeout with
agent.cancelSignal; verify whetherstrands-pyexposes an agent cancel mechanism before promising parity — at minimum honortimeout.
Completeness of source (strands-ts)
- Merged: ✅ · Unit tests: ✅ (bodies, header flattening, 2xx/3xx/4xx/5xx, timeout/network errors) · Integ: ✅ (
test/integ/tools/http-request.test.ts, real endpoint). - Docs: ✅ in shared
vended-tools.mdx(marked TS-only — update on port) + README; no dedicated per-tool.mdx.
Confirmation
- [x] The change is complete in the source SDK (merged + unit + integ tested + documented); every related artifact is listed above.
@strandly-the-agent implement
Looks like this is being worked on here https://github.com/strands-agents/harness-sdk/pull/3395.
Duplicate of https://github.com/strands-agents/harness-sdk/issues/3238