---
title: Plugin Types
description: Detailed implementation of internal plugins and external system drivers.
icon: Component
---
import { Steps, Step } from 'fumadocs-ui/components/steps';
Vane categorizes plugins based on their implementation source and operational logic. This guide covers the high-performance internal components and the drivers that power external extensions.
## Internal Plugins (Rust)
Built-in plugins are compiled directly into the Vane binary for maximum performance.
<Mermaid
chart="
graph LR
Engine[Flow Engine] --> Internal{Type?}
Internal -- Middleware --> Matcher[Matcher/RateLimit]
Internal -- Terminator --> Proxy[Proxy/Response]
"
/>
### Middleware
Used for cross-layer logic like:
- **`matcher`**: Evaluates conditions against the [KV Store](../resources/kv-store).
- **`ratelimit`**: Token-bucket based limiting.
### Terminators
Responsible for the final action of a flow:
- **L4 Proxy**: TCP/UDP forwarding.
- **L7 Upstream**: Full HTTP reverse proxying.
---
## External Drivers
External plugins are executed by Vane via specialized drivers.
<Mermaid
chart="
graph LR
Engine --> Driver{Driver Type}
Driver -- HTTP --> Remote[Remote Service]
Driver -- Unix --> Sidecar[Local Sidecar]
Driver -- Command --> Child[Subprocess]
"
/>
### 1. HTTPX & Unix Drivers
Both drivers encapsulate the plugin's `inputs` into a POST request.
- **HTTPX**: Supports custom timeouts and TLS.
- **Unix**: Communicates over a local socket file.
### 2. Command Driver (Subprocess)
The `command` driver executes a binary or script.
<Steps>
<Step>
### Path Validation
The program must exist within the **Trusted Bin Root** to prevent unauthorized execution.
<Mermaid
chart="
graph LR
Input[Program Path] --> Check{In Trusted Root?}
Check -- Yes --> Safe[Proceed]
Check -- No --> Block[Log Error]
"
/>
</Step>
<Step>
### Environment Sanitization
To prevent privilege escalation, Vane filters dangerous environment variables.
<Mermaid
chart="
graph LR
Env[Input Env] --> Filter{Filter}
Filter -- Drop --> Unsafe[LD_PRELOAD / PYTHONPATH]
Filter -- Keep --> Safe[APP_KEY / DEBUG]
Safe --> Child[Child Process]
"
/>
</Step>
<Step>
### Communication & Logging
Vane pipes inputs to `stdin` and captures `stdout` for results. `stderr` is redirected to Vane's debug logs.
<Mermaid
chart="
graph LR
Vane -->|JSON| Stdin[Subprocess STDIN]
Stdout[Subprocess STDOUT] -->|JSON| Vane
Stderr[Subprocess STDERR] -->|Text| Log[Vane Logger]
"
/>
</Step>
</Steps>
## External API Contract
All external drivers expect the following JSON response structure:
```json
{
"status": "success",
"data": {
"branch": "success",
"store": { "user_id": "12345" }
},
"message": "Optional error or info message"
}
```
<Callout type="warn" title="Driver Failures">
If an external driver encounters an I/O error (e.g., connection refused or process crash), it
automatically triggers the [Passive Circuit
Breaker](../engine/flow-executor#passive-circuit-breaker) to prevent performance degradation.
</Callout>