AgentCore Telegram Akira Setup
Prerequisiti
- Backend Akira deployato con
/mcp/*raggiungibile da AgentCore. infra/roles/management/files/agentcore-akira-plugin.ymldeployato in/opt/akira/agentcore/config/akira-plugin.yml.- Gruppo Telegram dedicato
akira-noccreato da un admin NOC.
Generazione MCP token
Genera un token plain e il relativo hash Argon2id su una macchina fidata:
export TOKEN="$(openssl rand -base64 48)"
uv run python - <<'PY'
import os
from akira_backend.core.passwords import hash_password
print(hash_password(os.environ["TOKEN"]))
PY
Inserisci l'hash in DB:
INSERT INTO mcp_api_tokens (name, token_hash, scopes, expires_at)
VALUES (
'agentcore-prod',
'<argon2_hash>',
ARRAY['mcp.tools.call'],
'2027-05-21'::timestamp
)
ON CONFLICT (name) DO UPDATE
SET token_hash = EXCLUDED.token_hash,
scopes = EXCLUDED.scopes,
expires_at = EXCLUDED.expires_at,
revoked_at = NULL;
Salva solo il token plain in Ansible Vault:
vault_agentcore_mcp_token: "<plain-token>"
Configurazione Telegram
- Crea il gruppo Telegram
akira-noc. - Aggiungi il bot AgentCore al gruppo.
- Recupera gli user ID Telegram degli operatori autorizzati.
- Aggiorna Ansible Vault:
vault_agentcore_telegram_token: "<bot-token>"
vault_agentcore_telegram_allowed_user_ids:
- 123456789
- 987654321
- Esegui il deploy management:
ansible-playbook -i infra/inventory infra/playbooks/deploy_management.yml --limit mgmt
Smoke Test
Nel gruppo akira-noc:
/start
Risultato atteso: AgentCore risponde con benvenuto e comandi disponibili.
Saldo TestCo?
Risultato atteso: AgentCore chiama /mcp/call/get_company_balance con
Authorization: Bearer <AGENTCORE_AKIRA_MCP_TOKEN> e restituisce saldo con
valuta.
Ricarica TestCo EUR 100
Risultato atteso:
- AgentCore chiede conferma all'utente.
- Dopo conferma chiama
POST /mcp/confirmations. - Ripete la write con
X-Confirmation-Token. - Il backend ritorna
200 OKe l'audit log usa actoragentcore:<user_id>.
Troubleshooting
401 missing_mcp_api_token: il container non passaAGENTCORE_AKIRA_MCP_TOKENcome Bearer token verso/mcp/*.403 invalid_mcp_api_token: token plain in vault non corrisponde all'hash DB, token scaduto, revocato o privo scopemcp.tools.call.428 confirmation_required: comportamento atteso per write tool senzaX-Confirmation-Token.- LLM quota exhausted: AgentCore deve rispondere
service unavailablee non ritentare automaticamente operazioni write.