@rippling/agents
v0.6.0-alpha.3
Published
TypeScript SDK for defining and evaluating agents on the Rippling platform
Maintainers
Keywords
Readme
Rippling Agents SDK
@rippling/agents is a TypeScript SDK for defining agents, extracting their manifests locally, and authoring tools, skills, references, sessions, and evals for the Rippling agent platform.
This package supports four public authoring styles:
- static agents with a single instruction body
- structured agents with phased state and typed working memory
- runtime agents with an imperative runtime callback
- orchestrators through the dedicated
@rippling/agents/orchestrationentrypoint
Running an agent still requires access to the platform runtime. The SDK can validate and extract authoring artifacts locally without contacting the runtime.
Install
Install the latest release from public npm.
npm install @rippling/agents@latestThe package provides ES modules and TypeScript declarations. The authoring patterns in this README and the repository fixtures are verified with Node.js 24.22.1 and TypeScript 5.9.3.
Choose an authoring style
1. Static agent
Use the object form when a single instruction body is enough.
import { defineAgent } from "@rippling/agents";
export default defineAgent({
name: "hello-world-agent",
goal: "Reply with a short greeting and offer one follow-up.",
instructions: "Greet the user briefly, answer directly, and offer one concrete next step.",
});2. Structured agent
Use the callback form when the agent has phases, state-local tools, or typed working memory.
import { defineAgent, defineMemory, defineSession, defineSessionControl, defineStates } from "@rippling/agents";
const phases = defineStates(["greeting", "follow_up"] as const);
export default defineAgent(
{
name: "structured-agent",
goal: "Handle a greeting and a follow-up.",
session: defineSession({
workingMemory: {
userName: defineMemory.string(),
},
control: defineSessionControl({
phase: phases,
statuses: ["active", "completed"] as const,
}),
}),
},
(agent) => {
agent.whenState("greeting", () => {
agent.useInstruction("Open warmly and ask one clarifying question if needed.");
});
agent.whenState("follow_up", () => {
agent.useInstruction("Answer the follow-up directly.");
});
},
);3. Runtime agent
Use runtime(context) when the agent needs imperative durable primitives such as child runs, shared memories, approvals, input, or tasks.
import { defineTool, defineAgent } from "@rippling/agents";
import * as v from "valibot";
const lookupWorkerProfile = defineTool({
name: "lookupWorkerProfile",
input: v.object({ workerId: v.string() }),
output: v.object({ workerId: v.string(), preferredName: v.string() }),
async execute(input) {
return { workerId: input.workerId, preferredName: "Alex" };
},
});
export default defineAgent({
name: "runtime-agent",
goal: "Route authenticated RPC requests into the correct internal child workflow.",
instructions: "Inspect RPC requests, acknowledge them, and spawn the matching child run.",
instance: "shared",
ingress: { protocol: "rpc" },
tools: [lookupWorkerProfile],
async runtime(context) {
if (context.event.kind !== "rpc") return;
await context.respond({
requestId: context.event.requestId,
message: `Accepted ${context.event.procedure}.`,
});
await context.spawn({
purpose: `rpc:${context.event.procedure}`,
tools: ["lookupWorkerProfile"],
capabilities: {
memories: "none",
workspace: "none",
tasks: "none",
approvals: "none",
input: "none",
},
});
},
});4. Orchestrator
Use the orchestration entrypoint when the agent is explicitly a coordinator with named child archetypes and event-driven handlers.
import { defineTool } from "@rippling/agents";
import { defineOrchestrator } from "@rippling/agents/orchestration";
import * as v from "valibot";
const searchDocs = defineTool({
name: "searchDocs",
input: v.object({ question: v.string() }),
output: v.object({ findings: v.array(v.string()) }),
async execute() {
return { findings: [] };
},
});
const draftSummary = defineTool({
name: "draftSummary",
input: v.object({
topic: v.string(),
findings: v.array(
v.object({
questionId: v.string(),
question: v.string(),
output: v.unknown(),
}),
),
}),
output: v.object({ summary: v.string() }),
async execute() {
return { summary: "" };
},
});
export default defineOrchestrator({
name: "research-coordinator",
goal: "Coordinate multi-question research and summarize the answer.",
instructions: "Split work, track correlated assignments, and respond when synthesis is complete.",
instance: "shared",
inventory: { tools: [searchDocs, draftSummary] },
archetypes: {
researcher: {
description: "Investigates one question and returns findings.",
tools: ["searchDocs"],
capabilities: {
memories: "read_only",
workspace: "none",
tasks: "none",
approvals: "none",
input: "none",
},
},
synthesizer: {
description: "Combines research outputs into one answer.",
tools: ["draftSummary"],
capabilities: {
memories: "read_only",
workspace: "none",
tasks: "none",
approvals: "none",
input: "none",
},
},
},
on: {
user_input: async (orchestrator, event) => {
const request = event.input as { topic: string; questions: string[] };
for (const [index, question] of request.questions.entries()) {
await orchestrator.assign("researcher", {
goal: `Research question ${index + 1}: ${question}`,
metadata: {
requestId: event.requestId,
topic: request.topic,
questionId: `question-${index + 1}`,
question,
phase: "research",
},
});
}
},
assignment_updated: async (orchestrator, event) => {
if (!event.requestId) return;
const assignments = await orchestrator.assignments.list({ requestId: event.requestId });
const research = assignments.filter((assignment) => assignment.metadata?.phase === "research");
const syntheses = assignments.filter((assignment) => assignment.metadata?.phase === "synthesis");
if (
research.length > 0 &&
research.every((assignment) => assignment.status === "succeeded") &&
syntheses.length === 0
) {
const topic = String(research[0]?.metadata?.topic ?? "your request");
await orchestrator.assign("synthesizer", {
goal: `Summarize the completed research for ${topic}.`,
context: {
topic,
findings: research.map((assignment) => ({
questionId: String(assignment.metadata?.questionId ?? ""),
question: String(assignment.metadata?.question ?? ""),
output: assignment.output,
})),
},
metadata: {
requestId: event.requestId,
topic,
phase: "synthesis",
},
});
return;
}
const completedSummary = syntheses.find((assignment) => assignment.status === "succeeded");
if (completedSummary) {
await orchestrator.respond({
requestId: event.requestId,
message: `The research for ${String(completedSummary.metadata?.topic ?? "your request")} is ready.`,
metadata: { summary: completedSummary.output },
});
}
},
},
});Durable primitives
The runtime-oriented surfaces build on a small durable primitive set:
- instance selection with
instance: "per_session" | "shared" - authenticated ingress with
ingress: { protocol: "https" | "rpc" } - child runs through
context.spawn(...) - shared memories through
context.memories.checkout(...) - approvals and input through
context.approvals.request(...)andcontext.input.request(...) - tasks through
context.tasks.schedule(...)
For runtime agents and orchestrator handlers, those durable methods live directly on the callback context. For tool and lifecycle execution contexts, the same runtime services are exposed through optional context.durable when the platform provides them.
The SDK exposes the full contract, but local test helpers intentionally return explicit “runtime not available” errors until the platform runtime provides those services.
Inspect a manifest locally
Use extractAgentDefinition from the root entrypoint to inspect the resulting manifest.
import agent from "./my-agent.js";
import { extractAgentDefinition } from "@rippling/agents";
console.log(JSON.stringify(extractAgentDefinition(agent), null, 2));Public entry points
| Import | Use |
| --- | --- |
| @rippling/agents | Agent definitions, runtime agents, tools, sessions, durable primitive types, and manifest extraction |
| @rippling/agents/orchestration | Orchestrator definitions, typed wake events, archetypes, and assignment helpers |
| @rippling/agents/models | Model and thinking-level selection |
| @rippling/agents/compat | Compatibility helpers for agent definitions |
| @rippling/agents/customization | Extension surfaces and overlays |
| @rippling/agents/verifiers | Verifier registration and lookup |
| @rippling/agents/workspace | File and code operations in a configured agent workspace |
| @rippling/agents/evals | Agent eval scenarios, assertions, and judges |
| @rippling/agents/evals/vitest-config | Vitest configuration for agent evals |
| @rippling/agents/evals/reporter | Eval reporting |
Documentation
The repository includes public-facing design and rationale documents for the durable surfaces:
docs/durable-agent-sdk-surface.mddocs/orchestrator-sdk-surface.md
The repository fixtures also include authoring examples under fixtures/agent-authoring-examples/src.
Evals
The eval entry points use optional peers. The tested versions are [email protected], [email protected], and [email protected]. Ordinary agent authoring works without them.
Run platform-backed evals through rippling agents eval in a configured developer context. The runner supplies the eval test glob, agent target, and platform credentials. By default, LLM judges use Rippling's internal LLM Gateway and its configured credentials. Deterministic assertions do not need that gateway, though an eval that starts an agent session still needs the agent runtime.
Choose a judge provider
Pass a Vitest Evals JudgeHarness as judgeHarness to defineEvalScenario to choose the judge provider for a suite. Existing suites that pass only { agent } keep using the runner's Gateway judge and --judge-model setting.
For providers supported by the Vercel AI SDK, use @vitest-evals/harness-ai-sdk with the provider's model. Install these optional development dependencies only in projects that use this integration. For example, for Anthropic:
npm install --save-dev @vitest-evals/[email protected] ai@^6 @ai-sdk/anthropic@^3 @types/json-schema@^7Set ANTHROPIC_API_KEY in the environment where the eval runs, then pass the harness to the suite:
import { anthropic } from "@ai-sdk/anthropic";
import { aiSdkJudgeHarness } from "@vitest-evals/harness-ai-sdk";
import { defineEvalScenario, expect, FactualityJudge } from "@rippling/agents/evals";
import agent from "../src/agent.js";
const judgeHarness = aiSdkJudgeHarness({
model: anthropic("claude-sonnet-4-5"),
});
defineEvalScenario("geography", { agent, judgeHarness }, (scenario) => {
scenario.it("answers a geography question", async (session) => {
await session.trigger("What is the capital of France?");
const turn = await session.waitForTurn();
await expect(turn.output).toSatisfyJudge(FactualityJudge(), {
expected: "Paris is the capital of France.",
threshold: 0.6,
});
});
});For OpenAI, use @ai-sdk/openai@^3 and its openai(...) model with OPENAI_API_KEY; other AI SDK providers follow the same pattern. A custom judge harness uses its own model and credentials, so Gateway credentials are unnecessary for that suite and --judge-model does not select its model. Platform credentials are still required to run the agent. Keep judge harnesses in eval files or shared eval helpers outside the deployed agent bundle.
With the AI SDK harness, a JSON response request that includes a schema returns a parsed object. A JSON request without a schema returns JSON text; custom judges should parse that text or supply a schema. The built-in FactualityJudge supplies its own schema.
