Create an agent identity in MOSS and get a capability token.
Every AI agent that interacts with MOSS must have a registered identity. This gives the agent a cryptographic identity for signing, lets you create policies that target specific agents, and provides an audit trail per agent.
const response = await fetch('https://api.mosscomputing.com/v1/agents', {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + access_token,
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Customer Support Bot',
description: 'Handles customer inquiries and escalations',
capabilities: ['read', 'respond', 'escalate'],
}),
});
const agent = await response.json();{
"id": "agt_abc123",
"name": "Customer Support Bot",
"status": "active",
"capability_token": "cap_..."
}Capability Token (cap_)
Your agent uses this to sign actions. Store it in environment variables. Never expose it in client-side code.
Agent Identity
The agent ID (agt_abc123) is used in policies. You can suspend, revoke, or rotate keys at any time.