Documentation · Getting started · GitHub
@systemfsoftware/agent builds durable agent Threads in TypeScript with Effect and Effect AI. Define schemas, instructions, and tools. The runtime runs the model/tool loop, validates output, and can retain accepted work across process restarts.
A Thread is the conversation; a Run is one logical execution; an Attempt is one period advancing it. Additional input can join an active Run. Model context, history, and recovery state have separate lifetimes, so a long conversation can be compacted without discarding its committed history.
Your application supplies authorization, tool handlers, model services, and storage. @systemfsoftware/agent supplies typed execution, bounded work, approvals, and recovery under a single owner per Thread. Native Effect AI tools and provider Layers work directly.
A durable receipt means the runtime owes a terminal settlement. Recorded results are reused; uncertain ordinary mutations require reconciliation. Durable Steps need external idempotency. There is no exactly-once external execution guarantee. Read the durability contract.
bun add @systemfsoftware/agent@beta effectimport { Agent, AgentRuntime } from '@systemfsoftware/agent'
import { Schema } from 'effect'
import { Toolkit } from 'effect/ai'
const triage = Agent.make('triage', {
input: Schema.String,
output: Schema.Struct({
severity: Schema.Literals(['low', 'medium', 'high', 'critical']),
explanation: Schema.String,
}),
instructions: 'Classify the bug report and explain the severity in one sentence.',
toolkit: Toolkit.empty,
policy: { maxTurns: 2, maxToolCalls: 1, maxDuration: '30 seconds' },
})
const result = AgentRuntime.run(triage, 'Users cannot sign in.')Supply a model and history Layer to execute the Effect. The getting-started guide has complete provider setup, installation, and an executable entry point.
| Need | Choice |
|---|---|
| Process-local conversations | InMemory.layer |
| Retained successful history | SQLite or PostgreSQL adapter |
| Durable Node service | Supplied SQLite host, or a custom PostgreSQL host |
| Durable Cloudflare service | SQLite-backed Thread Objects |
How it works · Platforms · Packages
Framework packages live in packages/*. pnpm is the package manager.
pnpm install
pnpm lint && pnpm typecheck && pnpm testRead AGENTS.md and the glossary before contributing. The gate runs format, lint, typecheck, build and test.