Configuración del proxy de API
Configura ShieldAgent como un proxy REST transparente con políticas por endpoint y registro de auditoría.
Cómo funciona el proxy REST
Además del proxy MCP, ShieldAgent puede interceptar llamadas REST de API realizadas por agentes a servicios externos (Stripe, Slack, microservicios internos, etc.). Cada solicitud es autenticada, verificada por políticas y registrada en auditoría antes de reenviarse.
Registrar un endpoint de API
Indica a ShieldAgent qué endpoints externos pueden alcanzar tus agentes:
import ShieldAgent from '@shieldagent/sdk';
const client = new ShieldAgent();
await client.apiEndpoints.create({
name: "stripe-charges",
upstreamUrl: "https://api.stripe.com/v1/charges",
allowedMethods: ["GET", "POST"],
description: "Stripe charges API",
});Configurar el agente para usar el proxy
Los agentes realizan llamadas REST a ShieldAgent en lugar de a la API externa directamente. ShieldAgent reenvía las solicitudes autenticadas tras la evaluación de políticas.
# Instead of calling Stripe directly:
# curl https://api.stripe.com/v1/charges -H 'Authorization: Bearer sk_live_...'
# The agent calls the ShieldAgent proxy:
curl https://proxy.shieldagent.io/rest/stripe-charges \
-H 'Authorization: Bearer <agent-key>' \
-H 'Content-Type: application/json' \
-d '{"amount": 2000, "currency": "usd", "source": "tok_..."}'Políticas por endpoint
Aplica restricciones a nivel de método sobre el registro de endpoints:
{
"tenantId": "<tenant-id>",
"agentId": "<agent-id>",
"toolName": "rest:stripe-charges",
"action": "deny",
"conditions": [
{
"type": "param_contains",
"param": "method",
"value": "DELETE"
}
]
}Filtrado de respuestas y DLP
ShieldAgent escanea las respuestas en busca de patrones de datos sensibles (PII, secretos, números de tarjeta) antes de devolverlas al agente. Configura reglas DLP por tenant:
await client.policies.create({
toolName: "rest:*",
action: "shadow",
conditions: [
{
type: "response_contains_pii",
sensitivity: "high",
},
],
});Registro de auditoría para llamadas REST
Cada solicitud REST proxificada se registra en el registro de auditoría inmutable con metadatos completos de solicitud/respuesta:
const auditEvents = await client.auditEvents.list({
toolType: "rest",
agentId: "<agent-id>",
limit: 50,
});Campos del registro de auditoría