Create an artifact schema
Create a schema by giving it a display name, atype, and the JSON Schema that specifies its fields, types, and validation rules.
schema = client.artifact_schemas.create(
display_name="Meeting Summary",
type="json",
description="Structured output for meeting summaries",
schema={
"type": "object",
"properties": {
"title": {"type": "string", "description": "Meeting title"},
"date": {"type": "string", "format": "date"},
"attendees": {
"type": "array",
"items": {"type": "string"},
},
"action_items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"description": {"type": "string"},
"assignee": {"type": "string"},
"due_date": {"type": "string", "format": "date"},
},
"required": ["description"],
},
},
"key_decisions": {
"type": "array",
"items": {"type": "string"},
},
},
"required": ["title", "date", "action_items"],
},
)
print(schema.id, schema.name)
const schema = await client.artifactSchemas.create({
displayName: 'Meeting Summary',
type: 'json',
description: 'Structured output for meeting summaries',
schema: {
type: 'object',
properties: {
title: { type: 'string', description: 'Meeting title' },
date: { type: 'string', format: 'date' },
attendees: {
type: 'array',
items: { type: 'string' },
},
actionItems: {
type: 'array',
items: {
type: 'object',
properties: {
description: { type: 'string' },
assignee: { type: 'string' },
dueDate: { type: 'string', format: 'date' },
},
required: ['description'],
},
},
keyDecisions: {
type: 'array',
items: { type: 'string' },
},
},
required: ['title', 'date', 'actionItems'],
},
});
console.log(schema.id, schema.name);
schema, err := client.ArtifactSchemas.CreateArtifactSchema(ctx, meibel.CreateAgentArtifactRequest{
Name: "meeting-summary",
Description: "Structured output for meeting summaries",
Schema: map[string]interface{}{
"type": "object",
"properties": map[string]interface{}{
"title": map[string]interface{}{"type": "string", "description": "Meeting title"},
"date": map[string]interface{}{"type": "string", "format": "date"},
"attendees": map[string]interface{}{"type": "array", "items": map[string]interface{}{"type": "string"}},
"action_items": map[string]interface{}{
"type": "array",
"items": map[string]interface{}{
"type": "object",
"properties": map[string]interface{}{
"description": map[string]interface{}{"type": "string"},
"assignee": map[string]interface{}{"type": "string"},
"due_date": map[string]interface{}{"type": "string", "format": "date"},
},
"required": []string{"description"},
},
},
"key_decisions": map[string]interface{}{
"type": "array",
"items": map[string]interface{}{"type": "string"},
},
},
"required": []string{"title", "date", "action_items"},
},
})
if err != nil {
log.Fatal(err)
}
fmt.Println(schema.ID, schema.Name)
meibel artifact-schemas create --data '{
"name": "meeting-summary",
"description": "Structured output for meeting summaries",
"schema": {
"type": "object",
"properties": {
"title": {"type": "string", "description": "Meeting title"},
"date": {"type": "string", "format": "date"},
"attendees": {"type": "array", "items": {"type": "string"}},
"action_items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"description": {"type": "string"},
"assignee": {"type": "string"},
"due_date": {"type": "string", "format": "date"}
},
"required": ["description"]
}
},
"key_decisions": {"type": "array", "items": {"type": "string"}}
},
"required": ["title", "date", "action_items"]
}
}'
Use a schema with an agent
Reference an artifact schema when creating or updating an agent so that its responses conform to the defined structure.from meibel.models import CreateAgentDefinitionRequest
agent = client.agents.create(body=CreateAgentDefinitionRequest(
display_name="Meeting Summarizer",
description="Produces structured meeting summaries",
instructions="You are a meeting summarizer. Extract key information and format it according to the provided schema.",
artifacts=[schema.name],
))
print(agent.id, agent.name)
const agent = await client.agents.create({
displayName: 'Meeting Summarizer',
description: 'Produces structured meeting summaries',
instructions: 'You are a meeting summarizer. Extract key information and format it according to the provided schema.',
artifacts: [schema.name],
});
console.log(agent.id, agent.name);
agent, err := client.Agents.CreateAgent(ctx, meibel.CreateAgentDefinitionRequest{
DisplayName: "Meeting Summarizer",
Description: "Produces structured meeting summaries",
Instructions: "You are a meeting summarizer. Extract key information and format it according to the provided schema.",
Artifacts: []string{schema.ID},
})
if err != nil {
log.Fatal(err)
}
fmt.Println(agent.ID, agent.Artifacts)
meibel agents create --data '{
"display_name": "Meeting Summarizer",
"description": "Produces structured meeting summaries",
"instructions": "You are a meeting summarizer. Extract key information and format it according to the provided schema.",
"artifacts": ["'"$SCHEMA_ID"'"]
}'
artifacts list alongside the natural language message. Each entry is an artifact the agent produced in that turn, with its content, filename, and mime_type.