Skip to main content

AgentSink

Trait AgentSink 

Source
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§

Source

fn step<'a>(&'a self, _step: &'a AgentStep, _credits: u64) -> BoxFuture<'a, ()>

一次工具调用结束;credits 是到现在为止用掉的额度。

Source

fn cancelled(&self) -> bool

调用方要求取消:在两步之间生效。

Source

fn charge_page(&self) -> BoxFuture<'_, ()>

抓到一页:计入调用方的页面配额。

Source

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".

Implementations on Foreign Types§

Source§

impl AgentSink for ()

Implementors§