R4 is a password manager and secret store for agent runtimes.
If an agent is pointed at https://r4.dev and told to use R4 for password management, the supported path is:
{accessKey}.{secret} formatPOST /api/v1/auth/auth/register-agent (send X-Requested-With: R4Client on that public auth POST)The important split is:
The private key stays on the runtime host. R4 stores only the matching public key and rotation metadata.
If the bootstrap flow did not already include publicKey, register the runtime key through:
This allows R4 to wrap vault DEKs for that agent.
Once the first registration succeeds, operators can add the agent to security groups, projects, or direct vault permissions.
Re-registering the same public key later is safe and idempotent. Rotating to a different key still requires the current private key and, when the old key still has active vault access, a complete rewrappedVaultKeys batch so every active DEK is atomically re-wrapped to the new key.
The agent can then:
GET /api/v1/machine/vault/syncStart with the Retrieve Passwords guide if your goal is to look up credentials quickly.
AGENT-scoped runtimes are the supported runtime path for password retrieval and can now also perform checkpoint-signed vault metadata writes.
They can:
Those write paths still depend on the runtime's currently active registered encryption key. If the runtime rotates that key while vault-backed access exists, it must submit replacement wrapped DEKs for every active vault. See Current Limitations.
Some AGENT runtimes act as "master agents" for other agents.
When an AGENT runtime also has:
TENANT_AGENT_MANAGERmachine.agent.all and machine.permissions.allit can:
The simplest orchestration bootstrap is:
GET /api/v1/machine/agent and reuse the current domainTenantIdPOST /api/v1/machine/agent to create the subordinate runtimePATCH /api/v1/machine/agent/:id/tenant-roles to grant the needed direct rolesPOST /api/v1/machine/permissions/PROJECT/:id/set-permissions to share project accessThat delegated-orchestration power does not change the current trust rules. Even an agent-manager runtime still needs its active registered signer for checkpoint-backed vault writes, and the broader attachment/procurement/webhook surfaces still require their own endpoint permissions and, in some cases, additional tenant or org roles.
For the dedicated lifecycle and delegated-access guides, see Agent Orchestration and Permission Management.
If the CLI, Node SDK, MCP server, or current raw machine API is missing a capability the runtime needs, submit feedback through:
POST /api/v1/machine/feedbackThis endpoint is AGENT-only and is meant for product-gap feedback such as "I tried to do X, but R4 does not support it yet." Do not include secret values, plaintext credentials, tokens, or private user data.
npm install -g @r4-sdk/cli
openssl genrsa -out ./agent-private-key.pem 2048
r4 auth login \
--api-key "$R4_API_KEY" \
--private-key-path ./agent-private-key.pem
r4 auth whoami
r4 vault items
r4 vault search github
r4 vault get GITHUB_PRODUCTION_TOKENIf the runtime loses its active private key, it loses the normal self-service way to rotate to a new one because key rotation requires proof from the current private key. Treat that file as part of the runtime identity, not as an optional cache.
If r4 vault items or the raw machine API reports that no wrapped key exists for the vault, the most common cause is ordering: the runtime public key was registered after access had already been assigned. Ask the operator to confirm the key registration happened first, then re-share or re-assign the access path.
If your agent framework already speaks MCP, use the local stdio MCP server:
{
"mcpServers": {
"r4": {
"command": "npx",
"args": ["-y", "@r4-sdk/mcp"],
"env": {
"R4_API_KEY": "agent_access_key.secret",
"R4_PRIVATE_KEY_PATH": "/absolute/path/to/agent-private-key.pem"
}
}
}
}The MCP server is intentionally local. It keeps the private key on the runtime host, reuses the supported Node SDK path for decryption, and exposes read-oriented tools like vault listing, secret-key search, and exact secret retrieval.
import R4 from '@r4-sdk/sdk'
const r4 = await R4.create({
apiKey: process.env.R4_API_KEY!,
privateKeyPath: './agent-private-key.pem',
})
const password = r4.env.GITHUB_PRODUCTION_TOKEN