> ## Documentation Index
> Fetch the complete documentation index at: https://docs.automate.ax/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# Get workspace agent run

> Check the current state of a ChatGPT Workspace Agent run.

`getChatGPTWorkspaceAgentRun` gets the latest status for a run started by `triggerChatGPTWorkspaceAgent`.

```ts automations/get-chatgpt-agent-run.automation.ts theme={null}
import { automation, onSchedule } from "automate.ax"
import { getChatGPTWorkspaceAgentRun } from "automate.ax/chatgpt"

export default automation("Check ChatGPT agent", () => {
  onSchedule({ schedule: "*/5 * * * *" })
  const run = getChatGPTWorkspaceAgentRun({
    apiTriggerId: "agtch_engineering_123",
    runId: "apirun_123",
  })

  run.status
  run.conversationUrl
})
```

Pass the same `apiTriggerId` used to start the run and its returned `runId`. Optional second argument `{ account }` defaults to the project binding. The result includes the published agent and trigger IDs, ChatGPT conversation URL, creation time, current status, and nullable failure details.

`status` is `queued`, `in_progress`, `suspended`, `completed`, or `failed`. Only `completed` and `failed` are terminal. A suspended run is waiting for an external action or tool. Failed runs report `dispatch_failed` or `run_failed` in `error.code`.
