Skip to content

Task AI Execution ​

Execute any task through an AI model for analysis, expansion, decomposition, or brainstorming. Supports file attachments, agent invocation, and automatic propagation to connected tasks.

Endpoints ​

MethodPathDescriptionAuthEntitlement
POST/bits/:id/executeExecute a task through AIJWTai.bits.execute
POST/chainies/:id/executeExecute a project through AIJWTai.bits.execute
GET/ai/models/availableList available models for a featureJWT--
PATCH/ai/runs/:runId/shareShare an execution resultJWT--
GET/community/executionsList public execution sharesNone--

Who can execute ​

An execution always runs, and is billed, in the account and workspace selected for the request.

  • You can execute only tasks and projects that you created in that workspace. Tasks and projects that a team or a collaborator shares with you are readable but not executable.
  • agentInstanceId must name an active agent available in the same workspace: an agent of that workspace or one shared with the whole account.
  • A task, project, or agent that you cannot execute returns 404, the same response as one that does not exist. Nothing is run or charged.
  • Automatic propagation only reaches your own tasks in the same account and workspace.

Execute a Task ​

Description ​

Use the id of the task you're executing (e.g. from a task lookup or create-task response) -- not the literal value shown in the examples below.

Request ​

Request Body ​

FieldTypeRequiredDescription
modestringNochat, analyze, expand, decompose, brainstorm (default: analyze)
promptstringNoOptional instruction to guide the AI (max 4000 chars)
modelIdstringNoOverride model UUID (must be entitled)
agentInstanceIdstringNoAgent instance UUID for specialized execution
attachmentFileIdsstring[]NoFile UUIDs from media library (max 20)

Execution Modes ​

ModeDescription
chatConversational - responds naturally to user instructions
analyzeStructured insights: observations, issues, key points
expandAdds context, resources, and depth to the task
decomposeBreaks the task into up to 10 action items
brainstormGenerates creative and practical approaches

Response ​

json
{
  "data": {
    "runId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
    "sessionId": "c9a7d1e2-4b3f-4e8a-9012-3d4e5f6a7b8c",
    "text": "1. Research the topic and gather key references\n2. Draft an outline with main sections\n3. Write the first section focusing on introduction"
  }
}

Code Examples ​

curl -X POST https://api.chainabit.com/api/v1/bits/$BIT_ID/execute \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "decompose",
    "prompt": "Break this into daily sub-tasks for a beginner."
  }'

Execute a Project ​

Description ​

Same execution pipeline as tasks, but the context includes the project's title, description, vision statement, and its recent tasks. Use the id of the project you're executing -- not the literal value shown in the examples below.

Request ​

FieldTypeRequiredDescription
modestringNoExecution mode (default: analyze)
promptstringNoOptional instruction (max 4000 chars)
modelIdstringNoOverride model UUID
agentInstanceIdstringNoAgent instance UUID

Response ​

Same response shape as Execute a Task (runId, sessionId, text).

Code Examples ​

curl -X POST https://api.chainabit.com/api/v1/chainies/$CHAINY_ID/execute \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "brainstorm",
    "prompt": "Suggest new approaches for this project."
  }'

List Available Models ​

Description ​

Returns models the authenticated user is entitled to use for a given feature key.

Request ​

Query params: see the featureKey query parameter used in the example below.

Response ​

json
{
  "data": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "GPT-4o",
      "modelKey": "gpt-4o",
      "provider": "openai",
      "providerName": "OpenAI",
      "capabilities": ["chat", "tools", "vision"],
      "contextWindowTokens": 128000
    }
  ]
}

Code Examples ​

curl "https://api.chainabit.com/api/v1/ai/models/available?featureKey=ai.bits.execute" \
  -H "Authorization: Bearer $TOKEN"

Share an Execution ​

Description ​

Share execution results publicly or revoke sharing.

Only the member who started a run can share it or change its sharing. Anyone else, including account owners and admins, receives 403. A run with no recorded starter can be shared by a member working in the run's account and workspace. A run from a temporary conversation cannot be shared.

Request ​

FieldTypeRequiredDescription
visibilitystringNoprivate or public
titlestringNoShare title (max 200 chars)
descriptionstringNoShare description (max 1000 chars)
allowCommentsbooleanNoAllow community comments
allowClonebooleanNoAllow cloning

Response ​

json
{
  "data": {
    "shareId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "accessToken": "<share-access-token>",
    "visibility": "public"
  }
}

Code Examples ​

javascript
const response = await fetch(`https://api.chainabit.com/api/v1/ai/runs/${runId}/share`, {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ visibility: "public", title: "My AI Analysis" }),
});
const { data } = await response.json();
python
response = requests.patch(
    f"{os.environ['BASE_URL']}/ai/runs/{run_id}/share",
    headers={"Authorization": f"Bearer {os.environ['TOKEN']}"},
    json={"visibility": "public", "title": "My AI Analysis"},
)
data = response.json()["data"]

Community Executions ​

Description ​

List publicly shared execution results. No authentication required.

Request ​

Query params: see the limit and offset query parameters used in the example below.

Response ​

json
{
  "data": [
    {
      "id": "share-uuid",
      "entity_id": "run-uuid",
      "visibility": "public",
      "allow_comments": true,
      "created_at": "2026-04-11T12:00:00.000Z"
    }
  ],
  "meta": {
    "total": 42,
    "limit": 10,
    "offset": 0,
    "hasNextPage": true
  }
}

Code Examples ​

curl "https://api.chainabit.com/api/v1/community/executions?limit=10&offset=0"

Entitlements ​

Execution requires the ai.bits.execute entitlement. Execution allowances, available model providers, attachment limits, and agent invocation depend on your plan. Use GET /ai/models/available to list the models you can use, and see the pricing page for current plan details.

Built with purpose. chainabit.com