Integration with AI Agents
Latchkey helps AI coding agents interact with third-party APIs.
Latchkey is designed primarily for AI agents. Agents use latchkey curl to make authenticated API calls, and latchkey auth browser to prompt you for credentials when needed. The typical flow:
An agent needs to call a service (e.g., Slack, GitHub)
If credentials exist, the agent runs
latchkey curland the request goes throughIf credentials are missing, the agent runs
latchkey auth browser <service>, which opens a browser window for you to log inOnce you authenticate, the agent retries and continues working
No custom code, service-specific connectors, or embedded tokens are required.
How agent integration works
Latchkey provides a skill file that teaches agents:
When to use Latchkey (e.g., when making API calls to supported services)
How to invoke
latchkey curlwith proper syntaxWhen to prompt you for authentication if credentials are missing
How to handle authentication errors
Once installed, agents make authenticated API calls by running latchkey curl instead of curl.
Using skills.sh
npx skills add imbue-ai/latchkeyThis will guide you through the process of adding the Latchkey skill to your agent(s).
To verify it worked, on the next launch, ask your agent to "list all Slack channels" or "create a Linear issue." If Latchkey is installed correctly, the agent will use latchkey curl to make the request.
Manually
If your agent supports custom skills, tools, or instructions, you can integrate Latchkey manually:
Generate the skill documentation:
latchkey skill-mdAdd the contents to your agent's configuration directory or system prompt
Ensure your agent can execute shell commands
The skill file will contain:
Command syntax for latchkey curl
When to use Latchkey vs plain curl
How to handle missing credentials
Example API calls
Taking OpenCode as an example:
Example agent workflow
Here's what happens when you ask an agent to create a Slack channel called "project-updates":
Agent recognizes this requires the Slack API
Agent runs:
latchkey curl -X POST 'https://slack.com/api/conversations.create' -H 'Content-Type: application/json' -d '{"name":"project-updates"}'If credentials exist, Latchkey injects the auth header and makes the request
If credentials are missing: Latchkey returns an error. The agent then runs
latchkey auth browser slack, which opens a browser window for you to log in.You authenticate in the browser. The agent detects that credentials are now available and retries the request successfully.
Security considerations
Keep in mind, when using latchkey auth browser, agents authenticate as you. They gain the same API access you have. They can:
Read private data
Create, modify, or delete resources
Perform any action your account allows
What this means:
Don't use Latchkey with untrusted agents
Review agent actions in service audit logs when possible
Use separate accounts or restricted API tokens for high-risk services
Consider using latchkey auth set with limited-scope tokens instead of browser auth
Access Latchkey here: https://github.com/imbue-ai/latchkey
Last updated