# PromptJuggler > This file is very large and may be truncated. For an index of this content, please refer to https://docs.promptjuggler.com/llms.txt instead. > PromptJuggler – AI Prompt, Workflow & Agent Platform # Delete a knowledge document Source: https://docs.promptjuggler.com/api-reference/knowledge-bases/delete-a-knowledge-document /openapi.json delete /api/v1/knowledge-documents/{id} Permanently removes a document and all its chunks from the knowledge base. Search results will no longer include content from this document. # Get a knowledge base by slug Source: https://docs.promptjuggler.com/api-reference/knowledge-bases/get-a-knowledge-base-by-slug /openapi.json get /api/v1/knowledge-bases/{slug} Retrieves a knowledge base with its processing status, document count, chunk count, and a list of all documents. Use this to verify that uploaded documents have finished indexing before relying on them in prompts. # Get a knowledge document by ID Source: https://docs.promptjuggler.com/api-reference/knowledge-bases/get-a-knowledge-document-by-id /openapi.json get /api/v1/knowledge-documents/{id} Retrieves a single document with its processing status, file name, size, and chunk count. Use this to check whether a recently uploaded document has finished indexing. # Knowledge base finished Source: https://docs.promptjuggler.com/api-reference/knowledge-bases/knowledge-base-finished /openapi.json webhook knowledgebase.finished Fired when all documents in a knowledge base have finished processing. The entire knowledge base is ready for search at this point. # Knowledge document finished Source: https://docs.promptjuggler.com/api-reference/knowledge-bases/knowledge-document-finished /openapi.json webhook knowledgedocument.finished Fired when a single document finishes processing (chunking and embedding). Contains the document ID and final status. The document is searchable once this webhook fires with a successful status. # Upload documents to a knowledge base Source: https://docs.promptjuggler.com/api-reference/knowledge-bases/upload-documents-to-a-knowledge-base /openapi.json post /api/v1/knowledge-bases/{slug}/documents Uploads one or more files to a knowledge base for chunking and embedding. Documents are processed asynchronously. Listen for the knowledgedocument.finished webhook or poll the document endpoint to know when they are searchable. # Create and trigger a prompt run Source: https://docs.promptjuggler.com/api-reference/prompt-runs/create-and-trigger-a-prompt-run /openapi.json post /api/v1/prompts/{slug}/{version}/runs Triggers an asynchronous prompt run with the given inputs and returns a run ID and thread ID. Reference the prompt by version number, tag, or `__latest__`. Pass a thread ID to continue an existing conversation. # Get a prompt run by ID Source: https://docs.promptjuggler.com/api-reference/prompt-runs/get-a-prompt-run-by-id /openapi.json get /api/v1/promptruns/{id} Retrieves the current state of a prompt run, including status, outputs, token usage, cost, and errors. Poll this endpoint after receiving a webhook notification, or use it to check the status of a run in progress. # Prompt run finished Source: https://docs.promptjuggler.com/api-reference/prompt-runs/prompt-run-finished /openapi.json webhook promptrun.finished Fired when a prompt run completes or fails. Contains the run ID, status, outputs, and error details. Verify the PromptJuggler-Signature header to authenticate the payload. # Get a prompt revision by the prompt’s slug and version Source: https://docs.promptjuggler.com/api-reference/prompts/get-a-prompt-revision-by-the-prompt’s-slug-and-version /openapi.json get /api/v1/prompts/{slug}/{version} Retrieves the full configuration of a prompt revision including model, parameters, tool calls, messages. # Create a streaming credential for a thread Source: https://docs.promptjuggler.com/api-reference/streaming/create-a-streaming-credential-for-a-thread /openapi.json post /api/v1/threads/{thread}/stream-token Returns a short-lived, thread-scoped token your frontend can use to subscribe to live token output over SSE. Call this from your backend with your API key, then hand the token to the browser — the API key itself must never leave your server. The thread does not have to exist yet: mint a token, connect, then start the run. A fresh connection starts at the live tip, so connect before triggering a run, or set the `replay` option of the browser SDK to join a run already under way. # Create and trigger a workflow run Source: https://docs.promptjuggler.com/api-reference/workflow-runs/create-and-trigger-a-workflow-run /openapi.json post /api/v1/workflows/{slug}/{version}/runs Triggers an asynchronous workflow run with the given inputs and returns a run ID and thread ID. Reference the workflow by version number, tag, or `__latest__`. Pass a thread ID to continue an existing conversation across runs. # Get a workflow run by ID Source: https://docs.promptjuggler.com/api-reference/workflow-runs/get-a-workflow-run-by-id /openapi.json get /api/v1/workflowruns/{id} Retrieves the current state of a workflow run, including status, outputs, aggregated token usage, cost, and errors. Poll this endpoint after receiving a webhook notification, or use it to check the status of a run in progress. # Workflow run finished Source: https://docs.promptjuggler.com/api-reference/workflow-runs/workflow-run-finished /openapi.json webhook workflowrun.finished Fired when a workflow run completes or fails. Contains the run ID, status, outputs, and error details. Verify the PromptJuggler-Signature header to authenticate the payload. # Overview Source: https://docs.promptjuggler.com/api/overview Trigger runs, read results, manage knowledge bases. All via REST. The PromptJuggler API lets you trigger prompt and workflow runs, read results (status, outputs, cost, token usage), manage knowledge base documents, and receive webhooks when operations complete. All endpoints require authentication via an API key in the `Authorization` header. ```bash theme={null} curl -H "Authorization: Bearer YOUR_API_KEY" \ https://promptjuggler.com/api/v1/... ``` > [!TIP] > > Create API keys in [Settings](https://promptjuggler.com/settings) within the PromptJuggler app. Browse the endpoints below – each one has an interactive playground where you can try requests directly. # Evaluations Source: https://docs.promptjuggler.com/concepts/evaluations Test your prompts against real data. Stop guessing, start measuring. Evaluations let you run a prompt or workflow against a dataset and measure the results. Instead of testing one input at a time and hoping for the best, you define what good looks like and let PromptJuggler tell you whether you’re getting closer. ## How evaluations work An evaluation is a workflow with a twist. You build it on the same canvas as a regular workflow, but with two special features: 1. **The Input node connects to dataset columns** – instead of free-form user input, each input maps to a column in your dataset. When the evaluation runs, every row becomes a separate workflow run. 2. **SUT marking** – select any Prompt or Workflow node and mark it as the System Under Test (look for the beaker icon in the node’s toolbar). Token usage, cost, and duration metrics will only count the SUT nodes, so your measurement reflects what you’re actually testing, not the scaffolding around it. ## The evaluation page The layout extends the [workflow page](/concepts/workflows) with a bottom pane containing two tabs: **Dataset** – a spreadsheet-style editor for your test data. Add rows and columns, import from CSV, edit cells directly. For multi-turn testing, mark a column as a thread identifier using the column header menu: rows sharing the same thread value will run sequentially against the same conversation. **Run** – shows the results of the currently selected evaluation batch as a grid. Each row maps to a dataset row: inputs, outputs, assertion results, and an aggregated score. The score is a weighted average of your assertion outcomes – each [Assertion node](/workflow-nodes/assertion) carries a weight from 0 to 1. A dropdown next to the tabs lets you switch between past evaluation batches (labelled with dates and version numbers), and the **Run** button kicks off a new batch. ![Evaluation results grid](https://mintcdn.com/promptjuggler/rFcTjbapwgTAJFNk/images/evaluation_page-light.png?fit=max\&auto=format\&n=rFcTjbapwgTAJFNk\&q=85\&s=1eb965a45d1f7109525ce2d8bde0b356) An evaluation batch: dataset rows scored, individual run details on the right ## Assertions [Assertion nodes](/workflow-nodes/assertion) in an evaluation workflow define your quality criteria. Unlike in a regular workflow, assertions in evaluations don’t halt execution – they record pass/fail results and the workflow keeps going. This lets you evaluate every dataset row even if some assertions fail along the way. ## Versioning Evaluations use the same [naming and versioning](/concepts/naming-and-versioning) system as prompts and workflows. Publish an evaluation to freeze your test setup and compare results across prompt versions over time. # Knowledge Bases Source: https://docs.promptjuggler.com/concepts/knowledge-bases Upload documents. Get semantic search. That’s RAG, without the infrastructure. A knowledge base is a collection of documents that PromptJuggler chunks, embeds, and indexes for semantic search. Attach a [KB Search tool](/tools/knowledge-search) to a prompt or use a [KB Search node](/workflow-nodes/knowledge-search) in a workflow, and your AI gains access to your own content at runtime. That’s RAG, without the infrastructure headaches. ## Supported file types Upload any of these: `.txt`, `.csv`, `.tsv`, `.md`, `.html`, `.pdf`, `.docx`. ## How it works Upload a document and PromptJuggler takes care of the rest: splitting it into chunks, generating embeddings, and indexing everything for fast semantic search. Each document shows a status badge that updates in real time – no need to refresh the page. Once a document’s status shows as ready, it’s searchable. Any prompt or workflow with a KB Search tool or node can query it immediately. ## Naming Knowledge bases use [naming](/concepts/naming-and-versioning) (with the `kb_` slug prefix) but not versioning. A knowledge base is a living collection – you add and remove documents over time rather than publishing frozen snapshots. ## Using knowledge bases Two ways to connect a knowledge base to your AI: * **As a tool** – attach the [KB Search tool](/tools/knowledge-search) to a prompt. The model decides when to search and what to search for. Good for conversational use cases where the model should judge when external context is needed. * **As a workflow node** – add a [KB Search node](/workflow-nodes/knowledge-search) to a workflow. The search happens at a fixed point in the pipeline with a query you define. Good for structured pipelines where you always want context injected at a specific step. # Memory & Threads Source: https://docs.promptjuggler.com/concepts/memory-and-threads Conversational memory, channels, thread forking, and agentic communication patterns. Prompts in PromptJuggler can maintain conversational context across multiple runs using threads. A thread is a sequence of messages – the conversation history that gives a model context about what came before. ## Memory modes Each prompt has a memory setting that controls how it interacts with thread history: | Mode | Reads | Writes | What it’s for | | - | - | - | - | | **Stateless** | – | – | One-shot tasks. Classify this text, extract these fields, translate this paragraph. No memory needed, no memory kept. | | **Read-only** | ✓ | – | A prompt that needs context but shouldn’t alter the conversation record. A summariser that reads the full thread and produces a digest without adding to it. | | **Read-write** | ✓ | ✓ | The standard conversational mode. A chatbot that sees what came before and adds its response to the history. | | **Write-only** | – | ✓ | A prompt that contributes context for others without being influenced by prior history. A weather-fetching prompt that writes current conditions into the thread so downstream prompts can reference them. | ## Threads A thread is created when you trigger a run (prompt or workflow) and is returned in the response. Pass the same thread ID back on subsequent runs to continue the conversation. In the UI, this works through the **Continue** and **New Run** buttons at the bottom right of the run form. Continue appends to the current thread; New Run starts fresh. Threads are flexible – from the API, you can pass the same thread ID to different prompts or workflows, and the later ones will see the earlier ones’ memory. ## Forking You can fork a thread at any point in its history. Load an existing thread – even one from production – pick a message, and re-run from that point with a different prompt revision or different inputs. The original thread stays untouched; the fork creates a new branch. This is invaluable for prompt iteration: take a real conversation that went wrong, fork it at the critical moment, and test whether your revised prompt would have handled it better. ## Channels Channels are separate memory lanes within a thread. When a prompt node runs inside a workflow, you can assign it to a specific channel. Prompts on the same channel share history; prompts on different channels are isolated. This enables agentic patterns: one prompt gathers user requirements on a channel called `intake`, another researches options on `research`, a third synthesises everything on `summary`. Each sees only its own conversation, but the workflow orchestrates them into a coherent result. Channels also work when using a prompt as a tool call from another prompt – the parent prompt sets the channel, orchestrating which conversations its tool-prompts participate in. Channels can be set in three places: * **Workflow editor** – on a prompt node’s configuration * **Prompt tool calls** – set by the parent prompt * **API** – fully custom channel assignment per run # Naming & Versioning Source: https://docs.promptjuggler.com/concepts/naming-and-versioning Names, slugs, drafts, versions, and tags – the system that runs through everything. Names, slugs, drafts, and versions work the same way across prompts, workflows, and evaluations. Knowledge bases use naming but not versioning. Once you understand the pattern, it applies everywhere. ## Names and slugs When you create a prompt, workflow, evaluation, or knowledge base, it gets a random name: an adjective and a noun, sometimes amusing, sometimes not. You can rename it any time using the icon next to its name at the top of the editor. Every name generates a **slug** automatically: a URL-safe identifier with a type prefix. Prompts get `pr_`, workflows get `wf_`, knowledge bases get `kb_`. The slug is what you use in API calls and workflow references. > [!TIP] > > When you rename something, the old slug stays as a silent alias. API calls using the previous slug will keep working. No broken integrations, no coordination needed. ## Drafts Every time you save, PromptJuggler creates a new **draft revision**. Each revision is immutable: you’re not overwriting anything, you’re adding to the history. You can undo, redo, and even save from an earlier revision to branch off in a new direction. It's not full git, but it’s close. **Drafts are personal.** Only you can see and run your drafts. This means you can iterate freely without affecting anyone else in the workspace. ## Publishing When your draft is ready, you **publish** it. Publishing does three things: 1. Assigns the next version number (v1, v2, v3 …) 2. Lets you attach a note describing what changed 3. Makes this version visible and usable across the entire workspace Published versions are immutable. You can’t edit v3 after the fact. What you can do is create a new draft from it, improve it, and publish v4. ## Tags Tags are movable labels you attach to published versions. Common examples: `production`, `staging`, `canary`. A tag always points to exactly one version, and you can move it whenever you want. Tags ignore case: `Production` and `production` are the same tag. This lets you decouple "what’s deployed" from "what’s the latest." Publish v12, test it, then move the `production` tag from v11 to v12 when you’re confident. If something goes wrong, move it back. ## Referencing versions When calling a prompt or workflow from the [API](/api/overview) or from a workflow node, you can reference it by: | Reference | What it resolves to | | - | - | | Version number (e.g. `3`) | Exactly that version, always | | Tag (e.g. `production`) | Whatever version the tag currently points to | | `__latest__` | The most recently published version | > [!TIP] > > Only published versions can be called from the API. Drafts are for your eyes only. ## Publishing workflows Workflows can contain nodes that reference prompts or other workflows. When you publish a workflow, PromptJuggler checks that every referenced prompt and sub-workflow points to a published version. If any node still references a draft, the publish will fail with a clear error telling you which ones need attention. This is a safety net: a published workflow should produce the same result every time, and that’s only possible when all its pieces are pinned. ## How it applies | Resource | Naming | Slug prefix | Versioning | | - | - | - | - | | Prompts | ✅ | `pr_` | ✅ | | Workflows | ✅ | `wf_` | ✅ | | Evaluations | ✅ | `ev_` | ✅ | | Knowledge Bases | ✅ | `kb_` | – | # Prompts Source: https://docs.promptjuggler.com/concepts/prompts The fundamental building block: instructions, model, tools, and memory in one versioned unit. A prompt in PromptJuggler is more than a text string. It bundles together your instructions, model configuration, tools, and memory settings into a versioned, runnable unit. Build it once, refine it over time, call it from workflows, other prompts via tool calls, or the API. ## The prompt page The prompt page is split into two: the **editor** on the left, the **run pane** on the right. At the very top: the prompt’s name, rename button, slug, and copy button. Next to those, **Runs** and **Evaluations**. **Runs** opens a scrollable log of every past run of this prompt: dates, revision numbers, tags, inputs, outputs, status, stats – all in one grid. Click any row to load that revision and its run, inspect the results, and iterate from there. **Evaluations** shows which [evaluations](/concepts/evaluations) use this prompt as their test subject. Jump to any of them, or create a new one right here – the fastest path from “I wonder if this is actually better” to finding out. Below that, the **revision bar**: a dropdown to switch between published versions and draft lanes, a publish button, and undo/redo. On the right side of this row, the autosave toggle and save button. This is where you navigate your prompt’s timeline and control when things become permanent. Below the revision bar, the **configuration toolbar** gives you quick access to everything that shapes how the prompt behaves. Each button shows a compact summary of its current setting and opens a popover or dialog for editing: * **Model** – pick a provider and model * **Params** – temperature, top-p, reasoning effort, max tokens, response format: whatever the selected model supports. Setting the response format to JSON Schema reveals a button that opens a dedicated schema editor where you can define the structure graphically or as code * **Tools** – attach any number of [tools](/concepts/tools) to let the model call external functions during execution * **Memory** – choose how this prompt interacts with conversation history: stateless, read-only, read-write, or write-only. See [Memory & Threads](/concepts/memory-and-threads) for the full picture ## System instruction and messages Below the toolbar: the **system instruction** and the **message list**. The system instruction sets the stage: who the model is, how it should behave, what constraints to respect. Below it, messages define the conversation template. By default you get a single user message, but you can add more user and assistant messages for few-shot examples or multi-turn templates. Use `{{placeholders}}` in double curly braces for values you want to fill in at run time. They become input fields when you run the prompt. ![Prompt editor](https://mintcdn.com/promptjuggler/rFcTjbapwgTAJFNk/images/prompt_editor-light.png?fit=max\&auto=format\&n=rFcTjbapwgTAJFNk\&q=85\&s=442b314c11ac4a7d4bc1b3f6300d1cdd) The prompt editor: system instruction, message template with placeholder, and configuration toolbar ## Running a prompt The run form sits at the bottom right of the screen. Fill in your placeholders, hit **Run**, and watch the result appear in the right pane: the full conversation, with duration, token usage, and cost at the top. Click the header to expand the details: token breakdown (input, cached, output, reasoning) and both gross duration (total processing time including parallel work) and net duration (wall clock time from start to finish). From there you can: * **Continue** a conversation to test multi-turn behaviour * **Start a new run** to clear the slate * **Fork a thread** between any two messages to explore “what if this version had responded instead” – load an existing thread, pick a point, and re-run with a different prompt revision. Invaluable for iterating on prompts against real conversation history ## Versioning Prompts use the [naming and versioning](/concepts/naming-and-versioning) system. Every save creates a new draft revision. Publish when you’re ready to make a version available to your team, to workflows, or to the API. ## What makes this powerful A prompt in PromptJuggler is a complete, portable unit. Model, parameters, tools, memory, schema – all travel together. Change the model and the parameter options adapt. Attach a knowledge base search tool and your prompt gains context. Wire it into a workflow and it becomes one node in a larger system. Use it as a tool call from another prompt and it becomes part of a conversation. Publish it and it’s callable from your product with a single API request. Every piece is simple. The combinations are where it gets interesting. # Reliability Source: https://docs.promptjuggler.com/concepts/reliability What happens when a provider wobbles, a network blips, or we ship a release mid-run. Everything between your request and the model's answer can fail: providers rate-limit and time out, networks drop, tool endpoints go down, and we deploy new code while your runs are in flight. Most of that is transient, and transient trouble should not become your problem. So PromptJuggler absorbs it. A run either **completes**, or it **ends with a recorded reason** — never silently, never half-applied, and never because a release happened to land while it was executing. This page describes what the platform does on your behalf, and — at the end — what it deliberately doesn't. ## Two kinds of failure Every failure gets classified before anything else happens, because the right response depends entirely on what kind it is. Retrying a malformed request is pointless; giving up on a 503 is wasteful. | Kind | Examples | What we do | | - | - | - | | **Transient** | Rate limits, provider 5xx and overload, timeouts, torn streams, a tool endpoint mid-deploy | Back off and retry, with the run left intact | | **Terminal** | Malformed request, unknown model, invalid credentials, hard quota exhaustion | Stop immediately and record why — retrying cannot change the answer | | **Ours** | A worker being shut down for a release | Hand the work back to the queue so another worker picks it up from the start | ## Retries Retries happen at two altitudes, independently. **Inside a call**, the runner retries the provider itself. Delays grow exponentially and carry random jitter, so a provider recovering from an incident doesn't get a synchronised stampede from every worker at once. **Around the run**, a run that fails transiently is re-dispatched as a whole — a fresh attempt against the model, from the beginning of that step. The run-level ladder is **bounded**: attempts are finite, and when they are spent the run is marked failed with the error that stopped it. Provider-level backoff deliberately isn't — while a provider is rate-limiting or unavailable, the run waits for it to come back rather than being failed over an outage that was never yours, each wait longer than the last up to a ceiling. Either way, nothing retries silently: the attempt count and the last error are always on the run. > [!NOTE] > > A retry generates tokens again, and generated tokens are billed. Retries > protect your run's outcome, not your bill — a run that succeeds on its third > attempt has paid for three. ## Circuit breaking When a provider is genuinely unwell, continuing to call it wastes time and money and slows its recovery. A circuit breaker watches for sustained failure against each of your provider API keys, and when it trips, further calls on that key fail fast for a short cooling-off period instead of piling on. It then lets traffic through again on its own — if the provider has recovered, everything resumes; if it hasn't, the breaker re-trips. Nobody has to intervene, and there is no stuck-open state waiting on a human. The breaker is shared across every worker, so it reflects what the whole fleet is seeing rather than one process's local bad luck. The part worth knowing is what the breaker refuses to count. **Only failures that are actually evidence about the provider's health move it.** A rejected request means the provider answered — it was up, and it said no. A remote MCP server timing out is the provider *telling you* that someone else's server is down. Counting either would take a healthy provider offline for all of your runs sharing that key, over an outage it had no part in. ## Rate limits, learned rather than guessed Request and token budgets are tracked centrally and shared across all workers, so your concurrency is a real fleet-wide number rather than a per-process guess that collectively overshoots. Those budgets are also **read back from the provider on every call** — including on a 429. Providers adjust limits per account and over time, so the limiter tracks what a provider currently says rather than what was true when the model was added. When you're at the limit, work queues and waits instead of hammering the API into a longer backoff — and you choose the order it waits in, since every run takes a `priority`: an interactive request takes the next free slot ahead of the batch job you queued that morning. ## Retries can't double-apply Retrying is only safe if a duplicate can't do damage — and in any queue-based system, duplicate and late deliveries are a matter of *when*, not *if*. A worker can finish a job and lose the connection before its answer lands; the job runs again; both answers eventually arrive. Every response carries the attempt it belongs to, and a run only accepts a result while it is still waiting for one. Once a run has completed or failed, later deliveries are **ignored, not applied**. Concurrent writes to the same run are serialised, so two handlers racing on the same record cannot interleave into a corrupted state. The practical consequence: a retry never double-appends a message to a thread, never double-counts token usage, and never resurrects a run you already saw finish. ## Deploys don't fail your runs When a worker is asked to shut down — a release, a scale-down, a node being recycled — it stops accepting new work and keeps executing what it already has. Runs that finish inside the grace window complete normally. Anything still executing when the window closes is **returned to the queue rather than failed**, and another worker starts it over. From your side, a deploy looks like nothing at all. ## Failure stays contained Failures are scoped as tightly as the work they belong to — as, on paid plans, is the capacity underneath them: your runs execute on queues and workers dedicated to your tenant, so nobody else's backlog is ever in front of yours. **Within a workflow**, each node retries on its own ladder. A node having a bad time retries in place — it does not restart the workflow, re-run completed nodes, or disturb branches executing beside it. Only if that node exhausts its own retries does the workflow fail, and then it fails as a whole rather than limping onward: no half-finished workflow ever reports a result assembled from the nodes that happened to succeed. **Within a prompt run**, a failed tool call doesn't have to be fatal. Each tool has a [fail-fast toggle](/tools/overview#attaching-tools): leave it off and the error is handed back to the model as the tool's result, so it can try another approach or explain the problem in its answer. Turn it on for tools where a wrong answer is worse than no answer. **Streaming is a side channel.** Runs execute, persist, and complete identically whether anyone is watching. If the streaming infrastructure has a problem, streaming degrades and the run is untouched — and a dropped connection resumes exactly where it left off, since [the stream is a replayable log](/concepts/streaming), not a live firehose. A run's record is always the source of truth. **Webhooks** that fail are retried on their own schedule, independently of the run that triggered them. A webhook endpoint being down never affects the run's outcome. ## When a run does fail, you can see why Failure is data, not a dead end. * The run's status and error are on the run record — one fetch, no log-diving. * The **partial output of the failed attempt is kept** alongside it. When a run dies mid-generation, what the model had produced by then is usually the fastest route to understanding why. * The [transcript](/concepts/transcript) shows which tools were called, in order, and which of them errored — so a failure caused by a tool is visibly a tool failure. * Clients streaming a run receive an explicit signal when a retry re-generates text, so a reader never sees two overlapping attempts spliced together. ## What we don't promise Robustness claims are worth exactly as much as the limits stated alongside them. * **Delivery is at-least-once, not exactly-once.** We make duplicates harmless on our side. Your own webhook handlers should be idempotent too — a delivery can arrive twice. * **Terminal errors are not retried.** An invalid request, a bad key, or exhausted quota fails immediately and stays failed. That is the correct behaviour, but it does mean some failures reach you on the first attempt. * **Retries cost tokens.** See the note above. * **Streams are ephemeral.** The replay buffer behind a resumable stream has bounded retention. Reconnect promptly and lose nothing; come back much later and fetch the run instead — which is why the run record, not the stream, is the source of truth. * **A model's answer is still a model's answer.** None of this makes an LLM deterministic or correct. For that, use [evaluations](/concepts/evaluations). * **The last hop is yours.** Everything on this page begins once a request reaches us. The network between your code and our API is the one stretch we can't make reliable for you, so if a call does fail, retry it — a short retry with backoff around your PromptJuggler calls, the same as you would give any remote service. # Streaming Source: https://docs.promptjuggler.com/concepts/streaming Token-by-token delivery to your end users' browsers, with exact resume and honest loss signals. Streaming delivers a run's output as it is generated — token by token, straight to your end user's browser over Server-Sent Events. It is built for chat experiences: the user sends a message, and the answer types itself out in real time. Streaming is a **side channel**. Runs execute, persist, and complete exactly the same whether anyone is watching or not, and the run record fetched from the API remains the source of truth. If a stream is interrupted, nothing about the run is affected — the protocol below tells the client precisely what it can trust and when to fall back to fetching the result. ## How it fits together 1. Your **backend** mints a stream credential for a thread — one call with any server SDK. The credential grants read access to that thread's stream and nothing else; your API key never reaches the browser. 2. Your **frontend** opens an SSE connection with that credential — most easily via [`@promptjuggler/browser`](/sdks/browser/overview), which handles the whole protocol. 3. Your backend triggers runs on the thread as usual. Everything those runs stream — including every prompt node of a workflow — arrives on the connection, tagged by run and [channel](/concepts/memory-and-threads#channels). ## Getting a credential `POST /api/v1/threads/{thread}/stream-token` (`createStreamToken` in every SDK) returns: ```json theme={null} { "token": "eyJ…", "expiresAt": "2026-07-25T12:00:00+00:00", "url": "https://stream.promptjuggler.com/stream/0198…" } ``` Hand the response to the browser verbatim — the `url` is the thread's SSE endpoint, so the frontend needs no per-environment configuration. Tokens are valid for 24 hours; the browser SDK requests a fresh one on every reconnect, so expiry takes care of itself. The thread does not need to exist yet: mint the token first, connect, then trigger the first run against the same thread ID. Each plan includes a simultaneous streaming connection allowance (10× your concurrency). Connections beyond it are refused with `429` until one closes. ## The event protocol The stream is an ordered, replayed log. Every event carries an SSE `id`; a client that reconnects with `Last-Event-ID` resumes exactly where it left off, losing nothing across network blips and deploys. Events are JSON, keyed by `runId` and `channel`: | Event | Meaning | | - | - | | `token` | One text delta, with `segment` and `seq` ordering metadata. | | `reset` | The run is re-generating a segment (a retry): discard its buffered text. | | `data` | An [emit tool](/tools/emit) produced a structured payload: `tool` and `payload`. | | `tool_start` | The model used a tool: `tool` and a `ref` correlator, at the point it used it. | | `tool_end` | That tool finished: the same `ref`, plus `status` (`ok` or `error`) — and, for a search, the `queries` it ran and the `citations` it found. | | `done` | The run finished. Fetch the run via the API when you need the authoritative result. | | `failure` | The run failed, after all retries. Carries `code` and `message`. | | `stale` | The server could not resume without loss — anything buffered may be incomplete. | | `reconnect` | The server is handing the connection off (a deploy): reconnect immediately. | Two rules keep clients honest: * **Connect before you trigger.** A fresh subscription starts at the live tip of the thread, not in the past. Open the stream first, then start the run, and you see every event from the beginning. A client that can only connect after triggering the run sets the [browser SDK](/sdks/browser/overview)'s `replay` option, or sends `Last-Event-ID: 0` from a raw SSE client, to replay the thread's recent history. * **`stale` means fall back.** Replay covers reconnects within the retention window (minutes). Beyond it — or if events had to be shed under extreme load — the server says `stale` instead of leaving the client to guess. Runs that finish under a `stale` shadow are flagged, and the authoritative text is one API call away. A `tool_end` carries no `segment` or `seq`. It is a status update rather than a position, found by its `ref` wherever the chip already sits — which is what lets an async tool (a [prompt or workflow call](/tools/prompt-and-workflow), a [knowledge search](/tools/knowledge-search)) resolve seconds after the model moved on. A tool that never ends stays pending, which is exactly what a call still running looks like. A chip is published where the model used the tool, not where its turn ended — including for the tools the **provider** runs inside its own turn, [web search](/tools/web-search) and remote [MCP](/tools/mcp). So a model that keeps talking after calling something gives you two text blocks with the chip between them, live and on a refetch alike. The one thing a fetched run adds is a text block's citations, which a provider attaches to the finished message rather than to the deltas it was streamed as; see [Transcript](/concepts/transcript#live-and-fetched-agree). The browser SDK folds all of this — segments, resets, resume, staleness — into a single maintained `text` per run with a `gapped` flag that tells you the one thing you need to know: whether to fetch the run for the full result. Emit payloads ride the same stream as `data` events and are maintained the same way, as `runs[runId].data` (see [emit tools](/tools/emit)). Tool events fold into `runs[runId].transcript`, the same ordered shape a fetched run returns — see [Transcript](/concepts/transcript). ## Workflows and channels Every prompt node in a workflow streams. Events are tagged with the node's [channel](/concepts/memory-and-threads#channels), so a workflow declares at design time which of its conversations are user-facing: put the user-visible prompt on a `support` channel, connect with `?channel=support` (or `channels: ['support']` in the browser SDK), and internal research or synthesis lanes never reach the browser. > [!NOTE] > > Streaming requires API access, so it is available on all paid plans. # Tools Source: https://docs.promptjuggler.com/concepts/tools Give your prompts superpowers: HTTP, scripts, search, MCP, and more. Tools are functions that a model can call during prompt execution. When the model needs external information or wants to perform an action, it requests a tool call. PromptJuggler executes it, feeds the result back, and the model continues – across as many rounds as the conversation needs. You can attach any combination of tools to a prompt: HTTP calls, knowledge base searches, scripts, web search, MCP servers, or even other prompts and workflows. Every tool has a **name**, a **description** (which tells the model what the tool does and when to use it), and a **fail-fast** toggle. When fail-fast is on, a failed tool call fails the entire prompt run. When off, the error is fed back to the model so it can try a different approach. See the [Tools section](/tools/overview) for detailed documentation on each tool type and its configuration. # Transcript Source: https://docs.promptjuggler.com/concepts/transcript A run as a renderable sequence: assistant text, the tools it used, and structured payloads in position. Every prompt run returns its answer twice, in two shapes for two jobs. `output` is the flat text — the right answer for a pipeline, a webhook, a curl call, or anything that just wants the result. It is always present and it is not going anywhere. `transcript` is the same run as an ordered sequence you can render: blocks of assistant prose, the tools the model used, and [emit](/tools/emit) payloads where the model produced them. It is what a chat UI needs and what a flat string cannot express. ## Why a flat string isn't enough Two things get lost when a run collapses to one string. **Text runs together at tool boundaries.** Providers split one logical block of prose into several messages — Anthropic does it around citations, sometimes mid-word — so `output` joins them with nothing at all. That is correct, and it is also why a model that says "I'll look that up.", calls a tool, then says "Here's what I found…" comes back as `I'll look that up.Here's what I found…`. A tool call is a real boundary and the string has no way to say so. **Tool activity is invisible.** A chat UI wants a bubble, then a "used web_search" chip, then another bubble. Nothing in a string carries that. The transcript fixes both by construction: adjacent prose is already merged, and a tool sits between the blocks either side of it. ## The shape ```json theme={null} { "output": "I'll look that up.Here's what I found: 2850 km.", "transcript": [ { "type": "text", "content": "I'll look that up.", "citations": [] }, { "type": "tool", "name": "lookup", "status": "ok", "queries": [], "citations": [] }, { "type": "text", "content": "Here's what I found: 2850 km.", "citations": [] } ] } ``` Three kinds of item, discriminated by `type`: | Kind | Carries | | - | - | | `text` | A block of assistant prose, plus any sources it cited | | `tool` | The tool's name and how the call ended — deliberately not its arguments or its result | | `data` | An [emit tool](/tools/emit) payload, in the position the model produced it | A tool item's `status` is `ok`, `error`, or `pending`. **Pending** is a real state on a finished fetch: an async tool — a [prompt or workflow call](/tools/prompt-and-workflow), a [knowledge search](/tools/knowledge-search) — can still be running when you read the run. `queries` and `citations` on a tool item are only ever populated by the built-in [web search](/tools/web-search); every other tool leaves them empty. > [!NOTE] > > Tool items carry no arguments, no results and no call ids, on purpose. Results can be > enormous, arguments can carry user data, and a chip needs neither. A failed run has an empty `transcript`, exactly as it has a null `output` and an empty `emitted`. ## Rendering it ```tsx theme={null} {run.transcript.map((item, i) => { switch (item.type) { case 'text': return {item.content}; case 'tool': return ; case 'data': return ; } })} ``` ## Live and fetched agree The same shape arrives on the [token stream](/concepts/streaming) as a run is generated, so one component renders it mid-flight and after a refetch. Every chip streams in the position the fetched transcript gives it — tools PromptJuggler runs for you ([HTTP](/tools/http-call), [script](/tools/script), [knowledge search](/tools/knowledge-search), [prompt and workflow](/tools/prompt-and-workflow) calls) with a live `pending` → `ok`/`error` status, and the ones the provider runs inside its own turn ([web search](/tools/web-search), remote [MCP](/tools/mcp)) as they happen. A `web_search` chip reports the `queries` it ran and the `citations` it found as it resolves, so a live chip and a refetched one say the same thing. **One thing a fetched run adds:** a `text` item's `citations`. A provider attaches those to the finished message rather than to the deltas it was streamed as, so they are empty live and populated on a fetch. The text itself is identical and every item is in the same place — fetch the run when you want to footnote the prose. (A chip's own `citations` are unaffected.) On Gemini, a `web_search` chip reports its `queries`; the sources show up as `citations` on the `text` item that cites them, on a fetched run. ## What this does not replace `output` and `emitted` are unchanged and always present. * Reach for **`output`** when you want the answer and nothing else — most integrations. * Reach for **`emitted`** when you want the run's structured results without walking a list — a pipeline or a webhook follow-up. * Reach for **`transcript`** when you are rendering the run to a person. All three derive from the same run, so they cannot disagree. # Workflows Source: https://docs.promptjuggler.com/concepts/workflows Visual pipelines that turn simple nodes into sophisticated agents. Workflows let you chain operations into a pipeline: prompts, scripts, data transformations, branching logic, loops, parallel execution. You build them visually on a canvas and run them as a single unit. If prompts are individual instruments, workflows are the orchestra. ## The workflow page The layout mirrors the [prompt page](/concepts/prompts): editor on the left, run pane on the right. At the top: name, slug, history, and evaluations – same as prompts. Below that, the **revision bar** with version selection, publish, undo/redo, autosave, and save. Below the revision bar: the **canvas**, filling the rest of the screen. This is where you build. ## The canvas The canvas is a drag-and-drop node editor. Add nodes from the **+** button at the bottom right, then wire them together by dragging connections between their handles. **Data flows left to right.** Each node has input handles on the left and output handles on the right. Connect an output to an input and data moves between them when the workflow runs. **Everything is a string.** Structured data travels as JSON strings. You don’t need to define schemas between nodes – the transformation nodes ([String, Array, JSON Query](/workflow-nodes/transform-nodes)) help you reshape data along the way. It’s deliberately simple: if you can read a JSON blob, you can understand what’s flowing through your workflow. ![Workflow canvas with run details](https://mintcdn.com/promptjuggler/rFcTjbapwgTAJFNk/images/workflow_editor-light.png?fit=max\&auto=format\&n=rFcTjbapwgTAJFNk\&q=85\&s=3d715d7e949b811ef243ff3b9559b19e) The workflow canvas: nodes, wiring, and the toolbar > [!TIP] > > The Loop node is special: it can re-trigger Prompt and Workflow nodes via a bottom handle, creating iterative cycles. Other nodes are deterministic and wouldn’t benefit from re-triggering. ## Skipping and merging When a [control flow node](/workflow-nodes/control-flow) doesn’t activate an output, the entire downstream branch is marked as **skipped**. Skipped nodes produce no output and consume no resources. When multiple edges wire into the same input handle, the values merge. If two active branches both feed into a summary prompt, their outputs arrive as a JSON array. If one of those branches was skipped (say, by an If or Switch upstream), it’s simply ignored – only the active branch’s output arrives. A single active value stays as-is, no wrapping. No nulls to handle, no special cases. ## Node types Every node does one thing well. Wire them together and the possibilities multiply. | Category | Nodes | What they do | | - | - | - | | **Data** | [Input, Output, Value](/workflow-nodes/data-nodes) | Get data in, get data out, define constants | | **Execution** | [Prompt, Workflow](/workflow-nodes/execution-nodes) | Run a prompt or nest another workflow | | **Knowledge** | [KB Search](/workflow-nodes/knowledge-search) | Query a knowledge base | | **Code** | [Script](/workflow-nodes/script) | Run custom code in a secure sandbox | | **Transform** | [String, Array, JSON Query](/workflow-nodes/transform-nodes) | Reshape, extract, and combine data | | **Parallel** | [Fanout](/workflow-nodes/fanout) | Process items in parallel | | **Control** | [If, Switch](/workflow-nodes/control-flow) | Conditional branching | | **Iteration** | [Loop](/workflow-nodes/loop) | Repeat operations | | **Validation** | [Assertion](/workflow-nodes/assertion) | Validate conditions during evaluation | See [Workflow Nodes](/workflow-nodes/overview) for detailed documentation on each type. ## Inspecting a run When a workflow run is loaded, every node on the canvas shows a status badge – you can see at a glance what succeeded, what failed, and what’s still pending. Click any node to inspect it. The run pane shows that node’s inputs and outputs. If the node ran multiple times (after a [Fanout](/workflow-nodes/fanout), for example), a stepper at the top lets you navigate between individual runs. Hit the back button to return to the workflow-level view. The **Overview** tab in the run pane displays the workflow’s top-level inputs and outputs. If the workflow contains prompts with memory, additional tabs appear for each channel – one per conversation thread that the prompts participated in. ## Agents and orchestration A workflow with prompts, tools, memory, and branching logic is an agent. PromptJuggler doesn’t draw a hard line between “workflow” and “agent” – an agent is simply a workflow that makes decisions. Add a prompt node with tools, wire in some conditional logic, give it memory across channels, and you’ve built one. The channel system lets prompts within a workflow communicate: each prompt node can read from and write to a specific channel, creating parallel conversation lanes. One prompt gathers requirements, another researches, a third synthesises – each on its own channel, all orchestrated by the workflow. ## Versioning and publishing Workflows use the same [naming and versioning](/concepts/naming-and-versioning) system as prompts. The one extra rule: when you publish a workflow, every prompt and sub-workflow it references must already be published. No draft dependencies allowed in a pinned version. This ensures that a published workflow produces the same result every time. ## What makes this powerful You can build remarkably sophisticated systems from simple, composable pieces. A Fanout node splits an array into parallel prompt runs. A Loop node retries until a condition is met. An If node routes data based on the result of a previous step. Each node is straightforward on its own; the power is in how you connect them. Think LEGO. Except the bricks can talk to AI models. # Build with your AI assistant Source: https://docs.promptjuggler.com/getting-started/ai-assistants Connect Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code or any MCP client to PromptJuggler, and build your prompts, workflows, agents and evaluations together. AI can build your AI. Whether you’re shaping a feature or tuning a prompt, your assistant can create prompts, workflows, agents and evaluations in PromptJuggler, run them, and improve them with you. It connects through [MCP](https://modelcontextprotocol.io/), the open standard for plugging AI assistants into the tools you use. Connect it once, then ask in your own words: * “Draft a prompt that sorts support tickets by urgency, try it on these three tickets, and show me the results.” * “Compare v3 and v4 of the summariser on these inputs and tell me which handles the edge cases better.” * “Build a workflow that drafts a reply and has a second prompt check its tone before returning it.” * “Find yesterday’s failed runs of the triage workflow and tell me what went wrong.” * “What can you do in PromptJuggler?” ## What you need * **A PromptJuggler account**, on any plan. * **A starter credit, or a key for your LLM provider.** New accounts get a \$1 credit that runs each provider’s cheap models, so your assistant can build and run right away. A key from OpenAI, Anthropic or Google Gemini, added in your workspace’s [Settings](/getting-started/settings#provider-api-keys), runs any model. ## Connect over MCP PromptJuggler’s MCP server has one address for every assistant: `https://mcp.promptjuggler.com`. **Working in more than one workspace?** Each has its own address, which **Connected apps** on My Account lists for you to copy. Add one connection per workspace with its address, and name each connection after its workspace. > [tab] Claude > > On claude.ai or in the Claude desktop app: > > 1. Go to [Customize > Connectors](https://claude.ai/customize/connectors). > 2. Click **Add**, then **Add custom connector**. > 3. Name it PromptJuggler, enter `https://mcp.promptjuggler.com` as the server URL, and click **Continue**. > 4. Keep the settings Claude detects, and click **Add**. > 5. Click **Connect**. > > On a Team or Enterprise plan, an Owner adds the connector once under **Organization settings > Connectors**. You then find it under **Customize > Connectors** and click **Connect**. > > Sign in, pick the workspace, and choose what your assistant may do. > [tab] ChatGPT > > Add it once, then bring it into any chat by typing `@` and picking PromptJuggler. > > 1. Open [Plugins](https://chatgpt.com/plugins) on chatgpt.com. In the ChatGPT desktop app, click the **Plugins** icon in the left pane. > 2. Click **Add** at the top right, then **Add custom MCP server**. > 3. Name it PromptJuggler and enter `https://mcp.promptjuggler.com` as the **Server URL**. > 4. Under authentication, pick **OAuth**. > 5. Click **I understand and want to continue**, then **Create as a plugin**. > 6. Install the plugin. > > If you use ChatGPT in a company workspace, your admin may need to allow it first. > > Sign in, pick the workspace, and choose what your assistant may do. > [tab] Claude Code > > **Already connected Claude?** If you sign in to Claude Code with your Claude account, it has every connector you added in Claude, PromptJuggler included, in the terminal, your IDE and the desktop app’s Code tab alike. Type `/mcp` to see it. > > **In the terminal or your IDE**, you can also add it on its own: > > ```bash theme={null} > claude mcp add --transport http --scope user promptjuggler https://mcp.promptjuggler.com > ``` > > Then type `/mcp` in Claude Code and select **promptjuggler** to open the sign-in page in your browser. > > **In the Claude desktop app’s Code tab**, add PromptJuggler as a connector the way the Claude tab shows; the Code tab picks it up. > > Sign in, pick the workspace, and choose what your assistant may do. > [tab] Codex > > **In the terminal** (Codex CLI), run: > > ```bash theme={null} > codex mcp add promptjuggler --url https://mcp.promptjuggler.com > codex mcp login promptjuggler > ``` > > **In the ChatGPT desktop app or your IDE** (Codex), open **MCP servers** in the Codex settings and click **Add server**. Choose **Streamable HTTP**, enter the address above, save, and select **Restart**, then **Authenticate**. > > The terminal and the apps share this setup, so adding PromptJuggler in one is enough. > > Sign in, pick the workspace, and choose what your assistant may do. > [tab] Cursor > > Add PromptJuggler to Cursor’s MCP config, `~/.cursor/mcp.json`: > > ```json theme={null} > { > "mcpServers": { > "promptjuggler": { > "url": "https://mcp.promptjuggler.com", > "auth": { "CLIENT_ID": "https://cursor.com/oauth/mcp-client.json" } > } > } > } > ``` > > Keep the `auth` line: it’s what lets Cursor sign in. Once you save the file, Cursor opens the sign-in page in your browser. > > Sign in, pick the workspace, and choose what your assistant may do. > [tab] VS Code > > You need GitHub Copilot set up in VS Code. > > 1. Open the Command Palette and run **MCP: Add Server**. > 2. Choose **HTTP** and enter `https://mcp.promptjuggler.com` as the URL. > 3. Name it PromptJuggler, then choose **Global** so it’s there in every window. > 4. Open Copilot Chat and switch to **Agent** mode. > 5. Ask anything. When the **MCP authentication required** card appears, click **Authenticate** to open the sign-in page in your browser. > > Sign in, pick the workspace, and choose what your assistant may do. PromptJuggler’s tools are then available in Agent mode. > [tab] Other apps > > Any other MCP client connects one of two ways. > > **If it signs in with OAuth**, add the server `https://mcp.promptjuggler.com`, then sign in, pick the workspace, and choose what your assistant may do. > > **If it takes a token instead**, create one: > > 1. In PromptJuggler, click **Account** at the bottom of the sidebar. > 2. Under **Connected apps**, click **Create token**, then pick the workspace, what your assistant may do, and when the token expires. > 3. Copy the token. It’s shown only once. > 4. In your app, add the server `https://mcp.promptjuggler.com` with the header `Authorization: Bearer `. ## You stay in control * **You choose what it can reach.** Each connection works in the one workspace you pick, and you decide whether your assistant may edit drafts, start runs and publish. * **It asks before publishing.** Publishing can change what your product runs, so your assistant checks with you first. * **You can disconnect it any time.** **Connected apps** on My Account lists your assistants and tokens, so you can disconnect an assistant or revoke a token whenever you like. ## From idea to product Your assistant works with the same drafts, versions and tags you do. [Naming & Versioning](/concepts/naming-and-versioning) explains them; here’s how they take an idea all the way to your product. **Publish once it works.** Drafts are yours alone, so you and your assistant can iterate freely. Publishing makes a version your team and your product can use. **Choose how your product picks up changes.** Your product can call a version number, so changes ship with your own releases. Or it can call a tag such as `production`, so changes ship, and roll back, without a deploy. Both work well. A common setup pairs a `staging` and a `production` tag with [matching environments](/guides/integration#environment-matching), so each gets its own variables and webhooks. **Wire it in.** Ask Claude Code or Codex to [call it from your code](/guides/integration), or ask your assistant for a handover note for your developers. Every step is one request away: > Publish this as “shorter answers” and run the ticket evaluation on it and on the version in production. ## Troubleshooting * **The sign-in page doesn’t open.** Copy the sign-in link your assistant shows into your browser, or disconnect PromptJuggler in your assistant and connect it again. * **Your assistant works in the wrong workspace.** Each connection works in the workspace you picked when connecting it. For another workspace, add a connection with that workspace’s own address from **Connected apps** on My Account. * **Your assistant says it can’t publish.** It publishes only if you allowed that when connecting it. Disconnect PromptJuggler in your assistant and connect it again, keeping **Publish versions and move tags** ticked. * **Runs fail with a provider error.** Models beyond the starter credit run on your workspace’s own provider keys. Add a key for the model’s provider in [Settings](/getting-started/settings#provider-api-keys). * **Your app can’t sign in.** If it doesn’t support OAuth sign-in, [create a token](#other-apps) and add it to the app instead. # What is PromptJuggler? Source: https://docs.promptjuggler.com/getting-started/introduction Tame the AI circus. One platform for prompts, workflows, agents, and evaluations. PromptJuggler is a platform for authoring prompts, building workflows and agents, evaluating quality, and running everything at scale. One place for the whole loop: write it, wire it, test it, ship it. You bring your own LLM API keys (OpenAI, Anthropic, Google Gemini). PromptJuggler handles the rest: versioning, orchestration, parallel execution, tools, knowledge bases, memory, and a clean API to plug it all into your product. Complex underneath, simple on the outside. ## Why it exists AI tooling today can feel like receiving a thousand puzzle pieces with no picture on the box. Evaluation means squinting at outputs and hoping for the best. Switching from one model to another means rethinking half your setup. And the moment you want to combine multiple steps into something coherent, the glue work multiplies faster than the actual value you’re trying to create. PromptJuggler is the organised workbench for people who want to build with AI properly: with care, with structure, and with the satisfying click of things fitting together exactly the way they should. ## What you can build **Start simple.** A single prompt with a template, model selection, and parameter tuning. Run it, refine it, version it. Try it on GPT, then flip to Claude or Gemini with one click. No SDK juggling, no redeployment. **Then go further.** Wire prompts into [workflows](/concepts/workflows): visual pipelines where data flows through transformation nodes, branches, loops, and parallel execution. Each piece does one thing well; together they can orchestrate remarkably sophisticated agents. Think LEGO for AI: simple bricks, serious structures, and the quiet satisfaction of watching them work. ![Workflow canvas](https://mintcdn.com/promptjuggler/rFcTjbapwgTAJFNk/images/workflow_page-light.png?fit=max\&auto=format\&n=rFcTjbapwgTAJFNk\&q=85\&s=abf8c910a097162c480ea5d257c99757) Prompts wired into a workflow, results on the right **Add knowledge.** Upload documents to a [knowledge base](/concepts/knowledge-bases), and your prompts can search them at runtime. That’s RAG: no vector database setup, no embedding pipeline to maintain, no infrastructure headaches. **Then prove it works.** [Evaluations](/concepts/evaluations) let you run a prompt against a dataset and measure the results. When you change something, you’ll know whether it got better or worse. Stop guessing. **And ship it.** The [REST API](/api/overview) lets you trigger prompt and workflow runs, read results (status, output, cost, token usage), manage knowledge base documents, and receive [webhooks](/guides/integration) when things finish. The execution engine is built for throughput: a thousand parallel prompt runs without breaking a sweat, on a fraction of the resources you’d expect. Build it in the UI, call it from your product, and let the platform do the heavy lifting. ## Who it’s for Anyone with a spark of curiosity for building systems. Whether you’re an engineer wiring AI into a product, a team lead prototyping that chatbot idea that keeps collecting dust on the backlog, or someone who simply wants an organised way to tame the chaos of working with LLMs: if you care about doing this well, you’re in the right place. ## Next steps > [card] [Quickstart](/getting-started/quickstart) > > From zero to your first prompt run in five minutes. > [card] [Build with your AI assistant](/getting-started/ai-assistants) > > Connect Claude, ChatGPT or another assistant, and build with it. > [card] [Settings](/getting-started/settings) > > Add your LLM provider keys and get ready to go. > [card] [Core Concepts](/concepts/prompts) > > Understand how prompts, workflows, and versioning fit together. > [card] [Integration Guide](/guides/integration) > > Connect PromptJuggler to your own product via the API. # Quickstart Source: https://docs.promptjuggler.com/getting-started/quickstart From sign-up to your first prompt run in five minutes. Five minutes. That’s all it takes to go from “I just signed up” to watching an LLM respond to your first prompt. Let’s go. ## 1. Sign up Head to [promptjuggler.com](https://promptjuggler.com) and create an account. Free tier, no credit card, no sales call. ## 2. Create your workspace First time in? You’ll be asked to name your workspace – this is where your prompts, workflows, agents, and team live. Pick a name, confirm, and you’re in. Your new workspace opens with two ways to build your first prompt: with your AI assistant, or right here in the editor. This guide takes the editor; [Build with your AI assistant](/getting-started/ai-assistants) takes the other. > [!TIP] > > If a colleague has already set up a workspace and invited you, you’ll land straight in theirs instead. ## 3. Add your LLM provider key Go to [Settings](https://promptjuggler.com/settings), select your preferred provider, paste your API key into the input field, and hit **Save**. > [!TIP] > > Don’t have an API key yet? [OpenAI](https://platform.openai.com/api-keys), [Anthropic](https://console.anthropic.com/), and [Google AI Studio](https://aistudio.google.com/apikey) all offer free-tier credits to get you started. ## 4. Create your first prompt Click **Create a prompt** on your new workspace’s first screen, or the **+** next to **Prompts** in the sidebar. You’ll see the prompt editor with two main sections – system instruction and messages – plus a toolbar for model selection, parameters, tools, memory, and more. Give the model some personality in the system instruction. Add a user message, and try the `{{placeholder}}` syntax: anything in double curly braces becomes an input field at run time. > Tell me something surprising about \{\{topic}} Pick a model from the toolbar, and you’re ready. ## 5. Run it At the bottom right of the screen, you’ll find the run form with input fields for each placeholder you defined. Type something in, hit **Run**, and watch. ## 6. Read the results The right pane shows your run: duration, token usage, and cost at the top, followed by the conversation – your message and the model’s response. Clean and immediate. ![Prompt run result](https://mintcdn.com/promptjuggler/rFcTjbapwgTAJFNk/images/prompt_page-light.png?fit=max\&auto=format\&n=rFcTjbapwgTAJFNk\&q=85\&s=bc780dd46d89ea244a8dafe2832b1856) A prompt with a placeholder, filled in and run — that's the whole loop That’s it. Your first prompt, running. ## What’s next? The path forks here – and that’s the point. Pick whichever direction sparks your curiosity: > [card] [Iterate](/concepts/prompts) > > Tune your prompt, tweak the parameters, try a different model. > [card] [Version it](/concepts/naming-and-versioning) > > Pin a version so you can reference it in workflows or call it from the API. > [card] [Build a workflow](/concepts/workflows) > > Wire multiple prompts into a pipeline with branching, loops, and parallel execution. > [card] [Test it properly](/concepts/evaluations) > > Run your prompt against a dataset and measure whether your changes actually helped. > [card] [Build with your AI assistant](/getting-started/ai-assistants) > > Let Claude, ChatGPT or another assistant create, run and improve prompts with you. # Settings Source: https://docs.promptjuggler.com/getting-started/settings Provider keys, workspaces, and everything else you configure once. Before you can run anything, PromptJuggler needs to know which LLM providers you’re working with. The settings page is where you configure everything that applies across your workspace. ## Workspaces A workspace is where your prompts, workflows, agents, knowledge bases, and team live. You create one when you first sign in. If a colleague has already set up a workspace and invited you, you’ll land straight in theirs instead. You can switch between workspaces or create new ones from the workspace selector at the top left of the sidebar. Handy if you’re a freelancer juggling multiple clients, or if you keep your hobby experiments separate from your day job. ## Members Invite team members to your workspace and manage their access. ## Provider API Keys PromptJuggler doesn’t proxy your LLM calls: your keys talk directly to the providers. Select a provider, paste your key, save. Done. Supported providers: * **OpenAI** * **Anthropic** * **Google Gemini** ## PromptJuggler API Keys These are *your* API keys for calling PromptJuggler's [REST API](/api/overview) from your own product. Not to be confused with provider API keys above: those let PJ talk to LLMs, these let *you* talk to PJ. ## Environment Variables Define variables that get injected into your prompt and workflow runs. Environment variables support environment matching: tag a variable with an environment like `production` or `staging`, and it will only be injected when the incoming API call identifies itself as that environment. ## Webhooks Get notified when things finish. Configure webhook URLs to receive callbacks on completed runs and indexing operations. Like environment variables, webhooks support environment matching: a webhook tagged `production` only fires for production runs. > [!TIP] > > See the [Integration Guide](/guides/integration) for details on API keys, environment variables, and webhooks. ## Subscription PromptJuggler is free to start. Paid tiers unlock higher concurrency, more storage, and API access. Upgrade, downgrade, or manage your payment method right from the settings page. # Building a Chatbot Source: https://docs.promptjuggler.com/guides/building-a-chatbot A production chat experience end to end: a conversational prompt, a thin backend, and a streaming React frontend. This guide builds a real-time chatbot on PromptJuggler: your user types a message, the answer streams into the page token by token, and the conversation remembers itself. It takes one prompt, two small backend endpoints, and one React component. ## 1. The prompt Create a prompt (say `assistant`) with **read-write memory** — it sees the conversation so far and appends its replies to it (see [Memory & Threads](/concepts/memory-and-threads)). Give it your system instructions and an input variable for the user's message, then publish it to `production`. ## 2. The backend Two endpoints, both thin. One mints the [stream credential](/concepts/streaming), one triggers runs. Your API key stays here; the browser never sees it. ```ts theme={null} import { PromptJuggler } from '@promptjuggler/sdk'; import { randomUUID } from 'node:crypto'; const pj = new PromptJuggler(process.env.PROMPTJUGGLER_API_KEY); // The stream credential: scoped to one thread, valid 24h. Authenticate your // own user first — whoever holds this can read that thread's stream. app.get('/api/chat/:thread/stream-token', async (req, res) => { res.json(await pj.createStreamToken(req.params.thread)); }); // One message: trigger a run on the thread. Returns immediately; the answer // arrives on the stream. app.post('/api/chat/:thread/messages', async (req, res) => { const run = await pj.runPrompt('assistant', 'production', { message: req.body.message, }, { thread: req.params.thread }); res.json({ runId: run.id }); }); ``` The thread ID is yours to choose — generate a UUID per conversation (`randomUUID()`), keep it in your session or database, and pass the same one to both endpoints. The thread doesn't need to exist before the first run; minting a stream token for it first is exactly the right order. ## 3. The frontend Connect **before** sending the first message — a fresh subscription starts at the live tip, so open the stream first and you see every token from the beginning. ```tsx theme={null} import { useState } from 'react'; import { usePromptJugglerStream } from '@promptjuggler/browser/react'; export function Chat({ threadId }: { threadId: string }) { const [draft, setDraft] = useState(''); const { connected, runs } = usePromptJugglerStream( { getToken: () => fetch(`/api/chat/${threadId}/stream-token`).then((r) => r.json()), }, [threadId], ); const send = async () => { setDraft(''); await fetch(`/api/chat/${threadId}/messages`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ message: draft }), }); }; return (
{Object.entries(runs).map(([runId, run]) => (
{run.text} {run.status === 'streaming' && }
))} setDraft(e.target.value)} />
); } ``` That's the whole loop: `send` triggers a run, the run streams into `runs[runId].text`, and `status` flips to `done` when it finishes. Reconnects, retries, and workflow segments are handled inside the hook. > [!NOTE] > > When a terminal state carries `gapped: true`, the streamed text may be incomplete — > fetch the run through your backend (`pj.getPromptRun(runId)`) and swap in the > authoritative output. With connect-before-send this is rare, but handling it is what > makes the UI trustworthy. ## Showing the user's side The stream carries the model's output; your user's messages you already have locally. Render them optimistically from your own state, keyed however you like — the runs map and your local messages interleave naturally by time. On a full page reload, rebuild the transcript from your backend (the thread's runs via the API, or your own message store) and let the stream take over for new messages. ## Structured data alongside the prose Sometimes the answer isn't only text. An assistant that pulls up records wants to stream its reply *and* hand the frontend the ids to render as cards. Add an [emit tool](/tools/emit) to the prompt — a tool whose schema-validated arguments **are** the result — and its payloads arrive on the same stream as `run.data`, beside the text you already render. Give the tool a payload schema (say `{ records: [{ id, title }] }`) and tell the model to emit when it has matches. Then render the data next to the prose: ```tsx theme={null} {Object.entries(runs).map(([runId, run]) => (
{run.text} {run.data?.map((item, i) => ( // payload matches your schema ))}
))} ``` `run.data` is the ordered list of `{ tool, payload }` the model emitted this run, maintained for you exactly like `text` — cards appear the moment the model produces them, while the prose keeps streaming. The same payloads are on the run's `emitted` field if you need the authoritative copy after a `gapped` terminal state. ## Showing what the model is doing If the prompt has tools, the user watches a pause with nothing to explain it — a [knowledge search](/tools/knowledge-search) or an [HTTP call](/tools/http-call) can take seconds. `run.transcript` is the same run as an ordered sequence — prose, tools, emit payloads in position — so you can render the activity instead of a blank gap: ```tsx theme={null} {Object.entries(runs).map(([runId, run]) => (
{run.transcript?.map((item, i) => { switch (item.type) { case 'text': return {item.content}; case 'tool': return ; case 'data': return ; } })} {run.status === 'streaming' && }
))} ``` A tool chip appears the moment the model calls the tool, with `status: 'pending'`, and flips to `ok` or `error` when it comes back. `transcript` replaces `text` and `data` in your render — it contains both — and it is the same shape `pj.getPromptRun(runId)` returns, so the same component renders a live run and a reloaded one. See [Transcript](/concepts/transcript) for the full shape. ## Workflows instead of a single prompt Swap `runPrompt` for `runWorkflow` and nothing else changes — every prompt node streams into the same connection. If the workflow has internal lanes (research, tool use, synthesis), put the user-facing node on a dedicated [channel](/concepts/memory-and-threads#channels) and pass `channels: ['support']` to the hook so only that lane renders. # Building Workflows Source: https://docs.promptjuggler.com/guides/building-workflows From a blank canvas to a working pipeline. ## Start with a canvas Click **+** next to **Workflows** in the sidebar. You get a blank canvas with zoom controls at the bottom left and a **+** button at the bottom right. ## Add your nodes Click **+** at the bottom right to open the menu of available [node types](/workflow-nodes/overview). Start with an **Input** node (your workflow’s entry point) and an **Output** node (where results emerge). Everything in between is up to you. ## Wire them together Drag from an output handle (right side of a node) to an input handle (left side of another). Data flows left to right. Each connection is a data path – when the upstream node completes, its output arrives at the downstream node’s input. A Prompt node also exposes one output per [emit tool](/tools/emit) it declares, so schema-validated structured data flows to downstream nodes directly. Remember: [everything is a string](/concepts/workflows#the-canvas). Structured data travels as JSON. The [transform nodes](/workflow-nodes/transform-nodes) help you reshape data between steps. ## Configure your nodes Click a node to open its configuration. Each type has different settings – a Prompt node needs a prompt and version selection, a Script node needs code, an If node needs an operator and comparand. The node pages under [Workflow Nodes](/workflow-nodes/overview) cover each type in detail. ## Test it Fill in the inputs at the bottom right and hit **Run**. Watch the status badges appear on each node as the workflow executes. Click any node to inspect its inputs and outputs in the run pane. ## Iterate and publish Every save creates a new draft revision. When your workflow does what you want, [publish it](/concepts/naming-and-versioning#publishing) to make it available to your team and the API. > [!TIP] > > Start small. A workflow with an Input, a Prompt, and an Output is a perfectly valid starting point. Add complexity as you need it – a transform here, a branch there, maybe a loop when you’re feeling adventurous. # Integration Guide Source: https://docs.promptjuggler.com/guides/integration API keys, webhooks, environment variables – everything you need to go live. You’ve built and tested your prompts, workflows and agents in the UI. Now it’s time to call them from your own product. The pattern is simple: trigger a run, wait for the webhook, fetch the result. ## The integration flow 1. **Create a PromptJuggler API key** in [Settings](https://promptjuggler.com/settings) 2. **Publish** the prompt or workflow you want to call – only published versions are available via the API 3. **Trigger a run** with a POST request, passing your inputs 4. **Store the run ID** from the response 5. **Wait for the webhook** telling you the run finished 6. **Fetch the result** with a GET request using the run ID That’s the whole loop. ## Authentication Every API request requires a Bearer token in the `Authorization` header: ```bash theme={null} curl -X POST https://promptjuggler.com/api/v1/prompts/pr_my-prompt/production/runs \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"inputs": {"topic": "octopuses"}}' ``` ## Triggering runs Runs are triggered by POST to either: * `/api/v1/prompts/{slug}/{version}/runs` – for prompt runs * `/api/v1/workflows/{slug}/{version}/runs` – for workflow runs The `version` parameter accepts a version number (`3`), a tag (`production`), or `__latest__` for the most recently published version. See [Naming & Versioning](/concepts/naming-and-versioning) for details. The request body includes: | Field | Required | Description | | - | - | - | | `inputs` | Yes | Key-value pairs matching your prompt’s placeholders or workflow’s input nodes | | `thread` | No | Thread ID to continue a conversation. Omit to start fresh | | `priority` | No | `onsite` (highest), `normal` (default), or `low` | | `environment` | No | Environment identifier (e.g. `production`, `staging`) for variable and webhook matching | | `metadata` | No | Arbitrary key-value data attached to the run for your own tracking. Keys can be up to 255 bytes, values up to 1,024 bytes | The response returns a **run ID** and a **thread ID**. Store both – the run ID to fetch results, the thread ID if you want to continue the conversation in a follow-up call. Runs are queued, so the response means *accepted*, not *created*: fetching the run ID straight away can briefly return `404`. Wait for the webhook, as in the flow above. ## Priority Runs triggered from the UI automatically get `onsite` priority. API runs default to `normal`. Use `low` for batch jobs or background processing where latency doesn’t matter. Higher-priority runs are processed first when the system is under load. ## Webhooks Instead of polling for completion, configure webhooks in [Settings](https://promptjuggler.com/settings) to receive a POST when a run finishes. Four webhook events are available: | Event | Fires when | | - | - | | `promptrun.finished` | A prompt run completes or fails | | `workflowrun.finished` | A workflow run completes or fails | | `knowledgedocument.finished` | A document finishes processing (chunking and embedding) | | `knowledgebase.finished` | All documents in a knowledge base are processed | Webhooks are signed with HMAC-SHA256 using your webhook secret. The signature arrives in the `PromptJuggler-Signature` header in the format `t={timestamp},v1={signature}`. To verify: recompute the HMAC over `{timestamp}.{raw_request_body}` and compare. Reject requests with timestamps outside your tolerance window to prevent replay attacks. ### Environment matching Both webhooks and environment variables use the same glob pattern matching. Tag a webhook URL with a pattern like `prod*` or `staging`, and it will only fire for runs whose `environment` field matches. A webhook with no environment tag fires for all runs. ## Environment variables Environment variables are injected into prompt and workflow runs automatically. Configure them in [Settings](https://promptjuggler.com/settings). Two sources, applied in order: 1. **Global variables** (set in Settings) – matched against the run’s `environment` field using glob patterns. A variable tagged `prod*` matches runs with environment `production` or `prod-eu` 2. **Per-request overrides** – passed directly in the create-run API call. These take precedence over global variables with the same key This lets you maintain a base set of credentials and configuration in Settings, while overriding specific values per request when needed – useful for example for multi-tenant setups where each of your customers needs different API keys or endpoints injected into the same workflow. ## Knowledge Base management The API supports managing knowledge base documents programmatically – handy when your users upload content through your product and you want their documents searchable by your AI behind the scenes. * **Upload documents** – POST files to `/api/v1/knowledge-bases/{slug}/documents` * **Get a knowledge base** – GET `/api/v1/knowledge-bases/{slug}` for status and document list * **Get a document** – GET `/api/v1/knowledge-documents/{id}` for processing status * **Delete a document** – DELETE `/api/v1/knowledge-documents/{id}` Use the `knowledgedocument.finished` and `knowledgebase.finished` webhooks to know when uploaded documents are ready for search. ## Full API Reference See the [API Reference](/api/overview) for complete endpoint documentation with an interactive playground, request/response schemas, and code examples. # Running Prompts Source: https://docs.promptjuggler.com/guides/running-prompts Run prompts and workflows in the UI and via the API, and make sense of the results. ## From the UI Open a prompt or workflow. The run form sits at the bottom right of the screen with input fields for each placeholder you’ve defined. Fill them in, hit **Run**, and the result appears in the right pane. A small key icon next to the inputs lets you pass runtime environment variables for the run – useful for populating `${VAR}` placeholders in [tool configurations](/tools/http-call#environment-variable-substitution). The run header shows duration, token usage, and cost at a glance. Click it to expand the details: token breakdown (input, cached, output, reasoning) and both gross duration (total processing time) and net duration (wall clock time from start to finish). For workflows, the canvas decorates each node with a status badge. Click any node to inspect its inputs and outputs. If a node ran multiple times (after a [Fanout](/workflow-nodes/fanout)), a stepper lets you navigate between individual runs. ## Threads and continuation When running a prompt or workflow with [memory](/concepts/memory-and-threads), you can **continue** an existing thread or **start fresh**. The buttons appear at the bottom right of the run form once a previous run is loaded. **Forking** lets you branch a thread at any point: load an existing conversation, pick a message, and re-run from there with a different prompt revision. The original thread stays untouched. Invaluable for testing “would my new version have handled this better?” ## Channels When a workflow contains prompts on different [channels](/concepts/memory-and-threads#channels), the run pane shows a tab for each channel. The **Overview** tab displays the workflow’s top-level inputs and outputs. ## From the API Trigger a run via POST to the [API](/api/overview), store the run ID, wait for the [webhook](/guides/integration#webhooks), then fetch the result. See the [Integration Guide](/guides/integration) for the full flow. ## Run history The **Runs** button in the toolbar opens a scrollable log of every past run. Dates, revision numbers, tags, inputs, outputs, status, stats – all in one grid. Click any row to load that run and its revision for inspection. # Setting Up Evaluations Source: https://docs.promptjuggler.com/guides/setting-up-evaluations Create datasets, wire assertions, and measure how your prompts, workflows and agents perform. ## Create an evaluation Click **+** next to **Evaluations** in the sidebar, or use the **Evaluations** dropdown in a prompt’s or workflow’s toolbar to create one directly from what you’re testing. An evaluation is a [workflow](/concepts/workflows) with two extra features: a dataset and SUT marking. ## Build your dataset Switch to the **Dataset** tab in the bottom pane. This is a spreadsheet-style editor: add rows and columns, edit cells directly, or import from CSV. Each column can map to an input on your evaluation workflow. When the evaluation runs, each row becomes a separate run with those values as inputs. ### Multi-turn testing For testing conversational prompts and workflows, mark a column as a **thread identifier** using the column header’s kebab menu. Rows with the same thread value will run against the same conversation thread, simulating a multi-turn interaction. ## Mark what you’re testing On the canvas, select a Prompt or Workflow node and mark it as the **System Under Test** (look for the beaker icon in the node’s hover toolbar). Token usage, cost, and duration metrics will only count SUT nodes, so your measurements reflect what you’re actually testing rather than the evaluation scaffolding around it. ## Add assertions Wire [Assertion nodes](/workflow-nodes/assertion) into your workflow to define what “good” looks like. Pick an operator, set the expected condition, and assign a weight (0 to 1). The evaluation’s aggregate score is a weighted average of all assertion outcomes. ## Run the evaluation Hit the **Run** button in the bottom pane. Every dataset row becomes a workflow run. Watch the results appear in the **Run** tab: inputs, outputs, assertion results, and the aggregate score. Switch between past evaluation batches using the dropdown next to the tabs. Compare how different prompt versions perform against the same dataset. # Using Knowledge Bases Source: https://docs.promptjuggler.com/guides/using-knowledge-bases Upload documents, wait for indexing, and connect them to your prompts and workflows. ## Create a knowledge base Click **+** next to **Knowledge Bases** in the sidebar. Your new KB gets a random name – rename it to something meaningful. ## Upload documents Add documents in any of these formats: `.txt`, `.csv`, `.tsv`, `.md`, `.html`, `.pdf`, `.docx`. PromptJuggler automatically chunks each document, generates embeddings, and indexes everything for semantic search. Each document shows a status badge that updates in real time – no need to refresh the page. When the status shows ready, that document is searchable. ## Connect to your prompts Two ways to give your prompts access to a knowledge base: **As a tool** – attach the [KB Search tool](/tools/knowledge-search) to a prompt. The model decides when to search and what to search for. Best for conversational use cases where context should be pulled in on demand. **As a workflow node** – add a [KB Search node](/workflow-nodes/knowledge-search) to a workflow. The search happens at a fixed point in the pipeline with a query you wire in. Best for structured pipelines where you always want context at a specific step. Configure the **top K** (how many chunks to return) and the **format** (text or JSON). ## Manage via the API You can also upload, inspect, and delete documents programmatically through the [API](/api/overview). Use the `knowledgedocument.finished` and `knowledgebase.finished` [webhooks](/guides/integration#webhooks) to know when uploads are ready for search. # Roadmap Source: https://docs.promptjuggler.com/roadmap Where PromptJuggler is going, and everything that got it here. PromptJuggler has been serving production workloads since June 2025. This page covers what’s coming, and what has shipped along the way. New models usually show up within days of release, so they don’t get entries of their own. ## What’s next *Directional, not a commitment — the order changes more often than the list does.* ### Soon * **SSO and OIDC** — including Microsoft Entra sign-in. * **Audit logs** — who changed what, and when. * **LangChain integration** — a package for using PromptJuggler prompts and workflows from LangChain. * **Agent skills** — reusable skills your agents can draw on. * **Agent memory** — a document store agents can write to and read back, so what they work out in one run is still there in the next. * **Evaluation improvements** — datasets built from production runs rather than hand-written cases, JSONL import, assertions on metrics like cost and duration, and evals surfaced on the prompt and workflow pages they belong to, with better filtering and sorting. ### Later * **Dashboard** — usage and spend, recent runs, and how each prompt and workflow is actually behaving, gathered into one place. * **Batch and priority processing** — provider batch queues and flex/priority tiers, across OpenAI, Anthropic and Gemini. * **Provider-side code execution** — let the model run code in the provider’s own sandbox, alongside the script tool you already have. * **Sub-tenants** — workspaces nested under a parent, for agencies and resellers. * **Automatic conversation summarisation** — keep long threads inside the context window without losing the plot. ## Missing something? Customer demand is the main thing that moves items up this list. If something here matters to you, or something that isn’t here matters more, [tell us](https://promptjuggler.com/contact). ## What’s shipped **November 2026** * **Build with your AI assistant** — connect Claude, ChatGPT or any other assistant over MCP, and it creates, runs and improves your prompts, workflows and agents with you. [Get started](/getting-started/ai-assistants). **September 2026** * **Hardened sessions** — sign-in tokens rotate on every use, and reuse is detected and cut off. * **Prompt caching for Claude** — prompts that call tools reuse their context from step to step, at a fraction of the input price. **August 2026** * **Scripts can reach the network** — a [script](/workflow-nodes/script) can call an API or fetch a page, not just compute. On paid plans. **July 2026** * **Token streaming** — tokens reach the browser as they’re generated, over SSE, with replay if a connection drops. Opt-in per prompt, so nothing changes unless you ask for it. * **The browser SDK** — [`@promptjuggler/browser`](/sdks/browser/overview), a streaming client for the people using your product rather than for your backend. A React hook and an Angular signals adapter sit on a framework-agnostic core. * **The emit tool** — [emit](/tools/emit) lets a model hand your application structured, schema-validated payloads mid-conversation, instead of leaving you to parse them back out of prose. * **Transcripts** — a run comes back as an ordered [transcript](/concepts/transcript): prose, tool calls and emitted payloads in the order the model produced them, ready to render straight into a chat UI. **June 2026** * **Five backend SDKs** — Python, TypeScript, Java, PHP and Go, generated from the OpenAPI spec and then wrapped in hand-written facades so they don’t feel machine-made. **April 2026** * **Trash and recovery** — deleting a prompt, workflow or knowledge base moves it to the trash rather than destroying it. You can bring it back. * **Per-environment provider keys** — point staging and production at different OpenAI, Anthropic or Gemini credentials, and each run picks up the right one. **March 2026** * **Knowledge bases and RAG** — upload documents and PromptJuggler handles extraction, chunking, embedding and semantic search, as both a [tool](/tools/knowledge-search) your prompts can call and a [workflow node](/workflow-nodes/knowledge-search). No vector database to run. * **Sub-agents** — prompts and workflows became [callable as tools](/tools/prompt-and-workflow) from other prompts. An agent can hand work to another agent, which can hand it to another, nested as deep as the problem needs. * **Threads and forking** — [threads](/concepts/memory-and-threads) got their own view, including forking a conversation from any point. * **Loop, array and conditional nodes** — [loop](/workflow-nodes/loop), array-operation and [conditional](/workflow-nodes/control-flow) nodes, for the logic that shouldn’t need a model. * **Environment variables** — configuration scoped per run, so one prompt can point at different systems in staging and production. **February 2026** * **Anthropic models** — Claude joined OpenAI and Gemini, with extended thinking supported. * **MCP tools** — any [MCP server](/tools/mcp) can be connected as a tool, across every provider. **January 2026** * **Redesigned interface** — the UI was rebuilt on a lighter component set, with clearer navigation and a sidebar you can actually find things in. * **JMESPath** — the [JSON Query node](/workflow-nodes/transform-nodes) accepts JMESPath alongside JSONPath, so you can use whichever syntax you already know. **December 2025** * **Versioning rebuilt** — the [draft-and-publish flow](/concepts/naming-and-versioning): work in a draft, publish when it’s ready, and leave your callers undisturbed until you do. * **Published OpenAPI spec** — the full API surface, specified. Later the foundation every SDK is generated from. * **JSON schema editor** — define structured input and output shapes without hand-writing schema. * **GitHub sign-in** — one fewer password. **November 2025** * **Conversation history** — prompts stopped being one-shot and started keeping the thread. * **Pin to a tag** — call a specific published version instead of whatever happens to be newest. **October 2025** * **Evaluations** — run a prompt against a dataset, assert on the results, and score them. When you change a prompt you find out whether it got better or worse, rather than squinting at a handful of outputs and hoping. * **Cost tracking** — every run reports what it cost. **September 2025** * **Reasoning controls** — reasoning effort, reasoning summaries and verbosity, exposed and normalised across providers. **August 2025** * **Google Gemini** — a second provider alongside OpenAI. **July 2025** * **File uploads** — attach files to a run. * **Script execution** — run sandboxed [code](/workflow-nodes/script) as a step, for the glue work that doesn’t need a model. **June 2025** * **In production** — PromptJuggler started serving production workloads: prompts with versioning and OpenAI model selection, visual workflows with fan-out and fan-in, tools, webhooks, and a public REST API. # Browser SDK Source: https://docs.promptjuggler.com/sdks/browser/overview Subscribe to live token streams from your end users' browsers — no API key required, or allowed. `@promptjuggler/browser` is the client for [streaming](/concepts/streaming): it opens the SSE connection, speaks the whole protocol — segments, resets, resume, staleness — and hands you one maintained text per run. Everything in the package is safe to ship to an end user's browser; it authenticates with a thread-scoped credential and never sees your API key. ## Installation ```bash theme={null} npm install @promptjuggler/browser ``` It runs in every modern browser (`fetch` + `ReadableStream`) and in Node.js 22+. ## The credential flow Your backend mints the credential with a server SDK and returns it verbatim; the browser hands it to `getToken`. That one function is the entire auth story: ```ts Your backend (Node example) theme={null} import { PromptJuggler } from '@promptjuggler/sdk'; const pj = new PromptJuggler(process.env.PROMPTJUGGLER_API_KEY); app.get('/api/stream-token', async (req, res) => { // Authenticate YOUR user first — the credential grants read access to the thread. res.json(await pj.createStreamToken(req.query.thread)); }); ``` ```ts Browser theme={null} import { PromptJugglerStream } from '@promptjuggler/browser'; const stream = new PromptJugglerStream({ // Called on connect and on every reconnect, so token expiry renews itself. getToken: async () => { const res = await fetch(`/api/stream-token?thread=${threadId}`); return res.json(); // { token, url } — createStreamToken's response, verbatim }, }); ``` ## Events ```ts theme={null} const finished = new Set(); stream.on('text', ({ runId, text }) => render(runId, text)); stream.on('data', ({ runId, data }) => renderCards(runId, data)); stream.on('done', ({ runId, gapped }) => { finished.add(runId); if (gapped) refetch(runId); }); // gap can arrive even after a clean done — a late token proving the finished // text incomplete — and no second done follows. Refetch settled runs it names. stream.on('gap', ({ runId }) => { if (finished.has(runId)) refetch(runId); }); stream.on('failure', ({ runId, message }) => showError(runId, message)); stream.connect(); ``` | Event | Payload highlights | When | | - | - | - | | `text` | `runId`, `text`, `gapped` | The run's full text so far, maintained for you — subscribe to this to just render. | | `data` | `runId`, `data` | The run's emit-tool payloads so far, maintained — structured data beside the text. | | `done` / `failure` | `runId`, `gapped` (+ `code`, `message`) | The run reached its terminal state. | | `gap` | `runId`, `segment` | Part of this run's text is missing (e.g. you joined mid-run). | | `stale` | — | The server lost history; runs still streaming should be treated as gapped. | | `token` / `reset` | raw protocol events | For append-style UIs that assemble text themselves. | | `connected` / `disconnected` | — | Connection lifecycle. | The one flag that matters is **`gapped`**: when a terminal event carries `gapped: true`, the streamed text is (or may be) incomplete — fetch the run through your backend for the authoritative result. When it is `false`, the text you rendered is the full output and no fetch is needed — with one edge for raw-event consumers: a `gap` arriving *after* a clean `done` retroactively proves that text incomplete (as in the sample above). The React hook folds all of this into `runs[runId].gapped`, which is why it is the recommended surface. Reconnection is automatic — exponential backoff after failures, immediate when the server hands the connection off during a deploy — and resumes exactly where it left off. `disconnect()` stops everything. ## Connecting after the run started A new connection starts at the live tip of the thread, so the usual order is to connect first and trigger the run second. When your frontend only learns the thread from the run it triggered, set `replay: true`: ```ts theme={null} const stream = new PromptJugglerStream({ getToken, replay: true }); ``` The first connection replays what the thread's recent history still holds, so a run already under way streams from its first token. Runs that finished in that window replay too, each ending with its `done` or `failure` event, so handle only the runs you show. ## React ```tsx theme={null} import { usePromptJugglerStream } from '@promptjuggler/browser/react'; function Chat({ threadId }: { threadId: string }) { const { connected, runs } = usePromptJugglerStream( { getToken: () => fetch(`/api/stream-token?thread=${threadId}`).then(r => r.json()) }, [threadId], // what identifies the subscription: change it, and the hook resubscribes ); return Object.entries(runs).map(([runId, run]) => ( )); } ``` `runs[runId]` is `{ text, data?, transcript?, channel, status: 'streaming' | 'done' | 'failed', gapped?, error? }` — render `text` and you have a chatbot. Render [`transcript`](/concepts/transcript) instead when the UI shows tool activity: it is the same run as an ordered sequence of prose, tool chips and emit payloads, in the same shape `getPromptRun` returns. The options object is read through a ref, so inline literals never cause reconnects; only the `deps` array does. ## Angular The same surface as signals, for Angular 17+: ```ts theme={null} import { Component, signal } from '@angular/core'; import { injectPromptJugglerStream } from '@promptjuggler/browser/angular'; @Component({ selector: 'app-chat', template: ` @for (run of stream.runs() | keyvalue; track run.key) {

{{ run.value.text }}

} `, }) export class ChatComponent { readonly threadId = signal('0198…'); readonly stream = injectPromptJugglerStream(() => { // Read the signal HERE, in the factory itself — that read is what the // adapter tracks. Inside getToken it would run too late to be seen. const thread = this.threadId(); return { getToken: () => fetch(`/api/stream-token?thread=${thread}`).then((r) => r.json()), }; }); } ``` `stream.connected` and `stream.runs` are signals holding the same shapes as the React hook. Reactivity follows Angular's grain: any signal read **during the factory call** — here `threadId`, hoisted into a local — is tracked, and changing it drops the old subscription (and its runs) and connects a fresh one. Reads deferred into `getToken` happen after tracking ends, so hoist them as above. Call it in an injection context (a field initializer or constructor); the subscription disconnects when the component is destroyed. Signals-only, so it works in zoneless applications. ## Workflows Every prompt node of a workflow streams into the same connection, keyed by `runId` and tagged with its [channel](/concepts/memory-and-threads#channels). Follow only the user-facing lanes with `channels: ['support']`. See the [chatbot guide](/guides/building-a-chatbot) for the full end-to-end walkthrough. # Go SDK Source: https://docs.promptjuggler.com/sdks/go/overview Run prompts and workflows, manage knowledge bases, and verify webhooks from Go. The PromptJuggler Go SDK is a thin, typed wrapper over the public REST API. You call flat, synchronous methods that take a `context.Context` and get back typed structs — authentication, request building, and JSON (de)serialization are handled for you. It runs on the standard library's `net/http`, so it pulls in no third-party HTTP stack. ## Requirements * Go 1.22 or newer ## Installation ```bash theme={null} go get go.promptjuggler.com/sdk ``` ## Set up the client Create an API key in [Settings](https://promptjuggler.com/settings), then construct the client once and reuse it (it is safe for concurrent use): ```go theme={null} import "go.promptjuggler.com/sdk" pj := promptjuggler.New("your-api-key") ``` The key is sent as a Bearer token to `https://promptjuggler.com`. Point the SDK at another host (e.g. for testing) with `promptjuggler.WithBaseURL(url)`, or swap the HTTP client (timeouts, proxy) with `promptjuggler.WithHTTPClient(h)`. ## Per-endpoint usage Every endpoint in the [API reference](/api/overview) includes a **Go SDK** code sample showing the exact call — that's the place to look for how to invoke each operation and what it returns. Typed models are returned from the `client` sub-package. A typical flow: ```go theme={null} import ( "context" "fmt" "go.promptjuggler.com/sdk/client" ) ctx := context.Background() // Trigger a run (async — returns immediately with the run ID) created, err := pj.RunPrompt(ctx, "greeting", "production", map[string]string{"name": "Ada"}) if err != nil { // handle err } // Poll for the result run, err := pj.GetPromptRun(ctx, created.Id) if err != nil { // handle err } if run.Status == client.RUNSTATUS_COMPLETED { fmt.Println(run.GetOutput()) } ``` Optional run parameters (priority, environment, metadata, …) are functional options on `RunPrompt` / `RunWorkflow`: ```go theme={null} pj.RunPrompt(ctx, "greeting", "production", map[string]string{"name": "Ada"}, promptjuggler.WithEnvironment("staging"), promptjuggler.WithPriority("onsite"), ) ``` > [!NOTE] > > Enum fields keep a value added to the API after your SDK version; `IsValid()` tells whether > the SDK declares it. ## Error handling When the API responds with an error status, the SDK returns an `*APIError` carrying the HTTP status code and the server's message. When the request never reaches the API (DNS failure, timeout, offline), it returns a `*NetworkError`. If the API replies with a success status whose body can't be decoded (a missing required field, say), it returns a `*DecodeError`. Match them with `errors.As`: ```go theme={null} import "errors" _, err := pj.GetPrompt(ctx, "does-not-exist", "production") var apiErr *promptjuggler.APIError if errors.As(err, &apiErr) { apiErr.StatusCode // e.g. 404 apiErr.Message // the server's error message } ``` You never inspect a generated-client error — the SDK translates the underlying client's errors into its own. ## Webhooks PromptJuggler signs every webhook with the `PromptJuggler-Signature` header. Verify it against the **raw** request body, before any JSON parsing: ```go theme={null} payload := string(rawBody) // the raw request body, as received signature := r.Header.Get("PromptJuggler-Signature") if !promptjuggler.VerifyWebhookSignature(payload, signature, "your-webhook-secret") { // reject the delivery (e.g. respond 403) } ``` `VerifyWebhookSignature` recomputes the HMAC-SHA256 of `{timestamp}.{raw_body}`, compares it in constant time, and rejects deliveries whose timestamp falls outside a tolerance window (default 300s) to prevent replay. A missing (empty) signature header returns false. Use `VerifyWebhookSignatureAt` to supply an explicit tolerance and clock. # Java SDK Source: https://docs.promptjuggler.com/sdks/java/overview Run prompts and workflows, manage knowledge bases, and verify webhooks from Java. The PromptJuggler Java SDK is a thin, typed wrapper over the public REST API. You call flat, synchronous methods and get back typed model objects — authentication, request building, and JSON (de)serialization are handled for you. It runs on the JDK's built-in HTTP client, so it pulls in no third-party HTTP stack. ## Requirements * Java 17 or newer ## Installation Replace `VERSION` with the latest release: [![Maven Central](https://img.shields.io/maven-central/v/com.promptjuggler/promptjuggler-java)](https://central.sonatype.com/artifact/com.promptjuggler/promptjuggler-java) ```kotlin Gradle theme={null} implementation("com.promptjuggler:promptjuggler-java:VERSION") ``` ```xml Maven theme={null} com.promptjuggler promptjuggler-java VERSION ``` ## Set up the client Create an API key in [Settings](https://promptjuggler.com/settings), then construct the client once and reuse it (it is thread-safe): ```java theme={null} import com.promptjuggler.PromptJuggler; PromptJuggler pj = new PromptJuggler("your-api-key"); ``` The key is sent as a Bearer token to `https://promptjuggler.com`. Point the SDK at another host (e.g. for testing) with the two-argument constructor: `new PromptJuggler(apiKey, baseUrl)`. ## Per-endpoint usage Every endpoint in the [API reference](/api/overview) includes a **Java SDK** code sample showing the exact call — that's the place to look for how to invoke each operation and what it returns. A typical flow: ```java theme={null} import com.promptjuggler.client.model.CreatePromptRunResponse; import com.promptjuggler.client.model.PromptRun; import com.promptjuggler.client.model.RunStatus; import java.util.Map; // Trigger a run (async — returns immediately with the run ID) CreatePromptRunResponse created = pj.runPrompt("greeting", "production", Map.of("name", "Ada")); // Poll for the result PromptRun run = pj.getPromptRun(created.getId()); if (run.getStatus() == RunStatus.COMPLETED) { System.out.println(run.getOutput()); } ``` Optional run parameters (priority, thread, environment, metadata, …) go through a `RunOptions` builder passed as the last argument: ```java theme={null} import com.promptjuggler.RunOptions; RunOptions options = RunOptions.builder().environment("staging").priority("onsite").build(); pj.runPrompt("greeting", "production", Map.of("name", "Ada"), options); ``` > [!NOTE] > > Methods return typed model objects with validated fields. They are read-only data — read > the fields, don't write them back. An enum value added to the API after your SDK version > reads as `UNKNOWN_DEFAULT_OPEN_API`, or as `null` in a nullable field such as > `ModelParams.getReasoningEffort()`. ## Error handling When the API responds with an error status, the SDK throws an `ApiError` carrying the HTTP status code and the server's message. When the request never reaches the API (DNS failure, timeout, offline), it throws a `NetworkError`. When the API replies with a success status but the SDK can't decode the body (a tool type newer than the SDK, say), it throws a `DecodeError`: the request succeeded, so retrying a run starts a second one. All three extend `PromptJugglerException`, which is **checked** — every call that reaches the API declares `throws PromptJugglerException`, so the compiler makes you handle (or propagate) the failure. Catch the base to handle the whole surface at once, or catch `ApiError` first when you need the status code: ```java theme={null} import com.promptjuggler.ApiError; import com.promptjuggler.PromptJugglerException; try { pj.getPrompt("does-not-exist", "production"); } catch (ApiError error) { error.statusCode(); // e.g. 404 error.getMessage(); // the server's error message } catch (PromptJugglerException error) { // a NetworkError, a DecodeError, or any other SDK failure } ``` You never catch a generated-client error — the SDK translates the underlying client's errors into its own. ## Webhooks PromptJuggler signs every webhook with the `PromptJuggler-Signature` header. Verify it against the **raw** request body, before any JSON parsing: ```java theme={null} import com.promptjuggler.Webhooks; String payload = request.getBody(); // the raw request body, as text String signature = request.getHeader("PromptJuggler-Signature"); if (!Webhooks.verifySignature(payload, signature, "your-webhook-secret")) { // reject the delivery (e.g. respond 403) } ``` `Webhooks.verifySignature` recomputes the HMAC-SHA256 of `{timestamp}.{raw_body}`, compares it in constant time, and rejects deliveries whose timestamp falls outside a tolerance window (default 300s) to prevent replay. Widen or narrow it with the five-argument overload. # PHP SDK Source: https://docs.promptjuggler.com/sdks/php/overview Run prompts and workflows, manage knowledge bases, and verify webhooks from PHP. The PromptJuggler PHP SDK is a thin, typed wrapper over the public REST API. You call flat, synchronous methods and get back readonly objects — authentication, request building, and JSON (de)serialization are handled for you. ## Requirements * PHP 8.2 or newer ## Installation ```bash theme={null} composer require promptjuggler/sdk ``` The SDK sends requests through the [PSR-18](https://www.php-fig.org/psr/psr-18/) HTTP client already in your project, such as Guzzle or Symfony HttpClient. If you have none, install one (`composer require guzzlehttp/guzzle`), or let Composer's `php-http/discovery` plugin install one when it asks. ## Set up the client Create an API key in [Settings](https://promptjuggler.com/settings), then construct the client once and reuse it: ```php theme={null} use PromptJuggler\Client\PromptJuggler; $pj = new PromptJuggler('your-api-key'); ``` The key is sent as a Bearer token to `https://promptjuggler.com`. Pass `baseUrl:` to target another deployment — the key goes to whatever URL you configure. The client is found automatically. Pass your own as the second argument to set timeouts, proxies, or middleware: ```php theme={null} use GuzzleHttp\Client; $pj = new PromptJuggler('your-api-key', new Client(['timeout' => 10])); ``` ## Per-endpoint usage Every endpoint in the [API reference](/api/overview) includes a **PHP SDK** code sample showing the exact call — that's the place to look for how to invoke each operation and what it returns. A typical flow: ```php theme={null} use PromptJuggler\Client\Models\Priority; use PromptJuggler\Client\Models\RunStatus; // Trigger a run (async — returns immediately with the run ID) $created = $pj->runPrompt('greeting', 'production', inputs: ['name' => 'Ada'], priority: Priority::Low); // Poll for the result $run = $pj->getPromptRun($created->id); if ($run->status === RunStatus::Completed) { echo $run->output; echo $run->cost?->total; } ``` > [!NOTE] > > Methods return generated readonly objects (`PromptJuggler\Client\Models\…`) > with public properties — read them, don't set values back. A field the API > always sends is non-nullable; an optional one is `null` when absent. A > response that lacks a required field, or has one of the wrong type, throws a > `DecodeException` naming the field. Fields the SDK doesn't know are ignored. ## Enums and unions Enum properties are typed with their SDK cases plus `UnknownEnumValue`, for example `RunStatus|UnknownEnumValue`. A value the API adds after your SDK version arrives as `UnknownEnumValue` instead of failing the call. `->value` works on both. A `match` without a `default` arm throws `UnhandledMatchError` on such a value, and PHPStan flags it, so end it with one: ```php theme={null} $message = match ($run->status) { RunStatus::Completed => $run->output, RunStatus::Failed => $run->error, RunStatus::Pending => 'still running', default => "unknown status {$run->status->value}", }; ``` `Tool`, `ResponseFormat`, and `TranscriptItem` are interfaces with one class per variant (`HttpCall`, `TranscriptText`, …). Tell them apart with `instanceof`. A variant newer than your SDK arrives as `UnknownTool`, `UnknownResponseFormat`, or `UnknownTranscriptItem`, with its `type` and the raw object in `data`: ```php theme={null} use PromptJuggler\Client\Models\HttpCall; foreach ($pj->getPrompt('greeting', 'production')->tools as $tool) { if ($tool instanceof HttpCall) { echo $tool->url; } } ``` ## Error handling When the API responds with an error status, the SDK throws a `PromptJuggler\Client\Exception\ApiException` carrying the HTTP status code (an `int`) and the server's message, or `"{status} {reason}"` when the body has none. When the request gets no complete response (DNS failure, timeout, a dropped connection), it throws a `NetworkException`. When the API replies with a success status but the SDK can't decode the body, it throws a `DecodeException`: the request succeeded, so retrying a run starts a second one. All three live in `PromptJuggler\Client\Exception` and implement the `PromptJugglerException` marker interface, so you can catch the whole surface at once. ```php theme={null} use PromptJuggler\Client\Exception\ApiException; try { $run = $pj->getPromptRun('does-not-exist'); } catch (ApiException $e) { $e->statusCode; // e.g. 404 $e->getMessage(); // the server's error message } ``` The SDK doesn't retry requests. Input that can't be encoded as JSON (invalid UTF-8) throws PHP's `InvalidArgumentException` before anything is sent. ## Webhooks PromptJuggler signs every webhook with the `PromptJuggler-Signature` header. Verify it against the **raw** request body, before any JSON decoding: ```php theme={null} use PromptJuggler\Client\Webhook\WebhookSignature; $payload = file_get_contents('php://input'); $signature = $_SERVER['HTTP_PROMPTJUGGLER_SIGNATURE'] ?? ''; if (!WebhookSignature::isValid($payload, $signature, 'your-webhook-secret')) { http_response_code(403); exit; } $event = json_decode($payload, true); ``` `isValid` recomputes the HMAC-SHA256 of `{timestamp}.{raw_body}`, compares it in constant time, and rejects deliveries whose timestamp falls outside a tolerance window (default 300s) to prevent replay. Widen or narrow it with the `tolerance:` argument. # Python SDK Source: https://docs.promptjuggler.com/sdks/python/overview Run prompts and workflows, manage knowledge bases, and verify webhooks from Python. The PromptJuggler Python SDK is a thin, typed wrapper over the public REST API. You call flat, synchronous methods and get back pydantic models — authentication, request building, and JSON (de)serialization are handled for you. ## Requirements * Python 3.10 or newer ## Installation ```bash theme={null} pip install promptjuggler ``` ## Set up the client Create an API key in [Settings](https://promptjuggler.com/settings), then construct the client once and reuse it: ```python theme={null} from promptjuggler import PromptJuggler pj = PromptJuggler("your-api-key") ``` The key is sent as a Bearer token to `https://promptjuggler.com`. Point the SDK at another host (e.g. for testing) with the `base_url=` argument. ## Per-endpoint usage Every endpoint in the [API reference](/api/overview) includes a **Python SDK** code sample showing the exact call — that's the place to look for how to invoke each operation and what it returns. A typical flow: ```python theme={null} from promptjuggler import RunStatus # Trigger a run (async — returns immediately with the run ID) created = pj.run_prompt("greeting", "production", {"name": "Ada"}) # Poll for the result run = pj.get_prompt_run(created.id) if run.status == RunStatus.COMPLETED: print(run.output) ``` > [!NOTE] > > Methods return pydantic models with typed, validated fields. They are read-only data — > read the fields, don't write them back. An enum field keeps a value added to the API after > your SDK version, as a member outside the declared ones. ## Error handling When the API responds with an error status, the SDK raises an `ApiError` carrying the HTTP status code and the server's message. When the request never reaches the API (DNS failure, timeout, offline), it raises a `NetworkError`. When the API replies with a success status but the SDK can't decode the body (a tool type newer than the SDK, say), it raises a `DecodeError`: the request succeeded, so retrying a run starts a second one. All three extend the `PromptJugglerError` base class, so you can catch the whole surface at once. ```python theme={null} from promptjuggler import ApiError try: revision = pj.get_prompt("does-not-exist", "production") except ApiError as error: error.status_code # e.g. 404 str(error) # the server's error message ``` You never catch a generated-client error — the SDK translates the underlying client's errors into its own. ## Webhooks PromptJuggler signs every webhook with the `PromptJuggler-Signature` header. Verify it against the **raw** request body, before any JSON parsing: ```python theme={null} import json from promptjuggler import verify_webhook_signature payload = request.body # the raw request body, as text signature = request.headers.get("PromptJuggler-Signature", "") if not verify_webhook_signature(payload, signature, "your-webhook-secret"): ... # reject the delivery (e.g. respond 403) event = json.loads(payload) ``` `verify_webhook_signature` recomputes the HMAC-SHA256 of `{timestamp}.{raw_body}`, compares it in constant time, and rejects deliveries whose timestamp falls outside a tolerance window (default 300s) to prevent replay. Widen or narrow it with the `tolerance=` argument. # TypeScript SDK Source: https://docs.promptjuggler.com/sdks/typescript/overview Run prompts and workflows, manage knowledge bases, and verify webhooks from TypeScript. The PromptJuggler TypeScript SDK is a thin, typed wrapper over the public REST API. You call flat, async methods and get back typed objects — authentication, request building, and JSON (de)serialization are handled for you. It runs in Node.js and any runtime with a global `fetch`. ## Requirements * Node.js 22 or newer ## Installation ```bash theme={null} npm install @promptjuggler/sdk ``` ## Set up the client Create an API key in [Settings](https://promptjuggler.com/settings), then construct the client once and reuse it: ```ts theme={null} import { PromptJuggler } from '@promptjuggler/sdk'; const pj = new PromptJuggler('your-api-key'); ``` The key is sent as a Bearer token to `https://promptjuggler.com`. Point the SDK at another host (e.g. for testing) with the `baseUrl` option, or inject a custom `fetch`. ## Per-endpoint usage Every endpoint in the [API reference](/api/overview) includes a **TypeScript SDK** code sample showing the exact call — that's the place to look for how to invoke each operation and what it returns. A typical flow: ```ts theme={null} import { RunStatus } from '@promptjuggler/sdk'; // Trigger a run (async — returns immediately with the run ID) const created = await pj.runPrompt('greeting', 'production', { name: 'Ada' }); // Poll for the result const run = await pj.getPromptRun(created.id); if (run.status === RunStatus.Completed) { console.log(run.output); } ``` > [!NOTE] > > Methods return generated model objects with typed fields. They are plain, read-only > data — read the fields, don't write them back. An enum field can hold a value added to the > API after your SDK version, outside its declared union. ## Error handling When the API responds with an error status, the SDK throws an `ApiError` carrying the HTTP status code and the server's message. When the request never reaches the API (DNS failure, timeout, offline), it throws a `ConnectionError`. When the API replies with a success status but the SDK can't decode the body, it throws a `DecodeError`: the request succeeded, so retrying a run starts a second one. All three extend the `PromptJugglerError` base class, so you can catch the whole surface at once. ```ts theme={null} import { ApiError } from '@promptjuggler/sdk'; try { const run = await pj.getPromptRun('does-not-exist'); } catch (error) { if (error instanceof ApiError) { error.statusCode; // e.g. 404 error.message; // the server's error message } } ``` You never catch a generated-client error — the SDK translates the underlying client's errors into its own. ## Webhooks PromptJuggler signs every webhook with the `PromptJuggler-Signature` header. Verify it against the **raw** request body, before any JSON parsing: ```ts theme={null} import { verifyWebhookSignature } from '@promptjuggler/sdk'; const payload = await request.text(); // the raw body const signature = request.headers.get('PromptJuggler-Signature') ?? ''; if (!(await verifyWebhookSignature(payload, signature, 'your-webhook-secret'))) { // reject the delivery (e.g. respond 403) } const event = JSON.parse(payload); ``` `verifyWebhookSignature` recomputes the HMAC-SHA256 of `{timestamp}.{raw_body}`, compares it in constant time, and rejects deliveries whose timestamp falls outside a tolerance window (default 300s) to prevent replay. Widen or narrow it with the `tolerance` argument. It uses the Web Crypto API, so it runs in Node, edge runtimes, and browsers alike. # Emit Tool Source: https://docs.promptjuggler.com/tools/emit Return schema-validated structured data beside the model's prose. An emit tool is a tool whose arguments **are** the result. The model calls it when it has structured data to hand back — a list of ids, a set of options, a chart spec — and PromptJuggler runs nothing external: it validates the payload against the tool's schema and delivers it, both on the run and on the live [stream](/concepts/streaming). It exists for chat experiences that need to stream prose *and* return structure at once. A support agent can stream "Let me pull those up…", call an emit tool with the matching record ids, and keep streaming its answer — the ids arrive as typed data your frontend renders as cards, while the prose stays plain readable text. ## Configuration * **Name** and **description** — as with any tool; the description tells the model when to emit. * **Payload schema** — a JSON Schema for the arguments. This is the contract: the model's payload is validated against it, and consumers can rely on the shape. The model may call an emit tool multiple times in one run — emit three cards, keep writing, emit two more. ## What you get back * **On the run** — `emitted` on the [run response](/api/overview): an ordered list of `{ tool, payload }` for every accepted emit. This is the authoritative record. The completion webhook carries only the run id and status, so fetch the run to read `emitted`. * **On the stream** — a `data` event per emit as it happens, carrying the same `{ tool, payload }`. The [browser SDK](/sdks/browser/overview) maintains these as `runs[runId].data`, so a chat renders cards the moment the model produces them. * **In position** — the run's [`transcript`](/concepts/transcript) carries each payload as a `data` item where the model produced it, between the blocks of prose either side. Use it when a card belongs mid-answer rather than at the end. The payload is the tool's arguments verbatim — no wrapping, no transformation. ## In workflows Inside a [workflow](/guides/building-workflows), each emit tool on a prompt node becomes a **named output** you can wire to downstream nodes — no prose-scraping. The output is a JSON array of that tool's payloads (empty if it didn't emit that run), so it drops straight into a [Fanout node](/workflow-nodes/fanout) to process each payload in parallel, or a [JSON Query transform node](/workflow-nodes/transform-nodes) to pull a field. ## Validation PromptJuggler validates every payload against the schema before accepting it, and caps it at 64 KB. A payload that doesn't conform (or is too large) is rejected back to the model as a tool error it can correct on the next turn — so the data your callers receive is always valid and bounded. Only accepted emits appear in `emitted` and on the stream; a rejected-then-retried call surfaces only the accepted retry. > [!NOTE] > > Emit tools need API access, so they are available on all paid plans. See the [chatbot guide](/guides/building-a-chatbot) for an end-to-end example. # HTTP Call Tool Source: https://docs.promptjuggler.com/tools/http-call Make HTTP requests to external APIs during execution. Lets the model make HTTP requests to external APIs during execution. Configure the endpoint and the model fills in the parameters at runtime. ## Configuration * **URL** – the endpoint to call. Supports [environment variable](/guides/integration#environment-variables) substitution with `${VAR_NAME}` syntax. A password or a credential query parameter – `api_key`, `token` and the like – takes its secret from a placeholder, e.g. `?api_key=${API_KEY}` * **Method** – GET, POST, PUT, PATCH, DELETE * **Headers** – custom headers, also supporting `${VAR_NAME}` substitution. Credential headers – `Authorization`, `Cookie`, and any header named like a key, token or secret – take their secret from a placeholder, e.g. `Authorization: Bearer ${API_TOKEN}` * **Parameters** – defined as a JSON Schema. For GET requests, parameters are serialised into the query string. For other methods, they travel as a JSON request body ## Environment variable substitution Use `${VAR_NAME}` in URLs and headers to inject values from your workspace’s [environment variables](/guides/integration#environment-variables) at runtime. This keeps secrets out of your workflow definitions – store an API key as an environment variable, reference it in the header, and the actual value gets injected when the tool runs. ## Correlation headers Every request the tool makes carries two headers identifying the run it came from, so your endpoint can correlate calls back to a PromptJuggler run: * **`PromptJuggler-RunId`** – the root run ID. It is shared across every prompt and workflow in the same run tree, so nested tool calls all report the same value. * **`PromptJuggler-Thread`** – the conversation thread ID. PromptJuggler sets these after your custom headers, so they take precedence if you configure a header with the same name. HTTP header names are case-insensitive – match on the name, not its exact casing. ## Limits * **Responses up to 256 KiB** – a longer response reaches the model cut at 256 KiB, with a note saying so. * **Redirects** – followed up to 10 times. Your custom headers go only to the host you configured and its subdomains, so a redirect elsewhere, such as to a CDN or a presigned storage URL, never sees your keys. # Knowledge Search Tool Source: https://docs.promptjuggler.com/tools/knowledge-search Semantic search over your documents, as a tool. Gives the model access to a [knowledge base](/concepts/knowledge-bases). When the model decides it needs context from your documents, it triggers a semantic search and receives the most relevant chunks. Select which knowledge base to search when configuring the tool. The model controls the query and timing. This is the tool equivalent of the [KB Search workflow node](/workflow-nodes/knowledge-search). The difference: as a tool, the model decides when to search and what to search for. As a node, the search happens at a fixed point in the pipeline. Use the tool for conversational prompts where the model should judge when context is needed. # MCP Tool Source: https://docs.promptjuggler.com/tools/mcp Connect to Model Context Protocol servers. Connects a prompt to a [Model Context Protocol](https://modelcontextprotocol.io/) server, giving the model access to whatever tools that server exposes. MCP is an open standard for extending LLM capabilities through external services – think of it as a universal plug for AI tools. ## Configuration * **Name** – identifies this MCP connection * **URL** – the MCP server endpoint. Supports [environment variable](/guides/integration#environment-variables) substitution with `${VAR_NAME}` syntax. A password or a credential query parameter takes its secret from a placeholder, e.g. `?token=${MCP_TOKEN}` * **Auth token** – the server’s token, kept as an [environment variable](/guides/integration#environment-variables) and referenced as `${VAR_NAME}`, so the secret stays in your workspace settings rather than in the prompt * **Allowed tools** – optionally restrict the model to specific tools from the server by listing their names. Leave empty to allow every tool the server exposes The MCP connection is passed through to the LLM provider. MCP is available on OpenAI and Anthropic models; Gemini models don't currently support it. ## Correlation Like the [HTTP Call tool](/tools/http-call#correlation-headers), MCP requests carry the run and thread IDs so your server can correlate them back to a PromptJuggler run: * **Run ID** – the root run ID, shared across every prompt and workflow in the same run tree, so nested calls all report the same value. * **Thread ID** – the conversation thread ID. How they reach your server depends on the provider: * **OpenAI** sends them as the `PromptJuggler-RunId` and `PromptJuggler-Thread` request headers. * **Anthropic**'s MCP connector doesn't support custom headers, so they're appended to your server URL as the `promptJugglerRunId` and `promptJugglerThread` query parameters instead. # Tools Source: https://docs.promptjuggler.com/tools/overview Give your prompts superpowers: HTTP, scripts, search, MCP, and more. Tools are functions that a model can call during prompt execution. When the model decides it needs external information or wants to perform an action, it requests a tool call. PromptJuggler executes the tool, feeds the result back, and the model continues – potentially requesting more tools in the same run, across as many rounds as the conversation needs. ## Attaching tools Open a prompt’s configuration toolbar, click **Tools**, and add as many as you need. Each tool type has its own configuration. You can mix types freely – a prompt can have an HTTP call, a knowledge base search, and an MCP server tool all attached at once. Every tool has a **name**, a **description** (which tells the model what the tool does and when to use it), and a **fail-fast** toggle. When on, a failed tool call fails the entire prompt run. When off, the error is fed back to the model so it can try a different approach. Names must be unique within a prompt, and `web_search` is reserved for the built-in [web search](/tools/web-search) tool — it is the name search reports under in a run's [transcript](/concepts/transcript), so a second tool sharing it would be indistinguishable to whoever is reading. ## Tool types > [card] [Prompt & Workflow](/tools/prompt-and-workflow) > > Call another prompt or trigger a workflow as a tool. Turtles all the way down. > [card] [Knowledge Search](/tools/knowledge-search) > > Search a knowledge base for relevant context. > [card] [HTTP Call](/tools/http-call) > > Make HTTP requests to external APIs. > [card] [Script](/tools/script) > > Run custom code in a secure sandbox. > [card] [Web Search](/tools/web-search) > > Search the web for current information. > [card] [MCP](/tools/mcp) > > Connect to Model Context Protocol servers. > [card] [Emit](/tools/emit) > > Return schema-validated structured data beside the prose. ## How tools work in workflows When a prompt with tools runs inside a workflow, the tools execute as part of that prompt node’s run. Tool results are internal to the prompt – they feed back into the model’s reasoning but don’t flow through the workflow’s edges. The workflow only sees the prompt’s final output. If you want a tool’s result to be available to other nodes, use a dedicated node type instead: a [KB Search node](/workflow-nodes/knowledge-search), a [Script node](/workflow-nodes/script), or wire the data through explicitly. # Prompt & Workflow Tools Source: https://docs.promptjuggler.com/tools/prompt-and-workflow Call other prompts or workflows as tools. A prompt can call another prompt or trigger a workflow as a tool. The model decides when to invoke it, PromptJuggler handles the execution, and the output feeds back into the conversation. Select the prompt or workflow from a dropdown and choose a version (or tag, or latest published). The parent prompt receives the tool’s output – text only, not internal state. If you need to share more context between them, [channels and memory](/concepts/memory-and-threads) can help, though things get interesting fast when prompts start nesting deeply. The parent prompt can also set the **channel** for a tool-prompt, orchestrating which memory lane it reads from and writes to. This is one of the building blocks of agentic patterns: a coordinator prompt directing specialist prompts, each on their own channel. # Script Tool Source: https://docs.promptjuggler.com/tools/script Run custom code as a callable tool. Runs JavaScript or Python in a sandboxed environment when the model decides it needs computation. Same sandbox as the [Script workflow node](/workflow-nodes/script) – isolated, fast, with access to the language’s standard library, and on paid plans outbound network access. See the workflow node for what the sandbox does and does not guarantee. The model calls the script with arguments, the sandbox executes it, and the result feeds back into the conversation. Useful for calculations, data formatting, validation, or any logic that’s easier to express in code than in natural language. # Web Search Tool Source: https://docs.promptjuggler.com/tools/web-search Search the web for current information. Gives the model access to web search. When enabled, the model can search for current information during execution and incorporate the results into its response. No configuration needed – just enable it. Web search is supported by all providers, though availability depends on the specific model. # Assertion Node Source: https://docs.promptjuggler.com/workflow-nodes/assertion Validate conditions during evaluation runs. The Assertion node checks whether a value meets a condition. Pick an operator from the dropdown and the relevant inputs appear: Contains, Equals, GreaterThan, GreaterThanOrEqual, IsEmpty, IsFalse, IsTrue, LessThan, LessThanOrEqual, NotContains, NotEmpty, NotEquals, NotRegex, OneOf, Range, Regex. ## Comparing values Equals and NotEquals compare text exactly, so `1.0` and `1` count as different values, and so do `abc` and `ABC`. To compare numbers, use Range, which reads `1.0` and `1` as the same number. Set min and max to the same number for an exact match, or apart to allow a tolerance. The [If node](/workflow-nodes/control-flow)’s Eq operator also compares numbers as numbers. GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual and Range fail when the limit is a number and the value isn’t, such as `N/A`. When the limit is text, they compare text, which suits dates like `2026-01-31`. ## Fail-fast By default, assertions record a pass or fail result and the workflow keeps going. Enable the **fail-fast** checkbox and a failed assertion will abort the entire workflow run immediately. Assertions don’t have an output handle – they’re observers, not gates. They watch data flow past and check whether it meets a condition. With fail-fast off, they quietly record the result. With fail-fast on, they pull the emergency brake on the whole run. If you need to route data based on a condition rather than abort, use an [If node](/workflow-nodes/control-flow). ## In evaluations Each assertion carries a **weight** (0 to 1). The evaluation’s aggregate score is a weighted average of all assertion outcomes – giving you a single number that captures how well your prompts and workflows performed across the dataset. Keep fail-fast off so every row gets evaluated. ## In regular workflows With fail-fast enabled, assertions become tripwires: if something has gone wrong, stop everything rather than letting the rest of the workflow act on bad data. Useful for sanity checks like verifying that a generated summary stays under a length threshold, or that a classification result is one of the expected categories. # Control Flow Nodes Source: https://docs.promptjuggler.com/workflow-nodes/control-flow If and Switch – conditional branching. ## If Routes data down one of two paths based on a condition. The If node takes an input value, a comparand, and an operator. If the condition is true, data flows through the **true** output. Otherwise, the **false** output. Available operators: Eq, Gt, Gte, IsEmpty, IsNumeric, Lt, Lte, Neq, Regex. Wire the data you want to gate into the target handle. Wire the value you want to test into the input handle. The comparand can come from another node or a Value node. ## Switch Routes data down one of several named paths based on matching. The Switch node has two inputs: the **value to match** against and the **data to forward**. Define a list of possible match values – when the match input hits one, the data flows through that output. Unmatched inputs flow through the default output. Useful for routing different intents, categories, or statuses to specialised processing paths. ## Skipped branches When a control flow node doesn’t activate an output (the If condition is false, or a Switch case doesn’t match), the entire downstream branch is marked as **skipped**. Skipped nodes don’t execute and produce no output. This plays nicely with multi-input wiring. When several edges feed into the same input handle, skipped sources are simply ignored. Say you have a Switch that routes a support ticket to either a “billing” branch or a “technical” branch, and both branches eventually wire into the same summary prompt – only the active branch’s output arrives. No nulls, no empty values, no special handling needed. # Data Nodes Source: https://docs.promptjuggler.com/workflow-nodes/data-nodes Input, Output, and Value – getting data in and out. ## Input The entry point for your workflow. Each Input node defines a named parameter that must be provided when the workflow runs – either from the run form in the UI, from the API request’s `inputs` field, or from a dataset column in an evaluation. ## Output The exit point. Whatever arrives at an Output node becomes part of the workflow’s result. You can have multiple Output nodes, each with a different name, and they’ll all appear in the run response. ## Value A constant. Type in a string value and it flows downstream unchanged. Useful for thresholds, template fragments, configuration strings, or anything you want hardcoded into the workflow without passing it as an input every time. To output an empty string – say, as the replacement in a String node – tick **Empty string**. A Value node left blank won’t save, so a value you forgot to fill in never passes silently as empty. # Execution Nodes Source: https://docs.promptjuggler.com/workflow-nodes/execution-nodes Prompt and Workflow nodes – where AI meets orchestration. ## Prompt Runs a [prompt](/concepts/prompts) within the workflow. Select a prompt and a version (or tag, or latest published) from the dropdowns, map the workflow’s data to the prompt’s placeholders, and the output feeds into whatever comes next. It also exposes one output per [emit tool](/tools/emit) it declares, each carrying that tool’s payloads. Configuration includes the [channel](/concepts/memory-and-threads#channels) assignment for memory isolation, and whether to use the prompt’s trigger handle for [loop](/workflow-nodes/loop) re-execution. ## Workflow Nests an entire [workflow](/concepts/workflows) inside another. Same pattern: select a workflow and version from the dropdowns, map inputs, receive outputs. This is how you build modular, reusable systems – a complex sub-process becomes a single node in a larger pipeline. Both Prompt and Workflow nodes have a **trigger handle** at the bottom. When a [Loop node](/workflow-nodes/loop) connects to this handle, it re-runs the node with fresh context on each iteration. # Fanout Node Source: https://docs.promptjuggler.com/workflow-nodes/fanout Process array items in parallel. Fanout takes a JSON array as input and runs the downstream node once per element, in parallel. When all parallel runs complete, the results merge back into a JSON array and flow onward. The fan-in happens automatically: the node immediately following the fanned-out node collects all results into an array, preserving order. No manual collection step needed. Results that are JSON join the array as JSON, and numbers like `5` or `1.5` join as numbers. Everything else joins as text, exactly as the node produced it, so a version like `1.10` or a long ID stays intact. To do arithmetic on values like `12.50` in a JSON Query, convert them first: `sum(map(&to_number(@), @))` in JMESPath. **Example:** You have a list of 50 customer questions. Fanout splits the array, the downstream Prompt node processes each question independently and in parallel, and the results recombine into a single array of answers. ## Limits A single fanout handles up to 1,000 items, and a workflow run creates up to 5,000 node runs in total – the second limit catches fanouts that multiply, since two fanouts feeding the same node produce one run per combination. Whichever limit trips is checked before that node expands, so none of its runs are created or billed – work the run completed earlier still is. > [!TIP] > > Need to process more? Chunk the array upstream and run the workflow once per > chunk – each run gets its own budget. # Knowledge Search Node Source: https://docs.promptjuggler.com/workflow-nodes/knowledge-search Query a knowledge base from within a workflow. Performs a semantic search against a [knowledge base](/concepts/knowledge-bases) using the input as a query. Returns the most relevant chunks. Two settings to configure: * **Top K** – how many chunks to return * **Format** – `text` (plain concatenated results) or `json` (structured with metadata) This is the workflow-level equivalent of the [KB Search tool](/tools/knowledge-search). The difference: a tool lets the model decide when to search, while this node searches at a fixed point in the pipeline. Use the node when you always want context, the tool when the model should judge. # Loop Node Source: https://docs.promptjuggler.com/workflow-nodes/loop Repeat operations with controlled feedback. The Loop node creates iterative cycles in your workflow. It’s the most powerful control flow primitive: with it, you can build retry logic, iterative refinement, convergence loops, and multi-pass agents. ## How it works The Loop node has an **input on the right** (receives data), a **loopback output** also on the left (sends data back upstream), and an **exit output** on the right (fires when the loop ends). The only configuration is **max iterations** – the safety limit on how many times the Loop node runs. It loops back at most one time fewer: with 1 it never loops back; with 2 it loops back at most once. When data reaches the loop body before the Loop node, as in the example below, that’s also the most passes the body gets. When it reaches the Loop node first, the body gets one pass fewer. When data arrives at the loop: * If iterations remain, the loopback output fires, sending the data back into the loop body * On the final iteration, the exit output fires instead, releasing the data downstream Nodes after the loop wait until it has finished. A node that reads from inside the loop gets that node’s result from every pass: one value as it is, several as a JSON list in pass order. ## Two wiring patterns **Pattern 1: Feed back into an input.** Wire the loopback output to a node’s regular input handle. The node re-runs with the new data. Everything between that node and the loop re-runs too. **Pattern 2: Trigger re-execution.** Wire the loopback output to the **trigger handle** (bottom) of a Prompt, Workflow, or Script node. This re-runs that specific node with fresh context while preserving its other inputs. ## A real-world example **Iterative summarisation:** “Keep summarising until it’s short enough.” Wire it like this: Input → Prompt → String (Length) → If (length > 200) → Loop → back to Prompt. The If node’s false output (short enough) goes to Output. The Loop’s exit output also goes to Output as a safety valve. The prompt summarises the text. If the summary is still too long, the loop feeds it back for another pass. When it’s short enough, the If node routes it to the output. If somehow it never gets short enough, the max iterations limit catches it. ## Several loops in one workflow A workflow can hold as many loops as you need, one after another: say, a research prompt with one retry, then a writing prompt with one rewrite. Each loop re-runs only its own nodes, and a node between two loops runs once. > [!TIP] > > The Loop’s exit output is your safety net: it carries a value only when the loop hits max iterations. Wire it to the same Output node as your success path, so even then you get the best result so far rather than nothing. # Workflow Nodes Source: https://docs.promptjuggler.com/workflow-nodes/overview Every node type in the workflow editor at a glance. Every workflow is built from nodes. Each one does one thing well. Wire them together and the possibilities multiply. > [card] [Data Nodes](/workflow-nodes/data-nodes) > > Input, Output, Value – get data in and out. > [card] [Execution Nodes](/workflow-nodes/execution-nodes) > > Prompt, Workflow – where AI meets orchestration. > [card] [Knowledge Search](/workflow-nodes/knowledge-search) > > Query a knowledge base for context. > [card] [Script](/workflow-nodes/script) > > Run custom code in a secure sandbox. > [card] [Transform Nodes](/workflow-nodes/transform-nodes) > > String, Array, JSON Query – reshape data between steps. > [card] [Fanout](/workflow-nodes/fanout) > > Process items in parallel. > [card] [Control Flow](/workflow-nodes/control-flow) > > If, Switch – conditional branching. > [card] [Loop](/workflow-nodes/loop) > > Repeat operations with controlled feedback. > [card] [Assertion](/workflow-nodes/assertion) > > Validate conditions during evaluations. # Script Node Source: https://docs.promptjuggler.com/workflow-nodes/script Run custom code in a secure, high-performance sandbox. Executes JavaScript or Python code in a sandboxed environment. The script receives inputs as variables and returns a string output. Scripts run in an isolated sandbox with access to the language’s standard library. Designed for data transformation, validation, formatting, and computation that goes beyond what the transform nodes offer. ### The sandbox **Outbound network access** is available on paid plans – your script can call an API, fetch a page, or reach any host it needs. On the free plan the sandbox has no network access at all, and a request will hang until the script times out rather than failing immediately. **No persistent filesystem.** A script may write files while it runs, but nothing is guaranteed to survive it. Sandboxes are disposable and consecutive runs are not promised the same one, so treat every run as starting empty – if a later run needs something, return it as output and pass it in. **A 30-second ceiling** per execution, after which the script is stopped. # Transform Nodes Source: https://docs.promptjuggler.com/workflow-nodes/transform-nodes String, Array, and JSON Query – reshape data between steps. Transform nodes are the connective tissue of a workflow. They reshape, extract, and combine data as it flows between the nodes that do the heavy lifting. ## String Performs a string operation on its input. Pick a function from the dropdown and the relevant inputs appear: Concat, Contains, EndsWith, IndexOf, Length, PadLeft, PadRight, RegexExtract, RegexMatch, Repeat, Replace, Reverse, Split, StartsWith, Substring, ToLower, ToUpper, Trim. ## Array Operates on a JSON array string. Pick a function: Chunk, Compact, Count, Drop, First, Flatten, Last, Merge, Pluck, Reverse, Slice, Sort, Take, Unique, Zip. ## JSON Query Extracts data from a JSON string using a query expression. A dropdown lets you choose between **JSONPath** and **JMESPath** syntax – use whichever you’re comfortable with. > [!TIP] > > Remember: everything in a workflow is a string. Transform nodes are how you navigate structured data without writing code. If you need something more complex, the [Script node](/workflow-nodes/script) is always an option.