Context Engine API
Table of Contents
upsquad/contextengine/v1/knobs_config.proto
ContextEngineKnobsConfig
ContextEngineKnobsConfig carries all runtime-tunable knobs that influence the Context Engine's per-call behaviour. Every field is individually clearance-annotated so the B7 resolver + generated form can fan-mask correctly.
| Field | Type | Label | Description |
|---|---|---|---|
| compaction_window_size | int32 | CompactionWindowSize is the maximum number of recent events the sliding-window compactor keeps verbatim. 0 falls back to the built-in default (currently max(ceil(0.2*total), 1) capped at 20). | |
| compaction_threshold_events | int32 | CompactionThresholdEvents is the session-event count beyond which compaction auto-runs. 0 means "never auto-run; compaction is manual-only for this tenant". | |
| embedding_provider_id | string | EmbeddingProviderID selects which embedding provider the engine uses for all subsequent writes. Valid values are registered platform providers (cf. AIGatewayCatalogConfig.providers). Empty means "platform default". L5 because changing this invalidates the tenant's existing vector index — not a tenant-level knob. | |
| retrieval_rrf_vector_weight | double | RetrievalRRFVectorWeight is the weight applied to the vector retrieval channel in the Reciprocal-Rank-Fusion merge. Range: [0.0, 1.0]. The BM25 channel weight is (1.0 - this value). 0.0 means "platform default (currently 0.5)". | |
| retrieval_vector_top_k | int32 | RetrievalVectorTopK is the k used for the vector-search stage of retrieval. 0 means "platform default (currently 32)". Capped at 200 at validate time — larger k is never useful and is a latency foot-gun. | |
| updated_at | google.protobuf.Timestamp | UpdatedAt is stamped server-side on every Update. Read-only. |
GetContextEngineKnobsConfigRequest
GetContextEngineKnobsConfigRequest is empty — tenant id flows from the authenticated context.
GetContextEngineKnobsConfigResponse
GetContextEngineKnobsConfigResponse returns the effective snapshot (tenant row where present, platform default otherwise).
| Field | Type | Label | Description |
|---|---|---|---|
| config | ContextEngineKnobsConfig | Config is the effective knob snapshot for the caller's tenant, falling back to platform defaults when no tenant row exists. |
UpdateContextEngineKnobsConfigRequest
UpdateContextEngineKnobsConfigRequest carries the new knob values.
| Field | Type | Label | Description |
|---|---|---|---|
| config | ContextEngineKnobsConfig | Config carries the desired new knob values. Zero-valued fields are interpreted as "fall back to the platform default" — not as "clear the override". Clearance is computed field-by-field. |
UpdateContextEngineKnobsConfigResponse
UpdateContextEngineKnobsConfigResponse echoes the merged snapshot.
| Field | Type | Label | Description |
|---|---|---|---|
| config | ContextEngineKnobsConfig | Config is the effective snapshot after the write, same shape as the Get response. |
ContextEngineKnobsConfigService
ContextEngineKnobsConfigService exposes the compaction / embedding / retrieval tuning knobs for the calling tenant. LLD-4 §2.1 Get/Update shape.
| Method Name | Request Type | Response Type | Description |
|---|---|---|---|
| GetContextEngineKnobsConfig | GetContextEngineKnobsConfigRequest | GetContextEngineKnobsConfigResponse | Get returns the tenant's current knobs, falling back to the platform default snapshot when no tenant row exists. Read-only, L3. |
| UpdateContextEngineKnobsConfig | UpdateContextEngineKnobsConfigRequest | UpdateContextEngineKnobsConfigResponse | Update replaces the tenant's knob set atomically and fires one config.updated audit event. Requires the highest clearance of any field the payload mutates — i.e. touching embedding_provider_id elevates the call to L5. |
Scalar Value Types
| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby |
|---|---|---|---|---|---|---|---|---|
| double | double | double | float | float64 | double | float | Float | |
| float | float | float | float | float32 | float | float | Float | |
| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum |
| uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) |
| uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) |
| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum |
| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) |
| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum |
| sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
| sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum |
| bool | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass | |
| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) |
| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) |