# `Wardrik.Operations.Lifecycle`

Operations on an agent's lifecycle: defining, starting, stopping, clearing and forgetting it,
and killing its tool calls.

# `calls`

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

Lists the tool calls the agent is running, with how long each has run.

# `clear`

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

Clears the agent's conversation, and restarts it from its definition.

# `define`

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

Defines an agent. Starts it, or reconfigures it if it's running.

# `definition`

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

Returns the agent's definition, the tools it names that aren't available yet, and when each
trigger runs next.

# `forget`

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

Stops the agent, and deletes its conversation and definition.

# `forgotten`

```elixir
@spec forgotten(Wardrik.t(), String.t()) :: :ok | {:error, Wardrik.Error.t()}
```

Stops the agent and deletes all its data, including its conversations.

# `kill`

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

Kills one of the agent's running tool calls. The model gets an error as its result.

# `spawn`

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

Starts the agent from its definition, unless it's running.

# `stop`

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

Stops the agent but keeps its conversation. It sleeps until something asks it.

# `undeclared`

```elixir
@spec undeclared(Wardrik.t(), String.t()) :: :ok | {:error, Wardrik.Error.t()}
```

Returns `:ok`, or a `conflict` error if the agent `id` is declared outside the API.

---

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