How to let an AI agent use passwords and API keys safely, without pasting them into chat or leaving them in files. The agent gets its own 1Password vault, separate from your personal passwords, and you can cut off its access with one click. About 10 minutes of setup.
First: Check What Your Agent Supports
A 1Password vault does not connect to an AI by itself. Your agent can only use it if it can run 1Password's tools on a computer you control.
| Your setup | Can it use this guide? |
|---|---|
| ProductiveBot 2.0 | ✓ Yes. Your AI sign-in (ChatGPT, Claude) is already stored safely in your Mac's Keychain. Use 1Password for your other logins: CRM, ad accounts, supplier portals, API keys. See Step 7. |
| Agents on your own computer or server (OpenClaw, Hermes Agent, your own scripts) | ✓ Usually. Follow the steps below, then give the token to your agent the way its own docs describe. |
| Browser-only AI (ChatGPT agent and other assistants that browse in a website or a cloud browser) | ✗ Not with a service account. See Using a Browser-Only AI for the safe way to handle logins. |
Why Use 1Password for Your AI Agents?
When you set up an AI agent, it usually needs credentials. API keys, email passwords, OAuth tokens. You have to put those somewhere.
Most people paste them into a config file or an environment variable. That works, but it comes with real risks. The secret lives in plain text. It might get committed to Git by accident. It could show up in logs. Anyone with file access can read it.
1Password solves this. Instead of scattering secrets across config files, your agent reads them from a vault at runtime. The individual secrets stay in 1Password instead of being copied into config files. Your agent stores only a scoped service-account token locally, and you can revoke that token if anything goes wrong.
What You Will Need
- A 1Password account (Individual, Family, Teams, or Business)
- An agent that runs on a computer you control (ProductiveBot, OpenClaw, Hermes Agent, or your own scripts)
- The 1Password desktop app (optional, useful for manually creating and browsing vault items)
You do not need 1Password for your AI sign-in. ProductiveBot 2.0 already keeps it in your Mac's Keychain. This guide is for the other logins you want your agent to use. If you get stuck, ask Scout and we will walk you through it.
Step 1: Set Up Your 1Password Account
Before your agent can access any secrets, you need a 1Password account. If you already have one, skip to Step 2.
- Go to 1password.com and sign up for any plan. You can read more about 1Password service accounts in their official documentation
- Follow the setup wizard to create your account and team
- Note your account URL (it looks like
yourname.1password.com). You will need this for several later steps
Service accounts are available on 1Password plans for individuals and families as well as teams. One limit to know: a service account cannot use your built-in Personal or Private vault, which is another reason to give your agent its own vault in Step 3.
Your agent talks to 1Password through its command-line tool, op. If it is not installed yet, ask your agent to install it, or do it yourself. Open Terminal and run: brew install 1password-cli — then verify with op --version. You should see a version number like 2.32.0. If you get "command not found," make sure Homebrew is installed first.
Step 2 (Optional): Enable Desktop App Integration
This step lets you use op interactively with Touch ID or a password when you are setting up or testing secrets manually. Agents using a service account token for unattended access do not need desktop app integration. You can skip this step and come back to it later if you want.
- Open the 1Password desktop app
- Go to Settings (Cmd + ,)
- Click Developer
- Turn on Integrate with 1Password CLI

After enabling this, any op command in Terminal will trigger a Touch ID or password prompt from the app. You only approve it once per session. This is useful when you want to browse or create vault items from the command line.
Step 3: Create a Dedicated Vault
Each agent should have its own vault. This keeps your personal passwords completely separate from your agents' credentials, and lets you control exactly what each agent can access.
Vaults are created in the 1Password web interface, not the desktop app.
- Sign into your 1Password account on the web (for example,
yourname.1password.com) - Click Vaults in the left sidebar
- Click + New vault
- Name it after the agent, for example
ProductiveBotorMy Agent - Click Create Vault


