How to run Portal with a custom wrapper
Goal
Add a wrapper binary that forwards a host-capability request through Portal.
Prerequisites
- Running
agent-portal-host - Access to socket path (
AGENT_PORTAL_SOCKETor config default) - Wrapper implemented in Rust (
wrappers/convention)
Steps
- Define wrapper CLI shape that matches the tool you want to emulate.
- In wrapper, create a
PortalClientusing env/config resolution. - Translate wrapper input into a Portal method request.
- Forward host response bytes/stdout/stderr to wrapper stdout/stderr.
- Exit with mapped exit code from portal response.
- Place wrapper ahead of native utility on PATH in target environment.
Validation
- Wrapper command succeeds against live
agent-portal-host. - Expected output format matches calling tool expectations.
- Failure path returns useful stderr and non-zero code.