Built-ins
AIArtifactTypeDefinition
Describe the versioned payload of an artifact available to agents and the UI.
The label and description callback summarize validated payload data. Supply an authorization callback when the artifact refers to stored objects with access rules. Keep earlier schema versions registered while saved artifacts still use them.
| Setting | Type | Default | Description |
|---|---|---|---|
id | str | Required | Stable ID shared by all schema versions of an artifact type.Pattern: '^[a-z][a-z0-9_.-]*$' |
documentation | str | '' | Markdown and tagged examples included in the generated developer reference. |
schema_version | int | 1 | Version used to resolve the exact stored payload schema.At least: 1 |
label | str | Required | Name shown for this artifact type. |
model | type[ArtifactPayloadT] | Required | Pydantic model for the artifact payload. |
describe | Callable[[ArtifactPayloadT], AIArtifactDescription] | Required | Callback that supplies the display title and summary. |
authorize | Optional[AIArtifactAuthorizer[ArtifactPayloadT]] | None | Optional check on whether a user can access the artifact source. |
icon | str | None | None | Icon shown for this artifact type. |
render_cls | type[AIArtifactRenderer] | None | None | Optional renderer for the artifact's presentation. |
search | Optional[AIArtifactSearch[ArtifactPayloadT]] | None | Optional callback that searches for available artifacts. |
upload | Optional[AIArtifactUpload[ArtifactPayloadT]] | None | Optional callback that uploads content for an artifact. |
selection_file_id | Callable[[ArtifactPayloadT], uuid.UUID | None] | None | None | Optional callback that resolves an artifact's stored file ID. |
tool_names | tuple[str, ...] | () | Tool names associated with this artifact type. |
tool_result_adapters | tuple[type[AIArtifactToolResultAdapter], ...] | () | Adapters that turn tool results into artifact candidates. |
Register an artifact for a review note
Define a self-contained payload and describe only data carried by that payload.
from pydantic import Field
from bloomerp.agents.artifacts.registry import AI_ARTIFACT_REGISTRY
from bloomerp.agents.definition import AIArtifactDescription, AIArtifactPayload, AIArtifactTypeDefinition
class ReviewNotePayload(AIArtifactPayload):
'''Store the note that will be presented with the artifact.'''
title: str = Field(min_length=1)
note: str = Field(min_length=1)
def describe_review_note(payload: ReviewNotePayload) -> AIArtifactDescription:
'''Use the note itself to build the artifact's title and summary.'''
return AIArtifactDescription(title=payload.title, summary=payload.note)
review_note = AIArtifactTypeDefinition[ReviewNotePayload](
id="example.review_note",
label="Review note",
model=ReviewNotePayload,
describe=describe_review_note,
)
AI_ARTIFACT_REGISTRY.register(review_note)Add a new artifact schema version
Extend the previous example with a category. Register version two alongside version one so stored notes still resolve their original payload contract.
from pydantic import Field
from bloomerp.agents.artifacts.registry import AI_ARTIFACT_REGISTRY
from bloomerp.agents.definition import AIArtifactDescription, AIArtifactTypeDefinition
class CategorizedReviewNote(ReviewNotePayload):
'''Store an optional category in version two.'''
category: str = Field(default="general")
def describe_categorized_note(payload: CategorizedReviewNote) -> AIArtifactDescription:
'''Include the category in the note summary.'''
return AIArtifactDescription(
title=payload.title,
summary=f"{payload.category}: {payload.note}",
)
categorized_note = AIArtifactTypeDefinition[CategorizedReviewNote](
id="example.review_note",
schema_version=2,
label="Categorized review note",
model=CategorizedReviewNote,
describe=describe_categorized_note,
)
AI_ARTIFACT_REGISTRY.register(categorized_note)Files
ID file · Lookup ID file@1
| Field | Value |
|---|---|
schema_version | 1 |
icon | fa-file |
FileArtifactPayload
Identify a file source without copying its live content or permissions.
| Setting | Type | Default | Description |
|---|---|---|---|
file_id | uuid.UUID | Required | — |
name | str | Required | Minimum length: 1Maximum length: 255 |
media_type | str | Required | Minimum length: 1Maximum length: 255 |
Modules
ID module · Lookup ID module@1
| Field | Value |
|---|---|
schema_version | 1 |
icon | fa-layer-group |
ModuleArtifactPayload
Identify a module and retain the selected human-readable context.
| Setting | Type | Default | Description |
|---|---|---|---|
module_id | str | Required | Minimum length: 1Maximum length: 255 |
name | str | Required | Minimum length: 1Maximum length: 255 |
description | str | '' | Maximum length: 10000 |
Model
ID model · Lookup ID model@1
| Field | Value |
|---|---|
schema_version | 1 |
icon | fa-table |
ModelArtifactPayload
Identify a model source without copying its live content or permissions.
| Setting | Type | Default | Description |
|---|---|---|---|
model_label | str | Required | Pattern: '^[a-zA-Z_][a-zA-Z0-9_]*\\.[a-zA-Z_][a-zA-Z0-9_]*$' |
Object
ID object · Lookup ID object@1
| Field | Value |
|---|---|
schema_version | 1 |
icon | fa-cube |
ObjectArtifactPayload
Identify a object source without copying its live content or permissions.
| Setting | Type | Default | Description |
|---|---|---|---|
model_label | str | Required | Pattern: '^[a-zA-Z_][a-zA-Z0-9_]*\\.[a-zA-Z_][a-zA-Z0-9_]*$' |
object_id | str | Required | Minimum length: 1Maximum length: 255 |
object_name | str | None | None | Minimum length: 1Maximum length: 500 |
SQL Query
ID sql_query · Lookup ID sql_query@1
| Field | Value |
|---|---|
schema_version | 1 |
icon | fa-code |
SqlQueryArtifactPayload
Store the SQL statement from a completed tool call.
| Setting | Type | Default | Description |
|---|---|---|---|
query | str | Required | — |
MCP resource
ID mcp · Lookup ID mcp@1
| Field | Value |
|---|---|
schema_version | 1 |
icon | fa-link |
McpArtifactPayload
Identify a mcp source without copying its live content or permissions.
| Setting | Type | Default | Description |
|---|---|---|---|
server_key | str | 'local' | Minimum length: 1Maximum length: 255 |
resource_uri | str | Required | Minimum length: 1Maximum length: 2048 |
Tile
ID tile · Lookup ID tile@1
| Field | Value |
|---|---|
schema_version | 1 |
icon | fa-chart-line |
TileArtifactPayload
Store a tile configuration independently of a saved workspace tile.
| Setting | Type | Default | Description |
|---|---|---|---|
title | str | Required | Minimum length: 1Maximum length: 255 |
tile_type | str | Required | Minimum length: 1Maximum length: 255 |
config | dict[str, JsonValue] | Required | — |
