Agents, Abilities & Functions
Expose an entry point and keep implementation inside the agent.
A public ability defines an externally callable capability. Private functions and skills organize internal implementation. A struct gives the result a named shape with explicit fields.
Complete example
Save the example as agents.aal
struct Report
score: Int
verdict: String
agent Tutorial is Agent
private
skill assessment
fn verdict(score: Int) -> String effects()
return if score >= 6 then "ready" else "revise"
public
ability run(score: Int) -> Report effects()
return Report(score: score, verdict: self.assessment.verdict(score))Syntax explained
-
Call a
privateskillmethod withself.assessment.verdict(...). Its result must satisfy the declared type. -
Report(...)constructs astructwith named fields. A record with the same fields is not the same nominal type. -
effects(...) bounds allowed effects, including indirect calls.
effects()excludes thinking, memory writes and external tools.
Build and run
cargo run --locked --bin aalc -- check agents.aal
cargo run --locked --bin aalc -- build agents.aal -o agents.aalc
cargo run --locked --bin aalc -- run agents.aalc \
--agent Tutorial --ability run \
--args '{"score":7}' \
--state-dir .aal-tutorial/agents --invocation agents-1Run with a fresh state directory. The returned value is shown below; the CLI also prints execution information.
{"score":7,"verdict":"ready"}Try it yourself
Set score to 4 and use a new invocation ID. Report should contain score: 4 and verdict: revise.