The engine powering agentic workflows.

Composable. Provider-agnostic. Headless. One Agent interface, every LLM. NDJSON over stdio. Embeddable in your own Rust project.

Install in seconds. No API keys required for local models.

session: 019f4...
{"type":"session_created","session_id":"019f4a2c-...","timestamp":1719876543}
{"type":"user_message","content":"explain this codebase"}
{"type":"thinking_delta","content":"Let me explore the repository structure..."}
{"type":"tool_call","tool":"glob","args":{"pattern":"**/*.rs"}}
{"type":"tool_result","files":["src/main.rs","src/lib.rs","..."]}
{"type":"markdown_delta","content":"This is a Rust project organized as..."}
{"type":"turn_completed","tokens":{"input":1247,"output":583}}

Provider-agnostic

Native loop calls LLMs directly. Anthropic, OpenAI, Gemini, Ollama, Bedrock, Copilot, DeepSeek. Connectors drive external agents behind the same interface.

Deep search

Optional plugin: search_web + scrape_page + researcher role. DuckDuckGo and SearXNG backends with automatic fallback.

Embeddable SDK

AgentBuilder fluent API composes providers + engine + plugins. The flex headless runner streams NDJSON over stdio.

Independent verification

Verify/SubmitVerdict spawn a fresh-context subagent that never sees the maker's reasoning — only artifacts and a rubric. Optional plugin, zero footprint when disabled.

Goal-loops & Routines

run_goal drives repeated turns to a stated outcome under explicit stop-rules. flex serve --enable-routines runs the same goals unattended, on a cron schedule or a webhook.

Headless HTTP API

flex serve: bearer-auth HTTP/SSE with an OpenAPI spec. Binds loopback-only unless given an explicit token — no CORS layer, no unauthenticated routes.

Get started

$ ./scripts/install_mac.sh

Builds the release binary and installs the flex runner to ~/.local/bin (macOS/Linux). On Windows use ./scripts/install_windows.sh (Git Bash / WSL / MSYS2) → %USERPROFILE%\.local\bin. Works from any project directory.

$ flex run --provider deepseek --model deepseek-v4-pro -p "explain this codebase"

Works with any project. No configuration needed.

SDK API

The AgentBuilder fluent API composes providers, the native engine, and plugins into an EngineService. It ships in the agentloop-sdk crate under packages/sdk.

$ use agentloop_sdk::AgentBuilder;
let service = AgentBuilder::new()
    .provider("deepseek")
    .model("deepseek-v4-pro")
    .provider_key("deepseek", "sk-...")
    .enable_plugin("search")
    .build()?;
.provider(id)

Preferred provider (anthropic, openai, gemini, deepseek, ...).

.model(ref)

Default model, optionally provider/model-qualified.

.provider_key(id, key)

API key for a built-in provider, bypassing env vars.

.cwd(path) / .headless()

Sandbox to a directory (default: cwd), or run read-only with no project.

.verbosity(level)

NDJSON output verbosity: Low, Medium, High.

.enable_plugin(id)

Enable a built-in plugin ("search", "learning", "verifier").

.plugin(impl Plugin)

Register a custom plugin.

.custom_providers(specs)

Client-configured OpenAI-compatible providers.

.all_providers(true)

Register every provider whose credentials resolve.

.fallback_models(models)

Engine-wide failover chain for sessions that don't set their own.

.enable_workflow_tool(true)

Register RunWorkflow: declarative multi-step subagent pipelines.

.build()

Resolve providers, fold in plugins, return EngineService.

Provider status

Built-in providers are detected from environment variables. Use .provider_key(id, key) to supply keys programmatically. OpenAI-compatible endpoints can be added via .custom_providers(vec![CustomProviderSpec { ... }]).

Provider Auth Status
anthropic ANTHROPIC_API_KEY stable
openai OPENAI_API_KEY stable
deepseek DEEPSEEK_API_KEY stable
gemini GEMINI_API_KEY stable
bedrock AWS credentials + region stable
ollama localhost:11434 stable
copilot device-flow sign-in stable
custom CustomProviderSpec stable

Architecture

Hub-and-spoke, layered bottom-up: contracts (pure data types) at the base, core (traits and registries) above, then everything else depends outward. The engine crate knows nothing about providers — the providers facade resolves credentials and hands a prebuilt registry to the engine.

SDK AgentBuilder · flex runner · composition root
providers anthropic · openai · gemini · ollama · bedrock · copilot · deepseek · delegators
gateway Channel trait · Routine{Spec,Trigger,Store} — contract-only, no EngineService dep
engine loop · prompts · session · tools · mcp · workspace · transports/{stdio,http} · learning · verifier
core Agent · Provider · Tool · SessionStore · Plugin · Hook · Workspaces
contracts events · content blocks · ToolCall · ids · caps · errors · branding