Operational Semantic of an AgentSpeak(L) Interpreter Using Late
Bindings
Frantisek Vidensky
a
, Frantisek Zboril
b
, Radek Koci
c
and Frantisek V. Zboril
d
Department of Intelligent Systems, Brno University of Technology, Bozetechova 2, Brno, Czech Republic
Keywords:
BDI Agents, Operational Semantics, AgentSpeak(L).
Abstract:
Although BDI systems have long been studied in the field of agent-based programming, there are still problems
open for research. One problem is that some parts of systems are non-deterministic in the original specification.
However, finding a suitable deterministic method can lead to improved rationality of an agent’s behaviour.
In our previous work, we introduced late binding into the interpretation of AgentSpeak(L) language. The
main benefit of this approach is that the interpreter chooses substitutions only when needed, thus avoiding
unnecessary and incorrect substitution selection. In this paper, we present a formal operational semantics
for an interpreter using late binding variables. A well-specified operational semantics is necessary for the
implementation of such an interpreter and its further development.
1 INTRODUCTION
Languages based on BDI paradigms have an im-
portant place in programming agents as autonomous
proactive systems. Currently, one of the basic lan-
guages is AgentSpeak(L) (Rao, 1996) and its dialects,
such as the ASL language for the Jason system (Bor-
dini et al., 2007). In the paper (Rao, 1996), where
the original language was first introduced, several se-
lection functions were listed that fulfilled their role in
agent control only in the abstract and introduced non-
determinism into agent functionality. In the practi-
cal reasoning phase, these were functions for select-
ing a goal to follow and for choosing between suitable
plans for the selected goal. In the execution phase, it
was a selection function to choose an intention to be
followed in a given cycle. From then to the present,
a number of approaches have been published to ad-
dress these non-determinisms to improve the rational-
ity of the behaviour of such agents. For example, in
(Caillou et al., 2017) the authors presented a cogni-
tive agent architecture based on the BDI paradigm us-
ing priorities in plan selection. In (Nunes and Luck,
2014), softgoals were used to influence the selection
of a plan to achieve goals. The authors of paper (Wa-
a
https://orcid.org/0000-0003-1808-441X
b
https://orcid.org/0000-0001-7861-8220
c
https://orcid.org/0000-0003-1313-6946
d
https://orcid.org/0000-0002-6965-4104
ters et al., 2015) introduced two new approaches for
intention selection. The same team of authors in the
paper (Waters et al., 2018) used a partial plan that
does not specify the exact order of operations in the
body of a plan, leading to increasing the agent’s flex-
ibility and robustness. Paper (Yao and Logan, 2016)
introduced the use of the Monte Carlo Tree Search
method to select intention to avoid conflicts in con-
currently executing plans.
One additional problem that we believe has not
received as much attention in this system has been
the choice of substitutions during both phases, i.e.,
the reasoning and execution phases. In a similar
BDI system, dMars (d’Inverno et al., 1997), the need
to choose substitutions was also mentioned but also
without detailed methods for choosing them. The
more advanced CAN (Sardina and Padgham, 2011)
system mentions substitutions as options for choosing
plans, which are chosen if the previously chosen plan
instance (i.e., the plan and any substitutions) fails.
In this paper, we want to demonstrate the opera-
tional semantics defining transition relation for inter-
preting the AgentSpeak(L) language using late bind-
ings variables. We introduced this approach in the
(Zboril Jr et al., 2022) paper.
This paper is structured as follows. The following
section gives a very brief overview of AgentSpeak(L)
and its constructs (such as beliefs, goals and plans).
Sections 3 and 4 will describe the fundamental oper-
ations for late binding and its use for interpreting an
Vidensky, F., Zboril, F., Koci, R. and V. Zboril, F.
Operational Semantic of an AgentSpeak(L) Interpreter Using Late Bindings.
DOI: 10.5220/0011620700003393
In Proceedings of the 15th International Conference on Agents and Artificial Intelligence (ICAART 2023) - Volume 1, pages 173-180
ISBN: 978-989-758-623-1; ISSN: 2184-433X
Copyright
c
2023 by SCITEPRESS Science and Technology Publications, Lda. Under CC license (CC BY-NC-ND 4.0)
173
agent program. We then present the main contribution
of this work, i.e. the operational semantics for inter-
preting the AgentSpeak(L) language using late bind-
ing variables in Section 5. Future work is discussed
in the last section.
2 AGENT PROGRAM WRITTEN
AgentSpeak(L)
This section will describe the basics of an agent pro-
gram written in AgentSpeak(L). The following text is
based on (Rao, 1996).
The essential element in an agent program is the
agent, which is defined as follows:
An agent is given by a tuple
hPB,EQ,BB,AS,IS,S
ε
,S
O
,S
I
i, where PB is a
plan base, EQ is an event queue, BB is a belief base,
AS is a set of actions that are executable by the agent,
IS is a set of intention structures and S
ε
, S
O
, S
I
are
events, options and intentions selection functions.
The purpose of an agent is to achieve certain goals.
There are two types of goals: achievement goals and
test goals. Goals are written as !g(t) and ?g(t) re-
spectively, where g is a predicate symbol and t is a
sequence of terms. Achievement goals state that the
agent wants to achieve an environmental state where
the atom representing the goal is true. The test goal
says that the agent wants to test whether there is uni-
fication with a belief from the base BB, which is a set
of beliefs in the form of literal.
Essential elements of an agent program are plans
that specify how to achieve a goal. Plans are writ-
ten in the form of t
e
: Ψ plan. Each plan consists
of the triggering event t
e
, context conditions Ψ and
the body of the plan is composed of a sequence of
elements that may be a goal or an action. A trigger
event can be internal (when a sub-goal needs to be
achieved) or external (triggered when the belief base
is updated while observing the environment). Gen-
erally, an event is triggered by adding (prefix +) or
removing (-) a belief or a goal.
For clarification, we mention that beliefs, events
and goals are written as first-order logic atomic for-
mulas (atoms). Also, a context condition for a plan is
either atomic formula or a set of atomic formulas in
conjunction.
In each cycle, an event is selected for processing
using the function S
ε
. This event is then unified with
the triggering events of the plans in the plan base PB.
Plans whose triggering events are unified are called
relevant plans. Relevant plans, whose context condi-
tions are a logical consequence of the belief base, are
called applicable plans. One of the applicable plans
is then selected using the function S
O
. This plan is
called a possible means of achieving the goal.
The problem that the system using late variables
binding during interpretation solves is that the substi-
tutions selected in one step may no longer be applica-
ble in the next step. In that case, the whole deliber-
ation cycle would have to be repeated, which can be
a big problem in a very dynamic environment. Our
proposed system uses delayed selection of substitu-
tion until necessary to solve this problem. This prin-
ciple is called late bindings. The basic methods used
in this system are described in the following section.
3 OVERVIEW OF OPERATIONS
AND FUNCTIONS FOR LATE
BINDINGS
As mentioned, in our previous article (Zboril Jr et al.,
2022) we defined operations and functions for late
bindings. For the purpose of completeness, they will
be re-introduced and briefly described in this section.
Unifiers and substitutions play an essential role in
late bindings, as they are created and then modified in
each part of the agent’s interpretation cycle. The pur-
pose of the basic function is to create sets of unifiers.
We called this function broad unification.
Definition 1. Broad unification, denoted as ρU, is
formally defined as:
ρU(p,PS)
def
== {mgu(p, p
0
) : p
0
PS}
maps the atom p and atom p
0
from the set of atoms PS
to a set of all possible most general unifiers without
variables renaming.
The result of a broad unification is a set of unifiers,
which we call a possible unifier set (PUS). In the fol-
lowing text, we will use the simplified form ρU for
the broad unification of the atom p and a set of atoms.
Definition 2. The instance set is denoted by Iσ. This
function maps an atom and a PUS to a set of atoms.
This instance set is defined as follows:
Iσ(p,ρU)
def
== {pσ : σ ρU}
Informally, the instance set contains each atom
that is created after applying each unifier from the
PUS to an atom. It must be noted that the instance
set is not the inverse function of the broad unification.
Definition 3. The Shorting function which we de-
noted , is defined as follows:
ρU p
def
== {σ : σ
0
(σ
0
ρU, σ σ
0
,
[t/x] σ
0
(x Var(p) [t/x] σ))}
ICAART 2023 - 15th International Conference on Agents and Artificial Intelligence
174
The resulting set contains such substitutions that sub-
stitute free variables from p.
The following functions and operations are used to
modify PUSs and play an essential role in late bind-
ings. The first is the merging operation. Its purpose is
to create a substitution from two other substitutions.
The operation unites substitutions when each variable
is substituted for the same term in both of them. If a
situation arises where the substitutions map the same
variable to two different terms, the result of the oper-
ation is an empty set.
Definition 4. The merging operation is denoted as n
and is defined as follows:
σ
1
n σ
2
def
==
σ
1
σ
2
iff [t
1
/x
1
] σ
1
[t
2
/x
2
]
σ
2
(x
1
= x
2
t
1
= t
2
)
/
0 else
Assume that the merging substitutions unify two
different atoms in two belief bases. If the result is
a non-empty set, both substitutions unify both atoms
into the belief bases. Nevertheless, there may be an-
other pair of unifiers for which this operation pro-
duces a non-empty set. To find such a pair, we defined
the restriction operator.
Definition 5. We denoted the restriction operator by
u, this operator is defined as:
ρU
1
u ρU
2
def
==
[
σ
1
ρU
1
,σ
2
ρU
2
σ
1
n σ
2
The result of this operator for two PUS
ρU(p
1
,BB
1
) and ρU(p
2
,BB
2
) is a set of unifiers that
contain all the most general unifiers that unify p
1
in
the belief base BB
1
and p
2
in the belief base BB
2
.
To transfer substitutions when moving from one
plan to another, we introduced the PUS intersection
function.
Definition 6. The intersection function denoted by
for PUS ρU and two atoms p
1
and p
2
is defined as
follows:
p
1
,ρU p
2
def
== ρU (p
2
,Iσ(p
1
,ρU))
4 LATE BINDINGS IN
INTERPRETATION OF
AgentSpeak(L)
The reasoning process produces substitutions that are
used in plan selection. It also creates substitutions by
unifying a plan’s triggering event and context condi-
tions with the selected (by the S
ε
selection function)
event to process and the agent’s belief base.
In most BDI systems, substitution must be se-
lected immediately when a plan is selected as a means
to achieve a goal. Nevertheless, the late binding sys-
tem will keep the substitutions separate as a PUS.
We call this PUS context of the plan. This con-
text changes when the agent performs an action or
achieves a goal. The system can also assign context
to events. Plans and events that do not have a selected
substitution but have an associated context are called
weak instances of plans and events.
Definition 7. A weak plan instance is a triple
hte,h,ctxi, where te is a plan’s triggering event, h =
h
1
;h
2
;...;h
m
is the plan’s body, and ctx is the plan’s
context.
Similarly, we can define a weak event instance.
Definition 8. A weak event instance is a triple
hevt, ix,ctxi, where evt is an event, ix is an identifier
of the intention that raises the event (or null in case of
an external event) and ctx is a context.
We should note here that in the previous paper
(Zboril Jr et al., 2022), the weak event instance was
defined as a tuple, and the identifier of the inten-
tion was missing. This was for simplicity, as we did
not need to distinguish between internal and external
events. However, this will be necessary for this paper,
as you will see later.
The purpose of a weak event instance is to repre-
sent an event that has arisen during the execution of
a weak plan instance. Thus, the context of the cur-
rently executing plan is used to create this weak event
instance.
In the following text, we will use the abbreviation
WPI for weak plan instance and WEI for weak event
instance.
The last definition in this section will be the defi-
nition of intention.
Definition 9. The intention is a structure containing
WEIs of a plan’s triggering event and a stack of WPI
plans. Formally, it is defined as follows:
hevt, ix,ctxi[hte
1
,h
1
,ctx
1
i hte
2
,h
2
,ctx
2
i ...
hte
n
,h
n
,ctx
n
i|
where the top of the stack is on the left.
If we need to shorten the intention notation, we
replace part or all of the stack contents with P. So
hevt, ix, ctxi[hte
n
,h
n
,ctx
n
i P| is also an intention.
In this and the previous sections the fundamentals
of late binding have been presented, and in the next
section the core of this paper, operational semantics,
will be described.
Operational Semantic of an AgentSpeak(L) Interpreter Using Late Bindings
175
5 OPERATIONAL SEMANTICS
A system using late binding variables performs a pro-
gram written in the AgentSpeak(L) language and in-
terprets it using weak instances. Its functioning can
be described by certain transition rules that specify
its operational semantic (Plotkin, 1981). This is a
common instrument for precise formal specification
of system behaviour based on labelled transition rules
which define the steps in which a system may evolve.
It has been used many times in the area of agent sys-
tems; for example, for AgentSpeak(L) interpretation
in its basic version (Moreira and Bordini, 2002) as
well as in the extended version with speech acts (Mor-
eira et al., 2003), goal dynamic in CAN (Harland
et al., 2014), etc.
Labelled transition rules define a relation among
an agent’s configurations.
Definition 10. Agent configuration is a tuple
hPB,EQ,BB,AS,ISi, where PB is a set of plans, EQ
is an event queue that contains WEIs, BB is a belief
base which consists of ground atoms, AS is a set of
actions, and IS is a set of intentions.
When an agent is executed, it’s running in a se-
quence of configurations from an initial configura-
tion to a final one. The agent’s current configura-
tion changes either when it does some reasoning, or
when it executes a plan. Let there be a relation =
AEX
(agent’s execution) that is composed of two relations
=
RSN
(reasoning) and =
ACT
(acting), where the first
relation represents the change of the agent’s configu-
ration during its practical reasoning process and the
second relation represents the agent’s actions. Then
we define that =
AEX
= ( =
RSN
=
ACT
), which means
that the AEX relation represents both practical rea-
soning as well as acting.
The transition rules for the agent’s execution cover
both these relations. Recall that the agent first looks
for a means for a goal event. The means should be a
plan which is relevant to the event, and it is applica-
ble due to an agent’s beliefs about the current environ-
ment. In this paper, we do not consider any advanced
reasoning about event selection; we assume that an
event is selected as the first element in the event queue
if the queue is not empty. It differs from the origi-
nal interpretation in the way it recognises applicabil-
ity and relevance.
5.1 Relevant and Applicable Plans
For completeness, here is the definition of a relevant
and applicable plan in the system. More about practi-
cal reasoning for weak instances can be found in our
previous paper (Zboril Jr et al., 2022).
Assume that there is WEI and a plan p, then the
plan p is relevant to the WEI when the PUS intersec-
tion of its triggering event and the event with context
create a set containing at least one substitution. Note
that this is true even if the substitution is an empty set.
Formally:
Definition 11. A plan te : b
1
b
2
... b
n
h
1
;h
2
;...;h
m
is relevant to a weak event instance
hevt, ix, ctxi when (evt, ctx te) 6=
/
0
For a relevant plan to be applicable, all its context
conditions must be satisfied in the belief base. More
concretely, it must be possible to find a PUS for each
context condition and belief base and then make the
restriction between them.
Definition 12. A plan te : b
1
b
2
... b
n
h
1
;h
2
;...;h
m
is applicable in the current belief base
BB if it is true that:
ρU(b
1
,BB) u ... u ρU(b
n
,BB) 6=
/
0
One plan is then selected from the applicable plans
using the selection function S
O
.
Any plan that is relevant and applicable can be
considered a means to achieve a goal, and the agent
may choose it as its intended means. If the plan is
both relevant and applicable, then the restriction of
PUSs (contexts) for both WPI and WEI must be a
non-empty PUS. Using the PUS intersection, we can
write:
ctx
1
= ((evt,ctx te) u ρU(b
1
,BB)u
... uρU(b
n
,BB)) 6=
/
0
and then ctx
1
is a context of a plan which, together
with the plan’s body h
1
;h
2
;...;h
m
, forms a new WPI
that can be an intended means for the WEI.
5.2 Transition Rules
In the following text, we can divide the presented
rules into three groups to define the relations men-
tioned above. The first group defines the relation =
RSN
using two rules.
The first rule (PR EXT EV T ) is used in situ-
ations when the agent deals with an external event
and the second rule (PR INT EV T ) is for the case
of an internal event. Both these rules change the
agent’s event queue and intention structure. Both also
compute contexts for relevant and applicable plans,
which can all be an intended means for the event.
Whether the event is internal or external depends on
the form
ICAART 2023 - 15th International Conference on Agents and Artificial Intelligence
176
PR-EXTEVT
e = hevt,null,ctxi EQ
p = te : b
1
... b
n
h PB
ctx
1
= ((evt,ctx te), ρU(b
1
,BB) u ... u ρU(b
n
,BB)) 6=
/
0
hPB,EQ,BB,AS,ISi =
RSN
hPB,EQ {e}, BB, AS,IS {hevt,ix,ctxi[hte,h,ctx
1
i]}i
PR-INTEVT
e = hevt,ix,ctxi EQ
p = te : b
1
... b
n
h PB
ctx
1
= ((evt,ctx te), ρU(b
1
,BB) u ... u ρU(b
n
,BB)) 6=
/
0
hPB,EQ,BB,AS,ISi =
RSN
hPB,EQ {e}, BB, AS,(IS {hevt
2
,ix,ctx
2
}i[P]}) {hevt
2
,ix,ctx
2
i[hte,h,ctx
1
i P|}i
EXEC1
i = hevt,ix,ctxi[hte
1
,h
1
,ctx
1
i| IS
1
hEQ
1
,BB
1
,AS
1
,(ix : h
1
,ctx
1
)i hEQ
2
,BB
2
,AS
2
,(ix : h
2
,ctx
2
)i
hPB
1
,EQ
1
,BB
1
,AS
1
,IS
1
i =
ACT
hPB
1
,EQ
2
,BB
2
,AS
2
,(IS
1
{i}) {hevt,ix,ctxi[hte
1
,h
2
,ctx
2
i|})i
EXEC2
i = hevt,ix,ctxi[hte
1
,h
1
,ctx
1
i P| IS
1
hEQ
1
,BB
1
,AS
1
,(ix : h
1
,ctx
1
)i hEQ
2
,BB
2
,AS
2
,(ix : h
2
,ctx
2
)i
hPB
1
,EQ
1
,BB
1
,AS
1
,IS
1
i =
ACT
hPB
1
,EQ
2
,BB
2
,AS
2
,(IS
1
{i}) {hevt,ix,ctxi[hte
1
,h
2
,ctx
2
i P|})i
CLEARINT1
i = hevt,ix,ctxi[hte
1
,null, ctx
1
i| IS
hPB,EQ,BB,AS,ISi =
ACT
hPB,EQ,BB,AS,(IS {i})i
CLEARFAIL1
i = hevt,ix,ctxi[hte
1
, f ail,ctx
1
i| IS
hPB,EQ,BB,AS,ISi =
ACT
hPB,EQ {hevt,null, ctxi}, BB, AS,(IS {i})i
of the WEI. When there is no parent intention men-
tioned, better say it is null, then a new intention stack
is created and an intended means is inserted there.
Otherwise, the means are added to the corresponding
intention stack.
If all three conditions above the line are satisfied
(null in this rule means that no intention is bound
to the event), then WEI e is removed from an event
queue EQ and a new intention ix is created. This in-
tention is composed of new WEIs hevt,ix, ctxi and a
plan stack that contains WPI hte,h,ctx
1
i. Note that
te is a triggering event of the chosen plan, h is its
body, and ctx
1
is the context computed as was shown
in Definitions 11 and 12.
The PR INT EV T rule is similar to the previous
one. It differs only in the form of the processed WEI.
The second group of rules defines the =
ACT
rela-
tion. At the intention level, the agents try to execute
one step for an intention from its intention set (the
intention was created for some WEI hevt
2
,ix,ctx
2
i).
There are six rules (EXEC1, EX EC2, CLEARINT 1,
CLEARFAIL1, CLEARINT 2, CLEARFAIL2) that de-
fine how the intention can change when the agent per-
forms the first item of its top-level plan. These rules
are used in situations when an intention step finishes
either successfully or unsuccessfully. If the step was
successful, then there are two separate rules for when
it completes the entire plan, and for when any actions
remain in the body of the plan. We must distinguish
whether the completed plan was a top-level plan of
the intention or a sub-plan within the intention.
All these rules use one more lower-level transition
relation that determines the behaviour of the agent
at the plan level. This transition relation is denoted
as and represents one step in the plan execution.
The following rules transform n-tuples of the form
hEQ,BB,AS,(ix : h, ctx)i, where EQ, BB and AS are
the same as in Definition 10. Sets PB and IS are omit-
ted and instead there is a shorted version of an inten-
tion stack that contains its identifier ix, h is the body
of its top-level plan, and ctx is its context.
The EXEC1 and EXEC2 rules are defined for any
non-empty intention stack with a non-empty plan on
top of it. Furthermore, the execution of a plan is as-
Operational Semantic of an AgentSpeak(L) Interpreter Using Late Bindings
177
sumed to lead neither to an empty plan nor to its fail-
ure. The body of the plan should remain in the in-
tention stack, but its body is always truncated by one
item. In addition, other parts within the configuration
may also be changed.
The first rule is applicable if the WIP is the only
element of the intention stack, and the second rule is
applicable if there is more than one WIP in the inten-
tion stack.
When the agent completes a sub-plan, the sub-
plan is removed from the intention stack. A sub-plan
is completed when there are no more items in the body
of the plan, which is represented by null. Neverthe-
less, if the plan is the last plan in the intention stack,
then the agent successfully achieves the top-level goal
and the corresponding plan is also removed from the
IS. Failure to complete the plan will result in the re-
moval of the corresponding plan, and moreover, the
WEI must be put back into the EQ.
The situation is a little more complicated when the
agent completes a plan to achieve a goal. Some in-
formation should be transmitted upward to the goal-
setting plan. The just-completed plan contains a con-
text with substitutions corresponding to all the goals
the agent has achieved during execution.
The higher-level plan declared the achievement
goal !g(t
1
) in the current context ctx
1
. For this goal, a
plan with trigger event +!g(t
2
) was chosen. Assume
that this plan has been successfully completed with
a context ctx
2
. If we create an instance set from the
trigger event g(t2) of the plan and the context ctx
2
, we
get all the goals that the plan achieved. Using the in-
tersection g(t
2
),ctx
2
g(t
1
),ctx
1
of the achievement
goal g(t
1
) in the context ctx
1
with the triggering event
g(t2) in the context ctx
2
we obtain a new context ctx
3
.
Note that the body of the plan in the first line con-
sists of two parts - the abstract part denoted as h
1
and
then the achievement goal !g(t
1
). Only the first part
of h
1
remains after this step.
If the plan fails and is not the last plan in the in-
tention stack, then the plan is removed from the stack
and the higher-level plan still contains the achieve-
ment goal.
The third and final set of rules defines the agent’s
behaviour at the plan level.
In the late binding system, the test target is the
only plan item that can fail. Whether it succeeds de-
pends on the result of the restriction of the goal atom,
the current context of the plan, and the current state of
the agent’s belief base. If the result is an empty set, it
means that the plan can continue to execute, and the
set is the new context of the plan.
In case the test goal fails, the whole plan fails.
An achievement goal may cause a new weak event
instance. If there is no corresponding WEI in the
agent’s EQ and the intention stack for the WEI does
not yet exist, the agent creates a new weak event in-
stance and puts it into the agent’s EQ event queue.
Otherwise, the achievement goal is already processed
or ready to be processed so the agent ignores it. Thus,
if a new WEI is created, then it consists of the achieve-
ment goal atom, an intention identifier, and a context
that is computed from the context of the original plan
truncated to the variables of the achievement goal. In
this case, the achievement goal is not removed from
the plan and remains in the body of the plan until the
agent achieves it.
CLEARINT2
i = hevt,ix,ctxi[hte
1
,!g(t
1
);h
1
,ctx
1
i h+!g(t
2
),null, ctx
2
i P| IS
ctx
3
= g(t
2
),ctx
2
g(t
1
),ctx
1
hPB,EQ,BB,AS,ISi =
ACT
hPB,EQ,BB,AS,(IS {i}) {hevt,ix,ctxi[hte
1
,h
1
,ctx
3
i P|}i
CLEARFAIL2
i = hevt,ix,ctxi[hte
1
,!g(t
1
);h
1
,ctx
1
i hte
2
, f ail,ctx
2
i P| IS
hPB,EQ,BB,AS,ISi =
ACT
hPB,EQ,BB,AS,(IS {i}) {hevt,ix,ctxi[hte
1
,!g(t
1
);h
1
,ctx
1
i P|}i
TESTG
ctx
1
= ctx u ρU(g(t), BB) 6=
/
0
hEQ,BB,AS,(ix :?g(t);h, ctx)i hEQ,BB,AS,(ix : h,ctx
1
)i
TESTFL
ctx u ρU(g(t),BB) =
/
0
hEQ,BB,AS,(ix :?g(t);h, ctx)i hEQ,BB,AS,(ix : f ail, ctx)i
ACHIEVEG
ctx
1
= ctx q(t)
h!q(t),ix,ctx
1
i[P| / IS
h+!q(t),ix,ctx
1
i / EQ
hEQ,BB,AS,(ix :!q(t);h, ctx)i
hEQ {h!q(t),ix, ctx
1
i},BB,AS,(ix :!q(t);h, ctx)i
ICAART 2023 - 15th International Conference on Agents and Artificial Intelligence
178
ADDBB
σ (ctx c(t))
hEQ,BB,AS,(ix : +c(t);h,ctx)i hEQ {h+c(t)σ,ix,ctx
i
},BB {c(t)σ}, AS, (ix : h,ctx u {σ})i
DELBB
σ (ctx c(t))
hEQ,BB,AS,(ix : c(t);h,ctx)i hEQ {h−c(t)σ,ix,ctx
i
},BB \ {c(t)σ}, AS,(ix : h,ctx u {σ})i
EXTACT
σ (ctx c(t))
hEQ,BB,AS,(ix : c(t);h,ctx)i hEQ, BB, AS {c(t)σ},(ix : h, ctx u {σ})i
The previous rules changed the context using re-
strictions and other functions and operations intro-
duced in section 3. External actions, as well as both
types of internal actions, must be precisely specified.
In other words, the agent must know exactly what to
do. For this reason, the action atom must be ground
and the agent must decide which concrete substitution
or substitutions to use from the context of the plan.
This does not mean that only one set of substitutions
can remain in the context. Note that there can be more
than one set of substitutions that map free variables of
action atoms to the same terms. Again, the shorting
function is used use here, which takes a context with
an action atom and maps them to one particular set
of substitutions of that atom. If we use these substi-
tutions to restrict the context of the original plan, we
get a new context that suits the executed action.
The following three rules ADDBB, DELBB and
EXTACT respond to the execution of an action during
the execution of a plan. It may be the addition or re-
moval of a belief from the belief base. Rules ADDBB
and DELBB are used in these situations.
Similarly, we can define the DELBB rule. In both
rules, the most suitable substitution is selected first
and the action is removed from the body of the cur-
rently executing plan. A new WEI is then put into the
agent’s event queue EQ. The result of the restriction
of the context of the plan and {σ} is used as the new
context for the top-level plan. The substitution σ is
applied to the belief c(t) and the result is inserted or
removed from the belief base BB.
The last rule is used when an external action is
performed.
Also in this rule, the substitution σ is chosen and
is used to compute the new context. The chosen sub-
stitution is also applied to the external event c(t) and
the result is inserted into the set of action AS.
6 CONCLUSIONS
We consider the transition system introduced in this
paper to be a basic formal specification of the inter-
pretation of AgentSpeak(L) language using late bind-
ings. Such an interpretation introduces more flexibil-
ity into agent decision-making by preserving options
until a specific decision needs to be made to perform
an action, compared to the original approaches. This
agent does not give up options for its future actions
prematurely and can correct its behaviour during the
execution of each plan according to the current situa-
tion or its current beliefs about the state of the system.
Currently, such an interpretation is implemented in
the system we program in the PROLOG language. In
this system, it can also be practically verified that for
some agent programs in that language, the agent can
deal with situations that fail in systems with classi-
cal interpretation. However, there are still a few open
areas, for example, the intention selection function is
not defined. Its implementation can be done in sev-
eral ways, so it will be necessary to design several
solutions and compare them with each other on a pre-
prepared set of examples using well-defined metrics.
This will be the direction of our future work.
ACKNOWLEDGEMENTS
This work has been supported by the internal BUT
project FIT-S-20-6427.
REFERENCES
Bordini, R. H., H
¨
ubner, J. F., and Wooldridge, M. (2007).
Programming multi-agent systems in AgentSpeak us-
ing Jason, volume 8. John Wiley & Sons.
Caillou, P., Gaudou, B., Grignard, A., Truong, C. Q., and
Taillandier, P. (2017). A simple-to-use bdi architecture
for agent-based modeling and simulation. In Advances
in Social Simulation 2015, pages 15–28. Springer.
Operational Semantic of an AgentSpeak(L) Interpreter Using Late Bindings
179
d’Inverno, M., Kinny, D., Luck, M., and Wooldridge, M.
(1997). A formal specification of dmars. In Inter-
national Workshop on Agent Theories, Architectures,
and Languages, pages 155–176. Springer.
Harland, J., Morley, D. N., Thangarajah, J., and Yorke-
Smith, N. (2014). An operational semantics for the
goal life-cycle in bdi agents. Autonomous agents and
multi-agent systems, 28(4):682–719.
Moreira,
´
A. F. and Bordini, R. H. (2002). An operational
semantics for a bdi agent-oriented programming lan-
guage. In Proceedings of the workshop on logics
for agent-based systems (LABS-02), held in conjunc-
tion with the Eighth International Conference on Prin-
ciples of Knowledge Representation and Reasoning
(KR2002), April, volume 22, pages 45–59.
Moreira,
´
A. F., Vieira, R., and Bordini, R. H. (2003).
Extending the operational semantics of a bdi agent-
oriented programming language for introducing
speech-act based communication. In International
Workshop on Declarative Agent Languages and Tech-
nologies, pages 135–154. Springer.
Nunes, I. and Luck, M. (2014). Softgoal-based plan selec-
tion in model-driven bdi agents. In Proceedings of the
2014 international conference on Autonomous agents
and multi-agent systems, pages 749–756.
Plotkin, G. D. (1981). A structural approach to operational
semantics. Aarhus university.
Rao, A. S. (1996). Agentspeak (l): Bdi agents speak
out in a logical computable language. In European
workshop on modelling autonomous agents in a multi-
agent world, pages 42–55. Springer.
Sardina, S. and Padgham, L. (2011). A bdi agent pro-
gramming language with failure handling, declarative
goals, and planning. Autonomous Agents and Multi-
Agent Systems, 23(1):18–70.
Waters, M., Nebel, B., Padgham, L., and Sardina, S. (2018).
Plan relaxation via action debinding and deordering.
In Twenty-Eighth International Conference on Auto-
mated Planning and Scheduling.
Waters, M., Padgham, L., and Sardina, S. (2015). Improv-
ing domain-independent intention selection in bdi sys-
tems. Autonomous Agents and Multi-Agent Systems,
29(4):683–717.
Yao, Y. and Logan, B. (2016). Action-level intention se-
lection for bdi agents. In Proceedings of the 2016
International Conference on Autonomous Agents &
Multiagent Systems, AAMAS ’16, page 1227–1236.
International Foundation for Autonomous Agents and
Multiagent Systems.
Zboril Jr, F., Vidensky, F., Koci, R., and Zboril, F. V. (2022).
Late bindings in agentspeak (l). In ICAART (3), pages
715–724.
ICAART 2023 - 15th International Conference on Agents and Artificial Intelligence
180