Skip to main content

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.

Managing Agents

Agents are the core building block of the Meibel platform. Each agent encapsulates a system prompt, model configuration, and optional datasources. This guide walks through the full lifecycle: creating, inspecting, updating, publishing, versioning, and deleting agents.

Create an agent

Create a new agent definition by providing a name, description, and system prompt.
import os
from meibel import MeibelClient
from meibel.models import CreateAgentDefinitionRequest

client = MeibelClient(api_key=os.environ["MEIBEL_API_KEY"])

agent = client.agents.create_agent(body=CreateAgentDefinitionRequest(
    display_name="Research Assistant",
    description="Answers questions using uploaded knowledge bases",
    instructions="You are a helpful research assistant. Answer questions accurately and cite your sources.",
))

print(agent.id, agent.display_name)
The response includes the agent’s id, display_name, description, instructions, and timestamps. Use the id for all subsequent operations.

Get agent details

Retrieve the full configuration and metadata for an existing agent.
agent = client.agents.get_agent(agent_id="agent_123")

print(agent.display_name)
print(agent.instructions)
print(agent.created_at)

Update an agent

Modify an agent’s name, description, system prompt, or other configuration fields. Only the fields you include in the request body are changed.
from meibel.models import UpdateAgentDefinitionRequest

updated = client.agents.update_agent(
    agent_id="agent_123",
    body=UpdateAgentDefinitionRequest(
        display_name="Research Assistant v2",
        instructions="You are an expert research assistant. Always cite sources with page numbers.",
    ),
)

print(updated.display_name)

Publish an agent

Publishing creates an immutable snapshot of the agent’s current configuration. Include a commit message to document what changed.
from meibel.models import PublishAgentDefinitionRequest

published = client.agents.publish_agent(
    agent_id="agent_123",
    body=PublishAgentDefinitionRequest(
        commit_message="Improved citation formatting and added page-number references",
    ),
)

print(published.version)
print(published.commit_message)
Publishing does not affect the draft agent. You can continue editing the draft and publish again when ready.

List agent versions

Retrieve all published versions for an agent. Versions are returned in reverse chronological order.
for version in client.agents.list_agent_versions(agent_id="agent_123"):
    print(f"v{version.version}: {version.commit_message} ({version.published_at})")

Delete an agent

Permanently remove an agent and all its published versions. This action cannot be undone.
client.agents.delete_agent(agent_id="agent_123")
Deleting an agent removes all published versions and terminates any active sessions associated with it.