How to Configure Vercel AI SDK SSH Approval

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up vercel ai sdk ssh approval by pausing tool calls before execution. A human reviewer must approve the shell command before the agent runs it. Teams often let AI agents run remote commands using static SSH keys. Broad server roles let a bad prompt alter files or leak secrets. Giving an agent direct root permissions creates a major risk for your servers. How a vercel ai sdk ssh approval workflow works The AI framework lets models ask for tool runs during a chat. You define a shell too

Approval Chains & Escalation + SSH Access Management: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

You set up vercel ai sdk ssh approval by pausing tool calls before execution. A human reviewer must approve the shell command before the agent runs it. Teams often let AI agents run remote commands using static SSH keys. Broad server roles let a bad prompt alter files or leak secrets. Giving an agent direct root permissions creates a major risk for your servers.

How a vercel ai sdk ssh approval workflow works

The AI framework lets models ask for tool runs during a chat. You define a shell tool that holds the target host and command text. When the model picks this tool, your app stops the run first. It sends the command details to a chat channel or ticket queue.

An operator reads the proposed command and clicks approve or deny. If the operator approves, the app opens an SSH session to the server. Most teams use OpenSSH certificates instead of raw static keys for this step. OpenSSH added certificate support for users and hosts in version 5.4.

A Certification Authority key signs a public key to make a user certificate. The certificate holds the public key, identity info, principal names, and options. This format is much simpler than the X.509 format used in TLS. You also set a time window when you sign the user certificate. By default, OpenSSH certificates last forever unless you set a time limit. Once signed, the agent uses this short certificate to log in and run.

Why native tool checks leave server gaps

Checking a tool call inside your app UI stops obvious bad runs. It lets a human block a bad command before the model sends it. Still, app-level checks only guard the front door of the agent flow. The app server still holds a private key or a signing key.

If someone steals that key, they bypass your app approval logic right away. OpenSSH certificates decide who can log in to a Linux host. They do not inspect each shell command while a session is active. You can bake a single forced command into an OpenSSH certificate option. That rigid setup breaks when an AI agent needs to run varied tasks.

Approval Chains & Escalation + SSH Access Management: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Also, standard SSH logs only show who logged in and when. They do not link each shell command back to the specific AI prompt. Server outputs can also return sensitive data like emails or card numbers. Native SSH returns raw text straight back to the AI model context. Masking rewrites matched fields in results so raw emails stay out of prompts. Teams need a way to pause commands at the network edge and mask outputs.

Best practices for agent SSH reviews

Split your agent tools into read actions and write actions right away. Let the agent check disk space or read logs with low-privilege keys. Require a human check whenever the model wants to restart a service. Keep your OpenSSH certificate validity windows down to a few minutes. Short lifetimes limit the blast radius if a worker node gets compromised.

Map each agent task to a distinct Linux user principal on the host. Never let an AI worker log in as the root user account. Send all approval requests to a dedicated channel where engineers watch active changes. Show the exact host name and command string in every review prompt. Clear context helps reviewers spot risky flags before they click approve.

Inspect one-shot SSH commands and file tasks

SSH certificates and host rules decide who is allowed on a machine. Setup alone does not check single commands or block sftp reads on sensitive paths. By design, hoop.dev runs an open-source SSH listener on the host where people and agents keep their normal ssh, sftp, and scp tools.

First, hoop.dev guardrails check one-shot commands and file paths before they run. Next, hoop.dev data masking masks matched values in file downloads. The audit trail logs the certificate principal, requested action, and verdict without storing session content. Interactive shells carry no guardrails and can be turned off when every action must be checked. Explore the code on GitHub.

Frequently asked questions

Can OpenSSH certificates limit an AI agent to one command?

Yes, you can add a command option when signing a user certificate. This forces the SSH server to run only that exact command on login. Still, this is hard to scale when agents run new diagnostic commands.

What happens if an OpenSSH certificate has no expiration time?

If you do not set a validity window, the certificate stays valid forever. You should always set a short end time when signing agent keys. This stops old worker nodes from logging into servers after a task ends.

Why is app-level tool approval not enough for server security?

App-level checks only work inside the code of your AI web app. The app still needs network access and valid SSH keys to run commands. Enforcing approvals at the SSH layer protects hosts even if app code fails.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.