Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Agent ScriptNew to Visual Studio Code? Get it now.
Agent Script

Agent Script

Salesforce

salesforce.com
| (0) | Free
VS Code extension for Agent Script language support
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Agent Script Language Server for VS Code (Beta)

This extension provides Agent Script language support in VS Code through the Agent Script Language Server.

Overview

Agent Script is a high-level declarative programming language for representing Salesforce agents. It allows you to define conversational agents, their reasoning capabilities, actions, and transitions between topics using a clean, YAML-like syntax. This extension brings Agent Script language support to VS Code, including syntax highlighting, real-time diagnostics, and code navigation.

Agent Script files use the .agent extension and are compiled to an underlying specification (AgentGraph) that the Salesforce reasoning engine executes.

Features

  • Syntax Highlighting: Full Agent Script syntax highlighting with support for topics, variables, actions, reasoning blocks, system instructions, and template expressions.
  • Language Server Integration: Real-time diagnostics and language features powered by the Agent Script Language Server, including:
    • Error detection and validation.
    • Quick fixes and code actions.
    • Go to definition.
    • Find all references.
    • Symbol navigation.
  • Document Symbols: Easily navigate your code's structure with outline view support for topics, variables, actions, and other language constructs.
  • Workspace Symbols: Search for symbols across your entire workspace to quickly find topics, variables, and actions.
  • Code Actions: Automatic quick fixes for common errors and warnings detected during compilation.

Installation

The Agent Script extension is installed automatically when you install the Agentforce DX extension, which contains tools for authoring, previewing, and testing the agents you build using Agent Script. But you can also install this extension separately from the VS Code Marketplace.

Open a workspace that contains an Agent Script file (.agent). The language server automatically starts when you open an Agent Script file.

Get Started with Agent Script

What is Agent Script?

Agent Script is a declarative language for building Salesforce agents in a structured and maintainable format. It allows you to define:

  • Topics: Topics represent different conversation flows or states in your agent. Each topic can have its own reasoning instructions, actions, and transitions. Reference topics using @topic.topicName.
  • Variables: Variables store data that persists across topics. They can be of various types: string, number, boolean, object, date, timestamp, currency, id, or list. Access variables using @variables.variableName.
  • Actions: Actions are functions that the agent can call. They're implemented with Apex classes, flows, prompt templates, and more. They can be defined within topics or referenced from external sources using @actions.actionName.
  • Reasoning: Reasoning blocks contain instructions that guide the agent's behavior. These are natural language instructions that tell the agent what to do in a given topic.
  • Transitions: Use transition to @topic.topicName or @utils.transition to @topic.topicName to move between topics.
  • Template Expressions: Use {!expression} syntax to embed dynamic values in strings, such as {!@variables.user_name}.

Basic Structure

An Agent Script file typically contains:

config:
    agent_name: "My Agent"
    agent_type: "AgentforceEmployeeAgent"

variables:
    user_name: string
    user_id: id

topic greeting:
    description: "Welcome the user"

    reasoning:
        instructions: |
            Greet the user by name and ask how you can help them today.

        actions:
            get_user_info: @actions.getUserInfo
                with user_id=@variables.user_id

File Organization

Agent Script files are typically organized in Salesforce DX projects as part of an AiAuthoringBundle metadata component in a package directory. Each .agent file represents a complete agent definition.

Additional Resources

  • Agent Script Documentation
  • Examples
  • Agentforce DX Documentation
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft