Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/paramveer-cyber/Deployaar/llms.txt

Use this file to discover all available pages before exploring further.

The agentRun router is how you trigger and observe the Deployaar coding agent. When assignAllToCodingAgent is called, it fires a coding-agent/run.requested Inngest event. An Inngest background function picks that event up, provisions an E2B sandbox, clones the linked GitHub repository, runs the AI coding loop (up to 40 tool-call iterations), commits the result to a feature branch, and opens a pull request — all without any further client interaction required.
Both procedures require authentication. assignAllToCodingAgent additionally requires that the feature request’s PRD has been approved and that at least one engineering task has been generated. An already-active run (status queued or running) blocks a new one with 409 Conflict.

agentRun.assignAllToCodingAgent — mutation

Queues a new coding agent run for the specified feature request. The procedure:
  1. Validates organization membership for the caller
  2. Confirms the PRD is approved (approvedAt is not null)
  3. Confirms at least one engineering task exists
  4. Creates an AgentRun record with status queued
  5. Fires the coding-agent/run.requested Inngest event
The actual code generation, git push, and PR creation happen asynchronously. Poll agentRun.getAgentRun to track progress.

Input

featureRequestId
string (UUID)
required
The UUID of the feature request to assign to the coding agent.

Response

{
  "success": true,
  "message": "Coding agent run queued",
  "data": {
    "agentRunId": "d290f1ee-6c54-4b01-90e6-d701748f0851",
    "featureRequestId": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"
  }
}
If a run with status queued or running already exists for this feature request, the procedure throws 409 Conflict. Wait for the active run to finish before queuing another.

agentRun.getAgentRun — query

Returns the latest agent run record for a feature request, or null if no run has ever been started. Use this to poll run status during execution.

Input

featureRequestId
string (UUID)
required
The UUID of the feature request whose latest agent run should be retrieved.

Response

{
  "success": true,
  "message": "Fetched",
  "data": {
    "agentRun": {
      "id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
      "featureRequestId": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
      "status": "succeeded",
      "iterationCount": 12,
      "headBranch": "deployaar_9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
      "prNumber": 47,
      "errorMessage": null,
      "startedAt": "2024-01-15T12:00:00.000Z",
      "finishedAt": "2024-01-15T12:08:30.000Z",
      "createdAt": "2024-01-15T11:59:50.000Z",
      "updatedAt": "2024-01-15T12:08:30.000Z"
    }
  }
}
agentRun is null before the first run is triggered. Once a run exists, the record is updated in place as the agent progresses.

AgentRunStatusResult type reference

id
string (UUID)
Unique identifier for the agent run record.
featureRequestId
string (UUID)
The feature request this run belongs to.
status
"queued" | "running" | "succeeded" | "failed"
Current lifecycle status of the agent run.
  • queued — Inngest event fired, background function not yet started
  • running — Sandbox is live, agent is executing tool calls
  • succeeded — All tasks complete, branch pushed, PR opened
  • failed — Run terminated with an error (see errorMessage)
iterationCount
number
Number of AI reasoning steps the agent used. The agent is capped at 40 iterations; exceeding this cap results in failed.
headBranch
string | null
The git branch name where the agent pushed its changes, in the format deployaar_<featureRequestId>. Set once the sandbox is provisioned.
prNumber
number | null
The GitHub pull request number opened by the agent. Set only after status reaches succeeded.
errorMessage
string | null
Human-readable error description when status is failed.
startedAt
Date | null
Timestamp when the Inngest function started executing (sandbox provisioned).
finishedAt
Date | null
Timestamp when the run completed (either succeeded or failed).
createdAt
Date
Timestamp when the agent run record was first created.
updatedAt
Date
Timestamp of the last update to the agent run record.

Status transition diagram

assignAllToCodingAgent()


       "queued"    ◄── Inngest event fired, DB record created

          ▼  [Inngest picks up event, sandbox provisioned]
       "running"   ◄── agent loop executing (up to 40 iterations)

    ┌─────┴──────┐
    ▼            ▼
"succeeded"   "failed"
 (PR opened)  (errorMessage set)

TypeScript polling example

Use React Query’s refetchInterval to poll the agent run status until the run finishes:
import { trpc } from "~/trpc/client";

const featureRequestId = "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d";

// Trigger the agent
const triggerMutation = trpc.agentRun.assignAllToCodingAgent.useMutation();

async function startAgent() {
  await triggerMutation.mutateAsync({ featureRequestId });
}

// Poll status until the run is done
const { data } = trpc.agentRun.getAgentRun.useQuery(
  { featureRequestId },
  {
    refetchInterval: (query) => {
      const status = query.state.data?.data.agentRun?.status;
      // Keep polling while the run is active
      if (status === "queued" || status === "running") return 4000;
      // Stop polling once terminal state is reached
      return false;
    },
  },
);

const agentRun = data?.data.agentRun;

if (agentRun?.status === "succeeded") {
  console.log(`PR #${agentRun.prNumber} opened on branch ${agentRun.headBranch}`);
}

if (agentRun?.status === "failed") {
  console.error("Agent run failed:", agentRun.errorMessage);
}

REST equivalent (curl)

# Trigger the coding agent for a feature request
curl -X POST https://api.deployaar.com/api/agent-runs/{featureRequestId}/assign \
  -H "Authorization: Bearer <token>"

# Poll the agent run status
curl https://api.deployaar.com/api/agent-runs/{featureRequestId} \
  -H "Authorization: Bearer <token>"

Build docs developers (and LLMs) love