SPADE BDI

Build intelligent cognitive agents with AgentSpeak(L) programming and BDI reasoning architecture

What is SPADE BDI?

SPADE BDI is a comprehensive plugin for SPADE 3+ that implements the Belief-Desire-Intention cognitive architecture, enabling agents to parse and execute AgentSpeak(L) programs with sophisticated reasoning capabilities.

Built on Bratman's BDI model, this framework creates hybrid agents that combine reactive behaviors with deliberative reasoning. Agents maintain a belief base (knowledge about the world), pursue goals (desired states), and execute plans through structured intention stacks.

Agent Creation Example:
from spade_bdi import BDIAgent

# Create BDI agent with AgentSpeak program
agent = BDIAgent("agent@server.com", "password", "agent_program.asl")
await agent.start()

# Dynamic belief management
agent.set_belief("location", "office")
agent.set_belief("temperature", 25)
current_location = agent.get_belief("location")

BDI Architecture Components

Belief Base Management

Dynamic knowledge base storing agent beliefs as predicates. Supports belief insertion, deletion, querying, and automatic updates from environmental perception and inter-agent communication.

temperature(25), location(office), weather(sunny)

Goal Processing

Achievement goals (prefixed with !) trigger plan selection and execution. Goals represent desired states or conditions the agent commits to achieving through deliberative reasoning.

!find_shelter, !maintain_temperature(22)

Plan Library & Execution

Plans follow TriggeringEvent : Context <- Body syntax. Context conditions determine plan applicability through logical evaluation and variable unification.

+!cool_room : temperature(T) & T > 25 <- turn_on_ac.

Reasoning Cycle

Implements belief revision, goal generation, plan selection, and intention management. Processes events from message queue, selects applicable plans, and manages intention stacks for concurrent goal pursuit.

AgentSpeak(L) Programming Language

SPADE BDI implements AgentSpeak(L), a logic programming language based on the BDI model, enabling declarative specification of agent behaviors through beliefs, plans, and goals.

Core Language Elements:
Beliefs:
// Initial beliefs
temperature(22).
location(kitchen).
is_sunny(true).
Plans:
// Plan structure
+!stay_cool : temperature(T) & T > 25 <-
    !find_shade;
    !drink_water.
Variables & Unification:

Variables start with uppercase letters and support Prolog-like unification for dynamic information processing:

+temperature(Temp) : Temp > 30 <-
    .print("Temperature is high: ", Temp);
    !activate_cooling(Temp).
Communication:

Built-in KQML performatives for inter-agent communication:

// Send beliefs and achieve goals
.send(robot1, tell, location(kitchen));
.send(coordinator, achieve, !patrol_area(zone_a));

BDI Reasoning Cycle Implementation

SPADE BDI implements a complete BDI reasoning cycle with belief revision, goal generation, plan selection, and intention management for sophisticated cognitive agent behavior.

Event Processing

Messages from the SPADE mailbox are processed as triggering events. Events can be belief additions/deletions or goal achievements, initiating the reasoning cycle.

Plan Selection

The agent searches the plan library for applicable plans whose trigger matches the event and whose context conditions are satisfied through belief base queries and unification.

Intention Formation

Selected plans become intentions and are pushed onto the intention stack. Multiple intentions can be pursued concurrently through interleaved execution.

Plan Execution

Plan bodies are executed step-by-step, performing actions, sending messages, adding/removing beliefs, and triggering new goals through recursive plan activation.

Technical Advantages

  • Formal Semantics: Based on operational semantics with theoretical foundations from Bratman's BDI model and Jason's AgentSpeak implementation
  • Hybrid Architecture: Combines reactive SPADE behaviors with deliberative BDI reasoning for optimal agent performance
  • Extensible Framework: Custom actions, functions, and belief manipulation with KQML communication support (TELL, UNTELL, ACHIEVE)
  • Prolog-like Unification: Sophisticated variable binding and context evaluation with logical inference capabilities
  • Distributed Reasoning: Service-oriented plan composition with distributed execution across multiple agents
  • Production Ready: Cross-platform Python implementation with active development and comprehensive documentation
Quick Integration Example:
# Install and create BDI agent
pip install spade-bdi

# Agent script file (agent.asl)
!start.
+!start <- +location(home); !patrol.
+!patrol : location(home) <- 
    .print("Starting patrol");
    !move_to(checkpoint1).

# Python integration
from spade_bdi import BDIAgent
import asyncio

async def main():
    agent = BDIAgent("agent@server", "pass", "agent.asl")
    await agent.start()
    # Agent runs BDI reasoning cycle automatically
    
asyncio.run(main())
Build Cognitive Agents with Formal BDI Reasoning