# Identity Infrastructure for AI Agents

## Your agent can reason.  But can it prove who it is?

Humans need an email address, a password manager, and a phone for 2FA to function on the internet. Remove any one and they're locked out. AI agents need the same primitives — purpose-built for autonomous operation. Loomal is that stack.

## Agents run on borrowed identities and hardcoded secrets.

### 01
**No accountability**  
When an agent sends an email or calls an API — who authorized it? Without identity, there's no delegation chain, no audit trail, no accountability.

### 02
**No trust boundaries**  
In multi-agent systems, agents can't verify each other. Without identity, any process can impersonate any agent. Inter-agent trust is impossible.

### 03
**No credentials management**  
API keys in .env files. 2FA skipped because agents can't handle it. One leaked credential compromises every service the agent touches. No rotation, no scoping, no encryption.

### 04
**No communication channel**  
Agents use your personal Gmail or dump to a queue. No dedicated address, no DKIM signing, no threading. Emails land in spam.

### 05
**No compliance path**  
FINRA, HIPAA, SOX, CMMC — every framework assumes actions trace to people. Agent actions don't. You're shipping into a regulatory gap with no infrastructure to close it.

### 06
**No revocation**  
When an employee leaves, their agents keep running. When a credential leaks, there's no kill switch. No way to revoke access across all services at once.

## The Agent Identity Stack.

Borrowed identities break accountability. Hardcoded secrets break security. Loomal replaces both by giving every agent a complete identity — infinite possibilities, one API. Each capability scoped, auditable, and instantly revocable.

### Inbox  
**A real email address your agent owns.**  
sales-x8k2m@mailgent.dev  
Not a forwarding alias or shared inbox — a dedicated mailbox with its own address. Full send, receive, and threading with automatic In-Reply-To stitching. Every outbound email is DKIM-signed with agent identity headers.

Learn more  
```javascript
const msg = await mg.messages.send({
  to: "lead@company.com",
  subject: "Following up",
  text: aiResponse,
})
```

### Vault  
**Encrypted credential storage for agents.**  
vault.store({ label, value })  
Stop hardcoding secrets in .env files. Store API keys, OAuth tokens, and login credentials with AES-256-GCM envelope encryption — per-credential data encryption keys wrapped by org-level KMS keys. Every credential is scoped to a specific identity with a full audit trail on every read.

Learn more  
```javascript
await mg.vault.store({
  label: "stripe-key",
  type: "api_key",
  value: "sk_live_...",
  service: "stripe",
})
```

### TOTP  
**2FA codes so your agent can log in anywhere.**  
totp.generate("github-2fa")  
Store TOTP seeds once, generate valid 6-digit codes on demand via the API. Seeds are stored encrypted and never returned — only the time-limited codes are accessible. Combined with email-based 2FA, Loomal agents can complete any standard authentication flow autonomously.

Learn more  
```javascript
const code = await mg.totp.generate("github-2fa")  
// => "349281"  (valid for 30s)
```

## Coming soon

### Voice  
**Phone and WhatsApp calls your agent can make.**  
Agents that can call, not just type. Make and receive calls over WhatsApp and phone — with the same identity, delegation chain, and audit trail as every other capability in the stack.

```javascript
await mg.voice.call({
  to: "+1-555-0142",
  message: followUpScript,
  channel: "whatsapp",
})
```

### Social  
**Publish to X, LinkedIn, and Instagram.**  
Your agent posts under its own verified identity — not yours. Schedule, publish, and engage across social platforms with full attribution and delegation chains on every action.

```javascript
await mg.social.post({
  platform: "linkedin",
  content: generatedPost,
  identity: "marketing-agent",
})
```

### Payments  
**Collect payments with Stripe integration.**  
Agents that can invoice, collect, and reconcile. Generate payment links, send them from the agent's own inbox, and track the full lifecycle — every transaction tied to a delegation chain.

```javascript
const link = await mg.payments.createLink({
  amount: 4999,
  currency: "usd",
  description: "Monthly retainer",
})
```

### Messaging  
**WhatsApp and Telegram for your agents.**  
Meet customers where they are. Send and receive messages on WhatsApp and Telegram with the same identity guarantees — scoped access, encrypted credentials, and every message traceable.

```javascript
await mg.messaging.send({
  channel: "telegram",
  to: chatId,
  text: supportResponse,
})
```

### KYA Profile  
**Know Your Agent — the agent's passport.**  
A machine-readable identity card that tells the world who built this agent, what it can do, and why it should be trusted. Trust scores, attestation counts, compliance badges — earned over time, not declared.

```javascript
const profile = await mg.kya.resolve(
  "did:web:api.loomal.ai:identities:id-abc"
)
// => { trust: { score: 94, attestations: 847 } }
```

### Attestation  
**Verifiable receipts for every agent action.**  
Cryptographically signed, timestamped, chained records of every action your agent takes. Not logging — tamper-proof, externally verifiable evidence. Auto-attests on email sends, vault reads, and delegation changes.

```javascript
const receipt = await mg.attestation.create({
  action: "claim.submitted",
  subject: "CLM-001",
  payload: { insurer: "blue-cross" },
})
```

### Signatures  
**Delegated e-signatures with proof of authority.**  
Your agent signs documents, contracts, and agreements — with the full delegation chain proving who authorized it. Optional human counter-signatures for high-value transactions.

```javascript
const sig = await mg.signature.create({
  documentHash: "sha256:abc123...",
  purpose: "contract_execution",
  metadata: { value: 25000 },
})
```

### OAuth  
**First-class OAuth identity for your agent.**  
Your agent gets its own OAuth client — not a borrowed human token. Automatic token refresh, consent-scoped access, and instant revocation. The delegation chain proves who authorized the grant.

```javascript
const token = await mg.oauth.authorize({
  provider: "salesforce",
  scopes: ["api", "refresh_token"],
  identity: "sales-agent",
})
```

## Every capability traces back to the human who authorized it.

Every agent action — every email, every API call, every credential read — traces through a delegation chain back to the human who authorized it. Revocation cascades instantly: pull one node and everything downstream stops. No orphaned access. No cleanup scripts. One chain. Instant, total revocation. This is how you answer FINRA, HIPAA, and CMMC.

```javascript
// The delegation chain on every action:
//
// Human (ops@novaworks.io)
//   └─ Org (novaworks)
//       └─ Identity (sales-agent-x8k2m)
//           └─ Action (email sent)
//
// Revoke the human?  → Org loses authorization.
// Revoke the org?    → All identities shut off.
// Revoke the identity? → All capabilities stop.
//
// One revocation. Complete shutdown. Zero orphaned access.
```

## Give your agent an identity.  See it work in two minutes.

Create an identity. Send your agent an email. Watch it reply from its own DKIM-signed address, pull credentials from the vault, and complete 2FA — every step traceable back to you.

Email, vault, and 2FA today. More channels shipping soon.
