Skip to content

yuer-dsl/compileagent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

CompileAgent

Deterministic Execution Layer for Modern AI Agents

Author: yuer (Guanyu)
Project Type: Execution Runtime Spec + Reference Implementation
Version: v0.1


What is CompileAgent?

CompileAgent introduces a missing execution layer in current AI agent frameworks:
a way to compile an Agent’s reasoning route or behavior specification into a deterministic, auditable, replayable execution graph.

Current Agent systems (OpenAI Agents, Microsoft Agent Framework, LangChain, AutoGen…) rely on dynamic LLM planning, which leads to:

  • ❌ Non-deterministic execution
  • ❌ Hidden reasoning drift
  • ❌ Hard-to-debug behavior
  • ❌ No stable replay of the same task
  • ❌ Hard to pass safety audits

CompileAgent solves this.

It provides a specification + runtime that allows:

  • ✔︎ Compile an Agent's “Route Plan” once
  • ✔︎ Execute it deterministically (no drift)
  • ✔︎ Produce stable replay logs
  • ✔︎ Guarantee tool-call consistency
  • ✔︎ Enforce safety constraints at execution time

This is not a prompt trick,
but a missing piece of the agent stack
a real “runtime layer”, analogous to bytecode execution in traditional computing.


Why CompileAgent?

Modern AI stacks surprisingly lack a deterministic runtime like:

  • Python → bytecode → VM
  • Java → JVM
  • C# → IL → CLR
  • SQL → Query Plan → Executor

Agents today skip this step entirely.

CompileAgent fills this gap by providing:

  • Route → IR (Intermediate Representation) → Deterministic Executor

This gives agents:

✔ Determinism

Same input → Same structured execution → Same audit logs.

✔ Debuggability

The compiled route is stable, visible, and replayable.

✔ Safety

User-defined constraints cannot be bypassed by LLM drift.

✔ Multi-runtime compatibility

Works with OpenAI Agents, Microsoft Agent Framework, LangChain tools, custom tool runners, etc.


Concept Diagram

User Intent ↓ LLM Planner (Optional) ↓ CompileAgent "Compiler" ↓ Intermediate Route (IR) ↓ Deterministic Executor ↓ Tools / Functions / APIs


Repository Structure

compileagent/ │ ├── docs/ │ ├── whitepaper-v0.1.md │ ├── route-ir-spec.md │ └── deterministic-executor-design.md │ ├── examples/ │ ├── python_compile/ │ │ ├── agent_core.py │ │ └── compile_agent.yuer (spec example) │ └── ms_agent_framework_integration/ │ ├── runtime/ │ ├── executor.py │ ├── compiler.py │ └── ir_model.py │ ├── tests/ │ └── test_compile_agent.py │ └── README.md


📝 Minimal CompileAgent Spec Example

Below is a minimal deterministic “compile task” demonstrating how CompileAgent works as an execution layer:

TASK: CompileAgent
VERSION: 0.2

ANCHOR:
  - "compile"
  - "agent"
  - "python"
  - "deterministic"

CONTROL:
  energy_budget: 50
  stability: strict
  timeout: 30s
  retry_policy: 1

SIGNATURE:
  author: yuer
  semantic_hash: "compile:python:agent_core.py"
  timestamp: 2025-11-18T15:35:00Z

RULES:
  must_use: "python3.11"
  input_file_extension: ".py"
  output_format: "pyc"
  must_log: true

TOOL:
  name: PythonCompiler
  path: /usr/bin/python3.11
  args: ["-m", "py_compile", "{input_file}"]

INPUT:
  input_file: "agent_core.py"

OUTPUT:
  status: success | failure
  compiled_path: "/__pycache__/agent_core.pyc"
  logs: []

How the Runtime Executes This Task

1. Parse DSL spec
2. Validate signature (author, semantic hash)
3. Load TOOL specification
4. Validate RULES (file extension, python version, output format)
5. Execute:
   python3.11 -m py_compile agent_core.py
6. Capture stdout/stderr into structured logs
7. Write OUTPUT block
8. Generate final audit record

No LLM drift.
No hidden reasoning.
Fully replayable.

Roadmap (2025)

 v0.2 IR Spec for multi-step agents

 Microsoft Agent Framework example integration

 OpenAI Agents runtime demo (tool-call deterministic)

 CompileAgent → WebAssembly-like IR (research)

 CompileAgent Plugin SDK

 Deterministic “meta-agent” example (complex workflow)

 Suggested Integrations
✔ Microsoft Agent Framework (Preview)

CompileAgent can serve as a deterministic sub-executor, ensuring tool calls and Python functions always follow the same route.

✔ OpenAI Agents

CompileAgent stabilizes tool-call sequences and prevents route drift.

✔ LangChain / AutoGen

Acts as a “deterministic backend executor”.

Contributing

Pull requests are welcome.
If you are building agent frameworks, deterministic runtimes, or semantic execution layers, feel free to open issues or discuss new IR designs.

 License

MIT License.

Acknowledgements

Conceptual inspiration comes from the evolution of:

compiler pipelines

deterministic runtimes

agent orchestration systems

But CompileAgent is an independent project and not affiliated with Microsoft or OpenAI.

Author

Guanyu (yuer)
Creator of

EDCA-OS

Yuer DSL

CompileAgent

About

A deterministic execution module for AI agents. Compile Agent turns LLM plans into stable, replayable, audit-ready execution flows. Framework-agnostic. Works with OpenAI Agents, Microsoft Agent Framework, Gemini, and EDCA OS.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors