Share secrets with AI agents through scoped grants.

Suppose a worker builds a preview for every pull request. It needs two staging variables for a few minutes. With EnvsAI, the parent process can issue a separate credential for each run and revoke it afterward.

Choose what the worker can read

In your project, add DATABASE_URL and REDIS_URL to staging. Create an API key for the orchestrator with delegation enabled and restrict it to staging. Keep that parent credential in the orchestrator’s secret store.

In the Agents workspace, select the parent key, those two variable names and a lifetime from 1 to 60 minutes. Give the worker the issued credential through its secret store. Worker grants are read-only and cannot issue further grants.

Run a Python worker with the repository integration

From a repository root with Node.js 20 or later, download and inspect the installer. Here preview is the name of an existing EnvsAI project.

curl -fsSLo envs-init.mjs https://envs.ai/downloads/envs-init.mjs
node envs-init.mjs --project preview --environment staging

The installer uses names from environment templates such as .env.example. It writes the project connection and runtime tools under .envsai/. Supply the worker grant as ENVS_TOKEN through your local or CI secret store, then check access and launch the worker.

node .envsai/run.mjs --check
node .envsai/run.mjs -- python worker.py

The same wrapper can launch a Node.js service, a compiled executable, or a command in a Jenkins pipeline. Treat the child process as trusted. It receives the values and controls what it logs.

Ask an owner to approve a worker run

From the orchestrator, request the key names and lifetime the worker needs. Use the delegation-enabled parent key in ENVS_TOKEN. The command prints a request ID you can share with the project owner.

node .envsai/envs-access.mjs request preview-builder DATABASE_URL,REDIS_URL 15

The owner opens Agents, selects the project and opens Approvals to review the worker, environment and keys. If the project uses an approval authenticator, the owner enters the six-digit code there. Manual requests are available on Free. With Pro, use request preview-builder --template TEMPLATE_ID to request a saved scope.

Replace REQUEST_ID below with the returned ID. Check the decision, then run the worker once the status is approved. Use the same parent key, project and environment for both commands.

node .envsai/envs-access.mjs status REQUEST_ID
node .envsai/envs-access.mjs run-approved REQUEST_ID -- python worker.py

A request expires ten minutes after submission. Its grant lifetime starts when it is claimed. The local runner claims it once, reads the approved values in one request, passes them to the child process and revokes the grant when the child exits. A variable marked for one protected read needs another approval for a later read.

Each approval can be claimed once. For a remote worker, start the receiver after approval and use share-approved REQUEST_ID --to "$REQUEST" to return a sealed envelope. For a worker secret store, pipe the JSON output of claim REQUEST_ID directly into the store. It contains the worker credential.

Require an authenticator for one variable

In Agents, choose your project and open Approvals. Set up the project authenticator, scan the QR code with Google Authenticator or enter the setup key, then confirm a six-digit code. Save your one-time recovery codes offline.

Under Protected variables, select a key such as PRODUCTION_DB_PASSWORD and confirm with a fresh code. An ordinary API key or worker grant can still check its name. Fetching its value requires approval of the exact worker scope. One approved fetch can deliver the protected values included in that scope. The next fetch requires a new request and code. A request for only unprotected names can use a regular credential.

For a protected run, use run-approved directly after approval. Checking a manifest preserves the approved read. Running a command that fetches actual values uses it. A project owner can also reveal one protected value from the Variables page using a fresh code. Each authenticator code is accepted once, so wait for the next code if you just used one.

EnvsAI records delivery. A process can keep a value it already received. To invalidate that value outside EnvsAI, rotate the underlying credential at its provider.

Pass a grant to another agent

Use this when the worker runs on another machine. Both repositories need the same EnvsAI project and environment in their configuration. The orchestrator holds a delegation-enabled parent key. The receiver needs Node.js 20+ and its own running process.

  1. On the receiving worker, start node .envsai/envs-access.mjs receive -- python worker.py. It prints a public request beginning with envsreq1. and waits for up to five minutes. Its private key stays in that process.
  2. Send the request to the orchestrator through a channel that authenticates both agents. The orchestrator selects the worker label, keys and lifetime. In this example REQUEST holds the public request.
node .envsai/envs-access.mjs share preview-builder DATABASE_URL,REDIS_URL 15 --to "$REQUEST"

Return the resulting envsbox1. line to the waiting process on standard input. That receiver decrypts the grant and starts the worker with the selected variables. The remote grant expires after its lifetime and can be revoked early in Agents. An existing Pro template can replace the key list and minutes with --template TEMPLATE_ID.

For an existing installation, refresh the access CLI, runtime loader and MCP server under .envsai/. Keep your project configuration.

See which worker tried to access secrets

Open Agents and select a project you own. Its activity feed shows the most recent 100 attributable events, including grant issuance, revocation, and secret or manifest reads using worker grants and project API keys. Each entry includes the time, credential label, outcome and available environment. Filter for denied attempts to investigate an expired grant or a worker using the wrong environment.

The worker label comes from its issued grant. If two processes share that credential, they appear as the same worker. An unrecognized token cannot be tied to a project. The feed contains metadata and is available on Free and Pro.

Let a worker check its access before starting

Connect the generated .envsai/mcp.json to your MCP client and give that server the worker credential through its secret store. Ask whether the worker can access DATABASE_URL and REDIS_URL. The live check_worker_access tool returns which names the current credential can see, its expiry and shareable references. The runtime fetches values when the job runs.

Read the agent integration entry points

Reuse the scope for repeat jobs

With Pro, the project owner can save a named grant template for the staging environment, its allowed key names and its lifetime. Each run gets a fresh worker credential. Use the template ID from the Agents workspace with the orchestrator’s delegation-enabled parent key in ENVS_TOKEN.

node .envsai/envs-access.mjs run review-worker --template TEMPLATE_ID -- python worker.py

The helper runs the command with the scoped values and revokes the grant when it finishes. Revocation stops future reads. Values already delivered to a running process remain available to that process.

See what Pro includes →

Let a planning agent check key names

For a ChatGPT task such as checking whether staging has REDIS_URL, connect the read-only MCP integration. You choose which projects to share. It returns configured names and envs:// references, so a planning agent can identify missing configuration before you issue a worker grant.

Connect ChatGPT and watch the walkthrough →