Writing Plugins
Runtime capabilities in PAREL are plugins. Model providers are configured separately from this plugin system.
# Plugin Interface
A plugin exports a definePlugin() call that returns hooks and capabilities:
▓ my-plugin/src/index.ts
import { definePlugin } from "@parel/plugin-sdk";
export default definePlugin({
name: "my-custom-tool",
version: "0.1.0",
hooks: {
onToolsRegister(ctx) {
ctx.registerTool({
name: "my_tool",
description: "Does something useful",
parameters: {
type: "object",
properties: {
input: { type: "string", description: "The input" },
},
required: ["input"],
},
async execute({ input }) {
return { result: `Processed: ${input}` };
},
});
},
},
});# Available Hooks
▓ lifecycle
hooks: {
onToolsRegister(ctx) // Register custom tools
onContextBuild(ctx) // Modify context before model call
beforeModelCall(ctx) // Inspect/modify model params
afterModelCall(ctx) // Process model response
beforeToolExec(ctx) // Gate or modify tool calls
afterToolExec(ctx) // Process tool results
onSessionStart(ctx) // Session initialization
onSessionEnd(ctx) // Cleanup
}# Model Providers
LLM provider adapters are not normal plugins. Use the top-level model config to select openai, openai-responses, or anthropic.
See the first-party plugins in the
ts/plugins/ directory for complete examples.