effect-uai
Effectful building blocks for agentic ai
Agents should be ordinary programs: explicit state, typed effects, visible streams, and tools you control. effect-uai gives you the primitives to build that loop without handing your architecture to a framework.
12 capabilities 18 providers 40+ recipes MIT license
Watch the intro Build agents that do more than chat
Your agent can speak, listen, draw, remember, search the web, run code, and join the chat. Each capability is one small interface, the same whichever provider you pick.
Language models
Build streaming, tool-calling agents once, then swap the provider underneath.
Explore
Image generation
Generate images from a prompt, then edit them against references.
Explore
Speech
Transcribe audio and synthesize speech, batch or live, for voice agents.
Explore
Realtime
Talk to the model live. It hears you, sees your camera, stops when you talk over it, and calls tools mid-call.
Explore
Music generation
Generate music from prompts, one-shot or streaming.
Explore
Embeddings
Vectorize text for semantic search, RAG, and clustering.
Explore
Reranking
Cut fifty candidates down to the five worth putting in the prompt.
Explore
Web search
Ground answers in live web results, with citations.
Explore
Web reading
Turn any URL into clean markdown, then extract typed data from it.
Explore
Sandboxes
Run model-written code in isolated microVMs.
Explore
Browser
Drive a real browser: navigate, click, fill, and read pages as markdown.
Explore
Messenger
Put your agent in the chat: it listens where people talk and streams answers back.
Explore
And more coming soon.
18 providers. Swap anytime.
Write against a shared interface and switch providers without touching your agent code.
Features
Explicit control
No black-box magic. You stay in full control of your agent loop.
Built on Effect
Retries, streams, concurrency, errors: handled by Effect, not reinvented.
Powerful building blocks
Small, composable primitives to assemble your own agentic loops.
Recipes for the hard parts
Copy-paste solutions for common agentic use cases that you can adapt as needed.
Streaming first
Everything is a stream you can transform, filter, and collect when ready. Performance built in.
Typed errors
Easy and type-safe error handling. Match
RateLimited, Unavailable, or Timeout directly, no string parsing.Carry your own state
History, budget, scratchpad: track whatever your agent needs. It's just a value.
Provider-portable
Code against the generic tag. Swap OpenAI, Anthropic, Gemini, or Mistral by changing a Layer.
Platform-independent
Built on Effect's platform layer, so the same agent code runs on Bun, Node, and Deno.
Watch the intro
Why the agent loop should be explicit, and how the primitives fit together, shown in code.
Recipes
40 and countingEach recipe shows how to solve a common agent problem with the primitives.
Tool call approval
Pause on sensitive tools. HTTP-bundled or queue-driven verdicts; same primitive.
Read recipeTools & HITL
Live tool updates
Watch tools work. Stream progress and reasoning as they run; the model gets one clean result.
Read recipeTools & HITL
MCP tools
Use any MCP server's tools. Connect, and its tools become an ordinary toolkit the loop runs; the connection closes with the stream.
Read recipeTools & HITL
Stream typed objects
Stream data as it arrives. Decode and validate one object at a time as the model writes.
Read recipeTools & HITL
Multi-model fallback
Stay online when a provider fails. Switch automatically on rate limits or outages.
Read recipeReliability
Model escalation
Pay only when needed. The cheap model handles easy questions and escalates hard ones to a more capable model.
Read recipeMulti-model
Auto-compaction
Never run out of context. Summarize history before the token budget runs dry.
Read recipeReliability
Pause and resume
Pause without losing progress. Hold the loop between turns and continue right where it stopped.
Read recipeReliability
Mid-stream abort
Stop on a dime. Cancel a running turn, drop the HTTP connection, and keep the partial output.
Read recipeReliability
Sleeper agent
Wait for a long-running tool call. The agent goes quiet while the work runs and wakes up the moment it's done.
Read recipeReliability
Agentic loop
Stay online for the whole chat. Pull user messages from a queue; debounce bursts into one batch.
Read recipeReliability
Modify output stream
Format for the wire. Map one function to ship the loop's output as SSE or JSONL.
Read recipeTransport
Model retry
Retry transient failures. Exponential backoff for rate limits and timeouts; fail fast on the rest.
Read recipeReliability
Multi-model compare
See how models differ. Send one prompt to OpenAI, Google, and Anthropic at once.
Read recipeMulti-model
Model council
Get the best answer. Models judge each other, the winner streams back.
Read recipeMulti-model
Voice loop
Talk to your agent. Streaming STT, LLM, and TTS composed as Effect fibers; stop-words interrupt mid-sentence.
Read recipeSpeech
Realtime voice agent
Talk over it and it stops. A voice assistant on a realtime model; web search runs while it keeps talking.
Read recipeRealtime
Camera assistant
Point at it instead of describing it. The voice agent with a camera; frames go over the same session as your voice.
Read recipeRealtime
Radio station
Run your own AI radio station. An AI DJ writes the next track while you listen to the current one; the same set replays for free.
Read recipeMusic
Conversational image edit
Say what to change, keep the picture. Getting the image you want takes a few goes, and your subject survives every one of them.
Read recipeImages
Storyboard
Tell a story in pictures. Your characters stay themselves across every panel, so eight images read as one comic instead of eight strangers.
Read recipeImages
Retrieve and rerank
Cosine finds related, not relevant. Re-score the top fifteen with a cross-encoder that reads query and candidate together.
Read recipeRetrieval
Agentic search
BM25 misses paraphrases, vectors miss names. Fuse both with RRF, rerank the head, and give it to the agent as a tool it can call again.
Read recipeRetrieval
Contextual retrieval
Chunking strips each passage of its referents. An LLM writes them back at index time, ahead of both the vector and the keyword leg.
Read recipeRetrieval
Run, fix, repeat
Let the model run its own code. It writes Python; the sandbox runs it; tracebacks feed back into the next turn until the answer's right.
Read recipeSandboxes
Grounded answer
Answer from the live web. The model searches, reads the results, and writes a cited answer; swap the LLM and search backend independently.
Read recipeWeb search
Deep research
Research a broad question. Plan it into sub-questions, investigate each with a streaming sub-agent, and synthesize one cited report.
Read recipeWeb search
Market intel
Extract typed data from any page. Read a batch of vendor pages and pull a structured pricing record from each, no selectors, concurrently.
Read recipeWeb reading
Agent usability testing
Test your UX with an agent. Give it a goal and a URL; it drives a real browser and reports whether it got there and where it hit friction.
Read recipeBrowser
Dashboard briefing
Read dashboards like a human. Screenshot a client-rendered dashboard and get a typed briefing: trend, anomalies, headline numbers.
Read recipeBrowser
Messenger agent
Ship the agent where people already are. Mention it in Telegram; it types, searches, draws, and streams the answer into one message.
Read recipeMessenger
Ready to build your loop?
Install the package, copy a recipe, keep your loop explicit.