core beginner

Emit Directive Agent

Focused example showing how actions emit domain events while still updating agent state in one step.

signals directives emit core-mechanics l1

Related guides and notebooks

What you’ll learn

  • How %Directive.Emit{} publishes domain events.
  • How state updates and emitted signals can happen in one action.
  • How to inspect emitted signals from a real runtime.

How it works

create_order updates orders state and emits order.created. process_payment updates last_payment and emits payment.processed. multi_emit demonstrates a list of emit directives in a single action.

call behavior

The demo sends signals through AgentServer.call/2, then renders:

  • Updated agent state
  • Captured emitted signals
  • A simple execution log