How to Configure OpenAI Agents SDK SSH Approval
To set up openai agents sdk ssh approval, wrap your shell tool in a review step. You also need to sign short-lived OpenSSH certificates for each task. Many teams start by giving an AI agent a static SSH key on a host. That broad role lets the agent run any command on the box without a check. If a prompt goes wrong, the agent can delete files or read secrets right away. How openai agents sdk ssh approval works in native setups In the OpenAI Agents SDK, an agent calls Python functions as tools.
SSH Agent Forwarding Security + Approval Chains & Escalation: the complete guide
Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.
To set up openai agents sdk ssh approval, wrap your shell tool in a review step. You also need to sign short-lived OpenSSH certificates for each task. Many teams start by giving an AI agent a static SSH key on a host. That broad role lets the agent run any command on the box without a check. If a prompt goes wrong, the agent can delete files or read secrets right away.
How openai agents sdk ssh approval works in native setups
In the OpenAI Agents SDK, an agent calls Python functions as tools. When an agent needs to check a server, it calls a custom SSH tool. To add an approval step, developers pause the function before the SSH call runs. The app sends a message to a human in chat or a web app. The human reads the planned shell command and clicks approve or deny.
On the server side, teams pair this check with OpenSSH user certificates. OpenSSH added certificate support for users and hosts in version 5.4. An admin key signs a public key to make a user certificate. That certificate holds a public key, identity info, principal names, and a set of options. It uses a much simpler format than X.509 certificates.
When a human approves the agent request, a script signs the agent key. The signing tool sets a key identity and lists allowed user or host names. The admin can also set a short time window so the certificate expires soon. Once signed, the agent logs in to the remote host and runs its script.
What native SSH setup solves and what it misses
Combining an app check with OpenSSH certificates solves static key sprawl. You do not have to leave permanent keys in agent memory or on disk. The certificate tells the server which user principal the agent can use. It also stops the agent from logging in before a human says yes.
Still, this setup leaves a big gap during the session. OpenSSH certificates decide who can log in to the host. They do not inspect every shell command the agent sends over an open channel. If the agent opens an interactive shell, it can run ten commands after one check.
SSH Agent Forwarding Security + Approval Chains & Escalation: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Even if the app checks the first command, the agent might chain extra commands. Standard host logs only show that the principal logged in with a certificate. They do not tie each command back to the exact AI prompt or human reviewer. Also, terminal output can contain user emails, phone numbers, or card numbers. Native SSH returns that raw text right into the agent context window.
Why host-level command rules fall short for AI agents
Some teams try to lock down the agent by setting forced commands in OpenSSH. A forced command runs one preset script no matter what the client asks to run. This works well for fixed backups or simple file transfers.
Still, AI agents exist to investigate new alerts and fix varied issues. If you lock a key to one script, the agent cannot adapt to a problem. If you allow a general shell, the forced command rule does nothing to help. Teams end up building custom wrapper scripts for every single command flag. Maintaining those scripts across dozens of servers takes too much engineering time. You need a way to approve individual commands and rewrite sensitive fields in results.
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 an OpenAI agent use a shared SSH key for server tasks?
It can, but shared keys create a major security risk. Every agent run uses the same identity, so logs cannot show which prompt ran what. Using per-task certificates or command approvals gives you clear audit trails.
Do OpenSSH certificates stop an agent from running bad commands?
No, a standard user certificate only controls login identity and options. Once the SSH session starts, the Unix user permissions on the host take over. You need command-level controls to stop harmful shell statements in flight.
How do you keep sensitive server output out of the agent prompt?
Native SSH sends all command output straight back to the caller. To protect data, you must filter the stream before the agent reads it. Data masking rewrites matched fields like emails, phone numbers, and national IDs in results.
Related guides
In this post