Custodian Labs | Build and deploy AI agents in 5 lines of code

5 min read Original article ↗

Custodian Labs takes you from idea to deployed, production-grade AI agent — with privacy built in at every layer. No infrastructure. No data leakage.

from custodian_labs import Custodian
 
model = Custodian(
    model="gpt-4o",
    system_prompt="You are a helpful assistant...",
)
 
model.deploy()

Everything you need. Nothing you don't.

Guardian layer

The proprietary Guardian Layer is the guardrail that detects PII and puts you in control of how it's handled before it reaches any model.

RAG out of the box

Give your agent long-term memory and document retrieval without configuring embeddings or vector DBs. Add a knowledge base in one line and it just works.

Model-agnostic

Switch between OpenAI, Anthropic, Mistral, or local models with one line — no vendor lock-in, no rewrite required. Your agent logic stays exactly as it is; only the model underneath changes.

Zero infrastructure

No database to provision, no vector store to connect, no hosting to manage. Custodian abstracts every layer beneath your agent so you focus entirely on logic.

Research-grade foundations

Commercialised with AUT Ventures and New Zealand Government funding. Production reliability grounded in deep academic research.

No databse. No hosting. Just deploy.

Normally you'd provision a vector DB, set up a hosting environment, wire up your model provider, write retry logic, handle streaming — all before writing a single line of agent logic. Custodian collapses that entire stack to a function call.

# Step 1: Provision a vector DB + embedding pipeline
pinecone.init(api_key=...), index = pinecone.Index("my-index")
embedder = SentenceTransformer("all-MiniLM-L6-v2")
chunks = [text[i:i+512] for i in range(0, len(text), 448)]
index.upsert([(f"doc_{i}", embedder.encode(c)) for i, c in enumerate(chunks)])

# Step 2: Manual PII scrubbing (fragile regex, hope for the best)
re.sub(r"[A-Z][a-z]+ [A-Z][a-z]+", "[REDACTED]", prompt)

# Step 3: Tool dispatch + retry logic
def call_with_retry(messages, max_retries=3):
    for attempt in range(max_retries):
        try: return client.chat.completions.create(...)
        except: time.sleep(2 ** attempt)

# Step 4: Session memory via Redis
redis_client.setex(f"ctx:{session_id}", 3600, json.dumps(messages[-20:]))

# Step 5: Flask server, auth, rate limiting, CORS, logging...
# Step 6: Write your Dockerfile, k8s config, CI/CD pipeline...
# Step 7: Finally — your agent runs. Maybe.
from custodian_labs import Custodian
 
model = Custodian(
    model="gpt-4o",
    system_prompt="You are a helpful assistant...",
)
 
model.deploy()

Assemble your team. Deploy as one.

Build teams of specialised agents that each handle their own domain — then deploy them as a single unified endpoint. Custodian's router automatically directs each query to the right agent.

Give each agent its own data sources, tools, system prompt, and topic scope. Scale the team without rewriting the interface.

the_engineer

Technology & engineering questions

the_strategist

Intelligence & strategy queries

the_scientist

Science & research topics

router

Automatically routes every query to the right agent

from custodian_labs import Agent, AgentTeam
 
team = AgentTeam(
    agents=[
        Agent(
            name="the_engineer",
            model="gpt-4o",
            system_prompt="You are a senior engineer. Handle all tech and engineering questions.",
            topics=["technology", "engineering", "AI"],
        ),
        Agent(
            name="the_strategist",
            model="gpt-4o",
            system_prompt="You are a strategy lead. Handle intelligence and strategy questions.",
            topics=["intelligence", "strategy", "espionage", "tactics"],
        ),
        Agent(
            name="the_scientist",
            model="gpt-4o",
            system_prompt="You are a research scientist. Handle science and research questions.",
            topics=["science", "research", "biology", "physics"],
        ),
    ],
    routing_mode="single",
)
 
app = team.deploy()

Introducing the Guardian Layer

