API Reference

Training

Retrain a source and track asynchronous training jobs.

Retrain a source

Re-runs the embedding job for an existing source. The source's existing embedded document (if any) is removed before the new job is dispatched. Retraining on a disabled agent returns 423 agent_unavailable.

Scope: source:edit · Rate limit: Training (20/min)

POST/agents/{agent}/sources/{source}/retrain
AuthorizationBearer <token>

Bearer API key. Create one in your dashboard (Settings → API Keys); the full value is shown only once. Requires the organization owner on a premium or active AppSumo plan.

In: header

Path Parameters

agentstring

The agent's UUID.

Formatuuid
sourcestring

The source's UUID. Must belong to the agent in the path.

Formatuuid

Response Body

curl -X POST "https://api.assistloop.ai/api/public/v1/agents/497f6eca-6276-4993-bfeb-53cbbbba6f08/sources/497f6eca-6276-4993-bfeb-53cbbbba6f08/retrain"
{
  "data": {
    "task_id": "celery-8d2f1a7b"
  },
  "meta": {
    "request_id": "b7f0b9c2-1a2b-4c3d-8e9f-0a1b2c3d4e5f"
  }
}
{
  "message": "Unauthenticated."
}
{
  "error": {
    "code": "insufficient_scope",
    "message": "Token is missing required scope: source:create",
    "details": []
  },
  "meta": {
    "request_id": "b7f0b9c2-1a2b-4c3d-8e9f-0a1b2c3d4e5f"
  }
}
{
  "error": {
    "code": "resource_not_found",
    "message": "Source not found.",
    "details": []
  },
  "meta": {
    "request_id": "b7f0b9c2-1a2b-4c3d-8e9f-0a1b2c3d4e5f"
  }
}
{
  "error": {
    "code": "validation_failed",
    "message": "Invalid source type.",
    "details": []
  },
  "meta": {
    "request_id": "b7f0b9c2-1a2b-4c3d-8e9f-0a1b2c3d4e5f"
  }
}
{
  "error": {
    "code": "agent_unavailable",
    "message": "Agent is currently disabled.",
    "details": []
  },
  "meta": {
    "request_id": "b7f0b9c2-1a2b-4c3d-8e9f-0a1b2c3d4e5f"
  }
}
{
  "error": {
    "code": "upstream_failure",
    "message": "Could not complete the request upstream.",
    "details": []
  },
  "meta": {
    "request_id": "b7f0b9c2-1a2b-4c3d-8e9f-0a1b2c3d4e5f"
  }
}

Training job status

Returns the live status of a training job. Use the task_id returned when a source is created or retrained. The task must belong to a source on this agent, otherwise 404 resource_not_found.

Scope: source:read · Rate limit: Polling (200/min)

GET/agents/{agent}/training-jobs/{taskId}
AuthorizationBearer <token>

Bearer API key. Create one in your dashboard (Settings → API Keys); the full value is shown only once. Requires the organization owner on a premium or active AppSumo plan.

In: header

Path Parameters

agentstring

The agent's UUID.

Formatuuid
taskIdstring

The asynchronous task ID.

Response Body

curl -X GET "https://api.assistloop.ai/api/public/v1/agents/497f6eca-6276-4993-bfeb-53cbbbba6f08/training-jobs/string"
{
  "data": {
    "id": "celery-8d2f1a7b",
    "status": "processing",
    "source_id": "7f3a1c8e-2b4d-4f6a-9c1e-3d5b7a9f0e21",
    "agent_id": "0c2e0b8a-6c1e-4f7e-9a3a-1b2c3d4e5f60",
    "progress": 60,
    "error": null
  },
  "meta": {
    "request_id": "b7f0b9c2-1a2b-4c3d-8e9f-0a1b2c3d4e5f"
  }
}
{
  "message": "Unauthenticated."
}
{
  "error": {
    "code": "insufficient_scope",
    "message": "Token is missing required scope: source:create",
    "details": []
  },
  "meta": {
    "request_id": "b7f0b9c2-1a2b-4c3d-8e9f-0a1b2c3d4e5f"
  }
}
{
  "error": {
    "code": "resource_not_found",
    "message": "Source not found.",
    "details": []
  },
  "meta": {
    "request_id": "b7f0b9c2-1a2b-4c3d-8e9f-0a1b2c3d4e5f"
  }
}
{
  "error": {
    "code": "upstream_failure",
    "message": "Could not complete the request upstream.",
    "details": []
  },
  "meta": {
    "request_id": "b7f0b9c2-1a2b-4c3d-8e9f-0a1b2c3d4e5f"
  }
}