BloomERP

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.

SettingTypeDefaultDescription
idstrRequiredStable ID shared by all schema versions of an artifact type.Pattern: '^[a-z][a-z0-9_.-]*$'
documentationstr''Markdown and tagged examples included in the generated developer reference.
schema_versionint1Version used to resolve the exact stored payload schema.At least: 1
labelstrRequiredName shown for this artifact type.
modeltype[ArtifactPayloadT]RequiredPydantic model for the artifact payload.
describeCallable[[ArtifactPayloadT], AIArtifactDescription]RequiredCallback that supplies the display title and summary.
authorizeOptional[AIArtifactAuthorizer[ArtifactPayloadT]]NoneOptional check on whether a user can access the artifact source.
iconstr | NoneNoneIcon shown for this artifact type.
render_clstype[AIArtifactRenderer] | NoneNoneOptional renderer for the artifact's presentation.
searchOptional[AIArtifactSearch[ArtifactPayloadT]]NoneOptional callback that searches for available artifacts.
uploadOptional[AIArtifactUpload[ArtifactPayloadT]]NoneOptional callback that uploads content for an artifact.
selection_file_idCallable[[ArtifactPayloadT], uuid.UUID | None] | NoneNoneOptional callback that resolves an artifact's stored file ID.
tool_namestuple[str, ...]()Tool names associated with this artifact type.
tool_result_adapterstuple[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.

python
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.

python
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

FieldValue
schema_version1
iconfa-file

FileArtifactPayload

Identify a file source without copying its live content or permissions.

SettingTypeDefaultDescription
file_iduuid.UUIDRequired—
namestrRequiredMinimum length: 1Maximum length: 255
media_typestrRequiredMinimum length: 1Maximum length: 255

Modules

ID module · Lookup ID module@1

FieldValue
schema_version1
iconfa-layer-group

ModuleArtifactPayload

Identify a module and retain the selected human-readable context.

SettingTypeDefaultDescription
module_idstrRequiredMinimum length: 1Maximum length: 255
namestrRequiredMinimum length: 1Maximum length: 255
descriptionstr''Maximum length: 10000

Model

ID model · Lookup ID model@1

FieldValue
schema_version1
iconfa-table

ModelArtifactPayload

Identify a model source without copying its live content or permissions.

SettingTypeDefaultDescription
model_labelstrRequiredPattern: '^[a-zA-Z_][a-zA-Z0-9_]*\\.[a-zA-Z_][a-zA-Z0-9_]*$'

Object

ID object · Lookup ID object@1

FieldValue
schema_version1
iconfa-cube

ObjectArtifactPayload

Identify a object source without copying its live content or permissions.

SettingTypeDefaultDescription
model_labelstrRequiredPattern: '^[a-zA-Z_][a-zA-Z0-9_]*\\.[a-zA-Z_][a-zA-Z0-9_]*$'
object_idstrRequiredMinimum length: 1Maximum length: 255
object_namestr | NoneNoneMinimum length: 1Maximum length: 500

SQL Query

ID sql_query · Lookup ID sql_query@1

FieldValue
schema_version1
iconfa-code

SqlQueryArtifactPayload

Store the SQL statement from a completed tool call.

SettingTypeDefaultDescription
querystrRequired—

MCP resource

ID mcp · Lookup ID mcp@1

FieldValue
schema_version1
iconfa-link

McpArtifactPayload

Identify a mcp source without copying its live content or permissions.

SettingTypeDefaultDescription
server_keystr'local'Minimum length: 1Maximum length: 255
resource_uristrRequiredMinimum length: 1Maximum length: 2048

Tile

ID tile · Lookup ID tile@1

FieldValue
schema_version1
iconfa-chart-line

TileArtifactPayload

Store a tile configuration independently of a saved workspace tile.

SettingTypeDefaultDescription
titlestrRequiredMinimum length: 1Maximum length: 255
tile_typestrRequiredMinimum length: 1Maximum length: 255
configdict[str, JsonValue]Required—