Your agent needs an identity — here's how to give it one that actually works
Your agent is running around the internet like a ghost. It has access to your email, your GitHub, your Slack, your databases — but when something goes wrong, good luck figuring out which agent did what, when, and why.
Most people bolt authentication onto their agents as an afterthought. They share API keys, reuse personal tokens, and pray nothing breaks. Then their agent starts making GitHub commits under their personal account, sending emails that look like they came from them, and leaving audit trails that make compliance teams nervous.
Here's the pattern that fixes it: Every agent gets its own identity, and every identity gets its own credentials.
Start with GitHub. Don't give your coding agent your personal access token. Create a machine user account specifically for your agent:
# GitHub machine user setup # 1. Create new GitHub account: yourname-agent@yourdomain.com # 2. Generate PAT with minimal required scopes # 3. Configure git identity in your agent's environment git config --global user.name "YourName Agent" git config --global user.email "yourname-agent@yourdomain.com" # Now commits are clearly attributed # "feat: implement user auth - YourName Agent"
Do the same for email. Create a dedicated agent email address and configure it in your agent's system prompt:
You are an AI agent operating on behalf of [Your Name]. When sending emails, always use the signature: --- This email was sent by [Your Name]'s AI Agent For questions, reply to this email or contact [your-email] Your agent email: agent@yourdomain.com Your SMTP config: [credentials with agent-specific auth]
For services that support it, use service accounts instead of user accounts. Google Workspace, AWS, and most enterprise tools have dedicated machine account types. These come with better audit trails and don't break when you change your password.
Pro tip: Name your agent accounts consistently. Use patterns like yourname-agent or agent-[purpose]. When you're debugging at 2 AM, you'll thank yourself for the clear naming.
The authentication piece gets trickier. You need your agent to authenticate as itself, not as you. This means:
- Separate API keys for every service
- Agent-specific OAuth apps where possible
- Service accounts instead of personal accounts
- Credential rotation that doesn't break your workflow
Store these credentials properly. Don't hardcode them in your agent's prompt. Use environment variables, a secrets manager, or at minimum a separate config file that's not in version control:
# agent-credentials.env (add to .gitignore) GITHUB_TOKEN=ghp_agent_token_here SMTP_USER=agent@yourdomain.com SMTP_PASS=agent_email_password SLACK_BOT_TOKEN=xoxb-agent-token OPENAI_API_KEY=sk-agent-key
The payoff is immediate. When your agent makes a mistake, you can see exactly what it did and when. When audit season comes, you have clean trails. When you need to revoke access, you're not locked out of your own accounts.
But here's the real win: your agent starts acting like a professional colleague instead of a digital poltergeist. Clear attribution builds trust. When people see "YourName Agent" on a commit or email, they know what they're dealing with. No confusion, no surprises.
Most people skip this because it feels like overhead. It's not. It's the difference between a toy that breaks in production and a system that scales with your business. Give your agent an identity it can be proud of.