Stream Kg Events
curl --request GET \
--url https://api.example.com/api/v1/kg/boards/{board_id}/eventsimport requests
url = "https://api.example.com/api/v1/kg/boards/{board_id}/events"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/kg/boards/{board_id}/events', 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.example.com/api/v1/kg/boards/{board_id}/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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.example.com/api/v1/kg/boards/{board_id}/events"
req, _ := http.NewRequest("GET", url, nil)
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.example.com/api/v1/kg/boards/{board_id}/events")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/kg/boards/{board_id}/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}knowledge-graph
Stream Kg Events
Server-Sent Events stream of `kg.session.committed` /
`kg.board.cleared` events for the given board.
The stream reads the `global_update_outbox` table for the latest events
and emits new rows at a 1-second poll cadence. This endpoint is the
backing data source for the React `useKgLiveEvents` hook (Frontend
responsibility — hook implementation lives in the sibling UI repo).
Protocol:
event: kg.session.committed
data: {"event_id": ..., "session_id": ..., "payload": {...}}
Filter by `since` to resume a dropped connection without replaying the
entire outbox backlog. Absence ⇒ start from now().
Bug fix (QueuePool exhaustion): este handler NÃO injeta mais
``db: AsyncSession = Depends(get_db)`` porque a session da request
ficaria viva durante toda a vida do SSE stream (loop ``while True``
forever) — cada cliente prendia 1 conexão do pool, e um pool de 15
saturava com poucas tabs/clientes (somando consolidation_worker,
outbox_worker, dispatcher e endpoints normais). Em vez disso abrimos
uma sessão **por iteração** via ``async_session_factory``, devolvendo
a conexão ao pool entre os ``sleep(1.0)``.
GET
/
api
/
v1
/
kg
/
boards
/
{board_id}
/
events
Stream Kg Events
curl --request GET \
--url https://api.example.com/api/v1/kg/boards/{board_id}/eventsimport requests
url = "https://api.example.com/api/v1/kg/boards/{board_id}/events"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/kg/boards/{board_id}/events', 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.example.com/api/v1/kg/boards/{board_id}/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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.example.com/api/v1/kg/boards/{board_id}/events"
req, _ := http.NewRequest("GET", url, nil)
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.example.com/api/v1/kg/boards/{board_id}/events")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/kg/boards/{board_id}/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}Last modified on May 17, 2026