Unofficial community resource. This site is not affiliated with, endorsed by, or operated by Salesforce. AgentScript is an open source project by Salesforce licensed under Apache 2.0.
✦ Open Agent Specification Language

Build agents with
a common language

AgentScript is a declarative language for defining AI agents. Configure state, execution flow, reasoning instructions, and deterministic control hooks — all in a single .agent file.

support_agent.agent
system:
    instructions: "You are a helpful support agent."

variables:
    customer_verified: mutable boolean = False
        description: "Whether the customer is verified"

start_agent support:
    description: "Main support agent"

    before_reasoning:
        if @variables.customer_verified is not True:
            transition to @subagent.Identity

    reasoning:
        instructions: ->
            | Help the customer with their request.
            if @variables.customer_verified:
                | Customer verified: {!@variables.customer_name}
🧱

Block-based Structure

Agents are composed from well-defined blocks: system, config, variables, actions, reasoning, and more. Each block has a typed schema.

⚖️

Determinism vs. Autonomy

Use before_reasoning and after_reasoning hooks for deterministic control, or write a single reasoning.instructions block and let the LLM reason freely.

🔌

Dialect System

The base AgentScript dialect is extended by platform-specific dialects: agentforce for Salesforce, agentfabric, and your own custom dialects.

🛠

Full Toolchain

Parser, linter, compiler, LSP server, VS Code extension, Monaco integration, and a browser playground — all open source under Apache 2.0.

📝

IDE Support

Language Server Protocol (LSP) provides diagnostics, completions, hover docs, go-to-definition, rename, and semantic highlighting in any LSP-compatible editor.

📦

npm SDK

Install @sf-agentscript/agentforce to parse, analyze, mutate, and compile agent scripts in Node.js or the browser. Full TypeScript support.

Specify what, not how

AgentScript describes what an agent is — its state, its available actions, its instructions — not how the runtime executes it.

Execution blocks like reasoning have implied execution determined by the runtime. The simple ReAct loop runs behind the scenes — you don't implement it in the script.

This means the same script can run on increasingly capable runtimes without changing a line of code.

agentscript (base) agentforce agentfabric custom
# Variables persist across turns
variables:
    order_id: mutable string = ""
    session_id: linked string

# Actions declare external tools
actions:
    LookupOrder:
        description: "Retrieve order by ID"
        inputs:
            order_number: string
                is_required: True
        outputs:
            status: string
        target: "flow://LookupOrder"

# Reasoning drives the LLM
reasoning:
    actions:
        lookup: @actions.LookupOrder
            with order_number=@variables.order_id
            set @variables.status = @outputs.status

Start building agents today

Read the documentation, try the examples, or install the SDK to integrate AgentScript into your toolchain.

Read the Docs Browse Examples GitHub Repo