pub trait AgentSink: Send + Sync {
// Provided methods
fn step<'a>(
&'a self,
_step: &'a AgentStep,
_credits: u64,
) -> BoxFuture<'a, ()> { ... }
fn cancelled(&self) -> bool { ... }
fn charge_page(&self) -> BoxFuture<'_, ()> { ... }
fn pages_left(&self) -> Option<u64> { ... }
}Expand description
agent 运行的回报和额度,由 API 层的任务管理实现;() 是不回报、不限额的实现。
Provided Methods§
Sourcefn step<'a>(&'a self, _step: &'a AgentStep, _credits: u64) -> BoxFuture<'a, ()>
fn step<'a>(&'a self, _step: &'a AgentStep, _credits: u64) -> BoxFuture<'a, ()>
一次工具调用结束;credits 是到现在为止用掉的额度。
Sourcefn charge_page(&self) -> BoxFuture<'_, ()>
fn charge_page(&self) -> BoxFuture<'_, ()>
抓到一页:计入调用方的页面配额。
Sourcefn pages_left(&self) -> Option<u64>
fn pages_left(&self) -> Option<u64>
调用方今天还能抓多少页;没有配额时 None。
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".