Custom Agents

A custom agent is an agent you build and run yourself — your own code, in your own process — as opposed to a third-party managed or hosted agent product. Netzilo embeds directly inside that process as an SDK: every LLM prompt, model response, and tool call your agent makes can be evaluated — allowed, blocked, or redacted — against policy pulled live from your Netzilo management server. No daemon, no sidecar, nothing to stand up.

Install

pip install netzilo

Core API

One call starts the embedded client. It's non-blocking — your agent keeps running while policy syncs in the background.

import netzilo

netzilo.start(
    server="https://srv.netzilo.com",  # management server
    pat="nzl_...",                     # or setup_key="..."
    agent_name="my-agent",
)

Everything on the Framework Adapters, Raw LLM Clients, and MCP & Middleware Integrations pages builds on this one call.

Platform support

Every toolkit on the following pages — framework hooks, raw LLM clients, MCP, Guardrails — works on macOS, Linux, and Windows.

Minimal example with advanced governance

A complete, runnable agent with advanced governance turned on — no framework, no manual tool wrapping. Once start() returns, every LLM call, subprocess, and outbound request your agent code makes is inspected in-process.

import time
import netzilo

netzilo.start(
    server="https://srv.netzilo.com",
    setup_key="...",                     # or pat="nzl_..."
    agent_name="my-agent",
    enable_advanced_governance=True,     # Linux only — see note above
)

while not netzilo.is_running():           # wait until policy has synced
    time.sleep(0.5)

# Your agent's own code runs unmodified from here — call any LLM SDK,
# spawn subprocesses, make outbound requests. All of it is inspected.
...

netzilo.stop()   # graceful stop: snapshots the behavior graph, flushes events

TypeScript also has a one-line fire-and-forget form for this exact case — govern() reads the same config from NETZILO_* environment variables and starts with advanced governance on by default:

import { govern } from "netzilo";

await govern(); // NETZILO_SERVER / NETZILO_SETUP_KEY / NETZILO_AGENT_NAME env vars; non-blocking