跳到主要内容
版本:最新版

Plugins

Overview

Plugins add route-local behavior after a decision matches. They can rewrite a request, retrieve context, short-circuit generation, inspect a response, or control what operational data is retained.

Shared services and stores belong under global:; the decision plugin only enables and tunes that behavior for one route.

Key Advantages

  • Keeps behavior attached to the route that needs it.
  • Reuses shared stores and services without duplicating their configuration.
  • Makes request mutation, retrieval, and response inspection auditable.

What Problem Does It Solve?

Routes often need different behavior even when they share the same Router. Plugins keep those differences next to the decision instead of hiding them in application middleware or enabling them globally.

When to Use

Use a plugin when behavior should apply only after a specific route matches. Use global: instead when every route shares the same service or backing store. Plugin entries live under routing.decisions[].plugins.

Configuration

routing:
decisions:
- name: cached-support
description: Reuse cached responses for support requests.
priority: 100
rules:
operator: AND
conditions: []
modelRefs:
- model: support-model
plugins:
- type: response_cache
configuration:
enabled: true
ttl_seconds: 3600

Plugin Inventory

TypeGoalShared dependencyGuide
fast_responseReturn a configured response without calling a modelNoneFast Response
system_promptInsert, replace, or append route-specific instructionsNoneSystem Prompt
header_mutationAdd, update, or delete downstream headersNoneHeader Mutation
request_paramsEnforce request parameter limitsNoneRequest Parameters
toolsAllow, block, filter, or remove tools and tool historyOptional global tool catalogTools
tool_selectionAdd tools from a catalog or filter caller tools semanticallyEmbedding runtime; tool database for add modeTool Selection
context_compressionReduce large provider-bound tool output or historyOptional embedding runtime and recovery storeContext Compression
response_cacheReuse compatible prior responsesglobal.stores.response_cacheResponse Cache
memoryRetrieve and optionally store conversational memoryglobal.stores.memoryMemory
ragRetrieve documents before generationConfigured RAG/vector backendRAG
router_replayOverride replay capture for one routeglobal.services.router_replayRouter Replay
hallucinationInspect factual support in a responseHallucination/NLI modules as configuredHallucination
response_jailbreakScreen a generated response for jailbreak contentPrompt-guard runtimeResponse Jailbreak
image_genSend a matched route to an image-generation backendConfigured image backendImage Generation

Content Safety bundles three supported plugins, not an additional plugin type.

Operational Boundaries

  • Plugins can interact when more than one mutates the provider-bound request or response. The Router pipeline fixes their execution order; reordering entries in YAML does not change it.
  • Retrieval, memory, cache, and replay may persist request-derived content. Configure retention, tenant/user scope, authentication, and encryption for the selected backend.
  • Header and prompt mutation can cross trust boundaries. Do not copy untrusted caller metadata into privileged headers or system instructions.
  • Validate the complete recipe before deployment so unsupported plugin names or incompatible settings fail before traffic reaches the Router.