1. Docs
  2. Pulumi Cloud
  3. Pulumi Cloud REST API
  4. Neo

Neo

    The Agent Tasks API allows you to create and manage AI agent tasks in Pulumi Cloud. These endpoints enable you to create tasks, monitor their status, respond to agent requests, and retrieve task events.

    Authentication

    All requests must be authenticated using a token via the Authorization HTTP header:

    Authorization: token {token}
    

    Base URL

    For Managed Pulumi Cloud (app.pulumi.com):

    https://api.pulumi.com
    

    For Self-Hosted Pulumi Cloud, use your configured API endpoint.


    Create a New Task

    Creates a new agent task for the specified organization.

    Endpoint

    POST /preview/agents/{orgName}/tasks
    

    Parameters

    Path Parameters

    ParameterTypeRequiredDescription
    orgNamestringYesThe organization name

    Request Body

    {
      "content": "string",
      "entity_diff": {
        "add": [
          {
            "type": "string",
            "id": "string"
          }
        ],
        "remove": [
          {
            "type": "string",
            "id": "string"
          }
        ]
      },
      "timestamp": "2025-01-15T00:00:00Z"
    }
    

    Request Fields

    FieldTypeRequiredDescription
    contentstringYesThe exact natural language instruction from the user
    entity_diffobjectNoEntities to add or remove from the agent
    timestampstring (ISO 8601)YesWhen the event occurred

    Response

    {
      "id": "task_abc123",
      "name": "Task name",
      "status": "pending",
      "createdAt": "2025-01-15T00:00:00Z",
      "entities": []
    }
    

    Response Fields

    FieldTypeDescription
    idstringUnique identifier for the task
    namestringHuman-readable name for the task
    statusstringCurrent status of the task (pending, running, completed, failed)
    createdAtstring (ISO 8601)When the task was created
    entitiesarrayList of entities associated with the task

    Example Request

    curl -X POST \
      -H "Content-Type: application/json" \
      -H "Authorization: token $PULUMI_ACCESS_TOKEN" \
      https://api.pulumi.com/preview/agents/my-org/tasks \
      -d '{
        "content": "Help me optimize my Pulumi stack",
        "timestamp": "2025-01-15T10:30:00Z"
      }'
    

    Error Responses

    • 400 Bad Request: Missing required fields or invalid request body
    • 401 Unauthorized: Invalid or missing authentication token
    • 403 Forbidden: Insufficient permissions to create tasks in this organization

    Get Task Metadata

    Retrieves metadata for a specific task.

    Endpoint

    GET /preview/agents/{orgName}/tasks/{taskID}
    

    Parameters

    Path Parameters

    ParameterTypeRequiredDescription
    orgNamestringYesThe organization name
    taskIDstringYesThe task identifier

    Response

    {
      "id": "task_abc123",
      "name": "Task name",
      "status": "running",
      "createdAt": "2025-01-15T00:00:00Z",
      "entities": [
        {
          "type": "stack",
          "id": "my-stack"
        }
      ]
    }
    

    Example Request

    curl -X GET \
      -H "Authorization: token $PULUMI_ACCESS_TOKEN" \
      https://api.pulumi.com/preview/agents/my-org/tasks/task_abc123
    

    Error Responses

    • 401 Unauthorized: Invalid or missing authentication token
    • 403 Forbidden: Insufficient permissions to view this task
    • 404 Not Found: Task not found

    List Tasks

    Lists all tasks for the specified organization.

    Endpoint

    GET /preview/agents/{orgName}/tasks
    

    Parameters

    Path Parameters

    ParameterTypeRequiredDescription
    orgNamestringYesThe organization name

    Query Parameters

    ParameterTypeRequiredDescription
    continuationTokenstringNoToken to fetch the next page of results
    pageSizeintegerNoNumber of items per page (1-1000, default: 100)

    Response

    {
      "tasks": [
        {
          "id": "task_abc123",
          "name": "Task name",
          "status": "completed",
          "createdAt": "2025-01-15T00:00:00Z",
          "entities": []
        }
      ],
      "continuationToken": "next_page_token"
    }
    

    Response Fields

    FieldTypeDescription
    tasksarrayList of tasks for this page
    continuationTokenstringToken to fetch the next page (null if no more results)

    Example Request

    curl -X GET \
      -H "Authorization: token $PULUMI_ACCESS_TOKEN" \
      "https://api.pulumi.com/preview/agents/my-org/tasks?pageSize=50"
    

    Error Responses

    • 400 Bad Request: Invalid pageSize parameter
    • 401 Unauthorized: Invalid or missing authentication token
    • 403 Forbidden: Insufficient permissions to list tasks in this organization

    Respond to an Existing Task

    Allows users to respond to an ongoing agent task with additional input or instructions.

    Endpoint

    POST /preview/agents/{orgName}/tasks/{taskID}
    

    Parameters

    Path Parameters

    ParameterTypeRequiredDescription
    orgNamestringYesThe organization name
    taskIDstringYesThe task identifier

    Request Body

    {
      "event": {
        "type": "user_input",
        "content": "string",
        "timestamp": "2025-01-15T00:00:00Z"
      }
    }
    

    Request Fields

    FieldTypeRequiredDescription
    eventobjectYesThe user event to append to the task
    event.typestringYesType of event (e.g., “user_input”)
    event.contentstringYesThe user’s response or additional instructions
    event.timestampstring (ISO 8601)YesWhen the event occurred

    Response

    Returns 202 Accepted with no body on success.

    Example Request

    curl -X POST \
      -H "Content-Type: application/json" \
      -H "Authorization: token $PULUMI_ACCESS_TOKEN" \
      https://api.pulumi.com/preview/agents/my-org/tasks/task_abc123 \
      -d '{
        "event": {
          "type": "user_input",
          "content": "Yes, please proceed with the optimization",
          "timestamp": "2025-01-15T10:35:00Z"
        }
      }'
    

    Error Responses

    • 400 Bad Request: Missing event field or invalid entities mentioned
    • 401 Unauthorized: Invalid or missing authentication token
    • 403 Forbidden: Insufficient permissions to respond to this task
    • 404 Not Found: Task not found
    • 409 Conflict: Cannot respond while a request is still ongoing

    List Events from a Task

    Retrieves the event stream for a specific task.

    Endpoint

    GET /preview/agents/{orgName}/tasks/{taskID}/events
    

    Parameters

    Path Parameters

    ParameterTypeRequiredDescription
    orgNamestringYesThe organization name
    taskIDstringYesThe task identifier

    Query Parameters

    ParameterTypeRequiredDescription
    continuationTokenstringNoToken to fetch the next page of results
    pageSizeintegerNoNumber of items per page (1-1000, default: 100)

    Response

    {
      "events": [
        {
          "type": "console_output",
          "timestamp": "2025-01-15T10:30:00Z",
          "content": "Processing request...",
          "sequence": 1
        },
        {
          "type": "user_input",
          "timestamp": "2025-01-15T10:35:00Z",
          "content": "Continue with optimization",
          "sequence": 2
        }
      ],
      "continuationToken": "next_page_token"
    }
    

    Response Fields

    FieldTypeDescription
    eventsarrayList of console events for this page
    events[].typestringType of event (console_output, user_input, etc.)
    events[].timestampstring (ISO 8601)When the event occurred
    events[].contentstringThe event content
    events[].sequenceintegerSequence number for ordering events
    continuationTokenstringToken to fetch the next page (null if no more results)

    Example Request

    curl -X GET \
      -H "Authorization: token $PULUMI_ACCESS_TOKEN" \
      "https://api.pulumi.com/preview/agents/my-org/tasks/task_abc123/events?pageSize=50"
    

    Error Responses

    • 400 Bad Request: Invalid pageSize parameter
    • 401 Unauthorized: Invalid or missing authentication token
    • 403 Forbidden: Insufficient permissions to view events for this task
    • 404 Not Found: Task not found

    Authorization

    The Agent Tasks API uses the following authorization requirements:

    • Read Operations (GET endpoints): Require AgentsReadAuth permission
    • Write Operations (POST endpoints): Require AgentsReadWriteAuth permission

    Users must have the appropriate permissions for the specified organization to access these endpoints.

    Rate Limiting

    API requests are subject to rate limiting. If you exceed the rate limit, you’ll receive a 429 Too Many Requests response. Please implement exponential backoff and retry logic in your applications.

    Preview Status

    These endpoints are currently in preview status (/preview/agents/...). The API may change before general availability. Please check the documentation regularly for updates.

      September 16 - Meet Neo. Save The Date