Complete reference for all standard library modules and functions.
ai::spawn_agent(config: AgentConfig) -> AgentCreates a new AI agent with the specified configuration.
Parameters:
config: Agent configuration map with name,
role, capabilitiesReturns: Agent object
Example:
let agent = ai::spawn_agent({
"name": "assistant",
"role": "helper",
"capabilities": ["text_analysis"]
});ai::send_message(from: string, to: string, message_type: string, content: Value, priority: string) -> MessageSends a message between agents.
Parameters:
from: Sender agent IDto: Recipient agent IDmessage_type: Type of messagecontent: Message contentpriority: Message priority ("low", "normal", "high",
"urgent")Returns: Message object
ai::create_coordinator(coordinator_id: string) -> AgentCoordinatorCreates a new agent coordinator for managing multiple agents.
ai::create_workflow(coordinator: AgentCoordinator, name: string, steps: vector<WorkflowStep>) -> WorkflowCreates a workflow with defined steps.
ai::execute_workflow(coordinator: AgentCoordinator, workflow_id: string) -> boolExecutes a workflow.
ai::analyze_text(text: string) -> TextAnalysisAnalyzes text using AI.
ai::generate_text(prompt: string) -> stringGenerates text using AI models.
chain::get_supported_chains() -> vector<ChainConfig>Returns list of all supported blockchain networks.
Returns: Vector of chain configurations
chain::deploy(chain_id: int, contract_name: string, constructor_args: map<string, string>) -> stringDeploys a smart contract to the specified chain.
Parameters:
chain_id: Chain ID (1=Ethereum, 137=Polygon, etc.)contract_name: Name of the contractconstructor_args: Constructor argumentsReturns: Contract address
Example:
let address = chain::deploy(1, "MyToken", {
"name": "MyToken",
"symbol": "MTK"
});chain::call(chain_id: int, contract_address: string, function_name: string, args: map<string, string>) -> stringCalls a function on a deployed contract.
chain::get_balance(chain_id: int, address: string) -> intGets the balance of an address.
chain::estimate_gas(chain_id: int, operation: string) -> intEstimates gas cost for an operation.
chain::get_gas_price(chain_id: int) -> floatGets current gas price.
chain::mint(name: string, metadata: map<string, string>) -> intMints an NFT or token.
chain::get(asset_id: int) -> map<string, string>Gets asset information.
database::connect(connection_string: string) -> DatabaseConnects to a database.
Parameters:
connection_string: Database connection string (e.g.,
"postgresql://user:pass@localhost/db")Returns: Database connection object
database::query(db: Database, sql: string, params: vector<Value>) -> QueryResultExecutes a SELECT query.
database::execute(db: Database, sql: string, params: vector<Value>) -> boolExecutes an INSERT, UPDATE, or DELETE query.
database::create_table(db: Database, table_name: string, schema: TableSchema) -> boolCreates a database table.
database::create_cache(cache_id: string) -> CacheCreates a cache instance.
database::cache_set(cache: Cache, key: string, value: Value, ttl_seconds: int) -> boolSets a value in cache.
database::cache_get(cache: Cache, key: string) -> ValueGets a value from cache.
web::create_server(config: map<string, Value>) -> HttpServerCreates an HTTP server.
Parameters:
config: Server configuration with port,
hostExample:
let server = web::create_server({
"port": 8080,
"host": "0.0.0.0"
});web::add_route(server: HttpServer, method: string, path: string, handler: Function) -> boolAdds a route to the server.
web::start(server: HttpServer) -> boolStarts the HTTP server.
web::create_websocket_server(port: int) -> WebSocketServerCreates a WebSocket server.
auth::login(username: string, password: string) -> SessionAuthenticates a user and creates a session.
auth::logout(session: Session) -> boolLogs out a user.
auth::session() -> SessionGets the current session.
auth::has_permission(session: Session, permission: string) -> boolChecks if session has a permission.
crypto::hash(data: string, algorithm: string) -> stringHashes data using specified algorithm.
Algorithms: "sha256", "sha512", "md5"
crypto::encrypt(data: string, key: string) -> stringEncrypts data using AES-256.
crypto::decrypt(encrypted_data: string, key: string) -> stringDecrypts data.
crypto::sign(data: string, private_key: string) -> stringSigns data with a private key.
crypto::verify(data: string, signature: string, public_key: string) -> boolVerifies a signature.
log::info(module: string, message: string) -> voidLogs an info message.
log::error(module: string, message: string) -> voidLogs an error message.
log::warn(module: string, message: string) -> voidLogs a warning message.
log::debug(module: string, message: string) -> voidLogs a debug message.
Example:
log::info("main", "Application started");
log::error("api", "Failed to connect");oracle::fetch(source: string, query: map<string, Value>) -> ValueFetches data from an oracle source.
oracle::verify(data: Value, signature: string) -> boolVerifies oracle data signature.
oracle::stream(source: string, callback: string) -> stringStreams data from an oracle.
kyc::verify(user_data: map<string, string>) -> map<string, Value>Verifies user identity (KYC).
Returns: Verification result with
status, score, details
kyc::validate_document(document_type: string, document_data: map<string, string>) -> map<string, Value>Validates identity documents.
aml::check_transaction(transaction_data: map<string, string>) -> map<string, Value>Checks transaction for AML compliance.
Returns: Result with risk_level,
risk_score, flags
aml::check_user(user_data: map<string, string>) -> map<string, Value>Checks user against AML databases.
trust::get_trust_level(entity_id: string) -> stringGets trust level of an entity.
Returns: "high", "medium", "low"
trust::set_trust_level(entity_id: string, level: string) -> boolSets trust level.
trust::authorize(admin_id: string, operation: string, resource: string) -> boolAuthorizes an operation.
config::get(key: string) -> ValueGets a configuration value.
config::set(key: string, value: Value) -> boolSets a configuration value.
config::load_from_file(path: string) -> map<string, Value>Loads configuration from a file.
service::register(name: string, endpoint: string) -> boolRegisters a service.
service::discover(service_name: string) -> ServiceInfoDiscovers a service.
service::call(service_name: string, method: string, args: map<string, Value>) -> ValueCalls a service method.
sync::push(data: map<string, Value>, target: SyncTarget) -> boolPushes data to a sync target.
sync::pull(source: SyncTarget) -> map<string, Value>Pulls data from a sync source.
mobile::create_app(config: AppConfig) -> MobileAppmobile::create_screen(app: MobileApp, screen_config: ScreenConfig) -> Screenmobile::request_permission(permission: string) -> booldesktop::create_window(config: WindowConfig) -> Windowdesktop::show_dialog(type: string, message: string) -> stringiot::connect_device(device_id: string, protocol: string) -> Deviceiot::send_command(device: Device, command: string, params: map<string, Value>) -> booliot::get_device_status(device_id: string) -> DeviceStatusFor more examples, see the Examples directory.