Complete reference for all attributes in dist_agent_lang.
Attributes in dist_agent_lang are annotations that modify the
behavior of services, functions, and other language constructs. They use
the @ prefix.
@trust(model)Specifies the trust model for a service.
Values:
"decentralized" - Fully decentralized, no central
authority"hybrid" - Combines centralized and decentralized
trust"centralized" - Traditional centralized trust
modelExample:
@trust("hybrid")
service MyService {
// Service code
}@chain(chain1, chain2, ...)Specifies which blockchain networks the service supports.
Supported Chains:
"ethereum" - Ethereum Mainnet (Chain ID: 1)"polygon" - Polygon (Chain ID: 137)"binance" - Binance Smart Chain (Chain ID: 56)"solana" - Solana (Chain ID: 101)"avalanche" - Avalanche (Chain ID: 43114)"arbitrum" - Arbitrum (Chain ID: 42161)"optimism" - Optimism (Chain ID: 10)Example:
@chain("ethereum", "polygon")
service MultiChainService {
// Works on both Ethereum and Polygon
}@compile_target(target)Specifies the compilation target for the service.
Values:
"blockchain" - Transpile to Solidity for blockchain
deployment"webassembly" - Transpile to Rust, build as WebAssembly
(also accepted: "wasm") (experimental)"native" - Transpile to Rust, build as native library
(experimental)"mobile" - Mobile target (stub; compile/transpile
deferred until transpile path exists)"edge" / "iot" - IoT/edge target (same:
edge = IoT). IoT is served by the runtime
(iot::* + IotState); compile/transpile to edge is stub,
same pattern as others when added. Use
dal build --target edge or --target iot.When @compile_target is present, the parser enforces
required attributes and forbidden
operations for that target. See Compile targets (constraints)
below.
Example:
@compile_target("blockchain")
@secure
@trust("hybrid")
service SmartContract {
// Compiled as smart contract; @secure and @trust required for blockchain
}Each target defines required attributes (must appear on the service) and forbidden operations (stdlib namespaces that must not be used in service methods). The parser validates these at parse time; the runtime may re-check required attributes when the service is instantiated.
| Target | Required attributes | Forbidden operations (namespaces / ops) |
|---|---|---|
| blockchain | @secure, @trust |
web::http_request, web::websocket,
desktop::window, mobile::notification,
iot::sensor_read |
| webassembly | @web |
chain::transaction, chain::deploy,
desktop::file_system, mobile::camera,
iot::device_control |
| native | @native |
chain::transaction, mobile::touch_event,
iot::sensor_read |
| mobile | @mobile |
chain::transaction, desktop::window,
iot::device_control |
| edge / iot | @edge |
chain::transaction, web::dom_manipulation,
desktop::window, mobile::camera |
Allowed operations per target are defined in the implementation
(get_target_constraints()); only the forbidden set and
required attributes are listed here. If you use
@compile_target, you must include the required attributes
and avoid calling forbidden namespaces in any service method.
Edge = IoT: IoT/edge is served by the runtime; see design/MOBILE_EDGE_IOT_TARGETS.md
for serve vs transpile and mobile deferral.
@interface(language)Generates client interface in the specified language.
Supported Languages:
"typescript" - TypeScript interface"javascript" - JavaScript interface"python" - Python interface"rust" - Rust interface"java" - Java interface"go" - Go interfaceExample:
@interface("typescript")
service APIService {
// Generates TypeScript client interface
}@secureEnforces security requirements on the service.
Effects:
Example:
@secure
@trust("hybrid")
service SecureService {
// All operations are secured
}@limit(n)Sets resource limits for the service.
Parameters:
n - Maximum number of operations/resourcesExample:
@limit(1000)
service LimitedService {
// Maximum 1000 operations
}@txnWraps operations in a transaction.
Effects:
Example:
@txn
fn transfer_funds() {
// Transaction-wrapped operation
}@secureMarks a function as requiring security checks.
@secure
fn admin_operation() {
// Requires authentication and authorization
}@txnWraps function execution in a transaction.
@txn
fn update_balance() {
// Executed as transaction
}@limit(n)Sets resource limit for a function.
@limit(100)
fn process_batch() {
// Limited to 100 operations
}@mobileIndicates mobile platform support.
@mobile
service MobileApp {
// Mobile-specific features
}@desktopIndicates desktop platform support.
@desktop
service DesktopApp {
// Desktop-specific features
}@iotIndicates IoT/edge device support.
@iot
service IoTDevice {
// IoT-specific features
}@aiEnables AI agent capabilities.
@ai
service AIService {
// AI agent features enabled
}@cachedEnables caching for a function.
@cached
fn expensive_operation() -> string {
// Results are cached
return compute_expensive_result();
}@persistentMarks data as persistent.
@persistent
service PersistentService {
// Data persists across restarts
}@versionedEnables versioning for a service.
@versioned
service VersionedService {
// Service versioning enabled
}@deprecatedMarks a function or service as deprecated.
@deprecated
fn old_function() {
// This function is deprecated
}Attributes can be combined:
@trust("hybrid")
@chain("ethereum", "polygon")
@secure
@compile_target("blockchain")
@interface("typescript")
service CompleteService {
@secure
@txn
@limit(1000)
fn secure_transaction() {
// Multiple attributes applied
}
}Service-level attributes apply to all functions unless overridden:
@secure
service SecureService {
// All functions inherit @secure
fn public_function() {
// Still requires security
}
// Can override at function level if needed
}@trust appropriately: Choose the
right trust model for your use case@chain explicitly: Always
specify which chains your service supports@secure for sensitive operations:
Mark all security-critical functions@trust("decentralized")
@chain("ethereum", "polygon")
@secure
@compile_target("blockchain")
service DeFiService {
@txn
@limit(10000)
fn swap_tokens() {
// Secure, transactional token swap
}
}@trust("hybrid")
@ai
@compile_target("native")
service AIAgentService {
@cached
fn analyze_data(data: string) -> map<string, any> {
// Cached AI analysis
}
}@trust("centralized")
@compile_target("webassembly")
@interface("typescript", "python")
service WebAPIService {
@secure
fn get_user_data() -> map<string, any> {
// Secure API endpoint
}
}See also: Syntax Reference | API Reference