Skip to main content

Context Engine API

Table of Contents

Top

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.

FieldTypeLabelDescription
compaction_window_sizeint32CompactionWindowSize 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_eventsint32CompactionThresholdEvents is the session-event count beyond which compaction auto-runs. 0 means "never auto-run; compaction is manual-only for this tenant".
embedding_provider_idstringEmbeddingProviderID 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_weightdoubleRetrievalRRFVectorWeight 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_kint32RetrievalVectorTopK 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_atgoogle.protobuf.TimestampUpdatedAt 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).

FieldTypeLabelDescription
configContextEngineKnobsConfigConfig 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.

FieldTypeLabelDescription
configContextEngineKnobsConfigConfig 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.

FieldTypeLabelDescription
configContextEngineKnobsConfigConfig 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 NameRequest TypeResponse TypeDescription
GetContextEngineKnobsConfigGetContextEngineKnobsConfigRequestGetContextEngineKnobsConfigResponseGet returns the tenant's current knobs, falling back to the platform default snapshot when no tenant row exists. Read-only, L3.
UpdateContextEngineKnobsConfigUpdateContextEngineKnobsConfigRequestUpdateContextEngineKnobsConfigResponseUpdate 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 TypeNotesC++JavaPythonGoC#PHPRuby
doubledoubledoublefloatfloat64doublefloatFloat
floatfloatfloatfloatfloat32floatfloatFloat
int32Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead.int32intintint32intintegerBignum or Fixnum (as required)
int64Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead.int64longint/longint64longinteger/stringBignum
uint32Uses variable-length encoding.uint32intint/longuint32uintintegerBignum or Fixnum (as required)
uint64Uses variable-length encoding.uint64longint/longuint64ulonginteger/stringBignum or Fixnum (as required)
sint32Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s.int32intintint32intintegerBignum or Fixnum (as required)
sint64Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s.int64longint/longint64longinteger/stringBignum
fixed32Always four bytes. More efficient than uint32 if values are often greater than 2^28.uint32intintuint32uintintegerBignum or Fixnum (as required)
fixed64Always eight bytes. More efficient than uint64 if values are often greater than 2^56.uint64longint/longuint64ulonginteger/stringBignum
sfixed32Always four bytes.int32intintint32intintegerBignum or Fixnum (as required)
sfixed64Always eight bytes.int64longint/longint64longinteger/stringBignum
boolboolbooleanbooleanboolboolbooleanTrueClass/FalseClass
stringA string must always contain UTF-8 encoded or 7-bit ASCII text.stringStringstr/unicodestringstringstringString (UTF-8)
bytesMay contain any arbitrary sequence of bytes.stringByteStringstr[]byteByteStringstringString (ASCII-8BIT)