Wardrik.Delegation (wardrik v0.1.0-rc.1)

Copy Markdown

Sends an agent's answer back to the agent that asked with agent_ask.

The answer arrives as a new message, which starts a turn:

From agent acme/reconciler:
In answer to your message msg_x1:
Two deposits match no invoice: …

How it works:

  1. Each question is saved in the store.
  2. It follows the run that takes the question up.
  3. When that run completes, fails or is cancelled, it sends the result to the asker. A run waiting on a person sends nothing yet.

On start it catches up on the logs it waits on, so runs that ended while it was down are still answered. Each answer has its own message ID, so a repeat is dropped. The answer carries the labels of the answering agent's conversation, or "outside" if that agent isn't running.

Summary

Functions

Records that asker sent agent the message id, so the answer goes back to asker.

Returns a specification to start this module under a supervisor.

Starts delegation.

Functions

asked(instance, asker, agent, id)

@spec asked(atom() | Wardrik.t(), String.t(), String.t(), String.t()) :: :ok

Records that asker sent agent the message id, so the answer goes back to asker.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(wardrik)

@spec start_link(Wardrik.t()) :: GenServer.on_start()

Starts delegation.