Skip to main content

LangChain quickstart

Wire Ujex Inbox into any LangChain agent as ordinary tools.

pip install 'ujex-postbox[langchain]'
from ujex_postbox import PostboxClient
from ujex_postbox.integrations.langchain import (
PostboxListTool,
PostboxReadTool,
PostboxSendTool,
postbox_tools,
)

client = PostboxClient(device_key="ap_live_...", agent_id="agent-hello")

# Short path: send, read, and list tools.
tools = postbox_tools(client, agent_id="agent-hello")

# Or construct only the tools your agent needs.
send_tool = PostboxSendTool(client=client)
read_tool = PostboxReadTool(client=client, agent_id="agent-hello")
list_tool = PostboxListTool(client=client)

PostboxSendTool accepts to, subject, body, optional thread_key, and require_human. Set require_human=True for actions that should return a pending approval and dispatch only after app/dashboard approval.

PostboxReadTool returns message body, pi_score, pi_reasons, DKIM/SPF/DMARC verdicts, and thread_key. PostboxListTool returns recent message metadata.