Julia Docs

Plugin Development

Plugins are the heart of Julia. Whether you're building token logic, reinforcement agents, or zero-knowledge modules — everything runs as a pluggable component, fully isolated and API-addressable.

This guide walks you through the process of writing, compiling, and exposing your own plugin.


Plugin Structure

Each plugin lives inside the /Plugins/ directory. Example layout:

/Plugins/arithmetic_agent/
├── arithmetic_agent.rs       # Core logic in Rust
├── Cargo.toml                # Rust package manifest
└── build.sh                  # Compilation script to WASM

You can structure your plugins however you like — as long as the output is a .wasm file.


Writing Your First Plugin

Julia plugins are typically written in Rust, thanks to its WASM support and memory safety.

Example:

#[no_mangle]
pub extern "C" fn execute(input_ptr: *const u8, input_len: usize) -> i32 {
    // Your logic here
    42
}

The only requirement: expose an execute() function that handles serialized inputs and returns serialized outputs.


Compiling to WASM

Use the Rust WASM target:

rustup target add wasm32-unknown-unknown
cargo build --target wasm32-unknown-unknown --release

The result: ./target/wasm32-unknown-unknown/release/your_plugin.wasm

Copy it to /Plugins/{plugin_name}/ and Julia will load it on startup.


Registering the Plugin

No manual registration needed — just place the .wasm in the correct folder and Julia will:

  • Load the plugin
  • Expose the endpoint
  • Route HTTP calls to it

Each plugin will be available via POST /api/{plugin-name}


Passing Parameters

Parameters should be passed as JSON. Julia automatically deserializes the input and routes it to the plugin runtime.

Example request:

POST /api/arithmetic-agent
{
  "initialSupply": 69000000,
  "burnRate": 0.042,
  "inflationRate": 0.017
}

Plugin Metadata (optional)

Plugins can optionally export metadata:

{
  "name": "arithmetic_agent",
  "version": "0.1.0",
  "author": "you",
  "description": "A plugin for modeling token inflation"
}

This allows plugins to self-describe inside admin dashboards or marketplaces.


Tips for Building Plugins

  • Use wasm-bindgen or wit-bindgen for complex I/O.
  • Keep logic focused and isolated.
  • Add logging internally; Julia can expose it.
  • Use shared crates across plugins to avoid duplication.

Next Steps

Once you’ve built your plugin:

  • Test it via Scalar UI
  • Chain it with other plugins
  • Register it into a larger protocol

Plugins are your programmable logic blocks — ship them fast, test in isolation, and evolve freely.

On this page