parallel, ability and skill
These examples target the current native kernel and do not use proposed async/await syntax.
parallel is an expression
parallel is not a function. Declare branches on separate lines one indentation level deeper. It returns a list in source order, regardless of completion order. This complete program returns [2,4]:
agent ParallelDemo is Agent
public
ability run() -> List<Int> effects()
values = parallel
1 + 1
2 + 2
return values
Each branch receives an owned-value snapshot. The expression returns after all branches join. There are at most 64 branches, with no nested parallel. Branches share fuel. The memory.write, workflow, skill and authoring effects are forbidden, including through indirect calls. Here, skill means the effect category, not every pure function inside a private skill.
Remote Agent calls also depend on the Host, outbound journal and call budgets. The syntax alone does not guarantee concurrent network requests.
Indentation
Use spaces, not tabs, and align statements in the same block. A colon after a block header is optional; this tutorial omits it. Indent parallel branches one level beyond the assignment, then return to the original level for return. Calls, lists and records may span lines inside delimiters.
ability and skill boundaries
| Construct | Owner and purpose | External access |
|---|---|---|
| public ability | An Agent's public contract: parameters, result and effect ceiling | Can be published as a public capability |
| private skill | Reusable behavior and resources inside an Agent | Not a direct network endpoint |
| fn inside a skill | Implements a step with its own effect constraints | Subject to the owning Agent's visibility |
A public manifest exposes contracts only. Bytecode includes private implementations; it is not an access-controlled public source format.
Calling another Agent from a skill
This is supported. Use agent("Worker").double(...) and permit the agent effect. The public entry point's effect analysis also includes this indirect call. This program returns 14:
agent Worker is Agent
public
ability double(value: Int) -> Int effects()
return value * 2
agent Coordinator is Agent
private
skill delegation
fn run(value: Int) -> Int effects(agent)
return agent("Worker").double(value)
public
ability run() -> Int effects(agent)
return self.delegation.run(7)
This example calls another Agent in the same program. Reaching another machine or language also requires an explicit contract, placement, trusted binding and SDK invocation context. An Agent name is not a network identity.
Run locally
Save the programs as parallel.aal and delegation.aal, then run from the AAL repository:
cargo run --locked --bin aalc -- run parallel.aal --agent ParallelDemo --ability run --args '{}' --state-dir /tmp/aal-parallel-demo --invocation parallel-1
cargo run --locked --bin aalc -- run delegation.aal --agent Coordinator --ability run --args '{}' --state-dir /tmp/aal-delegation-demo --invocation delegation-1