pub async fn derive_with_policy(
session: &Session,
provider: Arc<dyn Provider>,
model: &str,
system_prompt: &str,
tools: &[ToolDefinition],
event_tx: Option<&Sender<SessionEvent>>,
policy: DerivePolicy,
) -> Result<DerivedContext>Expand description
Derive an ephemeral DerivedContext under a chosen DerivePolicy.
Generalisation of derive_context that accepts a policy selector.
DerivePolicy::Legacy delegates back to derive_context so the
two signatures co-exist without behaviour drift during rollout.
§Arguments
Same as derive_context, plus:
policy— Which derivation strategy to run. SeeDerivePolicy.
§Errors
Propagates any error from the underlying pipeline.