feat(runtime): implement HTTP hostcall for agent API access#24
Merged
simonovic86 merged 1 commit intomainfrom Mar 13, 2026
Merged
feat(runtime): implement HTTP hostcall for agent API access#24simonovic86 merged 1 commit intomainfrom
simonovic86 merged 1 commit intomainfrom
Conversation
Add http_request hostcall to the capability membrane so agents can make HTTP requests to allowed external services. This is the single feature that makes agents actually useful (Product Phase 2, Task P2-1). Host-side (internal/hostcall/http.go): - ABI: http_request(method, url, headers, body, resp_buf) -> i32 - Security: allowed_hosts enforcement from manifest options - Timeout (10s default), max response size (1MB default) - Two-call pattern: returns -5 with size hint when buffer too small - Eventlog recording for deterministic replay (CM-4) SDK WASM wrapper (sdk/igor/hostcalls_http_wasm.go): - HTTPRequest, HTTPGet, HTTPPost convenience functions - Auto-retry with larger buffer on -5 (response too large) SDK native stubs (sdk/igor/hostcalls_http_stub.go): - Dispatches to MockBackend for native testing Mock support (sdk/igor/mock/mock.go): - HTTPHandler type + SetHTTPHandler for test configuration Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
http_requesthostcall to the capability membrane so WASM agents can make HTTP requests to external APIs (Product Phase 2, Task P2-1)HTTPRequest,HTTPGet,HTTPPostwrappers with auto-retry on buffer-too-small, plus native stubs and mock support for testingTest plan
go test ./internal/hostcall/...— extractAllowedHosts, checkAllowedHost, parseHeaders, extractIntOptiongo test ./sdk/igor/...— SDK compiles with updated MockBackend interfacego test ./...— all 25 packages passgo build ./cmd/igord/— product binary compilesmake check— fmt, vet, lint, tests all pass🤖 Generated with Claude Code