Most privacy solutions simply strip PII — but stripping context destroys AI accuracy. The Guardian Layer detects PII intelligently, then gives you full control over what happens next, without the original PII ever leaving your envionrment.

Custom PII entities

Define your own entity types beyond the defaults — internal employee IDs, product codes, proprietary terms. Guardian Layer learns your schema.

Input (raw)

Schedule a follow-up with James Harrington at james@acmecorp.com about the contract renewal for $240,000.

Guardian Layer — Transform

Sent to AI model

Schedule a follow-up with Alex Morgan at alex@synthco.io about the contract renewal for $240,000.

Returned to you with PII relinked

Follow-up scheduled with James Harrington for Thursday at 2pm. Calendar invite sent to james@acmecorp.com.

Input (raw)

Schedule a follow-up with James Harrington at james@acmecorp.com about the contract renewal for $240,000.

Guardian Layer — Mask / redact

Sent to AI model

Schedule a follow-up with [PERSON] at [EMAIL] about the contract renewal for [CURRENCY].

Returned to you with PII relinked

Follow-up scheduled with [PERSON] for Thursday at 2pm. Calendar invite sent to [EMAIL].

Input (raw)

Schedule a follow-up with James Harrington at james@acmecorp.com about the contract renewal for $240,000.

Guardian Layer — Detect only

Sent to AI model

Schedule a follow-up with James HarringtonPERSON at james@acmecorp.comEMAIL about the contract renewal for $240,000CURRENCY.

Detection report

  • Person

    James Harrington

    99%

  • Email

    james@acmecorp.com

    100%

  • Currency

    $240,000

    97%

  • Org

    acmecorp

    88%

Transform

Replaces personally identifiable information (PII) with synthetic equivalents that preserve meaning

Input (raw)

Schedule a follow-up with James Harrington at james@acmecorp.com about the contract renewal for $240,000.

Guardian Layer — Transform

Sent to AI model

Schedule a follow-up with Alex Morgan at alex@synthco.io about the contract renewal for $240,000.

Returned to you with PII relinked

Follow-up scheduled with James Harrington for Thursday at 2pm. Calendar invite sent to james@acmecorp.com.

Mask / redact

Replaces personally identifiable information (PII) with a typed label — the fastest and most conservative transform

Input (raw)

Schedule a follow-up with James Harrington at james@acmecorp.com about the contract renewal for $240,000.

Guardian Layer — Mask / redact

Sent to AI model

Schedule a follow-up with [PERSON] at [EMAIL] about the contract renewal for [CURRENCY].

Returned to you with PII relinked

Follow-up scheduled with [PERSON] for Thursday at 2pm. Calendar invite sent to [EMAIL].

Detect only

Only surface what Replaces personally identifiable information (PII) exists, without modifying any text

Input (raw)

Schedule a follow-up with James Harrington at james@acmecorp.com about the contract renewal for $240,000.

Guardian Layer — Detect only

Sent to AI model

Schedule a follow-up with James HarringtonPERSON at james@acmecorp.comEMAIL about the contract renewal for $240,000CURRENCY.

Detection report

  • Person

    James Harrington

    99%

  • Email

    james@acmecorp.com

    100%

  • Currency

    $240,000

    97%

  • Org

    acmecorp

    88%

Simple, transparent pricing

Start today for free. Scale when you're ready.

Basic

Sandbox, try it out free

  • 100k tokens

  • 1k requests

  • GPT-4o

  • Email and community support

Starter

For users who want more limits, priority access, and VIP support

  • 1m tokens

  • 10k requests

  • All models + newest first

  • Priority 24/7 support

  • Direct roadmap input

  • Monthly 1:1 product call

  • Free compliance assessment

Custom

Everything tailored to your stack and compliance needs

  • Custom token limit

  • Custom request limit

  • On-premise or private cloud

  • Offline deployments

  • Custom compliance & data contracts

  • Dedicated support & SLA

From idea to deployed.
In under 10 minutes.

Get an API key, install the SDK, and have a privacy-safe AI agent running in production — no infrastructure required.