Before you begin
- Set up credentials finished, so you have a
GITHUB_PATsecret and agithubproxied service in/coding-agent. - The Infisical CLI installed.
- macOS, or Linux with bubblewrap installed.
- Optional: GitHub’s
ghCLI, used for the check at the end. Acurlfallback is provided, so this is not required.
- macOS
- Linux
Nothing to install. The sandbox is part of macOS.
1. Log in
run brokers as you, so this is the only credential involved.
2. Launch your agent
Everything after-- is your agent’s own command. Run it from the directory you want the agent to work in:
GITHUB_TOKEN, set to the fake ghp_… placeholder, and uses it like a normal token. Calls to api.github.com get the real token swapped in as they pass through; everything else goes out untouched. Meanwhile the agent is sandboxed: it cannot read your keyring, your ~/.aws or ~/.ssh, or your Infisical token.
In a directory with an
.infisical.json (from infisical init) you can drop --projectId. --env and --path fall back to environment variables too, so in a configured shell this is just agent-proxy run -- claude.On macOS the first run asks for your password once. It adds the proxy’s local CA to your login keychain, which is what lets tools like
gh accept its certificates.3. Verify it works
Each check below makes the sameGET /user call to api.github.com, and the client only ever sends the fake ghp_… placeholder. As the request passes through the proxy the placeholder is swapped for the real value of your GITHUB_PAT, so GitHub returns your account profile even though the real token never reached the client. That is the whole point: real authenticated work without the caller ever holding the credential.
- Ask your agent
- gh CLI
- curl
The agent you just launched is already brokering. In its session, send:
Run gh api user and show me the output.
GitHub’s gh CLI reads GITHUB_TOKEN from the environment on its own, so the agent needs no token wiring: it runs the command and GitHub answers with your profile. Requires gh on your machine.Getting a
401? The proxy could not apply the credential and forwarded the placeholder unchanged. Confirm you have Read Value on GITHUB_PAT, since run brokers as you, and that the host pattern matches api.github.com. Add --log-file=/tmp/broker.log and tail -f it to see the decision for each request.run takes.
For agents running on your infrastructure, follow the Standalone Proxy quickstart instead.