Skip to main content

hiloop

A client library for accessing

hiloop.api

Contains methods for accessing the API

hiloop.api.identity_service

Contains endpoint functions for accessing the API

hiloop.api.identity_service.identity_service_who_am_i

sync_detailed

def sync_detailed(
        *, client: AuthenticatedClient | Client) -> Response[WhoAmIResponse]
Echo the caller identity stamped by authz. Acts as both a health probe and an identity sanity-check. The HTTP binding is what the Envoy gRPC-JSON transcoder exposes and what the generated OpenAPI/SDKs/CLI consume. Raises:
  • errors.UnexpectedStatus - If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
  • httpx.TimeoutException - If the request takes longer than Client.timeout.
Returns: Response[WhoAmIResponse]

sync

def sync(*, client: AuthenticatedClient | Client) -> WhoAmIResponse | None
Echo the caller identity stamped by authz. Acts as both a health probe and an identity sanity-check. The HTTP binding is what the Envoy gRPC-JSON transcoder exposes and what the generated OpenAPI/SDKs/CLI consume. Raises:
  • errors.UnexpectedStatus - If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
  • httpx.TimeoutException - If the request takes longer than Client.timeout.
Returns: WhoAmIResponse

asyncio_detailed

async def asyncio_detailed(
        *, client: AuthenticatedClient | Client) -> Response[WhoAmIResponse]
Echo the caller identity stamped by authz. Acts as both a health probe and an identity sanity-check. The HTTP binding is what the Envoy gRPC-JSON transcoder exposes and what the generated OpenAPI/SDKs/CLI consume. Raises:
  • errors.UnexpectedStatus - If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
  • httpx.TimeoutException - If the request takes longer than Client.timeout.
Returns: Response[WhoAmIResponse]

asyncio

async def asyncio(
        *, client: AuthenticatedClient | Client) -> WhoAmIResponse | None
Echo the caller identity stamped by authz. Acts as both a health probe and an identity sanity-check. The HTTP binding is what the Envoy gRPC-JSON transcoder exposes and what the generated OpenAPI/SDKs/CLI consume. Raises:
  • errors.UnexpectedStatus - If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
  • httpx.TimeoutException - If the request takes longer than Client.timeout.
Returns: WhoAmIResponse

hiloop.api.telemetry_query_service

Contains endpoint functions for accessing the API

hiloop.api.telemetry_query_service.telemetry_query_service_query

sync_detailed

def sync_detailed(*, client: AuthenticatedClient | Client,
                  body: QueryRequest) -> Response[QueryResponse]
Run a structured query over the caller’s telemetry. Arguments: body (QueryRequest): Raises:
  • errors.UnexpectedStatus - If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
  • httpx.TimeoutException - If the request takes longer than Client.timeout.
Returns: Response[QueryResponse]

sync

def sync(*, client: AuthenticatedClient | Client,
         body: QueryRequest) -> QueryResponse | None
Run a structured query over the caller’s telemetry. Arguments: body (QueryRequest): Raises:
  • errors.UnexpectedStatus - If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
  • httpx.TimeoutException - If the request takes longer than Client.timeout.
Returns: QueryResponse

asyncio_detailed

async def asyncio_detailed(*, client: AuthenticatedClient | Client,
                           body: QueryRequest) -> Response[QueryResponse]
Run a structured query over the caller’s telemetry. Arguments: body (QueryRequest): Raises:
  • errors.UnexpectedStatus - If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
  • httpx.TimeoutException - If the request takes longer than Client.timeout.
Returns: Response[QueryResponse]

asyncio

async def asyncio(*, client: AuthenticatedClient | Client,
                  body: QueryRequest) -> QueryResponse | None
Run a structured query over the caller’s telemetry. Arguments: body (QueryRequest): Raises:
  • errors.UnexpectedStatus - If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
  • httpx.TimeoutException - If the request takes longer than Client.timeout.
Returns: QueryResponse

hiloop.client

Client Objects

@define
class Client()
A class for keeping track of data related to the API The following are accepted as keyword arguments and will be used to construct httpx Clients internally: base_url: The base URL for the API, all requests are made to a relative path to this URL cookies: A dictionary of cookies to be sent with every request headers: A dictionary of headers to be sent with every request timeout: The maximum amount of a time a request can take. API functions will raise httpx.TimeoutException if this is exceeded. verify_ssl: Whether or not to verify the SSL certificate of the API server. This should be True in production, but can be set to False for testing purposes. follow_redirects: Whether or not to follow redirects. Default value is False. httpx_args: A dictionary of additional arguments to be passed to the httpx.Client and httpx.AsyncClient constructor. Attributes:
  • raise_on_unexpected_status - Whether or not to raise an errors.UnexpectedStatus if the API returns a status code that was not documented in the source OpenAPI document. Can also be provided as a keyword argument to the constructor.

