Sluice Docs

Connect Your AI Agent

Connecting your AI agent to Sluice takes about 2 minutes. You have two options:

  • REST API — Send emails programmatically via HTTP. See the REST API quickstart for a full walkthrough.
  • SMTP — Update your agent's SMTP configuration to point at Sluice (detailed below). No code changes beyond host/port/credentials.

This page covers the SMTP integration path.

What you need

  • Your Sluice SMTP credentials (from the dashboard or your onboarding email)
  • Access to your AI agent's SMTP configuration

SMTP settings

SettingValue
HostYour Sluice instance hostname
Port587 (STARTTLS) or 465 (implicit TLS)
UsernameYour organization's email address
PasswordYour Sluice SMTP password
EncryptionTLS required — plaintext connections are rejected

Sluice supports PLAIN and LOGIN authentication methods, which are compatible with virtually every SMTP client library.

Before and after

The only thing that changes is where your agent sends email. Instead of connecting directly to Gmail, SendGrid, or your email provider, your agent connects to Sluice. Sluice handles forwarding approved emails through your provider.

Before:  AI Agent  ──SMTP──>  Gmail / SendGrid / SES  ──>  Customer

After:   AI Agent  ──SMTP──>  Sluice  ──guardrails──>  Gmail / SendGrid / SES  ──>  Customer

Language and framework examples

Python

Using smtplib (standard library)

import smtplib
from email.mime.text import MIMEText
 
msg = MIMEText("Hello! Your order #1234 has shipped.")
msg["Subject"] = "Your order has shipped"
msg["From"] = "support@yourcompany.com"
msg["To"] = "customer@example.com"
 
with smtplib.SMTP("your-sluice-host", 587) as server:
    server.starttls()
    server.login("your-org@example.com", "your-sluice-password")
    server.send_message(msg)

Using aiosmtplib (async)

import aiosmtplib
 
await aiosmtplib.send(
    msg,
    hostname="your-sluice-host",
    port=587,
    username="your-org@example.com",
    password="your-sluice-password",
    start_tls=True,
)

Node.js

Using Nodemailer

const nodemailer = require("nodemailer");
 
const transporter = nodemailer.createTransport({
  host: "your-sluice-host",
  port: 587,
  secure: false, // STARTTLS
  auth: {
    user: "your-org@example.com",
    pass: "your-sluice-password",
  },
});
 
await transporter.sendMail({
  from: "support@yourcompany.com",
  to: "customer@example.com",
  subject: "Your order has shipped",
  text: "Hello! Your order #1234 has shipped.",
});

Go

import "net/smtp"
 
auth := smtp.PlainAuth("", "your-org@example.com", "your-sluice-password", "your-sluice-host")
err := smtp.SendMail("your-sluice-host:587", auth, from, to, msg)

Ruby

Net::SMTP.start("your-sluice-host", 587, "localhost", "your-org@example.com", "your-sluice-password", :login) do |smtp|
  smtp.send_message(message, from, to)
end

Credential management

  • SMTP passwords are cryptographically random 32-character strings
  • Passwords are hashed before storage — Sluice never stores plaintext credentials
  • You can regenerate your password from Settings > Inbound SMTP at any time (this revokes all previous credentials immediately)
  • Keep your SMTP password in a secrets manager or environment variable — don't hardcode it

Compatibility

Sluice speaks standard SMTP. If your agent can send email, it can use Sluice. This includes:

  • Any programming language with an SMTP library
  • AI agent frameworks (OpenAI Agents, LangChain, CrewAI, AutoGen, Semantic Kernel)
  • Automation platforms (n8n, Make, Zapier, Power Automate)
  • Custom applications and microservices

See the AI agent examples guide for step-by-step instructions for specific platforms.

On this page