> This page is for version v1 (default).
> For other versions, use one of these documentation indexes:
> - v1 (default): https://docs.rightbrain.ai/v-1/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.rightbrain.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.rightbrain.ai/_mcp/server.

# Get Run Events

GET https://app.rightbrain.ai/api/v1/org/{org_id}/project/{project_id}/task-agent/{task_agent_id}/run/{run_id}/events

Get conversation events for a specific TaskAgentRun.

Returns the full conversation history from the ADK session including:

* User messages
* Agent responses
* Tool calls and results
* Metadata-only memory compaction events, including token-threshold metadata when
  token-aware compaction was active
* Error messages (if any)

Events are returned in chronological order. The example below is the full event
sequence for a run that classifies an inbound email with a Task tool, looks up
the account through a connected integration tool, and drafts the reply through
a Task tool marked as the output formatter — the same run shown by
`GET .../run/{run_id}` and streamed live by `POST .../run`.

Reference: https://docs.rightbrain.ai/api-reference/api-reference/agents/get-task-agent-run-events

## Authentication

- `Authorization` header (bearer token, required) — API key or access token, sent as `Authorization: Bearer <token>`. The simplest option: create an API key in your dashboard under Settings, then paste it here.

## Servers

- `https://app.rightbrain.ai/api/v1` (Production, default)
- `https://app.rightbrain.ai/api/v1` (Staging API)
- `https://app.rblocal.dev/api/v1` (Local development)

## Request

### Path parameters

- `org_id` (string, required) — The unique identifier of the organization.
- `project_id` (string, required) — The unique identifier of the project.
- `task_agent_id` (string, required) — The specific Task Agent to reference.
- `run_id` (string, required) — The specific Run to reference.

### Query parameters

- `include_history` (boolean, optional, default: false) — Include full session history, not just this run's events

## Response

### 200

Run events

- `run_id` (string, required) — ID of the TaskAgentRun.
- `session_id` (string, required) — ADK session ID.
- `events` (list of TaskAgentEvent, optional, default: []) — Conversation events from the session.

## Errors

### 400 Bad Request Error

Bad Request

- `detail` (MalformedResourceIdentifierErrorPayload, required) — The error payload.

### 401 Unauthorized Error

Unauthorized - Authentication failed **Common causes:** - Missing `Authorization` header - Expired access token - Invalid or malformed token - Using API key in wrong format **Resolution:** Ensure you're including a valid Bearer token or API key in the Authorization header.

- `detail` (ErrorResponseDetail, required) — A plain error message, a list of field-level validation errors, a service validation error, or a domain error object with `reason` and `message`.

### 403 Forbidden Error

Forbidden - Insufficient permissions for Task Agent **Common causes:** - Your role lacks the required permission for this action - The Task Agent belongs to a different organization or project - The action requires admin or owner privileges **Resolution:** Contact your organization admin to request appropriate access.

- `GetTaskAgentRunEventsRequestForbiddenError`
  - PermissionCheckFailedErrorResponse: PermissionCheckFailedErrorResponse
  - MissingAuthenticationErrorResponse: MissingAuthenticationErrorResponse

### 404 Not Found Error

Run not found

- `detail` (ErrorResponseDetail, required) — A plain error message, a list of field-level validation errors, a service validation error, or a domain error object with `reason` and `message`.

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

### 500 Internal Server Error

Internal Server Error - Failed to retrieve run events

- `detail` (ErrorResponseDetail, required) — A plain error message, a list of field-level validation errors, a service validation error, or a domain error object with `reason` and `message`.

## Types

### TaskAgentEvent

Event from a TaskAgent conversation (from ADK session). Note: ADK may store multiple parallel tool calls or results in a single event. Use tool_calls/tool_results lists to access all of them.

- `id` (string, required) — Event ID from ADK session.
- `author` (string, required) — Event author: 'user' or agent name.
- `timestamp` (datetime, required) — When the event occurred.
- `event_type` (string, required) — Type of event.
- `content` (string, optional, nullable) — Text content of the event (extracted from parts).
- `tool_calls` (list of ToolCallInfo, optional, nullable) — Tool calls made in this event. Multiple if parallel calls.
- `tool_results` (list of ToolResultInfo, optional, nullable) — Tool results in this event. Multiple if parallel results.
- `files` (list of TaskAgentFileMetadata, optional) — Files uploaded with this user message. Populated only for user_message events.
- `error_message` (string, optional, nullable) — Error message if event_type is error.
- `metadata` (map from string to any, optional, nullable) — Event-specific metadata for system events such as memory compaction.

