Knowledge Object YAML Reference
This page documents every attribute available in a Knowledge Object YAML definition. Each file declares one object per YAML document; you can define multiple objects in one file by separating them with---.
Top-level structure
name and at least one field, and at least one of those fields must be a primary key:
fields
The list of columns that make up the object. Every field is validated on deploy; an unknown attribute or an unsupported type fails the deploy.
| Attribute | Type | Default | Description |
|---|---|---|---|
name | string | — | Field name (required). |
type | string | — | Field type (required). One of the supported types. |
primary_key | bool | false | Whether the field is part of the object’s primary key. |
optional | bool | false | Whether the field is nullable / may be omitted on create. |
mutable | bool | true | Whether the value can be changed after creation. |
default | any | null | Default value applied at the database level when the field is omitted. |
db_column | string | null | (Optional) Override the underlying ClickHouse column name. |
db_type | string | null | (Optional) Override the underlying ClickHouse column type. |
relationship | list | null | (Optional) Declares the field as a relationship to another object. |
options | list | null | (Optional, str only) Allowed values; renders a dropdown and is validated on write. See Options. |
Field types
| Type | Description |
|---|---|
int | Integer |
str | String |
float | Floating-point number |
bool | Boolean |
datetime | Timestamp |
date | Calendar date |
db_type to override the exact type.
Primary keys
At least one field must haveprimary_key: true. The combination of primary key fields uniquely identifies an instance, and it is used to compute the stable instance key (_key).
- Primary key fields cannot be optional.
- Primary key fields are immutable — attempting to change one through the API is an error. A different primary key is a different instance.
Defaults
default sets a database-level default that ClickHouse applies whenever the field is omitted from an insert. This means the default is enforced regardless of how the instance is created — through the API, or directly against the table.
Because it is a database expression, you can use functional defaults:
A field with a
default may be omitted when creating an instance — the database fills it in. Functional defaults such as now() can only be produced at insert time, so the client should leave the field out rather than sending a value.Mutability
Setmutable: false to freeze a field after the instance is created. Non-primary-key fields are mutable by default.
Custom database columns and types
Usedb_column and db_type to control the underlying ClickHouse storage independently of the field name and logical type:
Relationships
A relationship field points at another object’s instance. It is metadata only — there is no database-level foreign key. The field itself is a plain string that stores the target instance’s key (_key).
- The field’s
typemust bestr. relationshipmust reference exactly one target object, by name.
add_relationships flag — see the Instance API. In the UI, a relationship field is rendered as a picker over the target object’s instances, using the target’s label_column for display.
Options
Astr field can declare a fixed set of allowed values with options. The UI renders it as a dropdown instead of a free-text input, and the API rejects any create/update whose value is outside the list.
optionsis only valid onstrfields, and must not be empty.- Writing an instance with a value not in
optionsreturns400.
settings
Object-level settings. All are optional.
| Attribute | Type | Default | Description |
|---|---|---|---|
object_type | string | STANDALONE | STANDALONE (managed instances) or BACKED (backed by a dataset). |
backed_dataset | string | null | Alias of the backing dataset — required when object_type is BACKED. |
store_versions | bool | false | Whether previous instance versions are retained. |
icon | string | null | Icon name used to represent the object in the UI. |
label_column | string | null | Which field to display as an instance’s human label in the UI. |
label_columnmust name one of the object’s fields. It is used wherever an instance is shown by name — most importantly in relationship pickers.iconis purely for UI presentation.store_versionskeeps superseded versions of an instance available in history. With it off, old versions may be compacted away over time (history becomes best-effort).
actions
Actions bind a named operation on the object to a Python handler function in your repository.
| Attribute | Type | Description |
|---|---|---|
name | string | Action name (required). |
description | string | (Optional) Human-readable description. |
handler | string | Reference to the handler, in the form path/to/file.py:function. |
handler must point at a Python file and function in your repository. Changing an object’s actions does not trigger a schema migration — only field and setting changes do.
Executing actions via the API is on the roadmap; today, actions are declared and validated as part of the object definition.
Full example
objects/employee.yaml
Deploying multiple objects
To define more than one object in a single file, separate documents with---:
objects/hr.yaml
Next steps
- Overview — concepts, branching, and the lifecycle.
- Instance API — managing instances of your objects.