Effect libraries for agents, auth, and sync.

TypeScript packages built on Effect. MIT licensed.

Agent

Build TypeScript agents with Effect and Effect AI.

Define inputs, outputs, and tools with schemas. Yielded Agent runs the loop, executes tools, and validates the result, with typed errors, streaming, and bounded execution.

bun add @yielded/agent@beta
agent.ts
import { Effect, Schema } from "effect";
import { Agent, AgentRuntime } from "effect-agent";
import { Toolkit } from "effect/unstable/ai";

const planner = Agent.make("travel-planner", {
  input: Schema.Struct({ city: Schema.String, days: Schema.Int }),
  output: Schema.Struct({ itinerary: Schema.Array(Schema.String) }),
  instructions: ({ city, days }) => `Plan ${days} days in ${city}. Suggest one activity per day.`,
  toolkit: Toolkit.empty,
  policy: { maxTurns: 6, maxToolCalls: 10, maxDuration: "2 minutes" },
});

const program = Effect.gen(function* () {
  const result = yield* AgentRuntime.run(planner, { city: "Lisbon", days: 2 });
  yield* Effect.log(result.output.itinerary); // readonly string[]
});

Auth

Authentication composed with Effect.

Yielded Auth owns security-sensitive authentication behavior. Applications provide identity authority, persistence, protocol verification, and credential delivery.

bun add @yielded/auth@beta
auth.ts
import { Auth, Http, Sessions } from "@yielded/auth";
import { Password } from "@yielded/auth/strategies";

import { AuthApi } from "./auth-contract";

export const AppAuth = Auth.make(AuthApi, {
  sessions: Sessions.stateful(),
  strategies: { password: Password.make() },
  defaultStrategy: "password",
});

export const AuthRoutes = Http.layer(AppAuth, { origin: "https://app.example.com" });

Sync

Shared state for Effect apps.

Keep clients in step with server state through live updates and typed actions.

bun add @yielded/sync@beta
counter.ts
import { Action, Source } from "@yielded/sync";
import { Schema } from "effect";

export const CounterId = Schema.NonEmptyString.pipe(Schema.brand("CounterId"));

export const Counter = Source.make({
  kind: "counter",
  id: CounterId,
  schemaVersion: 1,
  snapshot: Schema.Struct({ value: Schema.Finite }),
  event: Schema.Struct({ value: Schema.Finite }),
  actions: [
    Action.make("set", {
      payload: Schema.Struct({ value: Schema.Finite }),
      success: Schema.Struct({ previous: Schema.Finite, current: Schema.Finite }),
      error: Schema.Never,
    }),
  ],
});