Framework guide
Handle 2FA and OTP codes in OpenAI Agents SDK automatically
Attach OTPilot as a streamable-HTTP MCP server to any agent built with the OpenAI Agents SDK. OTPilot keeps the TOTP seed encrypted on its side; your OpenAI Agents SDK agent only ever receives the current code, its expiry and the next code.
OpenAI Agents SDK · python
# pip install openai-agents
import os
from agents import Agent, Runner
from agents.mcp import MCPServerStreamableHttp
async with MCPServerStreamableHttp(
name="otpilot",
params={
"url": "https://otpilot.vibiz.app/mcp",
"headers": {"Authorization": f"Bearer {os.environ['OTPILOT_KEY']}"},
},
) as otpilot:
agent = Agent(
name="Ops agent",
instructions="When a Shopify login asks for a 2FA code, call get_code(account='shopify').",
mcp_servers=[otpilot],
)
await Runner.run(agent, "Log into Shopify and download last month's invoices")Why not put the seed in your OpenAI Agents SDK code?
- · A seed in an env var or prompt can generate codes forever — anyone who reads your logs, traces or repo can log in.
- · With OTPilot the agent holds a revocable, rate-limited key scoped to specific accounts. Revoke it and access ends instantly.
- · Each fetch is logged with the reason the agent gave, and sensitive accounts can require a human tap.
OpenAI Agents SDK 2FA guides by site
- Amazon 2FA with OpenAI Agents SDK→
- Amazon Web Services 2FA with OpenAI Agents SDK→
- Cloudflare 2FA with OpenAI Agents SDK→
- DigitalOcean 2FA with OpenAI Agents SDK→
- GitHub 2FA with OpenAI Agents SDK→
- GitLab 2FA with OpenAI Agents SDK→
- HubSpot 2FA with OpenAI Agents SDK→
- Microsoft Azure 2FA with OpenAI Agents SDK→
- PayPal 2FA with OpenAI Agents SDK→
- Shopify 2FA with OpenAI Agents SDK→
- Slack 2FA with OpenAI Agents SDK→
- Stripe 2FA with OpenAI Agents SDK→
Try it with your own secret — no signup
Paste a TOTP secret on the home page and get a live code plus a working API call in seconds.