@ay-2814/era-sdk
v0.1.0
Published
Era cognitive context for any conversational AI agent
Readme
@season/era-sdk
Drop-in cognitive context for any conversational AI agent. Zero runtime
dependencies (uses global fetch).
npm install @season/era-sdkQuick start
import { Era } from "@season/era-sdk";
const era = new Era({
apiKey: process.env.ERA_API_KEY!,
baseUrl: process.env.ERA_URL!,
partnerId: "your_partner_id",
});
const block = await era.turnContext(messages, { userId, sessionId });
systemPrompt += "\n\n" + block;For Vercel AI SDK auto-injection middleware, import @season/era-sdk/ai-sdk.
Modes & production behavior
mode: "async"(default) — stale-while-revalidate; instant response with the previous turn's block.mode: "sync"waits for the current turn.- Fail-open: any error returns
""— your agent never breaks. - Bounded retries on transient failures (timeout/network/5xx);
4xxis terminal. Configure withmaxRetries(default 1). - Timeouts: 2s async / 30s sync, override with
timeoutMs. - Logging: pass a
logger({ warn, info }) to integrate with pino/winston, ordebug: truefor verbose per-turn console output. Warnings only by default.
Options
| Option | Default | Notes |
|--------|---------|-------|
| mode | "async" | "async" | "sync" |
| brandVoice | — | words the [REC] action |
| timeoutMs | 2000 / 30000 | per request |
| maxRetries | 1 | transient-only |
| logger / debug | console / false | observability |
Develop
npm run build # tsc -> dist/
npm test # node --test