curl --request GET \
--url https://api.honcho.dev/v3/workspaces/{workspace_id}/sessions/{session_id}/context \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.honcho.dev/v3/workspaces/{workspace_id}/sessions/{session_id}/context"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.honcho.dev/v3/workspaces/{workspace_id}/sessions/{session_id}/context', 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://api.honcho.dev/v3/workspaces/{workspace_id}/sessions/{session_id}/context",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.honcho.dev/v3/workspaces/{workspace_id}/sessions/{session_id}/context"
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(string(body))
}HttpResponse<String> response = Unirest.get("https://api.honcho.dev/v3/workspaces/{workspace_id}/sessions/{session_id}/context")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.honcho.dev/v3/workspaces/{workspace_id}/sessions/{session_id}/context")
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{
"id": "<string>",
"messages": [
{
"id": "<string>",
"content": "<string>",
"peer_id": "<string>",
"session_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"workspace_id": "<string>",
"token_count": 123,
"metadata": {}
}
],
"summary": {
"content": "<string>",
"message_id": "<string>",
"summary_type": "<string>",
"created_at": "<string>",
"token_count": 123
},
"peer_representation": "<string>",
"peer_card": [
"<string>"
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Get Session Context
Produce a context object from the Session. The caller provides an optional token limit which the entire context must fit into. If not provided, the context will be exhaustive (within configured max tokens). To do this, we allocate 40% of the token limit to the summary, and 60% to recent messages — as many as can fit. Note that the summary will usually take up less space than this. If the caller does not want a summary, we allocate all the tokens to recent messages.
curl --request GET \
--url https://api.honcho.dev/v3/workspaces/{workspace_id}/sessions/{session_id}/context \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.honcho.dev/v3/workspaces/{workspace_id}/sessions/{session_id}/context"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.honcho.dev/v3/workspaces/{workspace_id}/sessions/{session_id}/context', 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://api.honcho.dev/v3/workspaces/{workspace_id}/sessions/{session_id}/context",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.honcho.dev/v3/workspaces/{workspace_id}/sessions/{session_id}/context"
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(string(body))
}HttpResponse<String> response = Unirest.get("https://api.honcho.dev/v3/workspaces/{workspace_id}/sessions/{session_id}/context")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.honcho.dev/v3/workspaces/{workspace_id}/sessions/{session_id}/context")
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{
"id": "<string>",
"messages": [
{
"id": "<string>",
"content": "<string>",
"peer_id": "<string>",
"session_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"workspace_id": "<string>",
"token_count": 123,
"metadata": {}
}
],
"summary": {
"content": "<string>",
"message_id": "<string>",
"summary_type": "<string>",
"created_at": "<string>",
"token_count": 123
},
"peer_representation": "<string>",
"peer_card": [
"<string>"
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Number of tokens to use for the context. Includes summary if set to true. Includes representation and peer card if they are included in the response. If not provided, the context will be exhaustive (within 100000 tokens)
x <= 100000A query string used to fetch semantically relevant conclusions
Whether or not to include a summary if one is available for the session
The target of the perspective. If given without peer_perspective, will get the Honcho-level representation and peer card for this peer. If given with peer_perspective, will get the representation and card for this peer from the perspective of that peer.
A peer to get context for. If given, response will attempt to include representation and card from the perspective of that peer. Must be provided with peer_target.
An (unprefixed) scope name to use as the perspective source: the representation and peer card of peer_target are read from the scope's observations instead of the global (or peer_perspective) view. Must be provided with peer_target; mutually exclusive with peer_perspective. Requires a workspace- or admin-level key.
Optional allowlist of session IDs confining the representation of peer_target to those sessions. This session must be one of them. Recall is restricted to conclusions stated directly in the allowed sessions — conclusions synthesized across sessions are excluded, since their provenance cannot be proven to sit inside the allowlist — and the peer card is omitted for the same reason. Mutually exclusive with scope and limit_to_session. A peer-scoped key must be an active member of every session named. The 1,000-session cap shared with the recall endpoints applies but is not reachable here: these are repeated query parameters, so a long list exceeds the request-line limit of the server or any proxy in front of it (a 414/431, not a 422) at a few hundred entries. Use a named scope for large or reusable session sets.
Whether to limit the representation to the session (as opposed to everything known about the target peer). Narrows recall the same way sessions does, so the same restrictions apply: explicit-only conclusions, and the peer card is omitted because it carries no per-session provenance.
Only used if search_query is provided. The number of semantic-search-retrieved conclusions to include in the representation
1 <= x <= 100Only used if search_query is provided. The maximum distance to search for semantically relevant conclusions
0 <= x <= 1Only used if search_query is provided. Whether to include the most frequent conclusions in the representation
Only used if search_query is provided. The maximum number of conclusions to include in the representation
1 <= x <= 100Response
Successful Response
Show child attributes
Show child attributes
The summary if available
Show child attributes
Show child attributes
A curated subset of a peer representation, if context is requested from a specific perspective
The peer card, if context is requested from a specific perspective
Was this page helpful?