Saltar al contenido principal
POST
/
agent
/
{projectId}
/
job
Create agent job
curl --request POST \
  --url https://api.mintlify.com/v2/agent/{projectId}/job \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "prompt": "<string>"
}
'
{
  "id": "<string>",
  "status": "active",
  "source": {
    "repository": "<string>",
    "ref": "<string>"
  },
  "model": "<string>",
  "prLink": "<string>",
  "createdAt": "2023-11-07T05:31:56Z",
  "archivedAt": "2023-11-07T05:31:56Z"
}
Este endpoint crea una tarea de agente que se ejecuta en segundo plano. A diferencia de la API v1 que transmite respuestas, la API v2 devuelve inmediatamente un ID de tarea que puede usar para consultar el estado.

Diferencias clave con v1

  • Fire-and-forget: La solicitud devuelve inmediatamente el ID de la tarea
  • Basado en polling: Use Obtener tarea de agente para verificar el estado y obtener el enlace PR
  • Solicitud simplificada: Usa una sola cadena prompt en lugar de un array de mensajes
  • Conversacional: Envíe mensajes de seguimiento con Enviar mensaje

Flujo de trabajo

  1. Cree una tarea con este endpoint
  2. Almacene el id devuelto
  3. Consulte el endpoint Obtener tarea de agente hasta que el status sea completed o failed
  4. Obtenga el prLink de la respuesta una vez que se cree el PR

Límites de tasa

La API de agente tiene los siguientes límites:
  • 100 usos por proyecto Mintlify por hora

Autorizaciones

Authorization
string
header
requerido

The Authorization header expects a Bearer token. Use an admin API key (prefixed with mint_). This is a server-side secret key. Generate one on the API keys page in your dashboard.

Parámetros de ruta

projectId
string
requerido

Your project ID. Can be copied from the API keys page in your dashboard.

Cuerpo

application/json
prompt
string
requerido

The task instructions for the agent to execute.

Respuesta

Agent job created successfully. The job runs in the background.

id
string

Unique identifier for the agent job.

status
enum<string>

Current status of the agent job.

Opciones disponibles:
active,
completed,
archived,
failed
source
object

Information about the source repository.

model
string

The AI model used for this job.

URL of the pull request created by the agent. Null until the PR is created.

createdAt
string<date-time>

Timestamp when the job was created.

archivedAt
string<date-time> | null

Timestamp when the job was archived. Null if still active.