Secrets
Two tools, env_set and env_list, let the agent store API keys and tokens of outside services for the app’s backend; values are never returned to the agent.
The backend reads a secret through env:
app/payments/post.ts
import { env } from "manh/env";
// …
const res = await fetch("https://api.example.com/charge", {
headers: { Authorization: `Bearer ${env.PAYMENT_API_KEY}` },
});Don’t write keys into code: check refuses strings that look like real keys.
env_set
Sets or deletes a secret. Full tool set only.
- Parameters:
project.name:UPPER_SNAKE, for examplePAYMENT_API_KEY. Names reserved for the platform andJWT_SECRETare refused.value: up to 5 KB.nulldeletes the secret.
- Returns:
ok,name,action(setordeleted),livesaying whether the running app already has the new value, and a note. - When the agent calls it: when you give the agent a key for an outside service. The agent asks you for the value and never makes one up.
Current apps get a new secret at once. Older apps get it on the next deploy.
env_list
Lists the project’s secret names, without values.
- Parameters:
project. - Returns:
secrets: each with its name, length, last change,pending(not deployed yet) andneedsReset(must be set again);pendingRemovals: names deleted but not deployed yet. - When the agent calls it: before writing code that reads
env.NAME, to know whether the secret exists.
manh.run sets MANH_APP_URL and JWT_SECRET (created on the first deploy). You see and change values on the project’s Secrets page. The /directory URL has no env_set, so there secrets are set in the dashboard only.
Next steps
- Call outside APIs: using secrets when calling outside systems.
- Data and security: how secrets are kept.
- Agent tools: the two tool sets.
Last updated