AgentMessage

sealed class AgentMessage(source)

Base type for messages exchanged between agents.

The hierarchy is sealed at the performative level: every concrete message is ultimately one of Request, Inform, Propose, Accept, Reject, or Cancel. The performatives themselves are open so that user models can add domain-specific payloads (for example, a concrete class TaskOffer : AgentMessage.Request<Task>(...)).

This vocabulary is loosely inspired by FIPA's Agent Communication Language, but kept intentionally small. It is sufficient to express Contract-Net-style task delegation, request/inform interactions, and simple negotiation.

The performatives are nested inside AgentMessage (so user code says AgentMessage.Request(...) rather than a bare Request) for two reasons: it keeps the sealed family visually associated with its parent, and it prevents collision with KSL's existing inner Request types in ProcessModel.Entity and related classes — those would otherwise shadow ours inside any process { } body, which is exactly where messages are constructed.

The from reference is typed as ProcessModel.Entity rather than the more specific Agent so that messages remain usable across AgentModel instances. Handlers that need the concrete agent type may cast.

Inheritors

Constructors

Link copied to clipboard
protected constructor()

Types

Link copied to clipboard
open class Accept(val from: ProcessModel.Entity, val conversationId: String) : AgentMessage

Indicates acceptance of a prior Propose or Request within the same conversation.

Link copied to clipboard
open class Cancel(val from: ProcessModel.Entity, val conversationId: String) : AgentMessage

Indicates that the sender is withdrawing from the conversation, abandoning whatever request or task was previously in flight.

Link copied to clipboard
open class Inform<P>(val from: ProcessModel.Entity, val payload: P, val conversationId: String? = null) : AgentMessage

An informational message that conveys a fact (payload) to the recipient without expecting any particular response.

Link copied to clipboard
open class Propose<P>(val from: ProcessModel.Entity, val proposal: P, val conversationId: String) : AgentMessage

A proposal carrying a candidate proposal for the recipient to evaluate, typically in response to an earlier Request. Used as the bid step of Contract-Net-style interactions. The conversation id is required because a propose is meaningful only as part of an ongoing exchange.

Link copied to clipboard
open class Reject(val from: ProcessModel.Entity, val conversationId: String, val reason: String? = null) : AgentMessage

Indicates rejection of a prior Propose or Request within the same conversation, optionally including a reason.

Link copied to clipboard
open class Request<P>(val from: ProcessModel.Entity, val payload: P, val conversationId: String? = null) : AgentMessage

A request that the recipient perform some action, expressed via payload.

Properties

Link copied to clipboard
abstract val conversationId: String?

Optional identifier that groups messages belonging to the same logical exchange (a Contract-Net call, a multi-turn negotiation, a tracked task lifecycle). Use a fresh value per conversation when grouping matters; leave null for one-shot messages.

Link copied to clipboard

The entity (typically an AgentModel.Agent) that sent this message.