Skip to main content

Builder API

CustodianBuilder is the Custodian class as a fluent chain. Same result, different style.

from custodian_labs import CustodianBuilder

app = (
CustodianBuilder()
.with_model("gpt-4o")
.with_prompt("You are a helpful finance assistant.")
.with_examples([
{"user": "When is an invoice overdue?",
"assistant": "After the due date passes without payment."},
])
.with_data_source_file("./policies.pdf")
.deploy()
)

print(app.chat("Give me a short overdue-invoice policy.").response)
Method
.with_model(model)Required.
.with_prompt(prompt) / .with_system_prompt(prompt)Required.
.with_name(name) / .with_description(description)Metadata.
.with_examples(examples)Few-shot pairs.
.with_data_source_file(path)Attach a file; call repeatedly for more.
.with_response_schema(schema)JSON Schema for structured output.
.with_privacy(enabled=True)Inline PII masking.
.deploy(share_mode=, share_password=)Create + deploy → App.
.chat()Deploy, then interactive terminal chat.

For tools or input_schema, use the Custodian class.

Credentials come from the environment only (CUSTODIAN_SDK_API_KEY / CUSTODIAN_SDK_BASE_URL). Need explicit api_key? Use the Custodian class. AssistantBuilder is a deprecated alias.

Next​

Data Sources & RAG · Chat Sessions