Skip to main content
POST
/
v1
/
explainability
/
context-attributor-from-run
Get context attribution from run
curl --request POST \
  --url https://flow.seekr.com/v1/explainability/context-attributor-from-run \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "thread_id": "<string>",
  "run_id": "<string>",
  "highlight": "<string>",
  "granularity": "sentence",
  "top_k": 5,
  "num_ablations": 123,
  "return_diagnostics": false
}
'
import requests

url = "https://flow.seekr.com/v1/explainability/context-attributor-from-run"

payload = {
"thread_id": "<string>",
"run_id": "<string>",
"highlight": "<string>",
"granularity": "sentence",
"top_k": 5,
"num_ablations": 123,
"return_diagnostics": False
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
thread_id: '<string>',
run_id: '<string>',
highlight: '<string>',
granularity: 'sentence',
top_k: 5,
num_ablations: 123,
return_diagnostics: false
})
};

fetch('https://flow.seekr.com/v1/explainability/context-attributor-from-run', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://flow.seekr.com/v1/explainability/context-attributor-from-run",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'thread_id' => '<string>',
'run_id' => '<string>',
'highlight' => '<string>',
'granularity' => 'sentence',
'top_k' => 5,
'num_ablations' => 123,
'return_diagnostics' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

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

func main() {

url := "https://flow.seekr.com/v1/explainability/context-attributor-from-run"

payload := strings.NewReader("{\n \"thread_id\": \"<string>\",\n \"run_id\": \"<string>\",\n \"highlight\": \"<string>\",\n \"granularity\": \"sentence\",\n \"top_k\": 5,\n \"num_ablations\": 123,\n \"return_diagnostics\": false\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")

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

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

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://flow.seekr.com/v1/explainability/context-attributor-from-run")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"thread_id\": \"<string>\",\n \"run_id\": \"<string>\",\n \"highlight\": \"<string>\",\n \"granularity\": \"sentence\",\n \"top_k\": 5,\n \"num_ablations\": 123,\n \"return_diagnostics\": false\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://flow.seekr.com/v1/explainability/context-attributor-from-run")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"thread_id\": \"<string>\",\n \"run_id\": \"<string>\",\n \"highlight\": \"<string>\",\n \"granularity\": \"sentence\",\n \"top_k\": 5,\n \"num_ablations\": 123,\n \"return_diagnostics\": false\n}"

response = http.request(request)
puts response.read_body
{
  "response_text": "<string>",
  "segments": [],
  "highlight": "<string>",
  "sources": [
    {
      "id": 123,
      "text": "<string>",
      "attribution": 123,
      "offset": 123,
      "tool_name": "<string>",
      "tool_call_id": "<string>",
      "tool": {
        "url": "<string>",
        "search_query": "<string>",
        "type": "web_search",
        "title": "<string>"
      },
      "source_type": "tool_response"
    }
  ],
  "diagnostics": {
    "num_sources": 123,
    "num_ablations": 123,
    "lasso_alpha": 123,
    "mask_probability": 123,
    "y_vector_stats": {},
    "raw_coef_stats": {},
    "scaler_stats": {}
  }
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}
Extracts context, query, and response from an existing agent run, then computes attribution scores across the retrieved sources. Required fields
  • thread_id — ID of the thread to analyze
Optional fields
  • run_id — The run to analyze. If not provided, uses the latest completed run.
  • highlight — A specific portion of the response to attribute
  • granularity — How to partition the context: sentence or chunk
  • top_k — Number of top sources to return per segment
  • num_ablations — Number of ablation experiments to run (32–256). Auto-computed if not set.
  • return_diagnostics — If true, includes internal diagnostic information in the response. Defaults to false.

Authorizations

Authorization
string
header
required

Your Seekr API key, sent in the Authorization header with no 'Bearer' prefix.

Body

application/json

Request model for context attribution from an agent run. Extracts the context, query, and response from the run, then computes attribution scores across the retrieved sources.

thread_id
string
required

ID of the thread to analyze.

run_id
string | null

Optional run ID. If not provided, uses the latest completed run.

highlight
string | null

Specific portion of response to attribute. If None, attributes all segments.

granularity
enum<string>
default:sentence

Granularity for partitioning context: sentence or chunk.

Available options:
sentence,
chunk
top_k
integer
default:5

Number of top attributed sources to return per segment.

Required range: x >= 1
num_ablations
integer | null

Number of ablation experiments to run. If None, computed dynamically using O(k log d) formula. Must be between 32 and 256 (inclusive) if specified.

return_diagnostics
boolean
default:false

If True, include diagnostic information in the response.

Response

Successful Response

Response model for context attribution.

response_text
string
required

The full response text that was attributed.

segments
SegmentAttribution · object[]

Attribution results for each response segment. Populated when highlight is not provided.

highlight
string | null

The highlighted portion of the response (if provided in request).

sources
(ToolResponseSource · object | RawContextSource · object | SystemPromptSource · object)[] | null

Context sources for the highlight. Only populated when highlight is provided.

A context source that originated from a tool call.

This model contains the core attribution fields plus tool-specific metadata nested in the tool field.

diagnostics
ContextAttributionDiagnostics · object | null

Diagnostic information. Only populated when return_diagnostics=True.

Last modified on June 25, 2026