pub struct PolicyEngine { /* private fields */ }Expand description
The policy engine — checks tool calls against the security policy
Implementations§
Source§impl PolicyEngine
impl PolicyEngine
Sourcepub fn new(policy: SecurityPolicy) -> Self
pub fn new(policy: SecurityPolicy) -> Self
Create a new policy engine with the given policy
Sourcepub fn default_secure() -> Self
pub fn default_secure() -> Self
Create a policy engine with default (secure) settings
Sourcepub fn permissive() -> Self
pub fn permissive() -> Self
Create a permissive policy engine (for development)
Sourcepub fn check_tool_call(&self, tool_name: &str, args: &Value) -> Decision
pub fn check_tool_call(&self, tool_name: &str, args: &Value) -> Decision
Check if a tool call is allowed
Sourcepub fn requires_approval(&self, tool_name: &str) -> bool
pub fn requires_approval(&self, tool_name: &str) -> bool
Check if a tool requires human approval
Sourcepub fn policy(&self) -> &SecurityPolicy
pub fn policy(&self) -> &SecurityPolicy
Get the policy configuration
Auto Trait Implementations§
impl Freeze for PolicyEngine
impl RefUnwindSafe for PolicyEngine
impl Send for PolicyEngine
impl Sync for PolicyEngine
impl Unpin for PolicyEngine
impl UnsafeUnpin for PolicyEngine
impl UnwindSafe for PolicyEngine
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> 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