Wardrik.Operations.Agent (wardrik v0.1.0-rc.1)

Copy Markdown

Operations on one agent: messaging it, deciding what it waits on, and reading it.

Summary

Functions

Approves one call the agent waits on.

Sends the agent a message. Returns the message's ID, and the cursor its answer comes after.

Returns the sign-in URL for a call that waits on a person signing in.

Cancels what the agent is doing, and drops its queued messages.

Cancels what the agent id is doing, and records it. Returns whether there was anything.

Approves or rejects the calls the agent waits on, all at once.

Rejects one call the agent waits on.

Returns a page of the agent's log.

Returns what the agent is doing now.

Returns the agent's runs, with what each did and cost.

Streams the agent's log as {event, cursor}. Reads what's there, then follows new events.

Returns the agent's conversation as a timeline for people to read.

Functions

approve(scope, input)

@spec approve(Wardrik.Scope.t(), map()) :: {:ok, map()} | {:error, Wardrik.Error.t()}

Approves one call the agent waits on.

ask(scope, input)

@spec ask(Wardrik.Scope.t(), map()) :: {:ok, map()} | {:error, Wardrik.Error.t()}

Sends the agent a message. Returns the message's ID, and the cursor its answer comes after.

authorization(scope, map)

@spec authorization(Wardrik.Scope.t(), map()) ::
  {:ok, map()} | {:error, Wardrik.Error.t()}

Returns the sign-in URL for a call that waits on a person signing in.

cancel(scope, map)

@spec cancel(Wardrik.Scope.t(), map()) :: {:ok, nil} | {:error, Wardrik.Error.t()}

Cancels what the agent is doing, and drops its queued messages.

cancelled(scope, id, pid)

@spec cancelled(Wardrik.Scope.t(), String.t(), pid() | nil) :: boolean()

Cancels what the agent id is doing, and records it. Returns whether there was anything.

decide(scope, map)

@spec decide(Wardrik.Scope.t(), map()) :: {:ok, map()} | {:error, Wardrik.Error.t()}

Approves or rejects the calls the agent waits on, all at once.

deny(scope, input)

@spec deny(Wardrik.Scope.t(), map()) :: {:ok, map()} | {:error, Wardrik.Error.t()}

Rejects one call the agent waits on.

events(scope, input)

@spec events(Wardrik.Scope.t(), map()) :: {:ok, map()} | {:error, Wardrik.Error.t()}

Returns a page of the agent's log.

read(scope, map)

@spec read(Wardrik.Scope.t(), map()) :: {:ok, map()} | {:error, Wardrik.Error.t()}

Returns what the agent is doing now.

runs(scope, map)

@spec runs(Wardrik.Scope.t(), map()) :: {:ok, map()}

Returns the agent's runs, with what each did and cost.

stream(scope, input)

@spec stream(Wardrik.Scope.t(), map()) ::
  {:ok, Enumerable.t()} | {:error, Wardrik.Error.t()}

Streams the agent's log as {event, cursor}. Reads what's there, then follows new events.

timeline(scope, map)

@spec timeline(Wardrik.Scope.t(), map()) :: {:ok, map()}

Returns the agent's conversation as a timeline for people to read.