> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getsupervisor.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Agendar llamada

> Programa una llamada diferida con la tool `schedule_call_tool`.

<Note>
  Usa la tool <code>schedule\_call\_tool</code> con la acción{' '}
  <code>scheduleCall</code>
  para reservar una llamada futura en la agenda del agente.
</Note>

<Info>
  Necesitas un agente de voz habilitado con disponibilidades publicadas.
  Autentícate con una API Key (<code>tools:execute</code>) y agrega el header
  <code>X-Workspace-Id</code>.
</Info>

## Ejecutar desde el SDK

<CodeGroup>
  ```ts theme={null}
  import { createClient } from "@getsupervisor/agents-studio-sdk";

  const client = createClient({
  baseUrl: process.env.API_BASE_URL!,
  workspaceId: process.env.WORKSPACE_ID!,
  apiKey: process.env.API_KEY!,
  });

  const response = await client.tools.execute(
  "schedule_call_tool",
  {
  agentId: "11111111-2222-3333-4444-555555555555",
  action: "scheduleCall",
  args: {
  proposed_datetime_iso: "2025-07-02T15:00:00-06:00",
  notes: "Confirmar demo con el equipo comercial",
  metadata: {
  customerId: "cust-789",
  priority: "high",
  },
  },
  },
  {
  idempotencyKey: `schedule-${Date.now()}`,
  }
  );

  console.log(response.result.referenceId, response.result.scheduledFor);

  ```

  ```bash theme={null}
  curl --request POST \
    --url "$API_BASE_URL/v1/tools/schedule_call_tool/execute" \
    --header "X-API-Key: $API_KEY" \
    --header "X-Workspace-Id: $WORKSPACE_ID" \
    --header "Content-Type: application/json" \
    --header "Idempotency-Key: schedule-$(date +%s)" \
    --data '{
      "agentId": "11111111-2222-3333-4444-555555555555",
      "action": "scheduleCall",
      "args": {
        "proposed_datetime_iso": "2025-07-02T15:00:00-06:00",
        "notes": "Confirmar demo con el equipo comercial",
        "metadata": {
          "customerId": "cust-789",
          "priority": "high"
        }
      }
    }'
  ```
</CodeGroup>

## Respuesta esperada

```json theme={null}
{
  "status": "ok",
  "result": {
    "status": "scheduled",
    "scheduledFor": "2025-07-02T21:00:00.000Z",
    "referenceId": "sch_01J8XT8Q9R0S1T2U3V4W"
  },
  "metadata": {
    "proposedAt": "2025-07-02T21:00:00.000Z",
    "scheduledStart": "2025-07-02T21:00:00.000Z",
    "scheduledEnd": "2025-07-02T21:15:00.000Z",
    "scheduledStartLocal": "2025-07-02T15:00:00-06:00",
    "scheduledEndLocal": "2025-07-02T15:15:00-06:00",
    "timezone": "America/Mexico_City",
    "windowSource": "agent_schedule",
    "windowDayOfWeek": 3
  }
}
```

## Validaciones clave

* <code>proposed\_datetime\_iso</code>: cadena ISO 8601 con zona horaria.
* <code>notes</code>: cadena opcional para compartir contexto con el agente.
* <code>metadata</code>: objeto plano opcional; se fusiona con la metadata de la
  conexión.
* Límite de búsqueda: el planificador intenta encontrar disponibilidad hasta 30 días después de la fecha propuesta.

<Info>
  Si no se encuentra disponibilidad en el horizonte configurado obtendrás
  <code>400 Unable to find an available window</code>. Ajusta la fecha propuesta
  o amplía los horarios del agente.
</Info>
