Project

Akashi

Provider-neutral agent framework for Dart and Flutter — multi-agent orchestration, durable execution and human-in-the-loop, published on pub.dev.

  • #ai
  • #open-source
  • #dart
  • #flutter
  • #agents

Akashi is an open-source, provider-neutral agent framework for Dart and Flutter, which I author and maintain. It brings the agent-runtime primitives that Python and TypeScript developers take for granted (Vercel's AI SDK, the OpenAI Agents SDK, Pydantic AI, LangGraph, Mastra) to the Dart ecosystem, so Flutter teams can build agents without leaving their language. Source: github.com/AleSZanello/akashi_agents. Live demos: akashi.azanello.com.

The problem

Dart already has LLM tooling (langchain_dart, dartantic_ai, Google's Genkit Dart), so Akashi deliberately does not try to be "the first Dart agent framework". It leads with the two lanes those tools under-serve: Multi-Agent Systems orchestration and Durable Execution — checkpoint/resume and Human-in-the-Loop pauses as a core concern, not a bolt-on.

Architecture and design decisions

  • Provider-neutral core. The pure-Dart akashi package defines the agent loop, tools, schemas and the provider and embedding contracts, and ships no provider SDKs. Adapters live in separate packages: Google Gemini, OpenAI and Anthropic Claude (thinking + tool_use), an Ollama stub, and akashi_gemma for on-device models — which proves the LanguageModel contract is not tied to HTTP.
  • Sealed classes as the type system for non-determinism. The three providers' streaming formats (text, thinking, tool_use) are normalized into one sealed union of messages and events, consumed with exhaustive switch. Stream<T> is the native streaming substrate.
  • Streaming-first tool loop. ToolLoopAgent runs a Tool Calling loop with typed tools and dependency injection, composable stop conditions (stepCountIs, hasToolCall) and a prepareStep hook for context control: keepLastMessages windowing and summarizeOlderThan compaction through a cheaper model.
  • Three multi-agent primitives. Subagent-as-tool (Agent.asTool) runs a child agent fresh and isolated — none of the parent's history leaks in and the child's tools are never advertised to the parent. Control handoffs are exposed to the model as transfer_to_<name> tools. Escalation policies (for example escalateOnToolErrors, escalateAfterSteps) start on a cheap model and switch to a stronger one once the task proves hard. akashi_workflow adds the deterministic, code-driven complement: bounded-concurrency fan-out, typed pipelines, retries with backoff, timeouts and cancellation — see Agent Orchestration.
  • Durability. Versioned Message/Part serialization over a SQLite checkpoint store (akashi_drift). An approval gate suspends a run (persists state and throws Suspended) and it can be resumed in another process.
  • Resilience. akashi_gateway resolves provider/model strings and provides FallbackModel, which fails over across providers with a shouldFailover(error) predicate. It deliberately refuses to fail over mid-stream: once output has been emitted, re-running the request would duplicate or garble it, so the error is rethrown.
  • Structured output with self-repair, picking the most reliable strategy the model declares and validating/repairing against the schema.

Ecosystem packages

The monorepo holds 14 packages, 13 of them published on pub.dev: core, the Gemini/OpenAI/Anthropic adapters, gateway, workflow, akashi_rag (RAG (Retrieval-Augmented Generation): a provider-neutral Retriever seam, an in-memory vector store, chunking and retrieval-as-tool), akashi_mcp (MCP (Model Context Protocol) tools over dart_mcp), akashi_otel (OpenTelemetry tracing for Observability), akashi_gen (optional build_runner codegen for tool schemas), akashi_drift, akashi_flutter (a reactive AgentController, AgentBuilder, message renderer and Isolate offload) and akashi_gemma. Token usage is tracked per call.

Engineering practice

It is a Dart pub workspace driven by Melos. CI on GitHub Actions runs analyze, format-check and tests for the workspace, plus separate jobs for the packages that resolve standalone (the drift package and the two Flutter packages). Tests run offline against fake models, and the web showcase runs every pillar — streaming, tools, human-in-the-loop, multi-agent and durable suspend/resume — in the browser on a fake model.

Status

Current line is v0.3 ("multi-agent · durable · Flutter-native"); the core akashi package scores 160/160 pub points. The roadmap lists multi-modal parts end to end and the Ollama adapter (v0.4) and exposing an Akashi agent as an MCP server (v0.5). MIT licensed. Links: pub.dev/packages/akashi · GitHub.

Related