### MalformedResourceIdentifierErrorPayload

- `message` (string, required) — Human readable representation of the error
- `reason` (enum, required) — The machine-readable error reason.
  - Allowed values: `MALFORMED_RESOURCE_IDENTIFIER`
- `malformedResourceIdentifierError` (MalformedResourceIdentifierErrorDetails, required) — Metadata detailing more information about the error.

### ErrorResponseDetail

A plain error message, a list of field-level validation errors, a service validation error, or a domain error object with `reason` and `message`.

- string
- list of ErrorResponseDetailOneOf1Items
- ErrorResponseDetail2
- ErrorResponseDetail3
- ErrorResponseDetail4

### PermissionCheckFailedErrorResponse

- `detail` (PermissionCheckFailedErrorPayload, required) — The error payload.

### MissingAuthenticationErrorResponse

- `detail` (MissingAuthenticationErrorPayload, required) — The error payload.

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)
- `input` (any, optional)
- `ctx` (ValidationErrorCtx, optional)

### ToolCallInfo

Information about a tool/task tool call within an event.

- `name` (string, required) — Name of the tool/task tool called.
- `args` (map from string to any, optional, nullable) — Arguments passed to the tool.

### ToolResultInfo

Information about a tool/task tool result within an event.

- `name` (string, required) — Name of the tool/task tool.
- `tool_result_type` (enum, optional) — Result source type: 'task' for TaskTool results, otherwise 'generic'.
  - Allowed values: `task`, `mcp`, `generic`
- `task_run_id` (string, optional, nullable) — TaskRun ID when the result originated from a task tool.
- `mcp_server_name` (string, optional, nullable) — MCP server name when the result originated from an MCP tool.
- `is_formatter_output` (boolean, optional, default: false) — True when this result is from the output formatter task tool.
- `result` (map from string to any, optional, nullable) — Result returned by the tool.

### TaskAgentFileMetadata

Extended file metadata for TaskAgent runs with provenance tracking. Inherits from TaskRunFileMetadata and adds fields to track whether a file was uploaded with the request or generated by a task tool.

- `original_filename` (string, required) — The original filename as submitted by the user
- `stored_filename` (string, required) — The generated filename used for storage
- `content_type` (string, required) — MIME type of the file
- `download_url` (string, optional, nullable) — Relative URL to download the file (generated dynamically, not stored in database)
- `size_bytes` (integer, optional, nullable) — File size in bytes (if available)
- `source` (enum, optional, default: input) — Source of the file: 'input' for uploaded files, 'generated' for task tool outputs
  - Allowed values: `input`, `generated`
- `source_task_name` (string, optional, nullable) — Name of the task tool/task that generated this file (only for generated files)
- `source_task_run_id` (string, optional, nullable) — TaskRun ID that generated this file (only for generated files)

### MalformedResourceIdentifierErrorDetails

- `field` (string, required)
- `value` (any, required)
- `expected_format` (string, required)

### ErrorResponseDetailOneOf1Items

- `type` (string, required) — Error type identifier
- `loc` (list of ErrorResponseDetailOneOf1ItemsLocItems, optional) — Path to the error location. Integer segments index into a list.
- `msg` (string, optional) — Human-readable error message. Present on errors produced by FastAPI's own request validation.
- `message` (string, optional) — Human-readable error message. Used instead of `msg` by Rightbrain's own validators.

### ErrorResponseDetail2

Validation error returned by a service after request parsing, such as a Task clone dependency failure.

- `type` ("validation_error", required)
- `errors` (list of ErrorResponseDetailOneOf2ErrorsItems, required)

### ErrorResponseDetail3

Domain error raised via a brain.exc.BaseError subclass. The exact extra field name and shape vary by error type.

