Report Abuse

Basic Information

AgentScript is an open-source SDK for building AI agents that 'think in code'. It prompts a large language model to generate AgentScript, a constrained subset of JavaScript, then parses that generated code into an abstract syntax tree (AST) and executes it in a dedicated interpreter rather than running raw code. The project is designed for developers who want agents to produce explicit executable plans, integrate with custom tools, and handle workflows that require loops, conditionals, human approval, or long-running state. The README includes examples showing integration with external services and LLM providers, and the package is distributed via npm for easy installation.

Links

Categorization

App Details

Features
Prompts LLMs to generate AgentScript code instead of issuing stepwise tool calls. Parses generated code into an AST and executes it in a safe, dedicated runtime rather than directly in Node. Supports defining a runtime with named tools and optional input/output variables. Enables pausing execution, serializing state, persisting to a database, and resuming later for human-in-the-loop interactions. Allows tool-level state and approval mechanisms. Works with deterministic functions and LLM-enabled tools. Provides examples and an examples repository. Includes a roadmap for additional JS features and observability tools.
Use Cases
AgentScript helps teams build agents that can plan and operate more autonomously by turning LLM reasoning into executable code, which reduces repeated back-and-forth LLM queries and shrinks context growth. The AST-based runtime makes execution resumable and safe, enabling long-running workflows, approvals, and human interventions without rerunning prompts. Developers can express loops, conditionals, and complex logic in generated code, making agents more flexible for ambiguous or evolving tasks. The model-agnostic design lets integrators plug in deterministic tools or LLM-backed helpers, and the serialization features aid persistence, auditing, and recovery of agent state.

Please fill the required fields*