pub struct WebhookHumanLoopProvider { /* private fields */ }Available on crate feature
human-loop only.Expand description
HTTP Webhook 人工介入 Provider。
向配置的 URL 发送 POST 请求,等待响应中返回的决策结果。 适合与企业审批系统、Slack Bot、钉钉机器人等外部平台集成。
§协议
请求 POST body(kind 字段区分场景):
{
"kind": "approval",
"prompt": "工具 [xxx] 需要人工审批...",
"tool_name": "xxx",
"args": { ... }
}或:
{
"kind": "input",
"prompt": "请补充你的意图..."
}响应(统一格式):
{
"decision": "approved" | "rejected" | "timeout",
"text": "用户输入的文本(input 场景)",
"reason": "可选说明"
}Implementations§
Source§impl WebhookHumanLoopProvider
impl WebhookHumanLoopProvider
Sourcepub fn new(url: impl Into<String>) -> WebhookHumanLoopProvider
pub fn new(url: impl Into<String>) -> WebhookHumanLoopProvider
创建 Webhook Provider,使用默认超时(5 分钟)。
Sourcepub fn with_timeout(self, timeout: Duration) -> WebhookHumanLoopProvider
pub fn with_timeout(self, timeout: Duration) -> WebhookHumanLoopProvider
自定义超时时长。
Trait Implementations§
Source§impl HumanLoopProvider for WebhookHumanLoopProvider
impl HumanLoopProvider for WebhookHumanLoopProvider
Source§fn request(
&self,
req: HumanLoopRequest,
) -> Pin<Box<dyn Future<Output = Result<HumanLoopResponse, ReactError>> + Send + '_>>
fn request( &self, req: HumanLoopRequest, ) -> Pin<Box<dyn Future<Output = Result<HumanLoopResponse, ReactError>> + Send + '_>>
发起人工介入请求
Auto Trait Implementations§
impl Freeze for WebhookHumanLoopProvider
impl !RefUnwindSafe for WebhookHumanLoopProvider
impl Send for WebhookHumanLoopProvider
impl Sync for WebhookHumanLoopProvider
impl Unpin for WebhookHumanLoopProvider
impl UnsafeUnpin for WebhookHumanLoopProvider
impl !UnwindSafe for WebhookHumanLoopProvider
Blanket Implementations§
Source§impl<T> BatchApprovalProvider for Twhere
T: HumanLoopProvider,
impl<T> BatchApprovalProvider for Twhere
T: HumanLoopProvider,
Source§fn batch_request(
&self,
batch: BatchApprovalRequest,
) -> Pin<Box<dyn Future<Output = Result<BatchApprovalResponse, ReactError>> + Send + '_>>
fn batch_request( &self, batch: BatchApprovalRequest, ) -> Pin<Box<dyn Future<Output = Result<BatchApprovalResponse, ReactError>> + Send + '_>>
批量审批请求 Read more
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
Mutably borrows from an owned value. Read more
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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>
Converts
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>
Converts
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>
Wrap the input message
T in a tonic::Request