generateText loop. It gets its tools from your Invoke workspace over MCP, so every tool call goes through Invoke.
Before you start
In the console, open API and copy two things: the MCP endpoint and an Agent key. The key belongs to one agent, so every call your agent makes is recorded as that agent’s, and it can’t act as another.1
Install
2
Write the agent
Save this as Node 24 runs
agent.ts:agent.ts
agent.ts as is. On an older Node, run it with npx tsx agent.ts. Close the MCP client when you’re done, as the finally does.3
Run it
Give it a real tool
In the console, open Connectors and connect a tool: GitHub, Slack, Linear, Notion or any MCP server. Its tools appear to your agent on the next run, with names a model API accepts (a GitHub connector’screate_issue is listed as github_create_issue). Then ask for something that changes the world:
invoke_claim_task), a retried write for that task is answered with its first receipt instead of running twice.
What happened
- Your agent acted as itself. The key is its identity: Invoke records every call as that agent’s.
- Every call was checked before it ran: the agent’s permissions, your workspace’s policies and its budget.
invoke_rememberandinvoke_recallare Invoke’s own memory. Notes an agent keeps across runs. Claiming a task again brings back its history and notes, and the workspace’s other agents can read them.
Other models
For Claude,npm install @ai-sdk/anthropic, import anthropic from it, and pass anthropic(process.env.MODEL ?? "claude-opus-5-5") as the model.
Next steps
- CLI: connect tools, then read receipts and the event log
- Authentication: agent keys and account keys
- Traces: read a run back stage by stage