with_headers

def with_headers(headers: dict[str, str]) -> Client
Get a new client matching this one with additional headers

with_cookies

def with_cookies(cookies: dict[str, str]) -> Client
Get a new client matching this one with additional cookies

with_timeout

def with_timeout(timeout: httpx.Timeout) -> Client
Get a new client matching this one with a new timeout configuration

set_httpx_client

def set_httpx_client(client: httpx.Client) -> Client
Manually set the underlying httpx.Client NOTE: This will override any other settings on the client, including cookies, headers, and timeout.

get_httpx_client

def get_httpx_client() -> httpx.Client
Get the underlying httpx.Client, constructing a new one if not previously set

__enter__

def __enter__() -> Client
Enter a context manager for self.client—you cannot enter twice (see httpx docs)

__exit__

def __exit__(*args: Any, **kwargs: Any) -> None
Exit a context manager for internal httpx.Client (see httpx docs)

set_async_httpx_client

def set_async_httpx_client(async_client: httpx.AsyncClient) -> Client
Manually set the underlying httpx.AsyncClient NOTE: This will override any other settings on the client, including cookies, headers, and timeout.

get_async_httpx_client

def get_async_httpx_client() -> httpx.AsyncClient
Get the underlying httpx.AsyncClient, constructing a new one if not previously set

__aenter__

async def __aenter__() -> Client
Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)

__aexit__

async def __aexit__(*args: Any, **kwargs: Any) -> None
Exit a context manager for underlying httpx.AsyncClient (see httpx docs)

AuthenticatedClient Objects

@define
class AuthenticatedClient()
A Client which has been authenticated for use on secured endpoints The following are accepted as keyword arguments and will be used to construct httpx Clients internally: base_url: The base URL for the API, all requests are made to a relative path to this URL cookies: A dictionary of cookies to be sent with every request headers: A dictionary of headers to be sent with every request timeout: The maximum amount of a time a request can take. API functions will raise httpx.TimeoutException if this is exceeded. verify_ssl: Whether or not to verify the SSL certificate of the API server. This should be True in production, but can be set to False for testing purposes. follow_redirects: Whether or not to follow redirects. Default value is False. httpx_args: A dictionary of additional arguments to be passed to the httpx.Client and httpx.AsyncClient constructor. Attributes:
  • raise_on_unexpected_status - Whether or not to raise an errors.UnexpectedStatus if the API returns a status code that was not documented in the source OpenAPI document. Can also be provided as a keyword argument to the constructor.
  • token - The token to use for authentication
  • prefix - The prefix to use for the Authorization header
  • auth_header_name - The name of the Authorization header

with_headers

def with_headers(headers: dict[str, str]) -> AuthenticatedClient
Get a new client matching this one with additional headers

with_cookies

def with_cookies(cookies: dict[str, str]) -> AuthenticatedClient
Get a new client matching this one with additional cookies

with_timeout

def with_timeout(timeout: httpx.Timeout) -> AuthenticatedClient
Get a new client matching this one with a new timeout configuration

set_httpx_client

def set_httpx_client(client: httpx.Client) -> AuthenticatedClient
Manually set the underlying httpx.Client NOTE: This will override any other settings on the client, including cookies, headers, and timeout.

get_httpx_client

def get_httpx_client() -> httpx.Client
Get the underlying httpx.Client, constructing a new one if not previously set

__enter__

def __enter__() -> AuthenticatedClient
Enter a context manager for self.client—you cannot enter twice (see httpx docs)

__exit__

def __exit__(*args: Any, **kwargs: Any) -> None
Exit a context manager for internal httpx.Client (see httpx docs)

set_async_httpx_client

def set_async_httpx_client(
        async_client: httpx.AsyncClient) -> AuthenticatedClient
Manually set the underlying httpx.AsyncClient NOTE: This will override any other settings on the client, including cookies, headers, and timeout.

get_async_httpx_client

def get_async_httpx_client() -> httpx.AsyncClient
Get the underlying httpx.AsyncClient, constructing a new one if not previously set

__aenter__

async def __aenter__() -> AuthenticatedClient
Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)

__aexit__

