Skip to main content

Custodian Agent Class

Custodian configures one agent, then .deploy() returns a chat-ready App.

from custodian_labs import Custodian

custodian = Custodian(
model="gpt-4o",
system_prompt="You are a helpful customer support assistant.",
privacy_enabled=True,
)
app = custodian.deploy()
reply = app.chat("How do I invite a teammate?")
print(reply.response)

Constructor​

ParameterTypeDefaultDescription
modelstr—Required.
system_promptstr—Required. Defines the agent's role and behavior.
name, descriptionstr—Metadata (description also feeds squad routing).
toolslist[str]—Built-in tools — see Built-in Tools.
exampleslist[dict]—Few-shot pairs with user / assistant keys.
input_schema, response_schemadict—JSON Schema for structured input / output.
privacy_enabledboolFalseMask PII before it reaches the model.
api_key, base_urlstrenvSee Authentication.
timeoutfloat30.0Seconds.
max_retriesint2Retries on network / 5xx errors.

Methods​

MethodPurpose
.add_examples(examples)Add few-shot pairs.
.add_data_source_file(path)Attach a knowledge file — see Data Sources & RAG.
.deploy(name=, share_mode=, share_password=)Deploy → App.
.chat(message)Deploy and send one message.

Structured output​

response_schema makes the agent return JSON; the reply carries a structured_output field.

custodian = Custodian(
model="gpt-4o",
system_prompt="Assess the risk and reply as JSON.",
response_schema={
"type": "object",
"properties": {"verdict": {"type": "string"}, "confidence": {"type": "number"}},
"required": ["verdict", "confidence"],
},
)
reply = custodian.deploy().chat("Assess the risk for ACME Corp (low).")
print(reply.structured_output) # {"verdict": "low", "confidence": 0.95}

External connections​

Gmail (read / send / reply from an agent) is coming soon.

Sharing​

Set at deploy time, not on the object:

custodian.deploy() # public (default)
custodian.deploy(share_mode="private")
custodian.deploy(share_mode="password", share_password="s3cret")

Next​

Builder API · Data Sources & RAG · Chat Sessions