Skip to main content

Features

What Freyja does today, and what it does not. The second list matters as much as the first, so it is on the same page rather than hidden.

What works​

Talking to models​

Text generationYes, on every provider
Images in a promptYes, by URL or data: URI
System instructionsYes, placed correctly per provider automatically
Model selectionYes, or leave it unset and take the endpoint's default
Sampling controlsmax_tokens, temperature, top_p
Reasoning effortYes, on every dialect; a level a vendor lacks is that vendor's rejection
Asking before sendingClient::check, no network call and no key used
Structured outputJSON schema, and free JSON where the provider offers it
Typed responsesgenerate_as::<T>() deserializes for you, see Typed output
Strict-mode schemasstrict_schema() rewrites a schema into the subset OpenAI accepts
Vendor-only fieldsextra_for(), scoped to a dialect so the request stays portable
Token accountingYes, normalized across providers
StreamingYes, on every dialect, see Streaming

Streaming delivers the same answer incrementally, and a drained stream converts back into the same GenerateResponse, so a streamed send runs the same loop as a plain one. Tool-call arguments and reasoning blobs are assembled for you and surface only once complete, so nothing stitches partial JSON.

Building agents​

Declaring toolsYes, with JSON Schema parameters
Typed tool functions#[tool] derives the schema and JSON executor from a sync or async function
Constraining tool choiceAuto, none, required, or a named tool
The full tool round tripYes, verified against live APIs, not just tested offline
Multi-turn conversationsYes, transcripts are plain data you own
Reasoning state replayHandled for you, see Concepts
Group-aware trimmingwindow_by_groups is public, so a Memory of your own applies the same rule Window::last does
Token-budget trimmingwindow_by_tokens is public, so a Memory of your own applies the same rule Window::tokens does, given a TokenCounter
Summarizing dropped turnsSummarizer is public, so a Memory of your own can summarize what it trims inside its own recall, the way Window::summarize does
Token estimationHeuristicCounter, a dependency-free estimate that counts media by what it shows, or any Fn(&Message) -> usize + Send closure wrapping a real tokenizer
Automatic loop orchestrationAgent runs the tool-calling loop for you and dispatches parallel tool calls concurrently, eight at a time
HooksAgent::hook takes a Hook that sees every model call and tool call and can end the run, see Hooks
Tracing and run spansThe tracing feature adds the Tracing hook and a run span per run, see Observability
Token budgetsAgent::token_budget ends a run with StopReason::OverBudget, see Observability
Record and replayScriptedModel scripts answers, usage and failures, Cassette records a real run once and replays it after, and HashEmbedder tests retrieval, all with no key, see Testing
Pause and resumeA guard answers Decision::Ask, and Conversation::resume carries on, even after a restart, see Human approval
Agents as tools and teamsAgent::into_tool lends work to another agent, and Team hands a conversation over, see Multi-agent
Refusing a tool callAgent::guard vets every requested call, and a refusal reaches the model as text it can act on
Tools that hold stateImplement Tool on a struct; its fields are per-agent state
Per-run data in a toolContext is handed to every call and never sent to the model
Tools defined at runtimename and definition are values, so an MCP-shaped tool needs no compile-time type
Tools that failA Result return reaches the model as error text it can recover from
Choosing what the model seesAgent::memory takes a Memory, which works with any Storage and leaves every stored turn in place. Window::last keeps pinned turns and the most recent turns
Bounding a transcript by token budgetWindow::tokens keeps pinned turns and the most recent turn groups fitting an estimated budget
Summarizing what a window dropsWindow::summarize sends one summary message in place of the turns its window drops, made by a Summarizer at half the window and reused until the window needs to drop more. Conversation::summary reads it and Conversation::compact makes one now
A conversation that survives a restartJsonlStorage::open(path) keeps one conversation in a file, one JSON record per line, as a pure store, and keeps the state slot, so a summary survives the restart too
A conversation in a databaseThe freyja-sqlx crate's PgStorage, MySqlStorage and SqliteStorage keep many conversations in Postgres, MySQL or SQLite, in two tables, with the state slot. It is a separate crate, so the core compiles no database driver. See Storage
Storage written elsewhereStorage is three required methods over public types, so a third-party crate implements it with no change here, and freyja::testing::storage_conformance checks it, and may cut anywhere it likes, because the repair pass drops both halves of a pair the cut separated
Embeddings and search by meaningClient::embed turns text into vectors on OpenAI-compatible endpoints and Gemini, and Anthropic refuses it with UnsupportedCapability. An Index searches texts by meaning, in memory or in any VectorStore, such as the freyja-sqlx crate's PgVectorStore for Postgres with pgvector, and Index::into_tool hands that search to an agent. See Embeddings and Retrieval
Tools from MCP serversThe freyja-mcp crate connects to a server over stdio or Streamable HTTP and hands its tools to an agent, with guards and hooks applying as they do to any tool. See MCP servers

The round trip is the load-bearing feature. A model asks for a function, you run it, you feed the result back, and it continues. Building an agent is the tutorial and Agents the guide.

