For AI agents
For AI agents
An agent that calls an API directly has to hold the credential, which puts it in the model’s context window, its logs and its history. With apigent, the agent runs a saved request by name; apigent fills in the secrets at send time and masks them in everything it prints.
agentapigent run "get-user" --env staging{"ok":true,"status":200,"url":"https://api.example.com/users?api_key=*****","body":{"id":"u-123","auth":"Bearer *****"}, ...}Start here
- Agent mode — turn on JSON output, no prompts and strict masking with
--agent,APIGENT_AGENT=1or anagentapigentsymlink. Runapigent docsfirst. - JSON output — the
run --jsonobject, dry runs, errors, history, diff and exit codes. - MCP server: serve saved requests as tools to Claude, Cursor or any MCP client with
apigent mcp. - Memory safety — why credentials must stay out of context windows, and what apigent does about it.
Set up once, as a human
The agent should only ever see names. Store secrets yourself, once:
apigent collection create "payments-api" --var BASE_URL=https://api.example.com --secret API_KEY=sk-live-...
apigent save "list-payments" '{{BASE_URL}}/payments' --collection payments-api \
--auth bearer --auth-param token='{{API_KEY}}'
# The agent only needs:
agentapigent run "list-payments"For environments, read the secret from stdin so it never lands in shell history: apigent env set prod API_KEY=- --secret API_KEY.
What the agent sees, and what it doesn’t
| Direct curl | apigent in agent mode | |
|---|---|---|
| API key in the command | yes | no — only a request name and environment name |
| Credential headers in output | yes | ***** |
| Secrets echoed back in the response body | yes | ***** |
| Secrets in error messages | yes | ***** |
| Record of what happened | no | every run recorded with secrets masked; apigent diag <id> |