|
| 1 | +# Announcing AIScript |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | +After months of collaboration with Claude, I'm excited to announce the open-source release of **AIScript** - a new programming language designed from the ground up for the age of AI. |
| 6 | + |
| 7 | +## Why Create Another Programming Language? |
| 8 | + |
| 9 | +Some might ask: "In an era where AI can write code for us, why build a new programming language?" The answer is precisely *because* AI is so good at code generation. |
| 10 | + |
| 11 | +Most mainstream languages were designed decades ago, when concepts like LLMs and agents weren't on anyone's radar. AIScript is different - it makes AI primitives first-class citizens in the language itself. With AIScript, features like `prompt`, `ai` functions, and `agent` are keywords, not libraries or packages. |
| 12 | + |
| 13 | +## Language + Web Framework: A Unified Approach |
| 14 | + |
| 15 | +AIScript takes a unique approach by combining a programming language with a web framework. This means: |
| 16 | + |
| 17 | +```javascript |
| 18 | +$ export OPENAI_API_KEY=<your-openai-api-key> |
| 19 | +$ cat web.ai |
| 20 | +get / { |
| 21 | + """An api to ask LLM""" |
| 22 | + |
| 23 | + query { |
| 24 | + """the question to ask""" |
| 25 | + @string(min_len=3, max_len=100) |
| 26 | + question: str |
| 27 | + } |
| 28 | + |
| 29 | + // `ai` and `prompt` are keywords |
| 30 | + ai fn ask(question: str) -> str { |
| 31 | + let answer = prompt question; |
| 32 | + return answer; |
| 33 | + } |
| 34 | + |
| 35 | + let answer = ask(query.question); |
| 36 | + return { answer }; |
| 37 | +} |
| 38 | + |
| 39 | +$ aiscript serve web.ai |
| 40 | +Listening on http://localhost:8080 |
| 41 | +``` |
| 42 | + |
| 43 | +One command to run a web API - no framework decisions, no dependency hell, just results. |
| 44 | + |
| 45 | +## Features That Stand Out |
| 46 | + |
| 47 | +### AI First-Class Citizens |
| 48 | + |
| 49 | +```javascript |
| 50 | +// Simple prompting |
| 51 | +let answer = prompt "Why is the sky blue?"; |
| 52 | + |
| 53 | +// With configuration |
| 54 | +let detailed_answer = prompt "Explain quantum physics" => { |
| 55 | + model: "claude-3.7", |
| 56 | + temperature: 0.8, |
| 57 | +}; |
| 58 | + |
| 59 | +// AI Functions |
| 60 | +ai fn generate_story(topic: str) -> str { |
| 61 | + return prompt f"Write a short story about {topic}"; |
| 62 | +} |
| 63 | + |
| 64 | +// Multi-Agent Systems |
| 65 | +agent Researcher { |
| 66 | + instructions: "You are a research assistant...", |
| 67 | + model: "gpt-4o", |
| 68 | + |
| 69 | + fn search_web(query: str) -> str { |
| 70 | + """ |
| 71 | + Search the web for information about a topic. |
| 72 | + """ |
| 73 | + // Implementation |
| 74 | + return "search results"; |
| 75 | + } |
| 76 | +} |
| 77 | +``` |
| 78 | + |
| 79 | +### Built-in Data Validation |
| 80 | + |
| 81 | +Data validation is built right into the language, inspired by Python's Pydantic: |
| 82 | + |
| 83 | +```javascript |
| 84 | +class User { |
| 85 | + @string(min_len=3, max=20) |
| 86 | + name: str, |
| 87 | + @number(min=18) |
| 88 | + age: int, |
| 89 | + @in(["male", "female", "other"]) |
| 90 | + gender: str = "other", |
| 91 | +} |
| 92 | + |
| 93 | +let user = User("Jo", 17, "male") |err| { |
| 94 | + print("Validation error:", err); |
| 95 | + // Validation error: name length is less than minimum |
| 96 | +}; |
| 97 | +``` |
| 98 | + |
| 99 | +### Batteries Included |
| 100 | + |
| 101 | +AIScript includes ready-to-use features that would normally require additional packages, configuration, and expertise: |
| 102 | + |
| 103 | +```javascript |
| 104 | +// JWT Auth with a single decorator |
| 105 | +@auth |
| 106 | +post /chat { |
| 107 | + // Protected endpoint code |
| 108 | +} |
| 109 | + |
| 110 | +// Social Login |
| 111 | +@sso(provider="google") |
| 112 | +get /auth/google { |
| 113 | + let url = sso.authority_url(); |
| 114 | + return temporary_redirect(target=url); |
| 115 | +} |
| 116 | +``` |
| 117 | + |
| 118 | +## Designed for the AI Generation Workflow |
| 119 | + |
| 120 | +In the industrial era, we didn't manufacture cars from raw materials - we assembled them from pre-built components. Similarly, in the AI era, code generation works best when AI can compose high-level components rather than writing everything from scratch. |
| 121 | + |
| 122 | +This philosophy aligns with Anthropic's Model Context Protocol (MCP) approach. Just as MCP provides a standardized way to connect AI models to different data sources and tools (like a "USB-C port for AI applications"), AIScript provides standardized high-level abstractions for web development. Both aim to simplify integrations and establish best practices for working with LLMs. |
| 123 | + |
| 124 | +With AIScript, AI only needs to generate a few tokens to achieve what would otherwise require writing dozens of lines of boilerplate code from scratch. The language provides pre-built integrations that plug directly into your application's needs, similar to how MCP offers pre-built integrations for LLMs. |
| 125 | + |
| 126 | +## Technical Highlights |
| 127 | + |
| 128 | +AIScript combines the best ideas from multiple languages with modern web development patterns: |
| 129 | + |
| 130 | +- **Syntax inspired by JavaScript, Python, and Rust** |
| 131 | +- **Rust-powered interpreter** for excellent performance |
| 132 | +- **Error handling with propagation operators** (`|err|` blocks and `?` operator) |
| 133 | +- **Axum and SQLx integration** for industry-standard backend performance |
| 134 | +- **Automatic OpenAPI documentation** generation |
| 135 | +- **Built-in database modules** (`std.db.pg` and `std.db.redis`) |
| 136 | +- **Elegant route DSL** for painless endpoint definition |
| 137 | +- **Automatic request validation** with helpful error messages |
| 138 | + |
| 139 | +## Join the AI-Native Development Revolution |
| 140 | + |
| 141 | +In the new era of AI-assisted development, we need tools designed specifically for this workflow. Code generation will increasingly rely on high-level abstractions rather than writing every line from scratch. AIScript aims to be the language that bridges traditional programming with AI capabilities. |
| 142 | + |
| 143 | +It represents a fundamental shift in how we think about web development: |
| 144 | + |
| 145 | +- **AI first, not AI bolted-on**: Built from the ground up for the age of AI |
| 146 | +- **Convention over configuration**: Sensible defaults, minimal boilerplate |
| 147 | +- **Best practices built-in**: Web development patterns encoded in the language itself |
| 148 | +- **Developer happiness**: Intuitive syntax and streamlined workflows |
| 149 | + |
| 150 | +## Try AIScript Today |
| 151 | + |
| 152 | +AIScript is ready for experimentation! Visit [github.com/aiscriptdev/aiscript](https://github.com/aiscriptdev/aiscript) to get started, and explore the full documentation at [aiscript.dev](https://aiscript.dev). |
| 153 | + |
| 154 | +This is just the beginning of our journey to redefine web development for the AI era. We're excited to see what you'll build with it! |
0 commit comments