golem-make-http-request-rust

Implements outgoing HTTP requests from Rust Golem agents using WASI HTTP clients.

1.5k|212|Updated Nov 24, 2023
One-click install
npx skills add https://github.com/golemcloud/golem --skill golem-make-http-request-rust
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golem-make-http-request-rust
Source: https://github.com/golemcloud/golem/tree/main/golem-skills/skills/rust/golem-make-http-request-rust
Command: npx skills add https://github.com/golemcloud/golem --skill golem-make-http-request-rust

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Rust code compiled to WebAssembly for Golem cannot use standard HTTP client crates like reqwest or hyper because they depend on native networking stacks. This Skill shows how to make outgoing HTTP requests from Golem Rust agents using WASI HTTP-compatible clients.

Core Features & Use Cases

  • wstd::http client usage: Covers GET, POST, JSON bodies, headers, response parsing, timeouts, and error handling with the default wstd crate.
  • golem-wasi-http alternative: Documents a reqwest-style API with bearer auth, query params, multipart uploads, and streaming request bodies.
  • Durable retry semantics: Explains status-code-keyed retry policies and atomic operations so failed HTTP calls integrate correctly with Golem's durable execution.
  • Use Case: A Golem agent that fetches weather data from an external API, or calls another Golem agent endpoint using the correct JSON body mapping convention.

Quick Start

Ask the AI to write a Golem Rust agent endpoint that makes an outgoing HTTP GET request to an external API and parses the JSON response.

Frequently Asked Questions about golem-make-http-request-rust

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I make an HTTP request from a Golem Rust agent?

Use the wstd::http Client, which is included by default in Golem Rust templates. Build a request with Request::get or Request::post, attach a body (Body::empty() for GET), and send it with Client::new().send(request).await.

Can I use reqwest in a Golem WebAssembly component?

No, reqwest, ureq, hyper, and surf do not work in Golem because they depend on native networking like tokio and OpenSSL, which are unavailable in WebAssembly. Use wstd::http or golem-wasi-http, which target the WASI HTTP interface.

What is the difference between wstd::http and golem-wasi-http?

wstd::http is a lightweight async client included by default in Golem Rust templates. golem-wasi-http offers a reqwest-style builder API with bearer auth, query params, multipart uploads, charset decoding, and manual streaming control over the request lifecycle.

How do I retry failed HTTP requests in Golem?

Define a named retry policy keyed on status-code in golem.yaml, and the host transparently re-sends the request on matching 5xx responses. Alternatively, inspect the response status and return an Err, optionally wrapping the call in with_atomic_operation.

Why does my POST to a Golem agent endpoint fail with a raw string body?

Golem agent endpoints deserialize non-binary bodies from a JSON object whose fields match method parameter names. Send Content-Type: application/json with a body like {"body": "value"} instead of raw text.