--- title: Multi-namespace Orchestration | SafetyKit description: Run multiple workflows for the same entity across namespaces. --- Use multi-namespace orchestration when one entity needs multiple independent evaluations. Common examples include object-level review in one namespace and account-level actions in another. ## When to use this pattern - separate policy ownership by workflow - different action semantics by namespace - independent iteration and rollout per workflow ## Core model - one real-world entity can appear in multiple namespaces - each namespace submission returns its own `requestId` - webhook processing is independent per namespace - your system can merge outcomes with deterministic precedence rules ## Recommended conventions - keep IDs stable for each namespace identity (`message_123`, `user_456`, etc.) - persist `(namespace, id, requestId)` for every submission - make handlers idempotent on webhook delivery retries - decide conflict precedence up front ## Ingest pattern - [ TypeScript](#tab-panel-18) - [ Python](#tab-panel-19) ``` import Safetykit from "safetykit"; const client = new Safetykit({ apiKey: process.env.SAFETYKIT_API_KEY }); const messageResponse = await client.data.ingest("messages", { data: { id: "message_12345", user_id: "user_67890", text: "sample content", sent_at: "2026-02-27T12:00:00.000Z", }, }); const userResponse = await client.data.ingest("users", { data: { id: "user_67890", latest_message_id: "message_12345", }, }); console.log(messageResponse.requestId, userResponse.requestId); ``` ``` from safetykit import Safetykit client = Safetykit(api_key="sk_your_api_key") message_response = client.data.ingest("messages", { "data": { "id": "message_12345", "user_id": "user_67890", "text": "sample content", "sent_at": "2026-02-27T12:00:00.000Z" } }) user_response = client.data.ingest("users", { "data": { "id": "user_67890", "latest_message_id": "message_12345" } }) print(message_response.request_id, user_response.request_id) ``` ## Webhook handling pattern - [ TypeScript](#tab-panel-20) - [ Python](#tab-panel-21) ``` if (event.type !== "workflow.succeeded") return; if (event.namespace === "messages") { await storeMessageDecision(event.id, event.output); } if (event.namespace === "users") { await applyUserAction(event.id, event.output); } ``` ``` if event["type"] != "workflow.succeeded": return if event["namespace"] == "messages": await store_message_decision(event["id"], event["output"]) if event["namespace"] == "users": await apply_user_action(event["id"], event["output"]) ``` ## Decision reconciliation A practical merge model is: 1. Persist each namespace decision independently. 2. Resolve final platform action with deterministic precedence. 3. Record which namespaces contributed to the final decision for auditability. For the canonical webhook payload contract, see [workflow.succeeded](/webhooks/event-types/workflow-succeeded/index.md).