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
| Parameter | Type | Default | Description |
|---|---|---|---|
model | str | — | Required. |
system_prompt | str | — | Required. Defines the agent's role and behavior. |
name, description | str | — | Metadata (description also feeds squad routing). |
tools | list[str] | — | Built-in tools — see Built-in Tools. |
examples | list[dict] | — | Few-shot pairs with user / assistant keys. |
input_schema, response_schema | dict | — | JSON Schema for structured input / output. |
privacy_enabled | bool | False | Mask PII before it reaches the model. |
api_key, base_url | str | env | See Authentication. |
timeout | float | 30.0 | Seconds. |
max_retries | int | 2 | Retries on network / 5xx errors. |
Methods
| Method | Purpose |
|---|---|
.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")