dist_agent_lang 1.0.5

A hybrid programming language for decentralized and centralized network integration
Documentation

dist_agent_lang

License: MIT Rust Platform

A hybrid compiled programming language for AI agents, blockchain, and distributed systems


๐Ÿ“– PUBLIC DOCUMENTATION

โžก๏ธ Complete Documentation (AI/LLM Ready)

Quick Links:

Optimized for both developers and AI assistants.


โš ๏ธ Beta Release Notice

Current Version: v1.0.5 (Beta Release) โ€” Actively Developed

dist_agent_lang is an actively maintained beta release with consistent updates and improvements. The language includes extensive security features, comprehensive documentation, and has passed all tests (140+ passing).

๐Ÿ™ Beta Testing Contributions Appreciated!
We welcome feedback, bug reports, and contributions from the developer community to help us reach production readiness (v1.1.0+).

โœ… Safe For:

  • Development & Prototyping - Building and testing applications
  • Learning & Experimentation - Educational purposes and learning
  • Non-Critical Applications - Applications not handling significant value
  • Testing & Validation - Validating concepts and workflows
  • Beta Testing - Help us improve with your feedback!

โš ๏ธ Use With Caution For:

  • Production Financial Applications - Applications handling real money (wait for v1.1.0+)
  • High-Value Smart Contracts - Contracts managing significant assets (third-party audit recommended)
  • Critical Infrastructure - Systems requiring high reliability (additional validation needed)
  • Sensitive Data Applications - Additional security audits strongly recommended

๐Ÿ”’ Security Features (v1.0.5):

  • โœ… Reentrancy protection
  • โœ… Safe math (overflow/underflow protection)
  • โœ… State isolation
  • โœ… Cross-chain security
  • โœ… Oracle security (signed feeds, multi-source validation)
  • โœ… Transaction atomicity (ACID guarantees)
  • โœ… Enhanced security logging with source tracking
  • โœ… 140+ tests passing (100%)
  • โœ… Zero compilation errors
  • โœ… Dependency security audit passed (0 vulnerabilities)

๐Ÿš€ What's New in v1.0.5:

  • Enhanced Log Functions - Optional source parameter for all log functions (info, warning, error, debug, audit)
  • HTTP Timeout Standardization - Standardized to 30000ms (30 seconds) for consistency with HTTP libraries
  • Comprehensive Security Integration Tests - End-to-end security workflow tests using actual DAL language code
  • Improved Logging - Custom source identifiers for better log filtering and debugging
  • Enhanced Testing - 140+ tests covering all standard library modules

๐Ÿ”„ Active Development:

This project receives consistent updates with improvements to security, performance, documentation, and features. We're working toward v1.1.0 (production release) with third-party security audits, real-world validation, and community feedback.

Target for Production (v1.1.0+): ~14 weeks with community validation

๐Ÿ“‹ Recommendations:

  • For Production Use: Wait for v1.1.0+ with third-party security audit and real-world validation
  • For Critical Applications: Conduct independent security audit before deployment
  • For Financial Applications: Additional formal verification strongly recommended
  • Always: Test thoroughly in development/testnet environments first
  • Join Beta Testing: Help us improve by testing and providing feedback!

๐Ÿค How to Contribute to Beta:

  • ๐Ÿงช Testing - Use the language, run examples, report bugs (no coding required!)
  • ๐Ÿ“ Documentation - Improve docs, write tutorials, fix typos
  • ๐Ÿ’ป Code - Fix bugs, implement features, add tests
  • ๐Ÿ’ก Ideas - Share use cases, suggest improvements, join discussions

๐Ÿ‘‰ New to contributing? Check out GOOD_FIRST_ISSUES.md for beginner-friendly tasks!

๐Ÿ“– Full Guide: See CONTRIBUTING.md for detailed contribution guidelines.

We value your feedback and contributions as we work toward production readiness!

๐Ÿš€ Features

๐Ÿค– AI Agent Framework

  • Multi-Agent Coordination: Create and orchestrate AI agents with built-in coordination
  • Workflow Management: Define complex workflows with step dependencies
  • Task Execution: Distributed task processing with status tracking
  • Memory Management: Persistent agent memory and context awareness
  • Communication Protocols: Inter-agent messaging and event-driven communication

โ›“๏ธ Blockchain Integration

  • Multi-Chain Support: Ethereum, Polygon, Binance, Solana, Avalanche, Arbitrum, Optimism
  • Smart Contract Development: Native smart contract creation and deployment
  • Cross-Chain Operations: Seamless asset transfers across different blockchains
  • Oracle Integration: Real-world data feeds and external API connectivity
  • Gas Optimization: Chain-specific gas estimation and transaction management

๐Ÿ”’ Security & Compliance

  • KYC/AML Integration: Built-in Know Your Customer and Anti-Money Laundering checks
  • Trust Model System: Configurable trust levels and security profiles
  • Audit Trails: Comprehensive logging and compliance tracking
  • Capability-Based Security: Fine-grained permission system
  • Cryptographic Operations: AES-256, SHA-256, ECDSA, multi-signature support

