Helen is an AI-native programming language.
Of the AI, By the AI, For the AI.
Prompts are first-class. Prompts can freely invoke tools, functions, and other agents.
In traditional programming languages, code is the program's core and AI is just an external service being called. In Helen, the prompt itself is the core logic - you describe tasks in natural language, and the prompt invokes tools to read/write files, run commands, search the web, or call other agents to collaborate. Deterministic constructs (variables, functions, control flow) fuse with first-class LLM primitives (llm act, llm if) into a single language.
- Prompt-first:
agentis a first-class language construct - not a library pattern - 364 stdlib functions across 22 modules - covering the full AI application pipeline
- 5-layer graduated compression + working memory: Long-conversation agents manage context automatically, no manual tuning
- Transcript SSOT: Conversations persisted as SQLite/JSONL, supporting audit and replay
- Multi-agent concurrency:
spawn+ Channel message queues, with built-inmailbox_select - Python bidirectional integration: Helen β Python FFI + Python β Helen Bridge
- 99 bilingual keywords (48 English + 51 Chinese) - write every construct in either language
- Prompt-first:
agentis a first-class language construct - not a library pattern - Bilingual support: Native Chinese and English programming, lowering the learning curve for teams
- Automatic context management: Long-conversation agents with automatic compression, no manual tuning
- Complete DSL: Variables, functions, control flow + LLM primitives fused into one language
- Multi-agent concurrency: spawn + Channel message queues for fine-grained concurrency control
- Session persistence: Built-in TranscriptStore with audit and replay support
- Excellent debugging experience: REPL + Transcript + Observability
| Scenario | Recommended | Reason |
|---|---|---|
| Rapid prototyping | Helen | Concise syntax, automatic context management |
| Complex RAG pipelines | LangChain | Large number of pre-built components |
| Multi-agent team collaboration | CrewAI / Helen | Helen provides finer-grained concurrency control |
| Chinese-English bilingual apps | Helen | Native bilingual support |
| Long-conversation agents | Helen | 5-layer graduated compression + working memory |
| Session audit & replay | Helen | Built-in TranscriptStore SSOT |
π Detailed comparison: Helen vs LangChain vs CrewAI vs AutoGen
pip install helen-langCreate hello.helen:
agent Greeter(name: str) {
description "A friendly greeter"
prompt "Greet {{name}} warmly in one sentence"
main {
return llm act "Greet {{name}} warmly"
}
}
main {
let g = Greeter("World")
print(g)
}
Run:
helen hello.helen
# Hello, World! It's wonderful to meet you!helen repl
> let x = 1 + 2
> print(x)
3
> :helpHelen includes a built-in AI programming assistant:
# Install with assistant support
pip install helen-lang[agent]
# Launch the assistant
helen agentFeatures:
- Web-based chat interface
- Smart context management (working memory, session recovery)
- Skill-based knowledge system (TDD, quality assessment, etc.)
- Direct tool access (file operations, shell commands, web search)
Requirements:
- Node.js 18+ (for web frontend)
- LLM API configured in
~/.helen/config.yaml
See helen/agent/README.md for details.
Helen Agents can be used directly in Python via the Python Bridge, just like ordinary Python classes:
- Create a Helen Agent file
translator.helen:
agent TranslatorAgent(text: str, target: str) {
description "Translate text to the target language"
prompt "Translate '{{text}}' to {{target}}"
main {
return llm act "Translate '{{text}}' to {{target}}"
}
}
- Import and call in Python:
from translator import TranslatorAgent
agent = TranslatorAgent()
result = agent("Hello", "French")
print(result) # "Bonjour"- Direct .helen file import:
from my_agents import TranslatorAgent - Type hint support: IDE auto-completion for Helen Agents
- Async calls:
await agent.async_call(...) - Decorator pattern:
@helen_agentdecorates Python functions - Parameter validation: Helen automatically validates agent parameter types
from helen.python_bridge import helen_agent
@helen_agent("translator.helen", "TranslatorAgent")
def translate(text: str, target: str) -> str:
pass
result = translate("Hello", "French")from agents import ResearchAgent, AnalysisAgent
# Research phase
researcher = ResearchAgent()
findings = researcher("quantum computing", depth="deep")
# Analysis phase
analyzer = AnalysisAgent()
insights = analyzer(findings)from workflow import PlannerAgent, ExecutorAgent, ReviewerAgent
planner = PlannerAgent()
plan = planner("Build a web app")
executor = ExecutorAgent()
result = executor(plan)
reviewer = ReviewerAgent()
feedback = reviewer(result)from llm_agents import ChatBot, Summarizer, Translator
chatbot = ChatBot()
response = chatbot("What is AI?")
summarizer = Summarizer()
summary = summarizer(long_text)
translator = Translator()
translated = translator(summary, target="Chinese")class HelenAgentWrapper:
def __init__(self, agent_name: str, helen_file: str, interpreter=None)
def __call__(self, *args, **kwargs) -> Any
"""Call agent"""
async def async_call(self, *args, **kwargs) -> Any
"""Async call agent"""@helen_agent(helen_file: str, agent_name: str = None)
def my_function(...):
"""Wrap function as a Helen agent call"""
@helen_module(helen_file: str)
class MyModule:
"""Wrap class as a collection of Helen agents"""from helen.python_bridge import install_import_hook
# Auto-install (default)
install_import_hook()
# Manual uninstall
from helen.python_bridge import uninstall_import_hook
uninstall_import_hook()from agents import TranslatorAgent
agent = TranslatorAgent()
texts = ["Hello", "World", "AI"]
results = [agent(text, target="French") for text in texts]
print(results) # ["Bonjour", "Monde", "IA"]from agents import TranslatorAgent
agent = TranslatorAgent()
try:
result = agent("Hello", target="French")
except TypeError as e:
print(f"Parameter error: {e}")
except Exception as e:
print(f"Execution error: {e}")from helen.interpreter import Interpreter
from helen.python_bridge import HelenAgentWrapper
# Create a shared interpreter
interpreter = Interpreter()
# Multiple agents share the same interpreter
agent1 = HelenAgentWrapper("Agent1", "agents.helen", interpreter)
agent2 = HelenAgentWrapper("Agent2", "agents.helen", interpreter)Contributions welcome! See CONTRIBUTING.md for details.
MIT License
- Documentation: https://helen.readthedocs.io
- GitHub: https://github.com/hahalee000000/helen
- PyPI: https://pypi.org/project/helen-lang
Start here β the Beginner Guide teaches Helen's "prompts are first-class" philosophy with an agent-first narrative:
- π Beginner Guide - Agent-first tutorial (11 chapters + appendix). Learn Helen from scratch.
- π Language Reference - Comprehensive, topic-indexed reference (18 chapters)
By topic:
- Wiki Index - Complete technical documentation
- Python Bridge - Python integration guide
- Context Management - Intelligent context handling (v1.20)
- Skill System - Skill loading and usage
- Transcripts are isolated per application in
.helen/sessions/by default (REPL scenario opts in to global) session_scopeconfiguration:auto|global|projectHELEN_SESSION_DIRenvironment variable to force a specific path- New
get_session_dir()/set_session_dir()stdlib functions
- Complete 6-dimension API (Inspection / Working Memory / Fine-grained Mutation / Runtime Config / Query / Multi-agent Transfer)
- 24 new stdlib functions:
context_stats/context_usage/pin_message/working_memory_*/export_context, etc. Message.pinned: boolfield β pinned messages are immune to all 5 compression layers- Internalized
classify_message
spawn Agent(...)returns a Channel, replacingasync/await/detach- Channel message queue:
send/receive/try_receive/cancel/close mailbox_select()multi-select primitive- Streaming interrupt:
on_chunkcallback returnsfalseto stop streaming; Ctrl+C interrupt
- Conversation history SSOT with SQLite/JSONL dual backends
- LRU cache (10K messages ~10MB)
- UUID addressing, O(1) lookups
- Non-destructive compression (BoundaryMarker audit trail)
- Working Memory
- Graduated Compression
- Cache-Aware Compression
- Three-Channel Context
- Agent context configuration
llm actsupports streaming output (on_chunk/on_complete callbacks)llm streamremoved (functionality merged intollm act)
- Direct Python import and usage of Helen Agents
- Bidirectional FFI (Helen β Python)
- Agent isolation levels (@open, @strict, @sandbox)
- Shared store and channel
- ReadOnlyView
- Closure value capture
- Agent scope isolation
- Short-circuit evaluation
- Subscript/field assignment
- Alias statements
- GitHub: https://github.com/hahalee000000/helen β Report issues, submit PRs, join discussions
- License: MIT β Business-friendly, open-source-friendly
- Python: 3.12+ required
- Platforms: Linux / macOS / Windows
Contributions welcome! See CLAUDE.md for the development workflow, or wiki/index.md for complete documentation.
- Code size: ~40,000 lines of Python (96 source files)
- Test coverage: 2917 tests, 137 test files
- Built-in stdlib: 287 functions, 287 Chinese aliases
- Built-in skills: 17 (helen-syntax, helen-stdlib, code-quality, github, etc.)
- Bilingual keywords: 89 (44.5 English + 44.5 Chinese)