---
title: "Runs"
description: "Run an agent, workflow, function, or query and read the result."
canonical_url: "https://docs.vettero.com/developer-api/runs"
---
# Runs

> Run an agent, workflow, function, or query and read the result.

Scope: `runs`.

`POST /api/developer/v1/runs`

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Meaning
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        kind
      </code>
    </td>
    
    <td>
      <code>
        agent
      </code>
      
      , <code>
        workflow
      </code>
      
      , <code>
        function
      </code>
      
      , or <code>
        query
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        resourceId
      </code>
    </td>
    
    <td>
      Id of that resource in the workspace
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        input
      </code>
    </td>
    
    <td>
      JSON object passed into the run. Shape depends on the resource
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        wait
      </code>
    </td>
    
    <td>
      Omit or <code>
        true
      </code>
      
       waits for the result (HTTP 200). <code>
        false
      </code>
      
       returns HTTP <strong>
        202
      </strong>
      
       with <code>
        { run, accepted: true }
      </code>
    </td>
  </tr>
</tbody>
</table>

`GET /api/developer/v1/runs/{id}` reads status, output, and error.

## How kinds behave

<table>
<thead>
  <tr>
    <th>
      Kind
    </th>
    
    <th>
      Behavior
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        function
      </code>
      
      , <code>
        query
      </code>
    </td>
    
    <td>
      Finish in the request. You usually get 200 with <code>
        output
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        agent
      </code>
      
      , <code>
        workflow
      </code>
    </td>
    
    <td>
      Run on the session worker. <code>
        sessionId
      </code>
      
       is set on the run
    </td>
  </tr>
</tbody>
</table>

## Status values

<table>
<thead>
  <tr>
    <th>
      Status
    </th>
    
    <th>
      Meaning
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        queued
      </code>
    </td>
    
    <td>
      Accepted, not finished yet (typical after <code>
        wait: false
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        running
      </code>
    </td>
    
    <td>
      In progress
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        waiting
      </code>
    </td>
    
    <td>
      Paused (for example for approval)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        completed
      </code>
    </td>
    
    <td>
      Done. Read <code>
        output
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        failed
      </code>
    </td>
    
    <td>
      Failed. Read <code>
        error
      </code>
    </td>
  </tr>
</tbody>
</table>

A finished or failed run also sends `run.completed` or `run.failed` to webhooks.


## Sitemap

See the full [sitemap](https://docs.vettero.com/sitemap.md) for all pages.