๐ŸŽฏ Multi-Target Compilation

  • Blockchain: Smart contract compilation for multiple chains
  • WebAssembly: Web-based applications and browser integration
  • Native: High-performance desktop applications
  • Mobile: iOS and Android app development
  • Edge: IoT and edge computing devices

๐Ÿ“š Documentation

Getting Started (5 minutes)

Production Deployment

Developer Guides

Tutorials

AI Features

CloudAdmin & Hybrid Trust

Migration Guides

Architecture & Reference


๐Ÿ“ฆ Installation

Prerequisites

Quick Install

From crates.io (recommended):

cargo install dist_agent_lang

From source:

git clone https://github.com/okjason-source/dist_agent_lang.git
cd dist_agent_lang
cargo install --path .

From release binary: Download from GitHub Releases and extract the binary to your PATH.

๐ŸŽฎ Quick Start

Hello World

// hello_world.dal
@trust("hybrid")
@chain("ethereum")
service HelloWorld {
    fn main() {
        print("Hello, dist_agent_lang!");
        
        // Create an AI agent
        let agent = ai::create_agent("greeter", {
            "role": "greeting_specialist",
            "capabilities": ["greeting", "conversation"]
        });
        
        // Deploy to blockchain
        let contract = chain::deploy_contract("HelloWorld", {
            "name": "Hello World Contract",
            "version": "1.0.5"
        });
        
        log::info("main", "Hello World deployed successfully!");
    }
}

AI Agent Example

// ai_agent_example.dal
@trust("hybrid")
@ai
@chain("ethereum")
service AIAgentDemo {
    fn create_ai_system() {
        // Create coordinator
        let coordinator = ai::create_coordinator("project_coordinator");
        
        // Spawn specialized agents
        spawn data_analyzer:ai {
            role: "data_analysis_specialist",
            capabilities: ["data_analysis", "statistics", "visualization"]
        } {
            log::info("agent", "Data Analyzer agent ready");
        }
        
        spawn blockchain_expert:ai {
            role: "blockchain_specialist", 
            capabilities: ["smart_contracts", "defi", "nft"]
        } {
            log::info("agent", "Blockchain Expert agent ready");
        }
        
        // Add agents to coordinator
        ai::add_agent_to_coordinator(coordinator, data_analyzer);
        ai::add_agent_to_coordinator(coordinator, blockchain_expert);
        
        // Create workflow
        let workflow = ai::create_workflow(coordinator, "data_analysis", [
            {
                "step_id": "analyze_data",
                "agent_id": data_analyzer.id,
                "task_type": "data_analysis"
            },
            {
                "step_id": "deploy_contract",
                "agent_id": blockchain_expert.id,
                "task_type": "contract_deployment",
                "dependencies": ["analyze_data"]
            }
        ]);
        
        // Execute workflow
        ai::execute_workflow(coordinator, workflow.workflow_id);
    }
}

Smart Contract Example

// smart_contract_example.dal
@trust("hybrid")
@secure
@chain("ethereum")
service TokenContract {
    name: string = "MyToken";
    symbol: string = "MTK";
    total_supply: int = 1000000;
    balances: map<string, int> = {};
    
    fn initialize(owner: string) {
        self.balances[owner] = self.total_supply;
        log::info("contract", "Token contract initialized");
    }
    
    fn transfer(to: string, amount: int) -> bool {
        let from = auth::session().user_id;
        
        if self.balances[from] < amount {
            return false;
        }
        
        self.balances[from] = self.balances[from] - amount;
        self.balances[to] = self.balances[to] + amount;
        
        log::info("transfer", "Transfer completed: " + amount + " tokens");
        return true;
    }
}

// Create and use service instances
let token = TokenContract::new();
token.initialize("0x1234567890123456789012345678901234567890");

// Alternative instantiation syntax
let token2 = service::new("TokenContract");
token2.initialize("0xabcdefabcdefabcdefabcdefabcdefabcdefabcd");

// Call methods on instances
token.transfer("0x456...", 100);

๐Ÿ“š Documentation

Getting Started

Tutorials

  • Complete Tutorial Series - 12 comprehensive tutorials from beginner to advanced
    • Tutorial 1: Getting Started
    • Tutorial 2: AI Agents
    • Tutorial 3: Blockchain Integration
    • Tutorial 4: Multi-Chain Operations
    • Tutorial 5: Security & Compliance
    • Tutorial 6: AI Integration
    • Tutorial 7: Database Operations
    • Tutorial 8: Web API Operations
    • Tutorial 9: Compliance Features
    • Tutorial 10: Error Handling
    • Tutorial 11: Performance Optimization
    • Tutorial 12: Testing & Debugging

Reference Documentation

Feature Guides

Examples

๐Ÿ› ๏ธ Development

Building from Source

git clone https://github.com/dist_agent_lang/dist_agent_lang.git
cd dist_agent_lang

# Build in debug mode
cargo build

# Build in release mode
cargo build --release

# Run tests
cargo test