- `reason` (string, required) — Machine-readable, upper-snake-case error reason, e.g. RESOURCE_NOT_FOUND, PERMISSION_CHECK_FAILED, TAG_NAME_CONFLICT.
- `message` (string, required) — Human-readable error message

### ErrorResponseDetail4

Integration precondition failure. Uses `code` rather than `reason`, and carries no extra field. Raised by the Gmail trigger routes when the underlying integration is not authorized.

- `code` (string, required) — Machine-readable code, e.g. GMAIL_INTEGRATION_AUTH_REQUIRED.
- `message` (string, required) — Human-readable error message

### PermissionCheckFailedErrorPayload

- `message` (string, required) — Human readable representation of the error
- `reason` (enum, required) — The machine-readable error reason.
  - Allowed values: `PERMISSION_CHECK_FAILED`
- `permissionCheckFailedError` (PermissionCheckFailedErrorDetails, required) — Metadata detailing more information about the error.

### MissingAuthenticationErrorPayload

- `message` (string, required) — Human readable representation of the error
- `reason` (enum, required) — The machine-readable error reason.
  - Allowed values: `MISSING_AUTHENTICATION`
- `missingAuthenticationError` (EmptyErrorDetails, required) — Metadata detailing more information about the error.

### ValidationErrorLocItems

- string
- integer

### ValidationErrorCtx

### ErrorResponseDetailOneOf1ItemsLocItems

- string
- integer

### ErrorResponseDetailOneOf2ErrorsItems

- `type` (string, required) — Error type identifier
- `loc` (list of ErrorResponseDetailOneOf2ErrorsItemsLocItems, optional) — Path to the error location. Integer segments index into a list.
- `msg` (string, optional) — Human-readable error message. Present on errors produced by FastAPI's own request validation.
- `message` (string, optional) — Human-readable error message. Used instead of `msg` by Rightbrain's own validators.

### PermissionCheckFailedErrorDetails

- `permission` (string, required)
- `subject` (IAMObjectErrorDetails, optional, nullable)
- `resource` (IAMObjectErrorDetails, optional, nullable)

### EmptyErrorDetails

### ErrorResponseDetailOneOf2ErrorsItemsLocItems

- string
- integer

### IAMObjectErrorDetails

- `type` (string, required)
- `id` (string, optional, nullable)

## Examples

**Response**

