swink_agent/stream_error_kind.rs
1use serde::{Deserialize, Serialize};
2
3/// Structured classification of stream errors.
4///
5/// Adapters can attach a `StreamErrorKind` to an `Error` event so the agent
6/// loop can classify errors structurally instead of relying on string matching.
7#[non_exhaustive]
8#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9#[serde(rename_all = "snake_case")]
10pub enum StreamErrorKind {
11 /// The provider throttled the request (HTTP 429 / rate limit).
12 Throttled,
13 /// The request exceeded the model's context window.
14 ContextWindowExceeded,
15 /// Authentication or authorization failure (HTTP 401/403).
16 Auth,
17 /// Transient network or server error (connection drop, 5xx, etc.).
18 Network,
19 /// Provider safety/content filter blocked the response.
20 ContentFiltered,
21}