plaited-eval-adapters
Guide for writing eval-compatible adapter scripts that emit TrialResult artifacts. Use when integrating external agents or scripts into the Plaited eval pipeline.
What this skill does
# Plaited Eval Adapters
Guide for writing adapter scripts that integrate with the Plaited eval pipeline. External agents and scripts can emit eval-compatible artifacts for use with `bunx plaited eval`.
## When to use
- Integrating an external agent (You.com, OpenRouter, custom) into the eval pipeline
- Writing a script that wraps a model provider
- Emitting structured trial results for strategy comparison
## Adapter Interface
An adapter receives `AdapterInput` and must return `AdapterResult`.
### AdapterInput
```typescript
{
/** Single or multi-turn prompt */
prompt: string | string[]
/** Working directory for the adapter */
cwd?: string
/** Optional scenario-specific system prompt override */
systemPrompt?: string
}
```
### AdapterResult
```typescript
{
/** Final agent response text (required) */
output: string
/** Optional structured trajectory */
trajectory?: TrajectoryStep[]
/** Optional capture evidence */
capture?: CaptureEvidence
/** Optional timing information */
timing?: Timing
/** Process exit code (null if signaled) */
exitCode?: number | null
/** Whether the adapter timed out */
timedOut?: boolean
}
```
## Implementation Patterns
### TypeScript module adapter
Export `adapt` as a named function:
```typescript
// my-adapter.ts
import type { AdapterInput, AdapterResult } from 'plaited/cli'
export const adapt = async ({
prompt,
cwd,
}: AdapterInput): Promise<AdapterResult> => {
const start = Date.now()
// Call your agent/provider
const response = await callMyAgent({
prompt: Array.isArray(prompt) ? prompt.join('\n') : prompt,
cwd,
})
return {
output: response.text,
timing: {
total: Date.now() - start,
inputTokens: response.inputTokens,
outputTokens: response.outputTokens,
},
trajectory: response.steps.map((step) => ({
type: step.type,
status: step.status,
timestamp: step.timestamp,
})),
capture: {
source: 'my-adapter',
format: 'chat-completion',
eventCount: response.events.length,
messageCount: response.messages.length,
toolCallCount: response.toolCalls.length,
},
}
}
```
### Executable adapter
Any executable that reads `AdapterInput` from stdin and emits `AdapterResult` to stdout:
```bash
#!/bin/bash
# my-adapter.sh
read -r input
PROMPT=$(echo "$input" | jq -r '.prompt')
# Call your agent
RESULT=$(call_my_agent "$PROMPT")
# Emit JSON result
echo "{\"output\": \"$RESULT\", \"timing\": {\"total\": 1234}}"
```
## Trajectory Format
Trajectory steps provide structured insight into agent behavior:
```typescript
{
/** Step type: message, tool_call, thought, plan, decision, event */
type: string
/** Optional status: pending, running, completed, failed */
status?: string
/** Optional timestamp (ms since epoch) */
timestamp?: number
// ... additional provider-specific fields preserved
}
```
### Common trajectory types
| Type | Description |
|------|-------------|
| `message` | User or assistant message |
| `tool_call` | Tool invocation |
| `thought` | Reasoning/thinking |
| `plan` | Execution plan |
| `decision` | Decision point |
| `event` | Other events |
## Capture Evidence
Model-agnostic evidence about what was captured during a run:
```typescript
{
/** Adapter or capture source identifier */
source: string
/** Capture format */
format: 'response-only' | 'chat-completion' | 'jsonl-event-stream' | 'mixed'
/** Count of provider-native events */
eventCount?: number
/** Count of user/assistant messages */
messageCount?: number
/** Count of reasoning/thought segments */
thoughtCount?: number
/** Count of tool calls */
toolCallCount?: number
/** Short evidence snippets */
snippets?: Array<{
kind: 'message' | 'thought' | 'tool_call' | 'event' | 'stderr' | 'stdout' | 'usage'
text: string
}>
}
```
## Usage and Cost Fields
Include timing data for cost analysis:
```typescript
{
timing: {
/** Adapter-reported total duration in ms */
total?: number
/** Input tokens consumed */
inputTokens?: number
/** Output tokens generated */
outputTokens?: number
}
}
```
## Untrusted Retrieved Content
When adapters include retrieved content in the prompt (RAG, web search, etc.):
1. **Mark retrieved content** in the trajectory
2. **Include source references** in metadata
3. **Track retrieval counts** in capture evidence
```typescript
trajectory: [
{
type: 'retrieval',
status: 'completed',
timestamp: Date.now(),
source: 'vector-db',
docCount: 5,
},
{
type: 'message',
role: 'user',
content: 'Context: [retrieved docs injected here]',
hasRetrievedContent: true,
},
]
```
## Error Handling
Return a valid result even on failure:
```typescript
export const adapt = async ({
prompt,
}: AdapterInput): Promise<AdapterResult> => {
try {
const response = await callAgent(prompt)
return { output: response.text }
} catch (error) {
return {
output: '',
exitCode: 1,
capture: {
source: 'my-adapter',
format: 'response-only',
},
}
}
}
```
## Multi-turn Support
For multi-turn conversations, pass an array of prompts:
```typescript
export const adapt = async ({
prompt,
}: AdapterInput): Promise<AdapterResult> => {
const turns = Array.isArray(prompt) ? prompt : [prompt]
let context = ''
for (const turn of turns) {
const response = await callAgent(context + turn)
context += `\nUser: ${turn}\nAssistant: ${response.text}`
}
return {
output: context,
trajectory: turns.map((_, i) => ({
type: 'message',
role: i % 2 === 0 ? 'user' : 'assistant',
})),
}
}
```
## Related Skills
- `plaited-eval` for running the eval CLI and comparing results
Related in Writing & Docs
jax-development
IncludedUse this skill when the user is writing, debugging, profiling, refactoring, reviewing, benchmarking, parallelising, exporting, or explaining JAX code, or when they mention JAX, jax.numpy, jit, grad, value_and_grad, vmap, scan, lax, random keys, pytrees, jax.Array, sharding, Mesh, PartitionSpec, NamedSharding, pmap, shard_map, Pallas, XLA, StableHLO, checkify, profiler, or the JAX repo. It helps turn NumPy or PyTorch-style code into pure functional JAX, fix tracer/control-flow/shape/PRNG bugs, remove recompiles and host-device syncs, choose transforms and sharding strategies, inspect jaxpr/lowering/IR, and benchmark compiled code correctly.
nature-article-writer
IncludedDrafts, rewrites, diagnostically critiques, and style-calibrates primary research manuscripts for Nature and Nature Portfolio journals. Use when the user wants a Nature-style title, summary paragraph or abstract, introduction, results, discussion, methods, figure legends, presubmission enquiry, cover letter, reviewer response, or when a scientific draft sounds generic, jargon-heavy, structurally weak, or AI-ish and needs precise, broad-reader-friendly prose without inventing data, analyses, or references. Best for primary research articles and letters rather than reviews or press releases unless explicitly adapting one.
deckrd
IncludedDocument-driven framework that derives requirements, specifications, implementation plans, and executable tasks from goals through structured AI dialogue. Use when user says "write requirements", "create spec", "plan implementation", "derive tasks", "structure this feature", "break down into tasks", or "document this module". Also use for reverse engineering existing code into docs (/deckrd rev). Do NOT use for direct code writing — use /deckrd-coder after tasks are generated. Do NOT use when the user only wants to run or fix existing code without planning.
clinical-decision-support
IncludedGenerate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug development, clinical research, and evidence synthesis.
handling-sf-data
IncludedSalesforce data operations with 130-point scoring. Use this skill to create, update, delete, bulk import/export, generate test data, and clean up org records using sf CLI and anonymous Apex. TRIGGER when: user creates test data, performs bulk import/export, uses sf data CLI commands, needs data factory patterns for Apex tests, or needs to seed/clean records in a Salesforce org. DO NOT TRIGGER when: SOQL query writing only (use querying-soql), Apex test execution (use running-apex-tests), or metadata deployment (use deploying-metadata).
accelint-ac-to-playwright
IncludedConvert and validate acceptance criteria for Playwright test automation. Use when user asks to (1) review/evaluate/check if AC are ready for automation, (2) assess if AC can be converted as-is, (3) validate AC quality for Playwright, (4) turn AC into tests, (5) generate tests from acceptance criteria, (6) convert .md bullets or .feature Gherkin files to Playwright specs, (7) create test automation from requirements. Handles both bullet-style markdown and Gherkin syntax with JSON test plan generation and validation.