async def __aexit__(*args: Any, **kwargs: Any) -> None
Exit a context manager for underlying httpx.AsyncClient (see httpx docs)

hiloop.errors

Contains shared errors types that can be raised from API functions

UnexpectedStatus Objects

class UnexpectedStatus(Exception)
Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True

hiloop.models

Contains all the data models used in inputs/outputs

hiloop.models.attribute_value

AttributeValue Objects

@_attrs_define
class AttributeValue()
A typed scalar attribute value (mirrors the Event v1 narrow value model). Attributes: string_value (str | Unset): int_value (str | Unset): double_value (float | Unset): bool_value (bool | Unset):

hiloop.models.calculation

Calculation Objects

@_attrs_define
class Calculation()
Attributes: op (CalculationOp | Unset):
  • column str | Unset - The column to aggregate. Required for every op except COUNT.

hiloop.models.calculation_op

hiloop.models.filter_

Filter Objects

@_attrs_define
class Filter()
Attributes: column (str | Unset): op (FilterOp | Unset):
  • value AttributeValue | Unset - A typed scalar attribute value (mirrors the Event v1 narrow value model).

hiloop.models.filter_op

hiloop.models.identity

Identity Objects

@_attrs_define
class Identity()
The caller identity, as resolved by the authz enforcement point and stamped onto the request as x-hiloop-* headers. The hiloop API edge trusts these headers; it does not re-authenticate. Attributes:
  • org_id str | Unset - x-hiloop-org-id — the organization the caller acts in.
  • tenant_id str | Unset - x-hiloop-tenant-id — the tenant the caller acts in (drives app.tenant_id / RLS downstream).
  • user_id str | Unset - x-hiloop-user-id — the user, when the credential is user-scoped; empty for service keys.
  • auth_method str | Unset - x-hiloop-auth-method — how the caller authenticated (e.g. “api_key”, “session”).
  • scope str | Unset - x-hiloop-scope — the granted scope, when present.

hiloop.models.order

Order Objects

@_attrs_define
class Order()
Attributes: column (str | Unset): descending (bool | Unset):

hiloop.models.query_request

QueryRequest Objects

@_attrs_define
class QueryRequest()
Attributes:
  • spec QuerySpec | Unset - A structured, server-validated query. The set of addressable columns is fixed by the canonical event schema; unknown columns are rejected.

hiloop.models.query_response

QueryResponse Objects

@_attrs_define
class QueryResponse()
Attributes: rows (list[Row] | Unset):

hiloop.models.query_spec

QuerySpec Objects

@_attrs_define
class QuerySpec()
A structured, server-validated query. The set of addressable columns is fixed by the canonical event schema; unknown columns are rejected. Attributes:
  • run_id str | Unset - The run (session) to query. Required.
  • fork_path str | Unset - Subtree anchor: the fork-node path to scope to. Empty means the whole run.
  • calculations list[Calculation] | Unset - Aggregations to compute. Empty means return matching rows (subject to limit).
  • breakdowns list[str] | Unset - Group-by columns for the calculations.
  • filters list[Filter] | Unset - Conjunctive (AND-ed) typed predicates.
  • time_range TimeRange | Unset - Inclusive wall-clock window in nanoseconds (matches CanonicalEvent.ts_wall_ns). orders (list[Order] | Unset):
  • limit int | Unset - Row cap; clamped server-side to a maximum.

hiloop.models.row

Row Objects

@_attrs_define
class Row()
One result row: column name -> typed value. For aggregations the columns are the breakdown columns plus one per calculation (e.g. “p95_duration_ns”). Attributes: columns (RowColumns | Unset):

hiloop.models.row_columns

RowColumns Objects

@_attrs_define
class RowColumns()

hiloop.models.time_range

TimeRange Objects

@_attrs_define
class TimeRange()
Inclusive wall-clock window in nanoseconds (matches CanonicalEvent.ts_wall_ns). Attributes: start_ns (str | Unset): end_ns (str | Unset):

hiloop.models.who_am_i_response

WhoAmIResponse Objects

@_attrs_define
class WhoAmIResponse()
Attributes:
  • identity Identity | Unset - The caller identity, as resolved by the authz enforcement point and stamped onto the request as x-hiloop-* headers. The hiloop API edge trusts these headers; it does not re-authenticate.

hiloop.types

Contains some shared types for properties

File Objects

@define
class File()
Contains information for file uploads

to_tuple

def to_tuple() -> FileTypes
Return a tuple representation that httpx will accept for multipart/form-data

Response Objects

@define
class Response(Generic[T])
A response from an endpoint