# Agent Script building blocks and the agent graph

*Agentforce Specialist Study Guide · AI Agents · Last updated November 6, 2026 · https://www.certifyforce.com/study-guide/agentforce-specialist/ai-agents/agent-script-building-blocks-and-the-agent-graph*

What Agent Script is and which blocks define an agent (system, config, variables, start_agent, subagents), how the script compiles into an Agent Graph that the Atlas Reasoning Engine runs, and what belongs in before_reasoning and after_reasoning.

- Certification: Salesforce Agentforce Specialist
- Exam section: AI Agents
- Study guide: https://www.certifyforce.com/study-guide/agentforce-specialist

**Official exam objective:**

> Explain how an agent works and its basic building blocks of agent script.

## What the exam expects

- Describe Agent Script and name the building blocks it defines: subagents, instructions, variables, actions and transitions.
- Explain how an agent turn runs, from the starting subagent to the LLM reasoning loop.
- Trace the three-stage pipeline from authored script to Agent Graph to the Atlas Reasoning Engine, and say which layer you author.
- Choose between agent-level (global) instructions, per-subagent instructions and a fallback subagent.
- Place logic correctly in before_reasoning, reasoning or after_reasoning, given how often each runs.
- Key terms: **Agent Script** (the language for building agents in Agentforce Builder); **subagent** (formerly topic: one job the agent can do); **Agent Graph** (the compiled execution plan); **Atlas Reasoning Engine** (the runtime that traverses the graph); **parse** (one full cycle through a subagent's lifecycle blocks).

## Key facts

| Fact | Detail | Source |
|---|---|---|
| Compilation | Agent Script compiles when you save a version of the agent | [Language Characteristics](https://developer.salesforce.com/docs/ai/agentforce/guide/ascript-lang.html) |
| System messages | `welcome` and `error` are required in the system block | [Agent Script Blocks](https://developer.salesforce.com/docs/ai/agentforce/guide/ascript-blocks.html) |
| Entry point | start_agent is the entry block (Agent Router in Canvas view); `reset_to_initial_node` True restarts there every turn, and it is off by default | [Agent Script Blocks](https://developer.salesforce.com/docs/ai/agentforce/guide/ascript-blocks.html) |
| Parse triggers | First entry, after every tool call whose action completes and returns a result, every new user turn in the subagent | [Hybrid Reasoning](https://architect.salesforce.com/docs/architect/fundamentals/guide/hybrid-reasoning-agentforce-builder-agent-script) |
| Displayable output | Per the architecture guide, `is_displayable: True` exits the loop at once and after_reasoning never runs | [Hybrid Reasoning](https://architect.salesforce.com/docs/architect/fundamentals/guide/hybrid-reasoning-agentforce-builder-agent-script) |
| Mid-subagent transition | The original subagent's after_reasoning isn't run | [After Reasoning](https://developer.salesforce.com/docs/ai/agentforce/guide/ascript-ref-before-after-reasoning.html) |
| Lifecycle block limits | No `\|` command; not allowed in a subagent that uses the HyperClassifier model | [After Reasoning](https://developer.salesforce.com/docs/ai/agentforce/guide/ascript-ref-before-after-reasoning.html) |

## Check yourself

- Why can a script fail to parse even when its indentation looks aligned?
- When are two consecutive properties treated as belonging to the same nesting level?
- Which part of a line stops being interpreted as script after a `#`?

## Sources

- [Hybrid Reasoning with New Agentforce Builder and Agent Script](https://architect.salesforce.com/docs/architect/fundamentals/guide/hybrid-reasoning-agentforce-builder-agent-script)
- [Agent Script](https://developer.salesforce.com/docs/ai/agentforce/guide/agent-script.html)
- [Learn About New Agentforce Builder with Agent Script](https://help.salesforce.com/s/articleView?id=005232662&language=en_US&type=1)
- [Agent Script Blocks](https://developer.salesforce.com/docs/ai/agentforce/guide/ascript-blocks.html)
- [Agent Script Language Characteristics](https://developer.salesforce.com/docs/ai/agentforce/guide/ascript-lang.html)
- [How Agents Work](https://help.salesforce.com/s/articleView?id=ai.agent_builder_reasoning_engine.htm&language=en_US&type=5)
- [Subagents](https://help.salesforce.com/s/articleView?id=ai.agent_topics.htm&language=en_US&type=5)
- [Agent Script Reference: After Reasoning](https://developer.salesforce.com/docs/ai/agentforce/guide/ascript-ref-before-after-reasoning.html)
- [Agent Script Pattern: Instruction Overrides](https://developer.salesforce.com/docs/ai/agentforce/guide/ascript-patterns-system-overrides.html)
- [Define Agent-Level Instructions and System Messages](https://help.salesforce.com/s/articleView?id=ai.copilot_setup_system_messages.htm&language=en_US&type=5)
- [Subagent Classification and Routing](https://help.salesforce.com/s/articleView?id=ai.agent_topics_routing.htm&language=en_US&type=5)
- [Agent Script Reference: Variables](https://developer.salesforce.com/docs/ai/agentforce/guide/ascript-ref-variables.html)

## About the full unit

The "Core concepts", "Exam traps" and "Worked scenario" sections of this unit and reading progress are included in the full study guide. The separate practice exams option includes the reviewed question bank and timed mock exams. The bundle includes both where available. See [current options and prices](https://www.certifyforce.com/pricing).
