Skip to main content
Use this page to load Qubrics tools into a LangGraph agent. The LangChain MCP adapters convert MCP tools into LangChain tools, so anything that accepts a tool list will accept them.
Replace placeholder keys and tokens before running any snippet. Do not commit smx_root_, smx_mbx_, or private HTTP bearer tokens to version control.

Requirements

  • Python 3.10 or newer.
  • A Qubrics key for the surface you are calling. Mailbox work needs an smx_mbx_ key or a scoped smx_agent_ token.

Install

Before upgrading an existing installation, keep its working package environment, dependency state, and MCP client and tool configuration. Version 2.0.0 removes local file_path and roots inputs from MCP attachment tools. Before switching existing agents, follow the upgrade and rollback guidance.

Connect over local stdio

The adapter launches the server and passes your key through the subprocess environment. Values written as ${VAR} are expanded from the current environment, so the key never appears in source.
client.py
Run more than one surface by switching to the sendmux-mcp entry point and naming the surfaces:

Connect over private HTTP

Use this when your graph runs somewhere it cannot spawn a process. Start the server yourself:
Then connect with the streamable HTTP transport and send the bearer token:
client.py

Build the agent

get_tools() returns LangChain tools you can hand to a prebuilt agent or bind to a model inside your own graph.
agent.py
Set tool_name_prefix=True on MultiServerMCPClient when you connect Qubrics alongside other MCP servers. It prefixes tool names with the server name and prevents collisions.

Give each user their own mailbox

Mailbox-scoped keys are the isolation boundary. Build a client per tenant rather than sharing one across the graph, so the agent working one tenant structurally cannot read another tenant’s mail.

Sending stays gated

A durable smx_agent_ token includes mailbox.read and email.receive, not email.send. After a named human owner accepts the invite and approves sending, exchange the durable token for a one-hour Sending-resource token and pass that as QUBRICS_SENDING_API_KEY.

Troubleshooting

Confirm the surfaces the server started with. sendmux-mcp requires QUBRICS_MCP_SURFACES; the single-surface entry points do not.
Check the key prefix. Mailbox accepts smx_mbx_ or a scoped smx_agent_, Sending accepts a send-capable smx_mbx_ or an owner-approved Sending-resource smx_agent_, and Management requires smx_root_.
Set handle_tool_errors=True on MultiServerMCPClient to return errors as tool messages the model can react to instead of raising.
Start the workflow with qubrics_mailbox_list_granted_mailboxes and pass the returned mailbox_id to tools that act on one mailbox.

Next steps

Agent frameworks

Compare connections across frameworks.

MCP

Review environment variables and tool discovery.

Mailbox API guides

Use search and batch operations efficiently.

Python SDK

Call Qubrics directly when you want full endpoint coverage.