Install the SDK
Install the server SDK in your backend and expose your workspace server key (nrl_sk_...) as NORILU_SECRET_KEY. One server key handles every customer space—keep it in your server’s secret store, never in browser code.
# TypeScript / Node.js (0.1.x on npm; APIs may evolve before 1.0)
npm install @norilu/server
From Python, Go or any other language, call the REST API with the same secret key. There is no public Python package yet, and the Go SDK is a private preview available on request; the Python and Go tabs on this page show the planned SDK shape.
See the Agent API reference for the audience-scoped OpenAPI schemas (server-v1, browser-v1, and management-v1), permissions, and event payloads.
Run an agent in a customer space
Pass your agent’s immutable agentId (agt_...), your customer’s tenant ID as space, and the signed-in user as user. Norilu isolates files, sandboxes, credentials, memory, and conversation history to that space, pins the thread to your active released version, and enforces maxCostUsd before every model or tool call.
import { Norilu } from "@norilu/server";
const norilu = new Norilu(); // reads NORILU_SECRET_KEY
export async function handleSupport(orgId: string, userId: string, input: string) {
const turn = await norilu.agents.run("agt_billing_01", {
space: orgId, // your customer's ID — no lookup table required
user: userId, // end-user isolation enforced server-side
input,
maxCostUsd: 0.5, // hard USD spending cap per run
});
if (turn.pending?.kind === "approve_tool_call") {
return { status: "waiting_for_approval", threadId: turn.threadId, pending: turn.pending };
}
return turn;
}
from norilu import Norilu
norilu = Norilu() # reads NORILU_SECRET_KEY
def handle_support(org_id: str, user_id: str, input: str):
turn = norilu.agents.run(
"agt_billing_01",
space=org_id, # your customer's ID — no lookup table required
user=user_id, # end-user isolation enforced server-side
input=input,
max_cost_usd=0.50, # hard USD spending cap per run
)
if turn.pending and turn.pending.kind == "approve_tool_call":
return {"status": "waiting_for_approval", "thread_id": turn.thread_id, "pending": turn.pending}
return turn
client, err := norilu.New(os.Getenv("NORILU_SECRET_KEY"), norilu.Options{})
if err != nil {
return err
}
turn, err := client.Agents.Run(ctx, "agt_billing_01", norilu.RunAgentParams{
Space: orgID,
User: userID,
Input: input,
MaxCostUSD: norilu.Float64(0.50),
})
if err != nil {
return err
}
if turn.Pending != nil && turn.Pending.Kind == "approve_tool_call" {
fmt.Println("Waiting for approval on thread:", turn.ThreadID)
}
curl --fail-with-body -sS https://app.norilu.com/api/v1/threads \
-A 'YourProduct/1.0' \
-H "Authorization: Bearer $NORILU_SECRET_KEY" \
-H 'Content-Type: application/json' \
--data '{
"agent_id": "agt_billing_01",
"space": "org_acme",
"user": "usr_42",
"input": "Refund invoice 1042",
"max_cost_usd": 0.50,
"stream": false
}'
Continue or stream a thread
For multi-turn conversations, use threads.stream() or threads.send() with the returned threadId to stream text deltas, live tool-call details, structured UI, and approval requests over SSE.
for await (const event of norilu.threads.stream(threadId, {
input: "Draft this week's account summary.",
})) {
if (event.type === "tool.activity") console.log("Tool:", event.tool, event.status);
if (event.type === "output_text.delta") process.stdout.write(event.delta);
if (event.type === "turn.requires_action") console.log("Pending approval:", event.approvals);
if (event.type === "turn.completed") console.log("\nDone:", event.turn.id);
}
for event in norilu.threads.stream(
thread_id,
input="Draft this week's account summary.",
):
if event.type == "tool.activity":
print("Tool:", event.tool, event.status)
elif event.type == "output_text.delta":
print(event.delta, end="", flush=True)
elif event.type == "turn.requires_action":
print("Pending approval:", event.approvals)
elif event.type == "turn.completed":
print("\nDone:", event.turn.id)
stream, err := client.Threads.Stream(ctx, threadID, norilu.SendMessageParams{
Input: "Draft this week's account summary.",
})
if err != nil {
return err
}
defer stream.Close()
turn, err := stream.ReadTurn(ctx, norilu.StreamHandlers{
OnTool: func(ev norilu.ToolActivityEvent) { fmt.Println("Tool:", ev.Tool, ev.Status) },
OnText: func(delta string) { fmt.Print(delta) },
})
if err != nil {
return err
}
fmt.Println("\nDone:", turn.ID)
If a network connection drops mid-turn, the turn keeps running safely on Norilu. Call norilu.threads.get(threadId) (or client.Threads.Get(ctx, threadID)) to reconcile its saved state before retrying.
Approve or deny tool calls
When an agent reaches a gated action (such as issuing a refund, sending an email, or updating a CRM record), the thread pauses with requires_action and returns the exact pending tool call and arguments. Resume it once your user or backend approves:
// Approve a single pending action
const resumed = await norilu.threads.approve(threadId, { approved: true });
// Or decide each pending call explicitly
const batch = await norilu.threads.approve(threadId, {
turnId: "turn_example",
decisions: [{ callId: "call_123", approve: true }],
});
# Approve a single pending action
resumed = norilu.threads.approve(thread_id, approved=True)
# Or decide each pending call explicitly
batch = norilu.threads.approve(
thread_id,
turn_id="turn_example",
decisions=[{"call_id": "call_123", "approve": True}],
)
// Approve a single pending action
resumed, err := client.Threads.Approve(ctx, threadID, norilu.ApproveParams{
Approved: norilu.Bool(true),
})
// Or decide each pending call explicitly
batch, err := client.Threads.Approve(ctx, threadID, norilu.ApproveParams{
TurnID: "turn_example",
Decisions: []norilu.Decision{{CallID: "call_123", Approve: true}},
})
Norilu verifies the exact pending turn, call IDs, and arguments on the server—stale, duplicate, or tampered decisions are rejected automatically.
Connect a customer’s accounts
Connect a customer’s accounts directly inside that customer’s space or generate a single-use, 24-hour Connect Link (no Norilu login required) for supported space connectors so the credential lands in its isolated Agent Vault. See Connector Vault.
Create agents, report issues & ship v2 rollouts
Create customer-scoped agents programmatically, report production failures directly into pinned regression tests, and roll out evaluated v2 releases selectively—Client A before Client B:
// 1. Create an agent from a goal, Skill, or MCP server
const agent = await norilu.agents.create({
goal: "Handle Stripe refund requests under $100 with human approval",
space: orgId,
});
// 2. Capture a real production failure into your regression suite
await norilu.threads.reportIssue(threadId, {
turnId,
reason: "Refunded the wrong invoice line item",
expectedBehavior: "Confirm the invoice ID before calling create_refund",
});
// 3. Promote an evaluated v2 release to canary customers first
await norilu.agents.promote(agent.id, {
version: 2,
spaces: ["org_canary_a"],
});
# 1. Create an agent from a goal, Skill, or MCP server
agent = norilu.agents.create(
goal="Handle Stripe refund requests under $100 with human approval",
space=org_id,
)
# 2. Capture a real production failure into your regression suite
norilu.threads.report_issue(
thread_id,
turn_id=turn_id,
reason="Refunded the wrong invoice line item",
expected_behavior="Confirm the invoice ID before calling create_refund",
)
# 3. Promote an evaluated v2 release to canary customers first
norilu.agents.promote(
agent.id,
version=2,
spaces=["org_canary_a"],
)
// 1. Create an agent from a goal, Skill, or MCP server
agent, err := client.Agents.Create(ctx, norilu.CreateAgentParams{
Goal: "Handle Stripe refund requests under $100 with human approval",
Space: orgID,
})
// 2. Capture a real production failure into your regression suite
_, err = client.Threads.ReportIssue(ctx, threadID, norilu.ReportIssueParams{
TurnID: turnID,
Reason: "Refunded the wrong invoice line item",
ExpectedBehavior: "Confirm the invoice ID before calling create_refund",
})
// 3. Promote an evaluated v2 release to canary customers first
err = client.Agents.Promote(ctx, agent.ID, norilu.PromoteAgentParams{
Version: 2,
Spaces: []string{"org_canary_a"},
})
Existing threads stay pinned to the version they started on. New threads pick up v2 automatically, and rollback is one call.
API audiences and credentials
Norilu enforces separate credentials and fail-closed guards across server, browser, and management endpoints:
| Audience | Route prefix | Credential prefix | Rules |
|---|---|---|---|
| Server | /api/v1/* | nrl_sk_... | Server-to-server only. Rejects browser Origin headers and browser tokens (403). |
| Browser / Embed | /api/embed/v1/* | nrl_bt_... | Short-lived scoped token minted by norilu.tokens.create(). Rejects server keys (403). |
| Management | /api/management/v1/* | nrl_mgmt_... | Workspace admin / CI automation only. Rejects browser headers and runtime keys (403). |
The user you pass when creating a thread is also the verified sub that Norilu signs into requests to your own MCP server. See Stateless MCP gateway.
Next, embed the agent directly in your UI with @norilu/react.