Language-model agent systems commonly rely on reactive prompting, in which a single instruction guides the model through an open-ended sequence of reasoning and tool-use steps, leaving control flow and intermediate state implicit and making agent behavior potentially difficult to control. Orchestration frameworks such as LangGraph, DSPy, and CrewAI impose greater structure through explicit workflow definitions, but tightly couple workflow logic with Python, making agents difficult to maintain and modify. In this paper, we introduce AgentSPEX, an Agent SPecification and EXecution Language for specifying LLM-agent workflows with explicit control flow and modular structure, along with a customizable agent harness. AgentSPEX supports typed steps, branching and loops, parallel execution, reusable submodules, and explicit state management, and these workflows execute within an agent harness that provides tool access, a sandboxed virtual environment, and support for checkpointing, verification, and logging. Furthermore, we provide a visual editor with synchronized graph and workflow views for authoring and inspection. We include ready-to-use agents for deep research and scientific research, and we evaluate AgentSPEX on 7 benchmarks. Finally, we show through a user study that AgentSPEX provides a more interpretable and accessible workflow-authoring paradigm than a popular existing agent framework.
Figures & tables
Figure 1: An overview of the AgentSPEX Architecture.
Construct
Category
Description
task
Invocation
Start a new conversation
step
Invocation
Continue a persistent conversation
if / switch
Control flow
Conditional branching
while
Control flow
Loop with configurable iteration limit
for_each
Control flow
Iterate over a list
call
Composition
Invoke another workflow as a submodule
Table 1: Workflow constructs that are supported by AgentSPEX
Figure 3: Visual editor interface for a deep research agent implemented with AgentSPEX, showing synchronized graph-based and YAML-based views of a workflow with reusable submodules.
Approach
Natural Language
Explicit Context
Visual Editor
AutoGen ( Wu et al., 2023 )
✗
✗
✗
DSPy ( Khattab et al., 2024 )
✗
✗
✗
CrewAI ( CrewAI, 2026 )
Partial
✗
✗
LangGraph w/ LangFlow ( Langflow AI, 2026 )
✗
✗
✓
n8n ( n8n-io, 2026 )
✗
✗
✓
ADL ( Zeng and Yan, 2025 )
✓
✗
✗
Table 3: Comparison of agent building frameworks. Natural Language : supports specifying workflow logic directly in natural language. Explicit Context : supports explicit, user-controlled context injection through variables or structured inputs. Visual Editor : provides a graphical interface for composing or editing workflows.
Appendix figures & tables4 assets
Supplementary material from the paper’s appendix.
Appendix
Domain
Benchmark
# Problems
Evaluation
Software Engineering
SWE-Bench Verified ( Jimenez et al., 2024 )
500
sb-cli
Mathematics
AIME 2025 ( Art of Problem Solving, 2026 )
30
Math-Verify
Chemistry
ChemBench ( Mirza et al., 2025 )
90
Exact Match
SciBench ( Wang et al., 2024a )
213
Exact Match
MMLU-Pro Stemez ( Wang et al., 2024b )
216
Exact Match
Generative Writing
WritingBench ( Wu et al., 2025 )
120
LLM-as-Judge
Appendix
Table 4: Summary of evaluation benchmarks.
Agent
Claude-Opus-4.5
Claude-Opus-4.6
Δ
mini-SWE-agent
76.8%
75.6%
− 1.2
Live-SWE-agent
78.0%
71.2%
− 6.8
AgentSPEX (Ours)
77.2%
77.0%
− 0.2
Appendix
Table 5: SWE-Bench Verified results broken down by model version. All runs use high-reasoning effort with temperature set to 1.0.
Figure 4: Example of the log viewer for a SWE-Bench Verified instance.
ID
Type
Question
Background
Background
How much agent development experience do you have?
Q0
Comprehension
What task are the agent declarations doing?
Q1
Preference
Which implementation is easier to read and understand?
Q2
Preference
Which approach would you find easier to start building a new agent workflow from scratch?
Q3
Preference
Which approach makes it easier to find and understand what LLM prompts are being used?
Q4
Preference
If you were building a complex multi-step agent workflow, which approach would you choose?
Appendix
Table 6: User study survey questions. The labels for the two agent frameworks are anonymized during the survey.