1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//! Prewarming: readying a runner's agent, and optionally a session, before the first message.
//!
//! [`Runner::prewarm`](crate::Runner::prewarm) does what a first turn would otherwise do
//! before its first model token: it opens the model's pooled connection
//! ([`Llm::prewarm`](adk_core::Llm::prewarm)), starts the servers an agent starts lazily, such
//! as a harness's MCP servers ([`Agent::prewarm`](adk_core::Agent::prewarm)), and reads the
//! session, which opens the session store's connection and refuses an archived session early.
//! It sends no prompt and spends no tokens.
//!
//! | Bound | What it keeps |
//! |---|---|
//! | Kill switch | A frozen runner refuses to prewarm, as it refuses a turn |
//! | Budget | The whole prewarm stops at [`Prewarm::budget`] (10 seconds by default) with `runner.prewarm.timeout` |
//! | Expiry | A warm model connection lasts as long as the client keeps it idle, 90 seconds for `adk-anthropic`; [`PrewarmReport::warm_until`] says when to prewarm again |
use Duration;
use ;
use ;
/// How long a model client keeps an idle connection open: `adk-anthropic`'s and `adk-model`'s
/// pool idle timeout.
pub const WARM_FOR: Duration = from_secs;
/// What [`Runner::prewarm`](crate::Runner::prewarm) readies.
///
/// # Example
///
/// ```rust
/// use std::time::Duration;
/// use adk_core::{SessionId, UserId};
/// use adk_runner::Prewarm;
///
/// let request = Prewarm::new()
/// .session(UserId::new("ana").unwrap(), SessionId::new("trip").unwrap())
/// .budget(Duration::from_secs(5));
/// assert_eq!(request.budget_or_default(), Duration::from_secs(5));
/// ```
/// What a [`Runner::prewarm`](crate::Runner::prewarm) did.