# Run benchmarks
cargo bench

Project Structure

dist_agent_lang/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ lexer/          # Lexical analysis
โ”‚   โ”œโ”€โ”€ parser/          # Syntax parsing
โ”‚   โ”œโ”€โ”€ runtime/         # Runtime environment
โ”‚   โ”œโ”€โ”€ stdlib/          # Standard library modules
โ”‚   โ”œโ”€โ”€ testing/         # Testing framework
โ”‚   โ””โ”€โ”€ performance/     # Performance optimization
โ”œโ”€โ”€ examples/            # Example code
โ”œโ”€โ”€ docs/               # Documentation
โ”œโ”€โ”€ scripts/            # Build and deployment scripts
โ”œโ”€โ”€ templates/          # Code generation templates
โ””โ”€โ”€ tests/              # Test suites

๐Ÿงช Examples

The project includes 11 comprehensive examples:

  1. AI Agent System Demo - Multi-agent coordination and workflow management
  2. Backend Connectivity Patterns - Database and API integration patterns
  3. Chain Selection Example - Multi-chain interaction and selection
  4. Cross-Chain Patterns - Asset management across different blockchains
  5. DeFi NFT RWA Contract - Real World Asset tokenization (Arbitrum)
  6. Dynamic NFT Examples - Dynamic NFTs with real-world data (Ethereum)
  7. Dynamic RWA Examples - Real World Asset tokenization (Ethereum)
  8. Enhanced Language Features - Advanced language capabilities
  9. General Purpose Demo - General programming examples
  10. Integrated Spawn AI Examples - Spawn and AI agent integration
  11. KEYS Token Implementation - Complete token system (Ethereum)

๐Ÿงช Testing

DAL uses a three-layer testing strategy for comprehensive validation:

Layer 1: Rust Unit Tests (Syntax Validation)

Fast syntax and parse-time validation for all DAL code:

cargo test                        # Run all tests
cargo test --test example_tests   # Run example tests only
cargo test -- --nocapture         # Run with output

Layer 2: Semantic Validators (Attribute & Type Validation)

Validation helpers for semantic correctness:

// Used within tests for semantic validation
test::expect_valid_trust_model("hybrid");
test::expect_valid_chain("ethereum");
test::expect_compatible_attributes(["trust", "chain"]);
test::expect_type(&value, "number");
test::expect_in_range(value, 0.0, 100.0);

Layer 3: DAL Test Files (Runtime Behavior)

Hardhat-style testing framework for DAL (.test.dal files):

# Run all DAL test files
./scripts/run_dal_tests.sh

# Run specific test file
cargo run --release -- run examples/token_contract.test.dal

Example DAL test:

describe("TokenContract", fn() {
    let contract;
    
    beforeEach(fn() {
        contract = deploy_service("TokenContract", {});
    });
    
    it("should transfer tokens", fn() {
        contract.transfer("bob", 100.0);
        expect(contract.balance_of("bob")).to_equal(100.0);
    });
});

Testing Documentation

For complete testing guides:

๐Ÿ”ง Configuration

Environment Variables

# Blockchain configuration
DIST_AGENT_RPC_URL_ETHEREUM=https://mainnet.infura.io/v3/YOUR_KEY
DIST_AGENT_RPC_URL_POLYGON=https://polygon-rpc.com
DIST_AGENT_PRIVATE_KEY=your_private_key

# AI configuration
DIST_AGENT_AI_API_KEY=your_openai_key
DIST_AGENT_AI_MODEL=gpt-4

# Database configuration
DIST_AGENT_DB_URL=postgresql://user:pass@localhost/db

Configuration File

# config.toml
[blockchain]
ethereum_rpc = "https://mainnet.infura.io/v3/YOUR_KEY"
polygon_rpc = "https://polygon-rpc.com"
private_key = "your_private_key"

[ai]
api_key = "your_openai_key"
model = "gpt-4"
max_tokens = 4096

[database]
url = "postgresql://user:pass@localhost/db"
pool_size = 10

๐Ÿค Contributing

Contributors Welcome! ๐ŸŽ‰ We're actively seeking help to improve and test dist_agent_lang. Every contribution, no matter how small, helps!

๐Ÿš€ Quick Start Contributing

No coding required? You can still help!

  • ๐Ÿงช Test the language - Run examples, report bugs
  • ๐Ÿ“ Improve documentation - Fix typos, clarify instructions
  • ๐Ÿ’ก Share feedback - Tell us what works and what doesn't

Ready to code? Great!

Development Setup

# Fork and clone
git clone https://github.com/your-username/dist_agent_lang.git
cd dist_agent_lang

# Install dependencies
cargo build

# Run tests
cargo test

# Format code
cargo fmt

# Check for issues
cargo clippy

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ†˜ Support

๐Ÿ™ Acknowledgments

  • Rust community for the excellent language and ecosystem
  • Ethereum community for blockchain standards and tools
  • AI/ML community for inspiration and best practices
  • Open source contributors who made this project possible

Made with โค๏ธ by OK Jason