Reaching providers​

Built-inOpenAI, Google Gemini, Anthropic
Wire dialectsFour, including the format most third-party vendors copy
Any other endpointOne Client::custom call, no code change
Non-conventional URLspath replaces the dialect's path, query pins parameters on every request
Credentials in the URLAuth::Query for an endpoint that takes its key as ?key=, kept out of url(), as is any secret_query value
Local runtimesYes, no credentials required

Built-in means Freyja ships and tests the URL and default model. It does not mean the others are second class: DeepSeek, Groq, OpenRouter, Ollama, and a long tail of others work through Custom providers with the same code paths.

Operational​

Connection poolingOne HTTP client per Client, reused
Timeouts120 seconds of inactivity by default, or supply your own HTTP client
ErrorsClassified by cause, each attributed to the endpoint that failed
Retrying a failed callRetry tries it again, deciding with is_retryable() and waiting the endpoint's own Retry-After, clamped to error::MAX_RETRY_AFTER. See Handling outages
A second model when the first is downFallback::new(primary, backup) falls over on a rate limit, a server error, a dropped connection, an unreachable endpoint or a spent quota. See Handling outages
Half price for work that can waitClient::submit_batch sends a batch to OpenAI or Anthropic, batch and batch_results read it back within 24 hours
Untrusted endpointsA redirect is followed only within one origin, and body, stream, frame, Retry-After and tool fan-out all have ceilings
Credential safetyDebug redacts the API key, secret_header and secret_query extend that to a second credential in Debug, error messages and url(), and every credential header goes out marked sensitive
Dependenciesreqwest, serde, serde_json, schemars, and freyja-macros

What does not exist yet​

Be sure none of these is on your critical path before adopting.

StatusWorkaround
Per-tool timeoutsOut of scope, deliberatelyRacing a call against a clock needs a timer, and Freyja depends on no runtime. A wrapper tool that holds the inner one and applies your runtime's timeout gets there in a dozen lines, for a tool you did not write as much as one you did. The Tool documentation has the whole implementation.
Structured-output schema derivationNot implemented#[tool] derives argument schemas, but ResponseFormat::JsonSchema still takes an explicit schema. Generate one with schemars and pass it through strict_schema().
Capability tablesNot plannedClient::check answers the same question by running the conversion, so there is nothing to keep in sync. It needs a request in hand, which a table would not.

Per-provider gaps​

Capability coverage is not uniform, and Freyja refuses rather than pretending.

CapabilityOpenAIGeminiAnthropicChat Completions
tool_choiceYesYesYesYes
reasoning_effortYesYesYesYes
response_formatYesYesSchema onlyYes
previous_response_idYesYesNoNo
metadataYesYesYesYes

A No means UnsupportedCapability before any network call, so you find out immediately rather than getting an answer that ignored you. Each provider page has the full table.

A Yes means Freyja can express it, not that every model will accept every value. Only the dialect is known here; the endpoint and the model are not. reasoning_effort is the clearest case, OpenAI's Responses API takes Max and its Chat Completions API does not, on the same model, and both arrive as the vendor's own BadRequest rather than as a refusal from Freyja.

The table has no middle column for "carries it but the endpoint says no", deliberately. Gemini rejects three thinking_level values and rejects labels outright; both fields exist, so both requests are sent and the endpoint answers. Freyja refuses a field only when the format has nowhere to put it, anything narrower is a claim about a deployment on a given day. See Gemini.

Verification status​

Freyja distinguishes "the tests pass" from "a real vendor accepted it", because the two came apart once already and cost three bugs.

EndpointLive tool round trip
OpenAIYes
GeminiYes
AnthropicYes
A Chat Completions endpoint (DeepSeek)Yes

Beyond text and tool calling, coverage is uneven and worth reading closely.

CapabilityLive coverage
Reasoning effortOpenAI, both dialects, every level; Gemini, all six levels
Chat Completions token capBoth spellings
Structured outputOpenAI and Gemini: nested struct, enum, Option, Vec, through generate_as
Streaming, textAll four dialects, deltas, usage on Done, and into_response parity
Streaming, tool callsNone. The assembler joining argument fragments is fixture-only
ImagesAn image_url part accepted live on OpenAI Chat Completions, on every role. Not exercised on the other three
Reasoning effort on AnthropicNone
Structured output on AnthropicNone

Two entries deserve their asterisks. The Anthropic dialect's live runs go through a compatible endpoint rather than Anthropic's own service, which covers the wire format and not the vendor. And streamed tool calls are the part of streaming most likely to differ between vendors, since that is where fragments are joined, so the one path with no live coverage is also the one that would benefit most.

That unevenness is not incidental. Sending Gemini a temperature was rejected outright until it was tried, and the offline tests had asserted the wrong shape for as long as they existed. Each dialect's streaming frames are taken from the vendor's own documentation and tested against recorded fixtures, including a test per dialect asserting that a drained stream matches what generate builds from the same turn.