Create a prompt
Create a reusable prompt template. Prompts can include variables using double-brace syntax (e.g.,{{topic}}) that are filled in at runtime.
import os
from meibel import MeibelClient
from meibel.models import CreateAgentPromptRequest
client = MeibelClient(api_key=os.environ["MEIBEL_API_KEY"])
prompt = client.prompts.create_prompt(body=CreateAgentPromptRequest(
name="summarize-document",
description="Summarizes a document with key takeaways",
content="Summarize the following document in {{length}} bullet points. Focus on {{focus_area}}. Include citations for each point.",
))
print(prompt.id, prompt.name)
import { MeibelClient } from 'meibel';
const client = new MeibelClient({ apiKey: process.env.MEIBEL_API_KEY });
const prompt = await client.prompts.createPrompt({
name: 'summarize-document',
description: 'Summarizes a document with key takeaways',
content: 'Summarize the following document in {{length}} bullet points. Focus on {{focus_area}}. Include citations for each point.',
});
console.log(prompt.id, prompt.name);
import (
"context"
"fmt"
"os"
meibel "github.com/meibel-ai/meibel-go"
)
client := meibel.NewClient(meibel.WithAPIKey(os.Getenv("MEIBEL_API_KEY")))
ctx := context.Background()
prompt, err := client.Prompts.CreatePrompt(ctx, meibel.CreateAgentPromptRequest{
Name: "summarize-document",
Description: "Summarizes a document with key takeaways",
Content: "Summarize the following document in {{length}} bullet points. Focus on {{focus_area}}. Include citations for each point.",
})
if err != nil {
log.Fatal(err)
}
fmt.Println(prompt.ID, prompt.Name)
meibel prompts create --data '{
"name": "summarize-document",
"description": "Summarizes a document with key takeaways",
"content": "Summarize the following document in {{length}} bullet points. Focus on {{focus_area}}. Include citations for each point."
}'
id, name, description, and content. Use the id to reference the prompt from agents or other API calls.
Get a prompt
Retrieve the full details of an existing prompt.prompt = client.prompts.get_prompt(prompt_id="prompt_123")
print(prompt.name)
print(prompt.content)
const prompt = await client.prompts.getPrompt('prompt_123');
console.log(prompt.name);
console.log(prompt.content);
prompt, err := client.Prompts.GetPrompt(ctx, "prompt_123")
if err != nil {
log.Fatal(err)
}
fmt.Println(prompt.Name)
fmt.Println(prompt.Content)
meibel prompts get prompt_123
Update a prompt
Modify a prompt’s name, description, or content. Only the fields you include are changed.from meibel.models import UpdateAgentPromptRequest
updated = client.prompts.update_prompt(
prompt_id="prompt_123",
body=UpdateAgentPromptRequest(
content="Provide a {{length}}-point summary of the document. Focus on {{focus_area}}. Cite sources with page numbers.",
),
)
print(updated.content)
const updated = await client.prompts.updatePrompt('prompt_123', {
content: 'Provide a {{length}}-point summary of the document. Focus on {{focus_area}}. Cite sources with page numbers.',
});
console.log(updated.content);
updated, err := client.Prompts.UpdatePrompt(ctx, "prompt_123", meibel.UpdateAgentPromptRequest{
Content: "Provide a {{length}}-point summary of the document. Focus on {{focus_area}}. Cite sources with page numbers.",
})
if err != nil {
log.Fatal(err)
}
fmt.Println(updated.Content)
meibel prompts update prompt_123 --data '{
"content": "Provide a {{length}}-point summary of the document. Focus on {{focus_area}}. Cite sources with page numbers."
}'
Updating a prompt does not affect agents that have already been published with the old version. Only new sessions or republished agents pick up the changes.
Delete a prompt
Permanently remove a prompt. This action cannot be undone.client.prompts.delete_prompt(prompt_id="prompt_123")
await client.prompts.deletePrompt('prompt_123');
err := client.Prompts.DeletePrompt(ctx, "prompt_123")
if err != nil {
log.Fatal(err)
}
meibel prompts delete prompt_123
Create an artifact schema
Artifact schemas define the structured output format that an agent should produce. Use JSON Schema to specify the 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"'"]
}'
artifact field alongside the natural language message. The artifact conforms to the JSON Schema you defined, making it straightforward to parse and store programmatically.