pub struct BudgetHint {
pub remaining_cost_cents: Option<f64>,
pub total_budget_cents: Option<f64>,
pub remaining_tool_calls: usize,
pub max_tool_calls: usize,
}Expand description
Budget state injected into the volatile system prompt section.
All fields are optional — omitted when the corresponding data source is unavailable.
BudgetHint::format_xml returns None when all fields would be absent.
Callers should construct this from cost-tracker and tool-orchestrator state, then call
format_xml and append the result to the system prompt when Some.
Fields§
§remaining_cost_cents: Option<f64>Remaining daily budget in US cents, if a daily limit is configured.
total_budget_cents: Option<f64>Total daily budget in US cents, if a daily limit is configured.
remaining_tool_calls: usizeRemaining tool-call iterations this turn.
max_tool_calls: usizeMaximum allowed tool-call iterations per turn (0 = no limit configured).
Implementations§
Source§impl BudgetHint
impl BudgetHint
Sourcepub fn format_xml(&self) -> Option<String>
pub fn format_xml(&self) -> Option<String>
Render the budget hint as an XML fragment for injection into the system prompt.
Returns None when no meaningful budget data is available — callers must skip
injection rather than injecting an empty <budget></budget> block.
§Examples
use zeph_agent_context::helpers::BudgetHint;
let hint = BudgetHint {
remaining_cost_cents: Some(50.0),
total_budget_cents: Some(100.0),
remaining_tool_calls: 8,
max_tool_calls: 10,
};
let xml = hint.format_xml().unwrap();
assert!(xml.contains("<remaining_cost_cents>50.00</remaining_cost_cents>"));
assert!(xml.contains("<remaining_tool_calls>8</remaining_tool_calls>"));Auto Trait Implementations§
impl Freeze for BudgetHint
impl RefUnwindSafe for BudgetHint
impl Send for BudgetHint
impl Sync for BudgetHint
impl Unpin for BudgetHint
impl UnsafeUnpin for BudgetHint
impl UnwindSafe for BudgetHint
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request