/AI agents that call APIs

Get started

AI agents that call APIs

Let an AI agent make a short-lived key for each task, use it, and end it, without ever seeing a real key.

An AI agent that refunds an order, opens a GitHub issue or sends an email needs an API key. With Vallkey it gets a task key instead: a ghost key for that one task, which works only for the minutes it asked for, can never do more than a key you chose, and stops on its own. The agent never sees your real key, and you see every task it ran.

1. Make an agent token

In Settings, API tokens, choose AI agent, pick the ghost keys it may start tasks from, and how long a task may run. A task key is never allowed more than the key it comes from, so tighten that key's rules first if the agent should do less than your app. Agent tokens come with Pro, Team and Business.

2. Connect the agent

Claude Code
claude mcp add vallkey --env VALLKEY_TOKEN=<agent token> -- npx -y vallkey mcp
Cursor, Windsurf and other MCP clients
1{2  "mcpServers": {3    "vallkey": { "command": "npx", "args": ["-y", "vallkey", "mcp"], "env": { "VALLKEY_TOKEN": "<agent token>" } }4  }5}

With an agent token, the MCP server offers task tools instead of the owner's:

ToolWhat it does
what_can_i_doThe keys the agent may start tasks from, their rules, and the limits.
start_taskA task key for one task: a key, a purpose and the minutes it needs, with tighter rules if it likes.
call_apiSends one request to the provider with the task key, and returns the answer. The key stays inside the MCP server.
task_activityEach request of the task, with the reason for each refused one.
list_tasks, end_taskIts tasks, and ending one: the key stops at once and is deleted.

Without MCP: the agent API

Any language
1# What may this agent do?2curl https://api.vallkey.com/_guard/v1/agent -H "Authorization: Bearer $VALLKEY_TOKEN"3 4# Start a task (key_id from the answer above)5curl https://api.vallkey.com/_guard/v1/agent/tasks -H "Authorization: Bearer $VALLKEY_TOKEN" \6  -d '{"key_id": "<key_id>", "purpose": "refund order 1042", "minutes": 15}'7 8# Use ghost_key from the answer like the real key, against api.vallkey.com, then:9curl -X POST https://api.vallkey.com/_guard/v1/agent/tasks/<key_id>/end -H "Authorization: Bearer $VALLKEY_TOKEN"

What keeps it safe

  • An agent token works only with the agent API: it cannot list your keys, change rules, see the team or reach anything else.
  • A task key can never do more than the key it comes from: other endpoints, higher amounts or a longer life are refused.
  • Every request of a task is checked against that key as it is now, and counted against its limits: tightening, killing or deleting it reaches running tasks at once, and new tasks never get a fresh daily budget.
  • A task's requests show in that key's Activity too, so the history stays after the task key is deleted.
  • Task keys stop at the end of their minutes, and are deleted soon after. Revoking the agent token stops every task it has running.
  • Every task is on the Keys page and in the audit log, with the agent's name and the purpose it gave. Stop any of them there.

Note

Agents start tasks often, so a task key does not send an alert each time. Alerts still go out when something is wrong, such as a key killed for a leak.

Still have a question?

We read every email, usually within a day.

Contact support