mod plugin#
- module plugin#
Provider plugin trait and input/output types for the ACG system.
The
ProviderPlugintrait defines the contract between ACG’s provider-agnostic optimization pipeline and backend-specific translation logic. Plugins receive aPluginInputcontaining the original request, Prompt IR, intent bundle, and agent identity, and produce aPluginOutputwith the translated request and aTranslationReport.Design
Synchronous:
translateis a pure data transform (JSON restructuring), not an I/O operation. This matches theLlmCodecpattern incrates/core/src/codec/traits.rs.Compatibility facade: provider plugins keep their existing synchronous trait surface, but can internally split translation into semantic hint planning plus request-surface application.
Send + Sync: Required for storage asArc<dyn ProviderPlugin>in concurrent contexts.Object-safe: The trait is designed to be used as a trait object.
Traits
- trait ProviderPlugin#
Provider plugin trait for backend-specific translation.
Plugins are stateless on the forward path. They translate provider-agnostic intents into backend-native API parameters.
Object Safety
This trait is object-safe and can be stored as
Arc<dyn ProviderPlugin>.Thread Safety
The
Send + Syncbounds allow plugins to be shared across async tasks and threads.Functions
- fn capabilities(&self) -> BackendCapabilities#
Report the capabilities of the backend this plugin targets.
- fn plugin_id(&self) -> &str#
Unique identifier for this plugin (e.g., “anthropic”, “openai”, “passthrough”).
- fn plugin_name(&self) -> &str#
Human-readable name for this plugin.
- fn translate(&self, input: &PluginInput<'_>) -> crate::acg::error::Result<PluginOutput>#
Translate intents into backend-native API parameters.
Structs and Unions
- struct PluginInput<'a>#
Input data provided to a plugin for translation.
All fields are borrowed references to avoid unnecessary cloning. The lifetime
'aties the input to the caller’s data.- original_request: &'a LlmRequest#
The original (pre-rewrite) request.
- rewritten_request: &'a LlmRequest#
The rewritten request (may be identical to original in early phases).
- intent_bundle: &'a OptimizationIntentBundle#
The optimization intent bundle from the policy engine.
- agent_identity: &'a AgentIdentity#
The agent identity for context.
- struct PluginOutput#
Output produced by a plugin after translation.
Contains the translated request in the backend’s native API format and a
TranslationReportdescribing what happened to each intent.- translated_request: LlmRequest#
The final request in the backend’s native API format.
- translation_report: TranslationReport#
Report describing what happened to each intent.