Skip to content

Host Functions

Host functions are the API surface exposed by PRX to WASM plugins. They provide controlled access to host capabilities like HTTP requests, file operations, and agent state.

Available Host Functions

HTTP

FunctionDescriptionPermission
http_request(method, url, headers, body)Make an HTTP requestnet.http
http_get(url)Shorthand for GET requestnet.http
http_post(url, body)Shorthand for POST requestnet.http

Filesystem

FunctionDescriptionPermission
fs_read(path)Read a filefs.read
fs_write(path, data)Write a filefs.write
fs_list(path)List directory contentsfs.read

Agent State

FunctionDescriptionPermission
memory_get(key)Read from agent memoryagent.memory.read
memory_set(key, value)Write to agent memoryagent.memory.write
config_get(key)Read plugin configurationagent.config

Logging

FunctionDescriptionPermission
log_info(msg)Log at info levelAlways allowed
log_warn(msg)Log at warn levelAlways allowed
log_error(msg)Log at error levelAlways allowed

Permission Manifest

Each plugin declares required permissions in its manifest:

toml
[permissions]
net.http = ["api.example.com"]
fs.read = ["/data/*"]
agent.memory.read = true

Released under the Apache-2.0 License.