Skip to content

Commit 704c458

Browse files
committed
Add blog post
1 parent 7506423 commit 704c458

File tree

7 files changed

+192
-14
lines changed

7 files changed

+192
-14
lines changed

docs/_meta.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,14 @@
1414
"link": "/std/overview",
1515
"activeMatch": "/std/"
1616
},
17+
{
18+
"text": "Blog",
19+
"link": "/blog",
20+
"activeMatch": "/blog/"
21+
},
1722
{
1823
"text": "Why AIScript",
19-
"link": "/guide/getting-started/why-aiscript",
20-
"activeMatch": "/guide/getting-started/why-aiscript"
24+
"link": "/blog/why-aiscript",
25+
"activeMatch": ""
2126
}
2227
]

docs/blog/_meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
["index", "why-aiscript", "announcing-aiscript"]

docs/blog/announcing-aiscript.md

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# Announcing AIScript
2+
3+
![](/aiscript-social-image.png)
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!

docs/blog/index.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: AIScript Blog
3+
sidebar: false
4+
---
5+
6+
# AIScript blogs
7+
8+
Check here for the latest articles and release announcements about AIScript.
9+
10+
## [Why AIScript](/blog/why-aiscript)
11+
12+
> March 11, 2025
13+
14+
## [Announcing AIScript: A Programming Language Built for the AI Era](/blog/announcing-aiscript)
15+
16+
> March 11, 2025
17+
18+

docs/guide/getting-started/why-aiscript.mdx renamed to docs/blog/why-aiscript.mdx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,7 @@ Most mainstream languages were designed decades ago—features like `prompt` and
161161
<Tabs>
162162
<Tab label="prompt.ai">
163163
```rust
164-
let answer = prompt "Why the sky is blue?" => {
165-
model: "claude-3.7",
166-
temperature: 0.8,
167-
};
164+
let answer = prompt "Why the sky is blue?";
168165
print(answer);
169166
```
170167
</Tab>
@@ -189,9 +186,6 @@ WeatherAgent.run(input=user_prompt);
189186
</Tab>
190187
<Tab label="project.toml">
191188
```toml
192-
[ai.embedding]
193-
model = "gpt-3.5-turbo"
194-
195189
[ai.openai]
196190
api_key = "YOUR_API_KEY"
197191

docs/guide/getting-started/_meta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
["introduction", "installation", "why-aiscript"]
1+
["introduction", "installation"]

docs/reference/language-keyword.mdx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@ The `prompt` keyword sends a text prompt to an AI model and returns the response
2424
let response = prompt "What is the capital of France?";
2525

2626
// With model specification
27-
let response = prompt "Explain quantum physics simply." => "anthropic://claude-3-5-sonnet-20241022?temperature=0.7";
27+
let detailed_answer = prompt {
28+
input: "Explain quantum computing",
29+
model: "gpt-4",
30+
max_tokens: 500,
31+
temperature: 0.7,
32+
system_prompt: "You are a quantum physics expert"
33+
};
2834
```
2935

3036
### agent
@@ -35,15 +41,14 @@ The `agent` keyword defines an AI agent with specific capabilities and instructi
3541
agent SearchAssistant {
3642
instructions: "You are a search assistant. Help users find information.",
3743
model: "claude-3-5-sonnet",
38-
tools: ["search", "summarize"],
3944

4045
fn search(query: str) -> str {
4146
// Implementation of search functionality
42-
prompt "Search for: {query}";
47+
prompt f"Search for: {query}";
4348
}
4449

4550
fn summarize(text: str) -> str {
46-
prompt "Summarize: {text}";
51+
prompt f"Summarize: {text}";
4752
}
4853
}
4954

@@ -186,6 +191,7 @@ Returns an error from a function.
186191
enum ArithError! {
187192
DivideByZero
188193
}
194+
189195
fn divide(a: int, b: int) -> float, ArithError! {
190196
if b == 0 {
191197
raise ArithError!::DivideByZero;

0 commit comments

Comments
 (0)