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 Datasources
Datasources are containers for the knowledge that powers your agents. A datasource holds uploaded files, manages the ingestion pipeline, and serves as the searchable knowledge base for agent conversations. This guide covers the full datasource lifecycle.
Create a datasource
Create a new, empty datasource to begin uploading content into.
import os
from meibel import MeibelClient
from meibel.models import CreateDatasourceRequest, ConnectorConfig
client = MeibelClient(api_key=os.environ["MEIBEL_API_KEY"])
datasource = client.datasources.create_datasource(body=CreateDatasourceRequest(
name="Q4 Financial Reports",
description="Quarterly earnings reports and analyst briefings",
connector=ConnectorConfig(type="managed"),
))
print(datasource.id, datasource.name)
The response includes the datasource id, name, description, and timestamps. Use the id for all subsequent operations.
Upload files
Upload files to a datasource. The SDK streams the file directly to the server in chunks, so files of any size can be uploaded without being fully buffered in memory.
with open("earnings-q4.pdf", "rb") as f:
upload = client.content.upload_content(
file=f,
file_name="earnings-q4.pdf",
)
print(upload.id)
You can upload multiple files to the same datasource. Supported formats include PDF, DOCX, XLSX, CSV, TXT, and JSON.
Trigger ingestion
After uploading files, trigger the ingestion pipeline to parse, extract, and index the content into searchable data elements.
result = client.content.trigger_ingest(datasource_id=datasource.id)
print(result.status)
Ingestion runs asynchronously. You can poll the datasource status or use streaming events to track progress.
Get datasource details
Retrieve the full metadata and status for a datasource, including ingestion state and file counts.
datasource = client.datasources.get_datasource(datasource_id="ds_123")
print(datasource.name)
print(datasource.status)
print(datasource.file_count)
Update a datasource
Modify a datasource’s name, description, or configuration. Only the fields you include in the request body are changed.
from meibel.models import UpdateDatasourceRequest
updated = client.datasources.update_datasource(
datasource_id="ds_123",
body=UpdateDatasourceRequest(
name="Q4 2025 Financial Reports",
description="Updated with final audited numbers",
),
)
print(updated.name)
Delete a datasource
Permanently remove a datasource and all its uploaded content and data elements. This action cannot be undone.
client.datasources.delete_datasource(datasource_id="ds_123")
Deleting a datasource removes all uploaded files and extracted data elements. Agents that reference this datasource will lose access to its content.