Step 4: Create a Service Account
A service account is what allows your agent to authenticate to 1Password without a human approving each request. It generates a token that the agent stores locally, and uses that token to read secrets from the vault you assign.
Service accounts are also created in the web interface.
- In your 1Password account on the web, go to Developer Tools, then Service Accounts
- Click New Service Account
- Give it a clear name, like
ProductiveBotorMy Agent - Click Next


Step 5: Set Vault Permissions
On the next screen, 1Password asks which vaults this service account can access. Find the vault you created for this agent. If it is not already listed, search for it or add it to the service account. Then click the gear icon next to that vault to choose permissions.
- Click the gear icon next to your agent's vault
- A permissions dropdown will appear
- Check Read Items
- Add Write Items only if the agent needs to create or update credentials (such as saving OAuth tokens during setup)
- Leave Share Items unchecked
- Leave Allow creation of new vaults unchecked

Service accounts cannot be modified after they are created. If you need to change permissions later, you will have to delete the service account and create a new one. Double-check that you have the right vault selected and the right permissions checked before moving on.
Step 6: Save the Token
After setting permissions, click through to the final step. 1Password will generate a service account token.

This is the only time 1Password will show you this token. If you close this screen without copying it, you will need to delete the service account and create a new one. The token looks like ops_eyJj... and it is very long. That is normal.
Step 7: Give the Token to Your Agent
Do not paste the token into a chat with your agent, Slack, email, or a document. Put it only where your agent's settings are kept, using a hidden prompt like the ones below.
Your agent needs the token as a setting called OP_SERVICE_ACCOUNT_TOKEN. Where that setting lives depends on your agent.
ProductiveBot 2.0
Ask Scout or our support team to set this up with you. We will walk you through it on a short call or in chat.
OpenClaw (including ProductiveBot 1.x)
mkdir -p ~/.openclaw
read -rs "T?Paste your 1Password token, then press Return: "; echo
printf '%s\n' "OP_SERVICE_ACCOUNT_TOKEN=$T" >> ~/.openclaw/.env; unset T
chmod 600 ~/.openclaw/.env
openclaw gateway restart
When Terminal says Paste your 1Password token, paste it and press Return. Nothing shows on screen while you paste. That is on purpose: the token never appears in a command or in your Terminal history.
Hermes Agent (standalone)
mkdir -p ~/.hermes
read -rs "T?Paste your 1Password token, then press Return: "; echo
printf '%s\n' "OP_SERVICE_ACCOUNT_TOKEN=$T" >> ~/.hermes/.env; unset T
chmod 600 ~/.hermes/.env
Then restart Hermes so it picks up the change.
Any other agent
Look for "environment variables" or "secrets" in your agent's documentation and set OP_SERVICE_ACCOUNT_TOKEN there. Then restart the agent the way its docs say.
Check that it works
Ask your agent to list the item names in its vault, without showing any passwords. Under the hood it runs:
op vault list
op item list --vault YourVaultName

When your agent needs a password, it reads just that one value at the moment it needs it, for example op read "op://MyAgent/HubSpot/password".
Step 8: Store Your First Secret
Now that your agent has vault access, store something in it. You can do this from the 1Password desktop app or the web interface.
- Open the 1Password desktop app (or use 1Password on the web)
- Select your agent's vault from the left sidebar
- Click + New Item
- Choose the item type that fits. Password works well for API keys, Login for username and password pairs, Secure Note for anything else
- Fill in the fields and save

