agentlib 1.1.0 is out. Three additions worth highlighting.

1. MCP WebSocket transport

The 1.0 release shipped HTTP MCP — fine for request/response tools, no good for tools that emit notifications. 1.1.0 adds a WebSocketMcpTransport with full-duplex JSON-RPC over a single socket, plus a notifications stream.

final mcp = await McpClient.connect(
  WebSocketMcpTransport(Uri.parse('wss://watcher.mcp.example.com')),
);

mcp.notifications.listen((n) {
  print('MCP: ${n.method} ${n.params}');
});

The transport handles reconnect with exponential backoff out of the box. In-flight requests replay after reconnect. See MCP on mobile for the longer write-up.

2. SQLite-backed snapshot store

Snapshots have been a public API since 1.0, but the default store was in-memory only. 1.1.0 ships SqfliteSnapshotStore — content-addressed, deduped via SHA-256, with cascade-deleting blob storage.

final store = SqfliteSnapshotStore(database: db);
final cfg = RunConfig(snapshotStore: store, ...);

Identical RunState produces the same content hash, so successive snapshots that differ by only a few tokens share storage. Call store.vacuum() to garbage-collect orphan blobs. See Snapshots.

3. In-loop handoffs

1.0 supported subagents (sync, parallel, background). 1.1.0 adds handoffs — the OpenAI Agents SDK pattern where one agent declaratively transfers control to another on the same conversation thread.

final triage = AgentSpec(
  name: 'triage',
  instructions: 'Classify the request, then hand off.',
  model: AnthropicProvider(apiKey: '<KEY>'),
  handoffs: [
    Handoff(agent: billingAgentDef, when: 'request is about billing'),
    Handoff(agent: techAgentDef, when: 'request is about a technical issue'),
  ],
);

When the triage agent decides to hand off, a HandoffEvent fires (you can register OnHandoff to log or veto), and the receiving agent picks up the conversation with the same message history and a fresh system prompt. Use the continueHandoff(handle) helper to drive the next turn.

This is different from a subagent: a handoff replaces the agent for subsequent turns. A subagent is dispatched and returns.

Other changes

  • New Handoffs concept guide in the repo’s documentation.
  • Loop guard now exposes a callback (OnLoopGuard) so you can surface “I’m in a loop” to the user.
  • Sh builtins gained wc -c and cut -f.
  • FllamaProvider includes a Phi-4 tool-call parser.
  • Bug fix: OnLowBattery debounces correctly under rapid battery state changes.

Upgrade

dependencies:
  agentlib: ^1.1.0

Then flutter pub upgrade agentlib. No breaking changes from 1.0 — all additions are backward-compatible.

What’s next

The 1.2 milestone focuses on:

  • Streaming MCP tool results — partial output for long-running MCP tools, surfaced as multiple ToolResult events.
  • Per-tool budget — declare token / time budgets per tool, enforced by the loop.
  • Better Phi-4 + Gemma 3 parsers — closing the on-device tool-call reliability gap.

If you have feature requests, file them on GitHub. If you ship something with agentlib, tell us — we love hearing about it.