top | item 47055184

Show HN: Assembly Language for Agents

2 points| vanilla-latte | 13 days ago |github.com

Hi HN!

I wanted to share something that I've been working on for the past couple of weeks. This was born from my desire to create my own toy fantasy console. One day, I had a thought:

Imagine if I had a console where the core driver/engine of it was an LLM? Or better yet, why not replace the ALU inside the CPU with an LLM?

What would the assembly language look like and what are the primitive data types (I can firmly blame Crafting Interpreters for this addiction)?

So I set out to answer my question by creating a simple interpreter which consumes a special kind of assembly code where each operation is transformed into small prompts (micro prompts?).

Think of a future where we would be writing code as follows:

``` ; PROGRAM: VIBE_CONTROLLER.aasm ; Objective: Adjust room environment based on subjective user vibe.

START: ; Initialise State LF X1, "room_sensors.json" ; Load current state: {temp: 18C, lights: 6000K, music: Off} LI X2, "Make it more warm." ; Load the user's vague complaint

    ; Load the user's desired vibe
    LI  X3, "Goal: Warm, inviting, comfortable, relaxed." 

    ; The Cognitive Operation
    APP X4, X2, X3 ; Apply the user's complaint and goal to generate a new state for the room.

    ; Predict the new state of X1 (Sensors) given X4 (Complaint + Goal).
    ; The LLU calculates: "Sterile" (Cold/White) -> Needs Warmer Temp + Warmer Light.
    INF X5, X1, X4                  
    
    ; X5 now holds the generated JSON: {temp: 22C, lights: 2700K, music: "LoFi Jazz"}

    ; Safety Guardrail
    ; Ensure that the generated state (X5) is aligned with safety rules (X6).
    LI  X6, "Constraint: Max Temp 23C. No Music if time > 11PM."
    INT X7, X5, X6                  ; X7 stores 100 if safe, 0 if unsafe.

    ; Branching Logic
    LI  X8, 0
    BGT X7, X8, HANDLER             ; If aligns with intention, jump to error handler
    
    ; Execute
    OUT X5                          ; Send new config to IoT Hub
    EXIT
HANDLER: LI X8, "{error: 'Request conflicts with safety protocols.'}" OUT X8 ```

What we have here is essentially an agent, but the assembly language for agents can be thought of as a middle ground between traditional programming languages and natural language prompts. It's more structured and modular than natural language prompts.

I would love to see what new, fun, and creative ways we can use this for.

Repo: https://github.com/HuyNguyenAu/assembly_language_for_agents

2 comments

order

nivertech|13 days ago

Not sure what Assembly gives you here.

DSL is a much better option.

You can even use graphviz/Mermaid/PlantUML for visual agentic workflows, instead of emulating them with ASSM-like branching instructions and flags.

vanilla-latte|10 days ago

That's a very good point, it didn't cross my mind thinking about this from a DSL pov