A modular agent-ready framework for exploring domain-specific languages (DSLs)
Project description
🧩 TinyDSL
TinyDSL is a modular, agent-ready framework for exploring and testing domain-specific languages (DSLs).
It currently supports two DSLs:
- 🎨 Gli — a graphics DSL for procedural image generation
- 🗣️ Lexi — a text DSL for structured, expressive text generation and reasoning
Both are served via a unified FastAPI backend and are designed to be invoked by LLM agents or external REST clients.
⚙️ Get Started
Use uv for lightweight environment management:
uv venv
uv sync
python -m api.main
Then open http://localhost:8008/docs for the interactive API UI.
🧠 Example Usage
Lexi (Text DSL)
set mood happy
say "Hello!"
repeat 2 { say "Have a wonderful day!" }
Lexi supports memory persistence:
remember name = "John Arthur"
recall name
Gli (Graphics DSL)
set color orange
repeat 10 {
set size 3+$i
draw circle x=cos($i*20)*$i*10 y=sin($i*20)*$i*10
}
Images are saved to /output with timestamped filenames.
🚀 Highlights
- Unified API for multiple DSLs (
/api/gli,/api/lexi) - Persistent, session-safe memory for Lexi (
/api/lexi/memory) - Built-in benchmark tasks and evaluation metrics
- Lightweight agent tool (
TinyDSLTool) for integration with LangChain, Autogen, or OpenAI agents - Simple modular structure to add new DSLs (e.g., music, logic, or code)
🤖 Agent Integration
Agents or Python scripts can call TinyDSL directly using the included tool:
from agent_tool import TinyDSLTool
tool = TinyDSLTool(base_url="http://localhost:8008/api")
# Run Lexi DSL
lexi_code = 'set mood happy\nsay "Hello there!"'
print(tool.run_lexi(lexi_code)["output"])
# Run a benchmark task
print(tool.run_lexi_task("005"))
# View and clear Lexi memory
print(tool.get_memory())
tool.clear_memory()
📚 API Overview
| DSL | Endpoint | Method | Purpose |
|---|---|---|---|
| Gli | /api/gli/run |
POST | Run graphics DSL code |
| Gli | /api/gli/run_example/{id} |
GET | Execute stored example |
| Lexi | /api/lexi/run |
POST | Execute Lexi DSL code |
| Lexi | /api/lexi/task |
POST | Run a predefined benchmark task |
| Lexi | /api/lexi/eval |
POST | Evaluate multiple outputs |
| Lexi | /api/lexi/memory |
GET | View persistent memory |
| Lexi | /api/lexi/memory/clear |
POST | Clear memory |
| Lexi | /api/lexi/memory/set |
POST | Set key-value in memory |
🧩 Extend
Add a new DSL by creating:
- An interpreter (
<dsl_name>.py) - An API router (
routes_<dsl_name>.py) - Example data or evaluation JSONs (optional)
Then register it in api/main.py.
TinyDSL’s modular design supports quick experimentation for acquire-and-apply learning across multiple DSLs.
🧭 Agent Workflow Example
TinyDSL is built for agent-based experiments testing acquisition, consolidation, and transfer of new skills. A typical loop looks like this:
-
Discover Tasks The agent fetches all available benchmark tasks:
tasks = [tool.run_lexi_task(tid) for tid in ["001", "002"]]
-
Execute & Learn The agent runs Lexi or Gli code, storing intermediate results in memory:
tool.run_lexi('remember mood = "happy"') tool.run_lexi('if mood is happy { say "Training complete!" }')
-
Evaluate After training or inference, results are scored automatically:
results = [{"task_id": "002", "output": "You look great today!"}] print(tool.eval_lexi_outputs(results))
-
Persist State Memory is persisted across sessions to simulate skill retention:
print(tool.get_memory()) # See consolidated knowledge
-
Transfer Test Clear memory and test new unseen compositions:
tool.clear_memory() tool.run_lexi_task("020") # Multi-step reasoning
With this flow, LLM agents can learn a new DSL in one session and apply it in another, making TinyDSL a foundation for studying continual learning, compositional reasoning, and symbolic generalization.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tinydsl-0.0.1.tar.gz.
File metadata
- Download URL: tinydsl-0.0.1.tar.gz
- Upload date:
- Size: 84.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fcb5814df2edf7154a9beca7dc566a4e594f1d8f20deb7064c7add277b9d5305
|
|
| MD5 |
2ce28c59c8cc9e71bfd4d0092866fdbd
|
|
| BLAKE2b-256 |
7ed2b5e1123b930f4b947654ca07e7cd0f34d6f77c3f6744f4b33781cb6246d9
|
Provenance
The following attestation bundles were made for tinydsl-0.0.1.tar.gz:
Publisher:
publish.yml on deepsaia/tinydsl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tinydsl-0.0.1.tar.gz -
Subject digest:
fcb5814df2edf7154a9beca7dc566a4e594f1d8f20deb7064c7add277b9d5305 - Sigstore transparency entry: 621768509
- Sigstore integration time:
-
Permalink:
deepsaia/tinydsl@2dab67874d9cc2dbb489c3295615451569ad5d22 -
Branch / Tag:
refs/tags/0.0.2 - Owner: https://github.com/deepsaia
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2dab67874d9cc2dbb489c3295615451569ad5d22 -
Trigger Event:
release
-
Statement type:
File details
Details for the file tinydsl-0.0.1-py3-none-any.whl.
File metadata
- Download URL: tinydsl-0.0.1-py3-none-any.whl
- Upload date:
- Size: 16.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5c1143e080901dfcda2ced01f39623eb66c5241192e9117b7c209682593e3ea
|
|
| MD5 |
ad4ab070d5581fce3aa95b0a3ef34ad1
|
|
| BLAKE2b-256 |
6b9596f7c460bff576037bd8c1d56888b4d115f67b1ab055bf5caff3b6b2a69d
|
Provenance
The following attestation bundles were made for tinydsl-0.0.1-py3-none-any.whl:
Publisher:
publish.yml on deepsaia/tinydsl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tinydsl-0.0.1-py3-none-any.whl -
Subject digest:
f5c1143e080901dfcda2ced01f39623eb66c5241192e9117b7c209682593e3ea - Sigstore transparency entry: 621768512
- Sigstore integration time:
-
Permalink:
deepsaia/tinydsl@2dab67874d9cc2dbb489c3295615451569ad5d22 -
Branch / Tag:
refs/tags/0.0.2 - Owner: https://github.com/deepsaia
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2dab67874d9cc2dbb489c3295615451569ad5d22 -
Trigger Event:
release
-
Statement type: