# `Jido.AgentServer.Status`
[🔗](https://github.com/agentjido/jido/blob/v2.3.0/lib/jido/agent_server/status.ex#L1)

Runtime status for an agent process.

Combines `Strategy.Snapshot` with process-level metadata to provide a clean,
stable API for querying agent status without depending on internal `__strategy__`
implementation details.

## Fields

- `agent_module` - The agent's module (e.g., `MyAgent`)
- `agent_id` - The agent's unique ID
- `pid` - The GenServer process PID
- `snapshot` - The `Strategy.Snapshot` containing core status info
- `raw_state` - Escape hatch containing full agent state (use sparingly)

## Usage

    {:ok, agent_status} = AgentServer.status(pid)

    # Check if completed
    if agent_status.snapshot.done? do
      IO.puts("Result: " <> inspect(agent_status.snapshot.result))
    end

    # Access snapshot fields via helpers
    case Status.status(agent_status) do
      :success -> handle_success(agent_status)
      :failure -> handle_failure(agent_status)
      :running -> poll_again()
    end

## Delegate Helpers

The module provides convenience delegates to common snapshot fields:
- `status/1` - Returns the snapshot's status
- `done?/1` - Returns the snapshot's done? flag
- `result/1` - Returns the snapshot's result
- `details/1` - Returns the snapshot's details map

# `t`

```elixir
@type t() :: %Jido.AgentServer.Status{
  agent_id: binary(),
  agent_module: atom(),
  pid: any(),
  raw_state: map(),
  snapshot: any()
}
```

# `active_requests`

```elixir
@spec active_requests(t()) :: [{String.t(), atom()}]
```

Returns active request tuples [{id, status}].

# `details`

```elixir
@spec details(t()) :: map()
```

Returns strategy-specific details from the snapshot.

# `done?`

```elixir
@spec done?(t()) :: boolean()
```

Returns whether the agent has reached a terminal state.

# `iteration`

```elixir
@spec iteration(t()) :: non_neg_integer() | nil
```

Returns the current iteration count from snapshot details.

# `new`

```elixir
@spec new(map()) :: {:ok, t()} | {:error, term()}
```

Creates a new Status from a map of attributes.

Returns `{:ok, status}` or `{:error, reason}`.

# `queue_length`

```elixir
@spec queue_length(t()) :: non_neg_integer()
```

Returns the directive queue length.

# `result`

```elixir
@spec result(t()) :: term() | nil
```

Returns the result from the snapshot (if any).

# `status`

```elixir
@spec status(t()) :: Jido.Agent.Strategy.status()
```

Returns the status from the snapshot (:idle, :running, :waiting, :success, :failure).

# `termination_reason`

```elixir
@spec termination_reason(t()) :: atom() | nil
```

Returns the termination reason (e.g., :final_answer, :max_iterations, :error).
