> ## Documentation Index
> Fetch the complete documentation index at: https://docs.meibel.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Artifact Schemas

> Create an artifact schema in JSON Schema with a display name and type, then attach it to an agent so its responses conform to that structure.

An artifact schema defines the structured output an agent produces. You write the schema once in JSON Schema and attach it to any agent that needs to return data in that shape.

## Create an artifact schema

Create a schema by giving it a display name, a `type`, and the JSON Schema that specifies its fields, types, and validation rules.

```python Python theme={null}
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)
```

```typescript TypeScript theme={null}
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);
```

```go Go theme={null}
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)
```

```bash CLI theme={null}
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.

```python Python theme={null}
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)
```

```typescript TypeScript theme={null}
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);
```

```go Go theme={null}
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)
```

```bash CLI theme={null}
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"'"]
}'
```

When an agent has an artifact schema attached, the chat response carries an `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`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.