Introduction

Give an AI agent the data and methods of an existing Flutter screen, with approval for the calls that need it.

Your screen's state class lists the data an agent can read and the methods it can call. Those methods use the same validation as your buttons. Calls marked for approval wait for the user. With GenUI, the agent also draws views as A2UI components, built from your widgets. The rest of the app keeps its existing UI and state management.

How it works

Your Flutter screen lists what the agent sees and may call. Tandem sends only the listed data, runs only the listed methods, waits for the user's approval and checks every view before it shows. An agent connects through TandemBridge, AG-UI or Firebase AI Logic.

A remote agent communicates with the app over AG-UI. It receives the screen's data and the current list of methods on each run. Your backend keeps the model, its API keys and its tools. Tandem works with backends that follow the backend contract, with reference implementations on Google ADK, LangGraph and Pydantic AI. Without a backend, the app connects to Gemini through Firebase AI Logic.

Your state class declares the agent's capabilities:

  List<AgentCapability> get agentCapabilities => [
    .sees(draft),
    .calls(setQuantity),
    if (draft.lines.isNotEmpty) .callsWithApproval(placeOrder),
  ];
  • .sees(draft) sends the current draft to the agent.
  • .calls(setQuantity) exposes the method your buttons call, with the same validation.
  • .callsWithApproval(placeOrder) runs the method after the user approves the request.

In a debug build, your coding agent can call the same methods through TandemBridge.

Tandem is 0.x. Its core API gets no breaking changes before 1.0, and the rest can change in a minor release.

Where to start