# `Wardrik.Operations.Agent`

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

# `approve`

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

Approves one call the agent waits on.

# `ask`

```elixir
@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`

```elixir
@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`

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

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

# `cancelled`

```elixir
@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`

```elixir
@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`

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

Rejects one call the agent waits on.

# `events`

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

Returns a page of the agent's log.

# `read`

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

Returns what the agent is doing now.

# `runs`

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

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

# `stream`

```elixir
@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`

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

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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