```json
{
  "run_id": "019fa2da-4790-712c-aaa2-cb8d287b620b",
  "session_id": "019fa2da-4790-7718-8edc-ae551b239242",
  "events": [
    {
      "id": "019fa2da-4790-76ea-a59f-d21e748d05b2",
      "author": "user",
      "timestamp": "2026-07-27T09:14:02Z",
      "event_type": "user_message",
      "content": "Subject: Charged twice for June invoice\n\nHi, I think we've been billed twice for our June bookkeeping retainer — I can see two charges of £450 on the 3rd and the 5th. Could someone check our account and let me know what's going on? Our account email is dana@northfieldjoinery.co.uk.\n\nThanks,\nDana",
      "files": []
    },
    {
      "id": "019fa2da-4790-7fc1-8499-87f7e92332e6",
      "author": "support_triage_agent",
      "timestamp": "2026-07-27T09:14:03Z",
      "event_type": "tool_call",
      "tool_calls": [
        {
          "name": "customer_support_analyzer",
          "args": {
            "message": "Subject: Charged twice for June invoice\n\nHi, I think we've been billed twice for our June bookkeeping retainer — I can see two charges of £450 on the 3rd and the 5th. Could someone check our account and let me know what's going on? Our account email is dana@northfieldjoinery.co.uk.\n\nThanks,\nDana"
          }
        }
      ],
      "files": []
    },
    {
      "id": "019fa2da-4790-7990-8af1-933d1b9a8538",
      "author": "support_triage_agent",
      "timestamp": "2026-07-27T09:14:04Z",
      "event_type": "tool_result",
      "tool_results": [
        {
          "name": "customer_support_analyzer",
          "tool_result_type": "task",
          "task_run_id": "019fa2da-4790-798a-9530-76940e914d17",
          "is_formatter_output": false,
          "result": {
            "result": {
              "category": "billing_dispute",
              "sentiment": "concerned",
              "suggested_response": "Confirm the duplicate charge, check the account, and let the customer know a refund will be reviewed."
            },
            "task_run_id": "019fa2da-4790-798a-9530-76940e914d17"
          }
        }
      ],
      "files": []
    },
    {
      "id": "019fa2da-4790-7be8-8bfe-06792d763e98",
      "author": "support_triage_agent",
      "timestamp": "2026-07-27T09:14:05Z",
      "event_type": "tool_call",
      "tool_calls": [
        {
          "name": "sheets_spreadsheets_values_get",
          "args": {
            "range": "Customers!A2:F500",
            "spreadsheet_id": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms"
          }
        }
      ],
      "files": []
    },
    {
      "id": "019fa2da-4790-7023-9935-659f10bbf266",
      "author": "support_triage_agent",
      "timestamp": "2026-07-27T09:14:06Z",
      "event_type": "tool_result",
      "tool_results": [
        {
          "name": "sheets_spreadsheets_values_get",
          "tool_result_type": "generic",
          "is_formatter_output": false,
          "result": {
            "majorDimension": "ROWS",
            "range": "Customers!A2:F2",
            "values": [
              [
                "NJ-1042",
                "Dana Whitfield",
                "dana@northfieldjoinery.co.uk",
                "Bookkeeping Retainer - Standard",
                "active",
                "No prior disputes"
              ]
            ]
          }
        }
      ],
      "files": []
    },
    {
      "id": "019fa2da-4790-7b9e-8229-2b44fb74adde",
      "author": "support_triage_agent",
      "timestamp": "2026-07-27T09:14:08Z",
      "event_type": "tool_call",
      "tool_calls": [
        {
          "name": "draft_support_reply",
          "args": {
            "customer_record": {
              "account_id": "NJ-1042",
              "name": "Dana Whitfield",
              "plan": "Bookkeeping Retainer - Standard",
              "status": "active"
            },
            "ticket_summary": "Customer reports being charged twice for the June retainer (£450 x2 on 3 and 5 July)."
          }
        }
      ],
      "files": []
    },
    {
      "id": "019fa2da-4790-76b2-a83e-5e15c385e5f5",
      "author": "support_triage_agent",
      "timestamp": "2026-07-27T09:14:10Z",
      "event_type": "formatted_output",
      "tool_results": [
        {
          "name": "draft_support_reply",
          "tool_result_type": "task",
          "task_run_id": "019fa2da-4790-7bff-bc7a-c397d193f25e",
          "is_formatter_output": true,
          "result": {
            "result": "Hi Dana,\n\nThanks for flagging this — I can see two £450 charges against your Bookkeeping Retainer account (NJ-1042) on 3 and 5 July, and that does look like a duplicate. There are no other disputes on file, so this should be straightforward.\n\nI can't issue the refund myself, but I've flagged it to the team and someone will confirm and process it within one business day.\n\nThanks for your patience,\nSupport Triage",
            "task_run_id": "019fa2da-4790-7bff-bc7a-c397d193f25e"
          }
        }
      ],
      "files": []
    }
  ]
}
```

**SDK Code**

```python Task Agents_getTaskAgentRunEvents_example
import requests

url = "https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task-agent/task_agent_id/run/run_id/events"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript Task Agents_getTaskAgentRunEvents_example
const url = 'https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task-agent/task_agent_id/run/run_id/events';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Task Agents_getTaskAgentRunEvents_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task-agent/task_agent_id/run/run_id/events"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Task Agents_getTaskAgentRunEvents_example
require 'uri'
require 'net/http'

url = URI("https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task-agent/task_agent_id/run/run_id/events")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java Task Agents_getTaskAgentRunEvents_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task-agent/task_agent_id/run/run_id/events")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php Task Agents_getTaskAgentRunEvents_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task-agent/task_agent_id/run/run_id/events', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp Task Agents_getTaskAgentRunEvents_example
using RestSharp;

var client = new RestClient("https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task-agent/task_agent_id/run/run_id/events");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Task Agents_getTaskAgentRunEvents_example
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task-agent/task_agent_id/run/run_id/events")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```