Skip to main content

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 tinydsl_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:

  1. Discover Tasks The agent fetches all available benchmark tasks:

    tasks = [tool.run_lexi_task(tid) for tid in ["001", "002"]]
    
  2. 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!" }')
    
  3. Evaluate After training or inference, results are scored automatically:

    results = [{"task_id": "002", "output": "You look great today!"}]
    print(tool.eval_lexi_outputs(results))
    
  4. Persist State Memory is persisted across sessions to simulate skill retention:

    print(tool.get_memory())  # See consolidated knowledge
    
  5. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tinydsl-0.0.5.tar.gz (88.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tinydsl-0.0.5-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file tinydsl-0.0.5.tar.gz.

File metadata

  • Download URL: tinydsl-0.0.5.tar.gz
  • Upload date:
  • Size: 88.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tinydsl-0.0.5.tar.gz
Algorithm Hash digest
SHA256 ec91d39364d68251c7e0751a1c77048d071ad44524375542cdba9e2c3d2b1d8d
MD5 bdb7cba23ee3d860d6f95903772538cb
BLAKE2b-256 e8c62170444d8b045d42a37a7084449edb14b332a6d7f0f19cecedd2f2ea788e

See more details on using hashes here.

Provenance

The following attestation bundles were made for tinydsl-0.0.5.tar.gz:

Publisher: publish.yml on deepsaia/tinydsl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tinydsl-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: tinydsl-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tinydsl-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 038b95255ce0635bb664a07c8bca9731c4c1732c9b36507e3f7188bed38d4d4c
MD5 4d78fc55e9a495f054289415ea925407
BLAKE2b-256 ba3ecb76b44691d6cc99aaf46add7de4805996d69da2d4376619992a4c821d75

See more details on using hashes here.

Provenance

The following attestation bundles were made for tinydsl-0.0.5-py3-none-any.whl:

Publisher: publish.yml on deepsaia/tinydsl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page