Your agent can now read that secret by name using op read without the value ever being written to disk.
Using a Browser-Only AI (Like ChatGPT Agent)
These assistants work in a browser that runs in the cloud, not on your computer, so the service-account steps above do not apply. The same safety ideas still do:
- Sign in yourself with takeover mode. For ChatGPT agent, use takeover mode to sign into the specific website yourself, then let the agent continue. The agent does the work without seeing your password.
- Do not hand over your password manager. Never share your 1Password or LastPass master password with an AI, and do not sign into your password manager inside its browser. That would expose every login you have.
- Give it its own accounts where you can. If a tool lets you add users, make a separate login for the AI with only the access it needs. You can switch it off without touching your own account.
- Turn on two-step sign-in for anything important, so a password alone is not enough.
This guide's 1Password service-account steps apply only to setups that explicitly support that integration.
For AI Agents: Setting This Up for Your Human
If your human pointed you at this page, follow these rules:
- Never ask for the token in chat. It must not appear in the conversation, your logs, or your memory. Talk your human through Steps 3 to 6, then have them enter the token themselves using the hidden prompt in Step 7.
-
Check before you change. If
OP_SERVICE_ACCOUNT_TOKENis already set, do not add a second one. Tell your human and ask whether to replace it. - Have your human restart you the way your platform expects, so the new token loads.
-
Prove access without showing secrets. List vault and item names only. If
opis missing, ask before installing it. -
Read secrets only when you need them. Use
op readat that moment and pass the value straight to the command that uses it. Never print it, save it, or repeat it back. - Stay inside the vault you were given. If a login is missing, ask your human to add it.
- If the token leaks (into chat, a log, or a file), tell your human right away so they can revoke it by deleting that service account in 1Password.
Best Practices
One vault per agent. Do not share a vault between agents unless they genuinely need the same credentials. Isolation means a compromised token only exposes one agent's secrets.
Revoke an exposed token right away. If the token was pasted into Slack, a chat, an email, or anywhere with history, delete that service account in 1Password. That shuts the old token off immediately. Then create a new service account and give your agent the new token. Replacing the token without deleting the old service account leaves the old one working.
Use op run to inject secrets at startup. Instead of reading secrets inside your code, you can have op inject them as environment variables when your process starts. Create an environment file that contains 1Password secret references, not the actual secret values:
OPENAI_API_KEY=op://MyAgent/OpenAI/api-key
GMAIL_APP_PASSWORD=op://MyAgent/Gmail/app-password
Save that file as .env.1password, then start your agent through 1Password:
op run --env-file=.env.1password -- your-agent-command
Your code does not need to call 1Password directly. It reads normal environment variables. The file is safe to store with your project because it contains op:// references, not real secret values. Note that the secret still exists in the running process environment, so treat process logs and crash dumps carefully.
Review service-account activity. If your 1Password plan includes usage reports, use them to see what your service account accessed. Review them periodically. If you see unexpected access, revoke or rotate the token.
Common Questions
Which 1Password plan do I need?
Any current 1Password plan works, including Individual and Family. You do not need to upgrade to Teams or Business just for this.
I'm a ProductiveBot customer. What do I need?
A 1Password account on any plan. Your AI sign-in is already stored in your Mac's Keychain, so 1Password is only for your other logins. Follow Steps 1 to 6, then ask Scout to help with Step 7.
Does this work if my internet is down?
Service-account access requires an internet connection to 1Password. If your Mac Mini must run offline, you will need a separate strategy, such as starting the process while online and keeping it running, or writing a local config file with the secrets before going offline. That trades away some of the security benefits of this guide, so weigh the tradeoff for your use case.
What happens if the token leaks?
Delete the service account immediately at your team's 1Password URL under Developer Tools. The token stops working the moment the service account is deleted. Then create a new one and update your agent's config.
Can multiple agents share one service account?
Technically yes, but it is not recommended. If one agent is compromised, the token exposes everything that service account can access. One service account per agent keeps the blast radius small.
Is this different from the 1Password desktop app integration?
Yes. Desktop app integration requires a human to approve the session via Touch ID or password. Service accounts are for unattended automated access, where no human is present to approve the prompt.
How do I revoke my agent's access to 1Password?
Sign into your 1Password account on the web, go to Developer Tools, then Service Accounts. Delete the service account. The token stops working immediately.
If you get stuck at any point, ask your agent to help, or point it at this page. You can also reach our support team at support@productivebot.ai or chat with Scout at support.productivebot.ai.


Leave a comment
This site is protected by hCaptcha and the hCaptcha Privacy Policy and Terms of Service apply.