TypeScript SDK
Highflame TypeScript SDK overview with an ordered path for setup, Shield wrappers, low-level client usage, and advanced topics.
JavaScript and TypeScript SDK for the Highflame guardrails service. The TypeScript package gives you two main ways to integrate Shield:
Shieldwrappers for the fastest path around prompts, tools, and model outputsthe
Highflameclient when you want full request and response control
Read This Section in Order
Getting Started: install
@highflame/sdk, authenticate, and wire up your first guarded functionShield Wrappers: choose the right wrapper and configure it correctly
Low-Level Client: use
client.guard.*,client.detect.*,client.detectors.*, andclient.debug.*Advanced Topics: debugging, optimization, streaming, context objects, sessions, and runtime options
Choosing the Right API
Guard a prompt before my LLM runs
shield.prompt(fn)
Guard a tool call before it executes
shield.tool(fn)
Guard a tool's return value before it's used
shield.toolResponse(fn)
Guard the LLM's output before returning to the caller
shield.modelResponse(fn)
Guard a file read or write
shield.wrap({ contentType: "file", action: "write_file" })(fn)
Evaluate with full control and inspect the full response
client.guard.evaluate()
Evaluate a prompt with minimal code
client.guard.evaluatePrompt()
Evaluate a tool call with minimal code
client.guard.evaluateToolCall()
Run detectors without Cedar policy evaluation
client.detect.run()
Observe traffic without blocking
pass mode: "monitor"
Understand why a decision was made
pass explain: true
See per-detector breakdowns
pass debug: true
Only run detectors referenced by active policies
pass optimize: true
BlockedError is only thrown by Shield wrappers. Direct client.guard.evaluate() calls always resolve, even when the decision is deny.
Create one Highflame client per process, not per request. The client maintains an internal token cache.
Framework Support
The TypeScript SDK ships first-class framework integrations for LangGraph, CrewAI, AWS Strands, and Azure AI Foundry — matching the Python SDK. Import them from their subpaths:
See the Framework Integrations reference for full usage. For custom integrations or call sites not covered by a framework adapter, integrate Shield at your model and tool boundaries with Shield wrappers or direct client.guard.* calls.
Last updated