markdownIntegration 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:

  1. An agent needs to call a service (e.g., Slack, GitHub)

  2. If credentials exist, the agent runs latchkey curl and the request goes through

  3. If credentials are missing, the agent runs latchkey auth browser <service>, which opens a browser window for you to log in

  4. Once 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:

  1. When to use Latchkey (e.g., when making API calls to supported services)

  2. How to invoke latchkey curl with proper syntax

  3. When to prompt you for authentication if credentials are missing

  4. 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/latchkey

This 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:

  1. Generate the skill documentation: latchkey skill-md

  2. Add the contents to your agent's configuration directory or system prompt

  3. 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":

  1. Agent recognizes this requires the Slack API

  2. Agent runs: latchkey curl -X POST 'https://slack.com/api/conversations.create' -H 'Content-Type: application/json' -d '{"name":"project-updates"}'

  3. If credentials exist, Latchkey injects the auth header and makes the request

  4. 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.

  5. 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/latchkeyarrow-up-right

Last updated