The Research Report
The Prompt Grows Up: What Salesforce's Agent Script Means for the Future of AI Agents
You're two weeks from shipping an agent to production and you're staring at the same question you've been circling for a month: how much of this should you let the model decide?
Not whether to use a model at all. That decision's already been made. But which decisions the model gets to make.
The one where a customer verifies their identity? Probably not that one. The one where the agent picks how to phrase a confirmation? Sure. The one where it decides whether this conversation is a refund question or a shipping question? Depends on your risk tolerance, your audit requirements, and how much the frontline team trusts the model.
Most agent frameworks don't let you choose how much the model decides on a per-decision basis. You pick a posture at the framework level: deterministic workflow engine or probabilistic LLM loop. That is the wrong unit of control.
Salesforce agrees. On April 30, 2026, they open-sourced Agent Script — a single-file, declarative language for defining AI agent behavior. The repo is at github.com/salesforce/agentscript. It has ~200 stars and climbing. It does something that sounds simple but cuts to the core of the hardest problem in production AI agents: it lets you pin the load-bearing logic as deterministic and let the agent reason through the rest, all in one file.
This is prompts-as-code reaching the enterprise. And it changes how we should think about building agents.
What Agent Script Is
Agent Script is a single-file, indentation-sensitive language for agent behavior. It looks a little like YAML and a little like Python. You declare variables, define actions the agent can call, and write the logic that runs around those actions.
Here's a minimal agent:
system:
instructions: "You help customers with their orders."
variables:
customer_name: mutable string = ""
description: "Customer's name, once we know it"
customer_verified: mutable boolean = False
description: "Whether the customer has been identity-verified"
start_agent order_helper:
description: "Helps verified customers with order questions"
reasoning:
instructions: ->
| Help the customer with their order.
if @variables.customer_verified:
| You're talking to {! @variables.customer_name }.
| You can discuss account-level details.
else:
| Ask the customer to verify their identity first.
The instructions block does two things at once. It uses if/else to conditionally build the prompt. It interpolates a variable ({! @variables.customer_name }) into the rendered text. The conditional re-evaluates every iteration of the reasoning loop. The moment verification succeeds, the next iteration sees the "verified" prompt.
One file. Diffable, reviewable, testable, shippable through the same CI pipeline as the rest of your code.
Agent Script compiles to an executable specification that runs on a Salesforce-managed runtime. The compiler, linter, language server, VS Code extension, and playground are in the open-source repo. The runtime is not — more on that below.
The Core Idea: Per-Decision Control
Here's the thing that matters most. Agent Script doesn't force you into "fully scripted" or "fully agentic." It gives you a dial, and you can turn that dial per decision.
The language provides a small set of primitives. Each one is a way of saying "I'll decide this part — you handle the rest."
variables — Declare typed state up front. Every variable has a type, a default, and a description. The description is not cosmetic: the model reads it when it needs to fill that variable from conversation context.
variables:
order_number: mutable string = ""
description: "Order number provided by the customer"
set — Assign a variable inside a procedure. Often used in an action callback to capture outputs.
verify: @actions.Verify_Customer
with [email protected]_email
set @variables.customer_verified = @outputs.customer_found
set @variables.customer_id = @outputs.customer_id
with input=value — Bind a parameter on an action call. Each parameter is either bound to a concrete value you control, or to ... — the ellipsis — which tells the model to fill it in from conversation. A single call can mix both:
issue_return: @actions.Issue_Return
with [email protected]_number # you decide
with return_reason=... # model decides
That ... is the whole philosophy in two characters. You decide what you decide. The model decides what you leave open.
available when — A guard clause on a reasoning action. When the condition is false, the action is not presented to the model on that iteration. It's not disabled. It's not in the set of things the model can choose from. Re-evaluated every iteration, so actions unlock and lock as state changes.
issue_return: @actions.Issue_Return
available when @variables.return_eligible == True
with [email protected]_number
if/else inside instructions — Branch deterministically to shape the prompt the model sees. Re-evaluated every iteration, so the prompt evolves as state evolves.
subagent + transition to — Organize capability into focused units and route between them. With available when controlling when a transition is offered.
One Agent, Three Postures
The Salesforce team walks through the same scenario three ways in their launch blog post. It's the clearest illustration of what this language actually does for you. Same scenario, three versions, same grammar. The only thing that moves is how many decisions the author pins.
The scenario: a customer wants to return an item. Three actions — verify by email, find the order, issue the return. A handful of variables. The shared setup is identical across all three versions.
Posture 1: Fully Scripted
Every decision is authored. The flow is a strict sequence — verify, then find, then issue — enforced by chained available when gates. At each point, the model has exactly one action it can reach for, and the instructions tell it which one.
The state machine lives entirely in the available when clauses and the conditional instructions. Each step unlocks when its preconditions are met. The instructions name the action the model should reach for next. The only thing left for the model is slot-filling — turning what the customer said into typed variables — and natural-language rendering. This is a workflow with an LLM on top.
When you'd reach for this: regulated flows, anything auditable, the parts of your agent where the ops team needs to trace exactly what happened and why.
Posture 2: Mixed
Keep the verification invariant, but let the model drive resolution. Verification is a reasoning action — gated so it's the only one available while the customer is unverified. The model has no real choice but to run it.
Identity is too load-bearing to leave open, so verification stays gated. But it happens inside the reasoning loop, where the model encounters it naturally. The other available when clauses reflect real preconditions: no order lookups before verification, no returns issued before eligibility. Customer IDs still come from variables. The return itself still has its parameters pinned.
In practice, this is what most production agents look like: a deterministic floor on the sensitive decisions, freedom to reason through the middle.
Posture 3: Agentic
Open up parameter extraction. Let the model drive timing, sequencing, and all inputs. The available when clauses are the only invariants left.
All input parameters are ... except customer_id, which can only be set by the verification action we control. No order lookups before verification, no returns issued before eligibility. Inside those gates, the model picks actions, extracts parameters, decides order, and decides when to finish.
This is an agent loop with a guardrail pattern that's visible in source and testable without a model call. Check that the available when conditions are wired correctly and you've checked the invariants.
What just happened
Same file format. Same grammar. Same runtime. Same two primitives doing the heavy lifting — available when and conditional instructions. Three postures.
You didn't switch frameworks to move between them. You changed which decisions were authored. That is what "scales from scripted to agentic" actually looks like in source code — not a migration path between two systems, but a dial on one. Teams that start scripted can loosen a gate or open up a parameter to .... Teams that start agentic can add a gate or pin a parameter when they discover a decision is load-bearing. The artifact is the same artifact throughout.
How a Turn Executes
An agent turn in Agent Script is a reasoning loop. The model reads the instructions you wrote, looks at the actions currently available to it, and picks one — or decides it's done and responds to the user. When it picks an action, the runtime executes it, variables update, and the loop iterates. The model reads the instructions again (now reflecting the new state), looks at the actions now available, and makes the next choice. When it generates a response instead of an action call, the loop exits.
Two things are worth underlining.
instructions and available when re-evaluate every iteration. That's not an optimization detail. It's the mechanism. When you write if @variables.customerverified: inside instructions, the prompt the model sees on iteration 2 is different from the prompt it saw on iteration 1, because the condition flipped when verification succeeded. When you put available when @variables.customerverified on an action, that action wasn't in the model's toolbox on iteration 1 and it is on iteration 2. You don't need a separate pre-pass to shape what the model sees. The loop shapes it for you, every turn.
The model sees the result, not the reasoning. Branches that were skipped, actions gated behind conditions that were false, parameters you bound from variables — none of those are in the prompt. The model sees the rendered instructions and the currently-available action pool. Everything else already happened.
The seam between "already decided" and "left open" is something you move by what you author. Pin more, the agent is more scripted. Pin less, the agent is more agentic. Same language, same file, same runtime. Moving the seam is a code change, not a framework change.
The Technical Stack
Agent Script is built on a layered architecture that's worth understanding if you're evaluating it.
The language is block-based. Everything is a block, and blocks compose to form an agent. Blocks fall into two categories: configuration (config, system) which set up the agent's identity and behavior, and execution (topic, start_agent) which define how the agent runs. The language is indentation-sensitive, like Python or YAML.
The toolchain is substantial:
- Parser — Two implementations: a hand-written TypeScript parser (error-tolerant recursive descent) and a tree-sitter grammar (C/WASM for browser use).
- Linter — 18+ lint passes organized as a DAG, registered per dialect.
- Compiler — Transforms the AST into a Salesforce runtime specification with source-map support.
- Language Server — Full LSP implementation with diagnostics, hover, completions, go-to-definition, rename, code actions, and semantic tokens.
- Editor Integrations — VS Code extension and Monaco editor integration.
- Playground — A browser-based UI with the Monaco editor, a graph view for visualizing topic/subagent flow, a CST/AST explorer, and real-time compiled output inspection.
The dialect system lets Salesforce and others extend the base language. Three dialects ship with the repo: the base agentscript dialect, agentforce (Salesforce's production dialect), and agentfabric (an alternative schema). Each extends the base with additional block types, fields, and lint rules.
The whole thing runs on Node.js >= 20 with pnpm >= 8. You can install the SDK via pnpm add @agentscript/agentforce and parse scripts programmatically.
Agent Script Is Not Interpreted
This is a key architectural point. Agent Script is not interpreted at conversation time, and it is not assembled by the model at runtime.
The compiler takes your script and emits an executable specification — a graph of nodes with fixed topology, known state transitions, and explicit tool wiring. The execution topology of your agent is known before any conversation begins. You can lint it, validate it, and diff it. The model never sees the script. It sees the rendered instructions and the currently-available action pool, which are the output of deterministic code running your script.
Actions in that graph resolve through a pluggable set of target URI schemes — flow:// for Salesforce Flow, apex:// for Apex classes, and others defined per dialect. The scheme determines how the runtime dispatches the call. The action declaration in your script determines when and with what arguments.
This is important. Agent Script doesn't replace your deterministic code. It orchestrates it. Apex classes and Flows show up as actions, referenced by a target URI. Agent Script decides when and why an action runs. Apex and Flow define how. You don't rewrite your existing business logic to put an agent on top of it. You describe the agent that uses it.
What's Open, What's Not
Salesforce is straightforward about this. The specification, parser, linter, compiler, LSP, editor integrations, playground, and formal spec are all open source under Apache 2.0.
What's not open source (yet) is the runtime. Agent Script compiles to a Salesforce-internal specification format that executes on Salesforce infrastructure. You can parse, lint, compile, and build tooling around Agent Script, but running agents requires Salesforce's runtime environment.
As a result, they're not accepting changes to the language spec for now. The spec needs to stay in sync with the runtime, and until they have a path to open-sourcing the runtime, unilateral spec changes would create a split they can't support.
This is a genuine tradeoff. They're being transparent about it. And they've said more will open up over time.
The Broader Trend: Prompts as Contracts
Agent Script didn't emerge from a vacuum. It's the latest and most enterprise-significant entry in a movement that's been building for two years: the shift from freeform prompts to structured, declarative specifications of agent behavior.
DSPy (from Stanford, now at 34K+ GitHub stars) pioneered the idea of treating prompts as programmable artifacts. Its tagline is "programming, not prompting." DSPy compiles declarative module calls into self-improving pipelines — you define what you want, and the framework optimizes the prompts and weights. It's a research-oriented framework focused on prompt optimization and pipeline composition.
LMQL (from ETH Zurich) introduced a SQL-like query language for LLMs with type constraints, control flow, and deterministic decoding constraints. LMQL lets you write programs that interleave prompt text with Python control flow and type constraints on model outputs. It's about constraining what the model generates.
PDL (Prompt Declaration Language, from IBM Research) is a declarative prompt programming language that treats prompts as data — composable, typed, and structured. It appeared in a 2024 paper and focuses on making LLM calls composable and type-safe.
OpenProse (1,100+ stars) is building "a new kind of language for a new kind of computer" — a declarative DSL for defining AI behavior.
AgentContract is a draft specification for behavioral contracts for AI agents, treating agent behavior as a versioned, testable contract rather than a disposable prompt.
SpecPrompt argues that "prompts are transient, specs persist" — define agent behavior as versioned, testable specifications rather than disposable chat messages.
These projects share a conviction: natural-language prompts are not a sufficient coordination mechanism for production agent behavior. They're too ambiguous, too brittle, too hard to audit, and too easy for a model to drift from. You need something more like code and less like a sticky note.
Agent Script is where this conviction meets enterprise scale.
Why This Matters
1. The unit of control is the decision, not the framework
Every other framework makes you choose your posture at the framework level. Deterministic workflow engine or probabilistic LLM loop. Agent Script says: pick per decision. Some decisions are load-bearing. Pin those. Other decisions are aesthetic. Let the model handle those. The language gives you primitives for both and doesn't take sides.
This is the right abstraction. Production agents are not "fully scripted" or "fully agentic." They're mixed. The identity check must be deterministic. The phrasing of the confirmation email can be left to the model. The routing decision depends on your risk tolerance. Agent Script gives you a single language to express all of those, in a single file, with a single deployment artifact.
2. Your agent is a file
This sounds mundane. It is not. Right now, production agents are configured through GUI builders, API calls, and scattered configuration fragments. The Agentforce Builder, OpenAI's assistant playground, Anthropic's console — they're all surface-level views over behavior that's distributed across databases and hidden prompt templates.
Agent Script makes the agent a single .agent file. That file is version-controlled, diffable, lintable, compilable, and writable by anything that can write text. Including coding agents. Salesforce explicitly notes that coding agents write good Agent Script — describe what the agent should do, get a valid file back, run it against the playground, watch what happens, describe the fix, go again.
The agent you ship is the file you review. No hidden assembly step. No runtime stitching a prompt together from fragments nobody on the team can see.
3. It's auditable in a way prompts aren't
When a production agent does something wrong, the first question is always "why did it do that?" With freeform prompts and ad-hoc tool wiring, the answer is often "the model decided." With Agent Script, you can look at the available when conditions and the set statements and trace the exact path. The execution topology is known before any conversation begins. You can lint it. You can validate it. You can diff it.
For regulated industries, this is not a nice-to-have. It's a requirement.
4. The dialect system is extensible
The base agentscript dialect defines the core language. Salesforce's agentforce dialect extends it with Salesforce-specific blocks and compilation targets. The agentfabric dialect provides an alternative schema. Others can define their own dialects — adding block types, fields, and lint rules — without forking the language.
This matters because it means Agent Script isn't just a Salesforce tool. It's a language specification that happens to have a Salesforce runtime. Other runtimes can implement other dialects. The parser, linter, and LSP all support the dialect layer.
5. The ... syntax is a philosophical statement
The ellipsis — ... — is the most important token in the language. It appears in with clauses to mark parameters that the model fills in at runtime. with order[email protected]number means you decide. with return_reason=... means the model decides.
This is the contract. Every parameter is either bound by you or left open for the model. There is no third option. There is no "the model will probably figure it out." It's explicit. It's auditable. And it's in the same file as everything else.
What It Doesn't Do
Agent Script is not a general-purpose programming language. It's a DSL for agent behavior. You're not going to write a web server in it.
The runtime is Salesforce-only right now. You can use the parser, linter, compiler, and tooling freely. But running an Agent Script agent outside of Salesforce's infrastructure requires building your own runtime, and there's no documented spec for the compiled output format yet.
The language spec is not accepting community changes. Salesforce needs the spec to stay in sync with their runtime. Until they open-source the runtime, unilateral spec changes would create a split.
There's no built-in testing framework for agents. You can lint and compile scripts, but integration testing against the model still requires a running agent.
The ... syntax only controls parameter extraction, not more complex model behavior like multi-step reasoning chains or tool selection preferences. The model still has latitude within the guardrails you set.
How It Fits the Prompts-as-Contracts Trend
The trajectory is clear. First we had prompt engineering — handcrafted natural-language instructions tuned by trial and error. Then prompt templates — parameterized prompts with variable substitution. Then structured prompts — JSON or YAML configs that define system messages, tool descriptions, and output schemas.
Now we're at prompts-as-contracts. The idea is that agent behavior should be specified as a versioned, testable, auditable contract — not a loose collection of prompt fragments. The contract defines what the agent must do, what it must not do, what tools it can use and when, and what state it manages. The model fills in the gaps within those constraints.
Agent Script is the most complete realization of this idea so far. It's not just a prompt template. It's not just a config file. It's a compiled language with a type system, a linter, a language server, and a formal specification. The compiled output is a graph with fixed topology and known state transitions. The source is a single file that captures every decision boundary between deterministic and probabilistic behavior.
The other entries in this space approach the problem from different angles. DSPy focuses on prompt optimization — you declare what you want, and it searches for the best prompt and few-shot examples. LMQL focuses on constraining model output during generation. PDL focuses on making LLM calls composable and type-safe. AgentContract is a draft spec for behavioral contracts.
Agent Script focuses on something different and arguably more important for production: the orchestration layer. It doesn't try to constrain what the model says. It constrains what the model can do. Which actions are available. Which parameters are bound. Which transitions are allowed. The model can phrase things however it wants. But it can't skip verification. It can't issue a return before checking eligibility. It can't access tools that aren't in its current action pool.
This is the right layer for enterprise agents. You don't need to control the model's words. You need to control its actions.
The Play for Salesforce
Open-sourcing Agent Script is a strategic move, and it's worth understanding why.
The agent tooling market is crowded. OpenAI has its assistant API. Anthropic has tool use. LangChain has agent orchestration. Google has Vertex AI Agent Builder. Microsoft has Copilot Studio. Everyone is building the layer between LLMs and business logic.
Salesforce's differentiator is the enterprise trust layer. Audit trails, compliance, role-based access, and deterministic guardrails for things that must not be left to model discretion. Agent Script makes that trust layer visible, reviewable, and version-controlled. The .agent file is the contract. The available when conditions are the guardrails. The compiled graph is the audit artifact.
By open-sourcing the language and toolchain, Salesforce is betting that developers will build skills around Agent Script. The VS Code extension, the LSP, the playground — these make it accessible outside the Salesforce ecosystem. The more people who can read, write, and lint Agent Script, the more likely it becomes a standard for specifying agent behavior.
The runtime lock-in is the tradeoff. You can author in the open. You run on Salesforce. For enterprises already on the platform, this is a feature, not a bug. For everyone else, it's a reason to watch but not adopt yet.
What Comes Next
Agent Script is early. The runtime isn't open source. The language spec isn't accepting community changes. The playground is local-only. The dialect system is extensible but the only production dialect is Salesforce's own.
But the design is right. The idea that agent behavior should be specified in a single, diffable, lintable, compilable file — with per-decision control over determinism vs. LLM reasoning — solves the real problem that production agent teams face every day. The ... syntax makes the contract explicit. The available when conditions make guardrails first-class. The reasoning loop makes state evolution automatic.
The prompts-as-contracts movement is reaching enterprise platforms. Agent Script is the strongest signal yet that this is where the industry is going. If you're building production agents, the question isn't whether you'll need something like this. It's whether you'll build it yourself or adopt a standard.
The .agent file is the unit of deployment. The ... is the unit of trust. And the language that makes both explicit is worth paying attention to.
Citations:
- Salesforce Agent Script GitHub repository: github.com/salesforce/agentscript
- Salesforce blog post "Agent Script: The Control Plane for Agentic Decisions": salesforce.com/blog/agent-script-control-plane
- Salesforce Developer Blog "Introducing Hybrid Reasoning with Agent Script": developer.salesforce.com/blogs/2025/10/introducing-hybrid-reasoning-with-agent-script
- Salesforce Agent Script product page: salesforce.com/agentforce/script/
- Agent Script formal specification (SPEC.md): github.com/salesforce/agentscript/blob/main/SPEC.md
- DSPy framework: dspy.ai and github.com/stanfordnlp/dspy (34K+ stars)
- LMQL: lmql.ai and github.com/eth-sri/lmql (4,165 stars)
- PDL (Prompt Declaration Language): arxiv.org/pdf/2410.19135
- OpenProse: github.com/openprose/prose (1,146 stars)
- AgentContract specification: github.com/agentcontract/spec
- SpecPrompt: specprompt.com
Suggested title: The Prompt Grows Up: What Salesforce's Agent Script Means for the Future of AI Agents
Word count: ~3,200
Fact-check notes:
- Star counts are as of early May 2026 and will change. The repo had ~199 stars when checked; the brief said 156. Used ~200 in the text as a rounded current figure.
- The "prompts-as-contracts" framing draws from multiple sources (AgentContract spec, SpecPrompt, the Salesforce blog's own language about "control plane for agentic decisions") and represents an interpretive synthesis, not a single cited source.
- The claim that Agent Script was open-sourced in April 2026 comes from the Salesforce blog post. Confirm the exact date if precision matters.
- The runtime is not open source. Salesforce has said "more will open up over time" but has not committed to a timeline. The article reflects this accurately.
- The comparison to DSPy, LMQL, PDL, and OpenProse is structural, not functional. These tools solve different problems in different ways. The article characterizes the differences accurately but readers should not assume they're interchangeable.
- The blog post example code (three postures) is reproduced and paraphrased from the Salesforce launch post. It is not fabricated.