> 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 Session Detail

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

Get detailed information about a specific session.

Returns session summary (run count, tokens) plus individual runs, including
phase timing data when available.

Reference: https://docs.rightbrain.ai/api-reference/api-reference/agents/get-task-agent-session-detail

## 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.
- `session_id` (string, required) — The session ID (UUID format, server-generated).

## Response

### 200

Session detail

- `session_id` (string, required) — ADK session ID (string format).
- `task_agent_id` (string, required)
- `run_count` (integer, required) — Number of runs in this session.
- `first_run` (string, required)
- `last_run` (string, required)
- `total_tokens` (integer, required)
- `total_charged_credits` (string, required) — Sum of total_charged_credits across all runs in this session.
- `runs` (list of TaskAgentRunRead, optional, default: []) — Runs in this 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.

- `GetTaskAgentSessionDetailRequestForbiddenError`
  - PermissionCheckFailedErrorResponse: PermissionCheckFailedErrorResponse
  - MissingAuthenticationErrorResponse: MissingAuthenticationErrorResponse

### 404 Not Found Error

Session 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 session detail

- `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

### TaskAgentRunRead

Schema for reading a TaskAgentRun.

- `id` (string, required)
- `task_agent_id` (string, required)
- `session_id` (string, required) — ADK session ID (string format).
- `user_id` (string, required, nullable)
- `input_tokens` (integer, required)
- `output_tokens` (integer, required)
- `total_tokens` (integer, required)
- `charged_credits` (string, required, nullable)
- `created` (string, required)
- `completed` (string, required, nullable)
- `duration_ms` (integer, required, nullable)
- `status` (enum, required) — Status of a TaskAgent run.
  - Allowed values: `running`, `waiting_for_human`, `completed`, `failed`
- `is_error` (boolean, required)
- `task_tools_invoked` (list of TaskToolInvocationRead, required, nullable)
- `is_chaos_run` (boolean, required)
- `task_agent_revision_id` (string, optional, nullable)
- `adk_session_user_id` (string, optional, nullable)
- `actor_user_id` (string, optional, nullable) — User whose authority caused this run.
- `actor_basis` (string, optional, nullable) — Reason the run actor was trusted.
- `execution_surface` (enum, optional, nullable) — Platform surface through which execution entered.
  - Allowed values: `a2a`, `eval`, `gmail_inbox`, `internal_task_agent`, `internal_task_agent_approval_resume`, `mcp`, `schedule`, `slack`, `task_agent_api`, `task_agent_approval_resume`, `task_agent_task_tool`, `task_api`, `webhook`
- `execution_source_id` (string, optional, nullable) — Surface-specific source identifier for correlating this run.
- `invocation_id` (string, optional, nullable)
- `invocation_ids` (list of string, optional, nullable)
- `is_continuation` (boolean, optional, default: false)
- `primary_llm_model_id` (string, optional, nullable)
- `fallback_llm_model_id` (string, optional, nullable)
- `used_fallback_model` (boolean, optional, default: false)
- `primary_failure_reason` (string, optional, nullable)
- `total_charged_credits` (string, optional, nullable)
- `approval_request_ids` (list of string, optional) — IDs of approval requests linked to this TaskAgentRun.
- `approval_requests` (list of TaskAgentRunApprovalSummary, optional) — Compact approval request summaries linked to this TaskAgentRun.
- `had_task_tool_fail` (boolean, optional, default: false)
- `had_mcp_tool_fail` (boolean, optional, default: false)
- `had_integration_tool_fail` (boolean, optional, default: false)
- `skills_activated` (list of SkillActivationRead, optional, nullable)
- `mcp_tools_invoked` (list of McpToolInvocationRead, optional, nullable)
- `integration_tools_invoked` (list of IntegrationToolInvocationRead, optional, nullable)
- `phase_timings` (list of PhaseTimingEntry, optional, nullable)
- `context_usage` (TaskAgentContextUsageRead, optional, nullable)
- `chaos_config` (TaskAgentChaosConfig, optional, nullable) — Run-scoped TaskAgent chaos policy.
- `chaos_events` (list of TaskAgentChaosEventRead, optional, nullable)
- `termination_reason` (string, optional, nullable)
- `last_activity_at` (string, optional, nullable)
- `trigger_type` (string, optional, default: manual) — How the run was triggered. Non-trigger sources include manual, api, and slack; trigger executions use their trigger type value.
- `model_usages` (list of TaskAgentRunModelUsageRead, optional)
- `files` (list of TaskAgentFileMetadata, optional, default: []) — Files associated with this agent run (both uploaded and generated by task tools)

### 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)

### TaskToolInvocationRead

Schema for an individual task tool invocation during a run.

- `task_id` (string, required) — Task ID as a UUID string.
- `task_name` (string, required)
- `task_revision_id` (string, optional, nullable) — TaskRevision ID used for this invocation.
- `task_run_id` (string, optional, nullable)
- `is_error` (boolean, optional, default: false)
- `is_formatter` (boolean, optional, default: false)
- `duration_ms` (integer, optional, nullable) — Task tool execution duration in milliseconds.
- `error_message` (string, optional, nullable) — Short error summary for failed task tool invocations.

### TaskAgentRunApprovalSummary

Compact approval request summary embedded in TaskAgentRun responses.

- `id` (string, required)
- `status` (enum, required) — Lifecycle status for TaskAgent tool approval requests.
  - Allowed values: `pending`, `approved`, `rejected`, `expired`, `cancelled`
- `tool_type` (enum, required) — TaskAgent tool source categories for action controls.
  - Allowed values: `task`, `mcp`, `integration`, `registered_tool`
- `tool_name` (string, required)
- `requested_at` (string, required)
- `decided_at` (string, optional, nullable)
- `requested_by_user_id` (string, optional, nullable)
- `decided_by_user_id` (string, optional, nullable)
- `decision_note` (string, optional, nullable)

### SkillActivationRead

Schema for a declarative skill activation during a run.

- `skill_id` (string, required) — Skill ID as a UUID string.
- `skill_slug` (string, required)
- `skill_display_name` (string, required)
- `activated` (boolean, required) — Whether the LLM loaded this skill during the run.
- `skill_revision_id` (string, optional, nullable)

### McpToolInvocationRead

Schema for an individual MCP tool invocation during a run.

- `server_id` (string, required) — TaskMcpServer ID as a UUID string.
- `server_name` (string, required) — Name of the MCP server.
- `tool_name` (string, required) — Name of the MCP tool that was called.
- `is_error` (boolean, optional, default: false)
- `duration_ms` (integer, optional, nullable) — MCP tool execution duration in milliseconds.
- `error_message` (string, optional, nullable) — Short error summary for failed MCP tool invocations.

### IntegrationToolInvocationRead

Schema for an individual integration tool invocation during a run.

- `integration_id` (string, required) — ProjectIntegration ID as a UUID string.
- `integration_name` (string, required) — Display name of the integration.
- `integration_type` (string, required) — Integration type identifier.
- `integration_tool_id` (string, required) — IntegrationTool ID as a UUID string.
- `tool_name` (string, required) — Runtime name of the integration tool.
- `principal_type` (string, required) — Principal type used for the invocation.
- `is_error` (boolean, optional, default: false)
- `duration_ms` (integer, optional, nullable) — Integration tool execution duration in milliseconds.
- `error_message` (string, optional, nullable) — Short error summary for failed integration tool invocations.

### PhaseTimingEntry

Schema for an orchestration timing phase within a run.

- `phase` (enum, required)
  - Allowed values: `llm_inference`, `task_tool_execution`, `mcp_tool_execution`, `integration_tool_execution`, `skill_activation`, `memory_compaction`
- `start_ms` (integer, required) — Phase start offset in milliseconds.
- `end_ms` (integer, required) — Phase end offset in milliseconds.
- `call_id` (string, optional, nullable) — ADK function_call_id for tool phases.
- `task_run_id` (string, optional, nullable) — TaskRun ID for task tool execution phases.
- `tool_name` (string, optional, nullable) — MCP tool name for MCP execution phases.
- `server_name` (string, optional, nullable) — MCP server name for MCP execution phases.
- `integration_name` (string, optional, nullable) — Integration name for integration execution phases.
- `trigger` (string, optional, nullable) — Trigger for memory compaction phases.
- `compaction_event_id` (string, optional, nullable) — ADK compaction event ID for memory compaction phases.
- `input_tokens` (integer, optional, nullable) — Input tokens used by the memory compaction summarizer.
- `output_tokens` (integer, optional, nullable) — Output tokens produced by the memory compaction summarizer.
- `total_tokens` (integer, optional, nullable) — Total tokens used by the memory compaction summarizer.
- `token_threshold` (integer, optional, nullable) — Configured token threshold for memory compaction phases.
- `event_retention_size` (integer, optional, nullable) — Configured ADK event retention size for token compaction.

### TaskAgentContextUsageRead

- `estimator_version` (string, required)
- `input_tokens` (TaskAgentContextUsageInputTokens, required)
- `schema_version` (integer, optional, default: 1)
- `input_files` (TaskAgentContextUsageInputFiles, optional, nullable)
- `output_tokens` (TaskAgentContextUsageOutputTokens, optional, nullable)
- `cache` (TaskAgentContextUsageCache, optional, nullable)
- `runtime_components` (map from string to TaskAgentRuntimeComponentContextUsage, optional)
- `metadata` (TaskAgentContextUsageMetadata, optional)

### TaskAgentChaosConfig

Run-scoped TaskAgent chaos policy.

- `enabled` (boolean, optional, default: true)
- `seed` (string, optional, nullable)
- `run_index` (integer, optional, default: 0)
- `max_faults` (integer, optional, default: 1)
- `modes` (list of TaskAgentChaosConfigModesItems, optional)

### TaskAgentChaosEventRead

Redacted chaos event persisted on a TaskAgentRun.

- `event_id` (string, required)
- `type` (string, required)
- `applied` (boolean, required)
- `seed` (string, required)
- `sample` (double, required)
- `threshold` (double, required)
- `decision_key` (string, required)
- `call_index` (integer, required)
- `target` (map from string to any, required)
- `phase` (string, required)
- `occurred_at` (string, required)
- `call_id` (string, optional, nullable)
- `latency_ms` (integer, optional, nullable)
- `tool_execution_skipped` (boolean, optional, nullable)
- `retryable` (boolean, optional, nullable)
- `error` (string, optional, nullable)
- `variant` (string, optional, nullable)
- `reason` (string, optional, nullable)

### TaskAgentRunModelUsageRead

Schema for reading per-model TaskAgent run usage.

- `id` (string, required)
- `task_agent_run_id` (string, required)
- `llm_model_id` (string, required, nullable)
- `usage_scope` (enum, required)
  - Allowed values: `reasoning`, `memory_compaction`
- `usage_type` (enum, required)
  - Allowed values: `primary`, `fallback`
- `input_tokens` (integer, required)
- `output_tokens` (integer, required)
- `total_tokens` (integer, required)
- `charged_credits` (string, required, nullable)
- `call_count` (integer, required)
- `created` (string, required)
- `modified` (string, required, nullable)

### 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

### TaskAgentContextUsageInputTokens

- `provider_total` (integer, optional, nullable)
- `observed_provider_total` (integer, optional, nullable)
- `estimated_total` (integer, optional, default: 0)
- `uncategorized` (integer, optional, nullable)
- `breakdown` (map from string to integer, optional)

### TaskAgentContextUsageInputFiles

- `estimated_tokens` (integer, optional, default: 0)
- `file_count` (integer, optional, default: 0)
- `text_file_count` (integer, optional, default: 0)
- `binary_file_count` (integer, optional, default: 0)
- `total_bytes` (integer, optional, default: 0)

### TaskAgentContextUsageOutputTokens

- `provider_total` (integer, optional, nullable)
- `observed_provider_total` (integer, optional, nullable)

### TaskAgentContextUsageCache

- `enabled` (boolean, optional, default: false)
- `gross_input_tokens` (integer, optional, default: 0)
- `cached_input_tokens` (integer, optional, default: 0)
- `cached_input_billing_ratio` (string, optional, nullable)
- `billing_input_tokens` (integer, optional, nullable)
- `billing_cached_read_input_tokens` (integer, optional, nullable)
- `requests_with_cached_tokens` (integer, optional, default: 0)

### TaskAgentRuntimeComponentContextUsage

- `estimated_tokens` (integer, optional, default: 0)
- `tool_declarations` (TaskAgentToolDeclarationContextUsage, optional)
- `loaded_payloads` (integer, optional, nullable)
- `provenance` (map from string to integer, optional)

### TaskAgentContextUsageMetadata

- `request_count` (integer, optional, default: 0)
- `partial` (boolean, optional, default: false)
- `provider_usage_missing` (boolean, optional, default: false)
- `provider_usage_complete` (boolean, optional, default: false)
- `observed_provider_total_tokens` (integer, optional, nullable)
- `context_window_attempted_input_tokens` (integer, optional, nullable)
- `context_window_limit_tokens` (integer, optional, nullable)
- `estimation_truncated` (boolean, optional, default: false)
- `truncated_estimate_count` (integer, optional, default: 0)
- `max_estimated_part_bytes` (integer, optional, nullable)
- `estimation_methods` (list of string, optional)

### TaskAgentChaosConfigModesItems

- `type`: `model_error` (TaskAgentChaosModelErrorMode)
  - `error` (enum, required)
    - Allowed values: `timeout`, `rate_limit`, `provider_unavailable`, `transient_internal`
  - `probability` (double, required)
- `type`: `tool_error` (TaskAgentChaosToolErrorMode)
  - `probability` (double, required)
  - `retryable` (boolean, optional, default: false)
  - `targets` (TaskAgentChaosTargets, optional, nullable) — Tool targets eligible for a chaos mode.
  - `variant` (enum, optional, nullable)
    - Allowed values: `empty_result`, `missing_fields`, `null_fields`, `unexpected_nesting`, `truncated_result`, `stale_result`
- `type`: `tool_latency` (TaskAgentChaosToolLatencyMode)
  - `latency_ms` (TaskAgentChaosLatencyRange, required) — Bounded per-fault latency injection range.
  - `probability` (double, required)
  - `targets` (TaskAgentChaosTargets, optional, nullable) — Tool targets eligible for a chaos mode.

### 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

### TaskAgentToolDeclarationContextUsage

- `estimated_tokens` (integer, optional, default: 0)
- `count` (integer, optional, default: 0)
- `unavailable_count` (integer, optional, default: 0)
- `error_count` (integer, optional, default: 0)

### TaskAgentChaosTargets

Tool targets eligible for a chaos mode.

- `tool_names` (list of string, optional, nullable)
- `sources` (list of enum, optional, nullable)
  - Allowed values: `task`, `mcp`, `integration`, `registered_tool`

### TaskAgentChaosLatencyRange

Bounded per-fault latency injection range.

- `min` (integer, required)
- `max` (integer, required)

### ErrorResponseDetailOneOf2ErrorsItemsLocItems

- string
- integer

### IAMObjectErrorDetails

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

## Examples

**Response**

```json
{
  "session_id": "019fa2da-4790-7718-8edc-ae551b239242",
  "task_agent_id": "019df849-e106-3301-5894-291b4c9c6cab",
  "run_count": 2,
  "first_run": "2026-07-27T09:14:02Z",
  "last_run": "2026-07-27T09:22:40Z",
  "total_tokens": 3390,
  "total_charged_credits": "6.15",
  "runs": [
    {
      "id": "019fa2da-4790-712c-aaa2-cb8d287b620b",
      "task_agent_id": "019df849-e106-3301-5894-291b4c9c6cab",
      "session_id": "019fa2da-4790-7718-8edc-ae551b239242",
      "user_id": "0190c234-1111-2222-3333-444444444444",
      "input_tokens": 1840,
      "output_tokens": 410,
      "total_tokens": 2250,
      "charged_credits": "4.10",
      "created": "2026-07-27T09:14:02Z",
      "completed": "2026-07-27T09:14:11Z",
      "duration_ms": 9130,
      "status": "completed",
      "is_error": false,
      "task_tools_invoked": [
        {
          "task_id": "019df7a2-44a0-7f6b-8a18-d81df57049d0",
          "task_name": "Customer Support Analyzer",
          "task_revision_id": "019df7a2-44a0-75d6-b036-4e86f6d45302",
          "task_run_id": "019fa2da-4790-798a-9530-76940e914d17",
          "is_error": false,
          "is_formatter": false,
          "duration_ms": 1120
        },
        {
          "task_id": "019df7a2-44a0-7186-92a6-a8e45e78537b",
          "task_name": "Draft Support Reply",
          "task_revision_id": "019df7a2-44a0-78c4-ba7b-6ae382a6253a",
          "task_run_id": "019fa2da-4790-7bff-bc7a-c397d193f25e",
          "is_error": false,
          "is_formatter": true,
          "duration_ms": 2380
        }
      ],
      "is_chaos_run": false,
      "task_agent_revision_id": "019df849-e12a-b57e-62d4-0e5875e91ef4",
      "adk_session_user_id": "0190c234-1111-2222-3333-444444444444",
      "actor_user_id": "0190c234-1111-2222-3333-444444444444",
      "actor_basis": "direct_user",
      "execution_surface": "task_agent_api",
      "execution_source_id": "019df849-e106-3301-5894-291b4c9c6cab",
      "invocation_id": "019fa2da-4790-7e73-b7af-bfd124a96ed6",
      "invocation_ids": [
        "019fa2da-4790-7e73-b7af-bfd124a96ed6"
      ],
      "is_continuation": false,
      "primary_llm_model_id": "ec217e75-72ea-4281-a1b8-cb7bd0ef9f41",
      "fallback_llm_model_id": "af2a9bbf-5f36-4b12-bd3f-92c57be96dec",
      "used_fallback_model": false,
      "total_charged_credits": "4.10",
      "approval_request_ids": [],
      "approval_requests": [],
      "had_task_tool_fail": false,
      "had_mcp_tool_fail": false,
      "had_integration_tool_fail": false,
      "integration_tools_invoked": [
        {
          "integration_id": "019df7a2-44a0-7a75-ae4f-4c8edcdac22e",
          "integration_name": "Customer Database",
          "integration_type": "google_sheets",
          "integration_tool_id": "019df7a2-44a0-7b09-afd0-c59cbc20126d",
          "tool_name": "sheets_spreadsheets_values_get",
          "principal_type": "project_default",
          "is_error": false,
          "duration_ms": 640
        }
      ],
      "phase_timings": [
        {
          "phase": "llm_inference",
          "start_ms": 0,
          "end_ms": 1450
        },
        {
          "phase": "integration_tool_execution",
          "start_ms": 1450,
          "end_ms": 2090,
          "call_id": "call-2b3c4d5e6f70",
          "tool_name": "sheets_spreadsheets_values_get",
          "integration_name": "Customer Database"
        },
        {
          "phase": "task_tool_execution",
          "start_ms": 2090,
          "end_ms": 4470,
          "call_id": "call-3c4d5e6f7081",
          "task_run_id": "019fa2da-4790-7bff-bc7a-c397d193f25e"
        }
      ],
      "context_usage": {
        "estimator_version": "task_agent_context_usage_v1",
        "input_tokens": {
          "provider_total": 1840,
          "observed_provider_total": 1840,
          "estimated_total": 1890,
          "uncategorized": 0,
          "breakdown": {
            "conversation_history": 0,
            "current_user_message": 23,
            "input_files": 0,
            "instructions": 153,
            "integrations": 0,
            "mcp_tools": 0,
            "registered_tools": 0,
            "runtime_file": 108,
            "skills": 0,
            "task_tools": 20
          }
        },
        "schema_version": 1,
        "input_files": {
          "estimated_tokens": 0,
          "file_count": 0,
          "text_file_count": 0,
          "binary_file_count": 0,
          "total_bytes": 0
        },
        "output_tokens": {
          "provider_total": 410,
          "observed_provider_total": 410
        },
        "runtime_components": {
          "integrations": {
            "estimated_tokens": 0,
            "tool_declarations": {
              "estimated_tokens": 0,
              "count": 0,
              "unavailable_count": 0,
              "error_count": 0
            },
            "provenance": {}
          },
          "mcp_tools": {
            "estimated_tokens": 0,
            "tool_declarations": {
              "estimated_tokens": 0,
              "count": 0,
              "unavailable_count": 0,
              "error_count": 0
            },
            "provenance": {}
          },
          "registered_tools": {
            "estimated_tokens": 0,
            "tool_declarations": {
              "estimated_tokens": 0,
              "count": 0,
              "unavailable_count": 0,
              "error_count": 0
            },
            "provenance": {}
          },
          "runtime_file": {
            "estimated_tokens": 108,
            "tool_declarations": {
              "estimated_tokens": 108,
              "count": 1,
              "unavailable_count": 0,
              "error_count": 0
            },
            "provenance": {
              "manual": 108
            }
          },
          "skills": {
            "estimated_tokens": 0,
            "tool_declarations": {
              "estimated_tokens": 0,
              "count": 0,
              "unavailable_count": 0,
              "error_count": 0
            },
            "loaded_payloads": 0,
            "provenance": {}
          },
          "task_tools": {
            "estimated_tokens": 20,
            "tool_declarations": {
              "estimated_tokens": 20,
              "count": 1,
              "unavailable_count": 0,
              "error_count": 0
            },
            "provenance": {
              "manual": 20
            }
          }
        },
        "metadata": {
          "request_count": 1,
          "partial": false,
          "provider_usage_missing": false,
          "provider_usage_complete": true,
          "observed_provider_total_tokens": 2250,
          "estimation_truncated": false,
          "truncated_estimate_count": 0,
          "estimation_methods": [
            "utf8_bytes_div_4"
          ]
        }
      },
      "last_activity_at": "2026-07-27T09:14:11Z",
      "trigger_type": "api",
      "model_usages": [
        {
          "id": "019fa2da-4790-7fa0-9552-00540687d1cb",
          "task_agent_run_id": "019fa2da-4790-712c-aaa2-cb8d287b620b",
          "llm_model_id": "ec217e75-72ea-4281-a1b8-cb7bd0ef9f41",
          "usage_scope": "reasoning",
          "usage_type": "primary",
          "input_tokens": 1840,
          "output_tokens": 410,
          "total_tokens": 2250,
          "charged_credits": "4.10",
          "call_count": 3,
          "created": "2026-07-27T09:14:02Z",
          "modified": "2026-07-27T09:14:11Z"
        }
      ],
      "files": []
    },
    {
      "id": "019fa2e2-2f00-7be2-bcf0-f056f44f700a",
      "task_agent_id": "019df849-e106-3301-5894-291b4c9c6cab",
      "session_id": "019fa2da-4790-7718-8edc-ae551b239242",
      "user_id": "0190c234-1111-2222-3333-444444444444",
      "input_tokens": 960,
      "output_tokens": 180,
      "total_tokens": 1140,
      "charged_credits": "2.05",
      "created": "2026-07-27T09:22:40Z",
      "completed": "2026-07-27T09:24:20Z",
      "duration_ms": 100000,
      "status": "completed",
      "is_error": false,
      "task_tools_invoked": [
        {
          "task_id": "019df7a2-44a0-7186-92a6-a8e45e78537b",
          "task_name": "Draft Support Reply",
          "task_revision_id": "019df7a2-44a0-78c4-ba7b-6ae382a6253a",
          "task_run_id": "019fa2e2-2f00-7f38-a32e-85d18e953d52",
          "is_error": false,
          "is_formatter": true,
          "duration_ms": 1360
        }
      ],
      "is_chaos_run": false,
      "task_agent_revision_id": "019df849-e12a-b57e-62d4-0e5875e91ef4",
      "adk_session_user_id": "0190c234-1111-2222-3333-444444444444",
      "actor_user_id": "0190c234-1111-2222-3333-444444444444",
      "actor_basis": "direct_user",
      "execution_surface": "task_agent_approval_resume",
      "execution_source_id": "019fa2e2-2f00-71c7-aee7-539ab31cd302",
      "invocation_id": "019fa2e2-2f00-7a54-9f70-cd49ad3571d2",
      "invocation_ids": [
        "019fa2e2-2f00-7a54-9f70-cd49ad3571d2"
      ],
      "is_continuation": true,
      "primary_llm_model_id": "ec217e75-72ea-4281-a1b8-cb7bd0ef9f41",
      "fallback_llm_model_id": "af2a9bbf-5f36-4b12-bd3f-92c57be96dec",
      "used_fallback_model": false,
      "total_charged_credits": "2.05",
      "approval_request_ids": [
        "019fa2e2-2f00-71c7-aee7-539ab31cd302"
      ],
      "approval_requests": [
        {
          "id": "019fa2e2-2f00-71c7-aee7-539ab31cd302",
          "status": "approved",
          "tool_type": "integration",
          "tool_name": "sheets_spreadsheets_values_append",
          "requested_at": "2026-07-27T09:22:41Z",
          "decided_at": "2026-07-27T09:24:15Z",
          "requested_by_user_id": "0190c234-1111-2222-3333-444444444444",
          "decided_by_user_id": "019df7a2-44a0-7f54-8478-e19c351d1cc8",
          "decision_note": "Approved — logging the resolved ticket is fine."
        }
      ],
      "had_task_tool_fail": false,
      "had_mcp_tool_fail": false,
      "had_integration_tool_fail": false,
      "integration_tools_invoked": [
        {
          "integration_id": "019df7a2-44a0-7a75-ae4f-4c8edcdac22e",
          "integration_name": "Customer Database",
          "integration_type": "google_sheets",
          "integration_tool_id": "019df7a2-44a0-7923-9ea9-87be4ba93be9",
          "tool_name": "sheets_spreadsheets_values_append",
          "principal_type": "project_default",
          "is_error": false,
          "duration_ms": 510
        }
      ],
      "last_activity_at": "2026-07-27T09:24:20Z",
      "trigger_type": "api",
      "model_usages": [
        {
          "id": "019fa2e2-2f00-76c3-8b69-2a582554fe03",
          "task_agent_run_id": "019fa2e2-2f00-7be2-bcf0-f056f44f700a",
          "llm_model_id": "ec217e75-72ea-4281-a1b8-cb7bd0ef9f41",
          "usage_scope": "reasoning",
          "usage_type": "primary",
          "input_tokens": 960,
          "output_tokens": 180,
          "total_tokens": 1140,
          "charged_credits": "2.05",
          "call_count": 2,
          "created": "2026-07-27T09:22:40Z",
          "modified": "2026-07-27T09:24:20Z"
        }
      ],
      "files": []
    }
  ]
}
```

**SDK Code**

```python Task Agents_getTaskAgentSessionDetail_example
import requests

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

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

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

print(response.json())
```

```javascript Task Agents_getTaskAgentSessionDetail_example
const url = 'https://app.rightbrain.ai/api/v1/org/org_id/project/project_id/task-agent/task_agent_id/session/session_id';
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_getTaskAgentSessionDetail_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/session/session_id"

	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_getTaskAgentSessionDetail_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/session/session_id")

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_getTaskAgentSessionDetail_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/session/session_id")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php Task Agents_getTaskAgentSessionDetail_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/session/session_id', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp Task Agents_getTaskAgentSessionDetail_example
using RestSharp;

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

```swift Task Agents_getTaskAgentSessionDetail_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/session/session_id")! 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()
```