tandem 0.3.3
tandem: ^0.3.3 copied to clipboard
Add an AI agent to a Flutter screen with AG-UI. Choose which data and methods to expose and which calls need approval. Render A2UI components with your widgets.
0.3.3 #
- The README,
example/example.mdand the skills show how to connect a screen to Firebase AI Logic withFirebaseConnectionfromtandem_firebase_ai, without an agent backend. They also name it as a replacement forOnDeviceAgent. - AG-UI
metadataon text messages, tool calls and backend tool results stays in the conversation history and goes back to the backend with them. Before, Tandem dropped it. - An event whose
metadatais not a JSON object fails the run with aFormatException. - A
TEXT_MESSAGE_CONTENTevent with an emptydeltaadds no chat message. Before, the chat showed an empty one. - After a failed run, the agent's texts go back to the backend in the order their messages started, as after a finished run. Before, they followed the order of their first text.
0.3.2 #
Connections and history #
OnDeviceAgent,OnDeviceAvailabilityandOnDeviceErrorCodeare deprecated ahead of their removal in 0.4.0. Use an AG-UI backend throughHttpAgentConnection.HttpAgentConnection(idleTimeout: ...)sets how long a run waits for response headers or the next bytes, including SSE comments. The default is 60 seconds.- AG-UI tool results sent as a list of content parts stay in the conversation history and go back to the backend unchanged. Before, Tandem dropped them.
- Each tool answer and each call without a parent message gets its own message ID. Before, reusing a tool call ID in a later run could make the backend skip the second answer.
- A response with no AG-UI events reports that the endpoint returned no events. An event whose JSON is not an object fails with a
FormatException.
Values and tool schemas #
- Tandem writes local
DateTimevalues with their UTC offset and reads date-time arguments as local time. Before, local values went out without an offset, and arguments with an offset orZcame back as UTC. - A
Uriargument must include a scheme, as its schema promises. Before, a relative URI was accepted. - A parameter or field with a doc comment keeps its type's instructions in the schema, including converter formats and how to point to an object by path.
- A view property of type
doublerejects a path to an extension type overint. Before, a property such as a price could display a value expressed in cents as an ordinary number. - The inset converters refuse a value that names the same side twice.
- When the agent list cannot encode a
.seesvalue, itsStateErrornames the getter. - The agent list throws a
StateErrorwhen an app method's tool name starts with the reservedtandem_prefix. - The
AgentCall.argumentsdelivered toonEventare read-only, including nested maps and lists. Before, changing them could change the view action note sent to the agent.
Drawn views #
- A rebuilt
TandemViewkeeps the drawn view when it receives another instance of the same catalog class. A different catalog class starts an empty view. - A required field in a drawn view keeps the latest entry made while another action runs and submits it when that action finishes. Before, those edits were lost.
- When the screen's agent list throws while drawing, the view call answers
failedand the run continues. A converter that throws unexpectedly gets a separate answer asking the agent to draw without the unreadable value. - View refusals name the template item's fields, explain list indices and report binding errors even alongside an unknown component. They omit repeated and empty hints and say when the next message will turn drawing back on.
- Before the first view is drawn, screen changes no longer make the view read and encode the agent list. A catalog conflict is reported when a run offers the view tool, once until the conflict changes.
Coding agents and scripts #
- A bridge call returns its method's answer even when another screen's agent list throws. The bridge reports the error through Flutter and includes it on that screen in
ext.tandem.describe. - A bridge call with only a known
contextselects the screen it describes. Repeated descriptions reuse the context while that screen shows the same data, and activity on other screens no longer expires it. - A repeated coding-agent call joins the pending call even when its JSON object keys arrive in a different order.
- In
testing.dart,AgentRequest.userTextreads the user's latest text,offersViewchecks whether the run can draw, andAgentStep.showViewdraws the given components.AgentRequest.newPressedActionsreads eachPressedActionwith itstool,arguments, typedToolStatus status, andanswer. - A
ScriptedAgentrun that calls an unoffered tool ends withRUN_ERRORandScriptedErrorCode.notOffered. Before, the call was silently dropped.
Sessions and package guidance #
- A session closed before it sends a message preserves the screen recorded by the last session that sent one. Closing during an approved coding-agent or view call also preserves the in-app agent's thread.
- A session stops dispatching a method if a listener releases its thread during
Calling. It also stops notifying listeners ifonEventdisposes it as a run fails to open. - All
Idle()instances compare equal and share a hash code, and so do allStopping()instances. - Runtime-only members of
AgentType,AgentView.write,AgentView.checked,AgentComponent.propertyandToolArgs.jsonare annotated@internal. The analyzer warns when an app uses them. - The README and skills guide apps to an AG-UI backend and show how to script views in the order desk. The coding-agent skill explains how to identify an unreadable screen and how to check whether a method ran before retrying it.
- The API docs explain how converter IDs distinguish configurations, when catalog actions are required, when approvals end and which arguments a call reports.
0.3.1 #
TandemThread(id: ThreadId(conversationId))sends the backend's own conversation ID with every run. A reset, such assession.startOver()or a lost connection, keeps it.ThreadId('')throws anArgumentError.- With such an ID, the next run after
session.startOver()or reopening on a changed screen first sends the calls whose answers have not gone out, with those answers. ThestartedOver,connectionLostandrunFailednotices then no longer mean a new conversation, because the backend may keep it. A thread without an ID works as before: Tandem picks one and replaces it at a reset. request.keyis anApprovalKeyfor the widget key of an approval card and for data kept per request. Copies fromwithStatus()keep it, and a later request gets a new one even when the backend repeats atoolCallId. Key cards by it instead oftoolCallId.approve,rejectandisPendingmatch a request by itskey. For a card from an earlier run whosetoolCallIdthe backend reused, or a request built withApprovalRequest(),approveandrejectthrowApprovalNotPendingunless the request has that status already. Before, they decided the pending call with the sametoolCallId, if one waited.agUiRun(input)turns the decoded events of one request into the requested run, for anAgentConnectionover another transport, such as a WebSocket. It skips replayed runs, expands text and tool-call chunks and closes at the run's end. It fails with aFormatExceptionwhen the run is missing or mixed with another.- A connection that implements
StoppableAgentConnectionhears aboutsession.stop(). The session calls itsstoponce with the run's input, unless the server ended the run already. ARUN_ERRORthen ends the stopped run quietly, and the session reports its code and message. After astopthat threw, aRUN_ERRORfails the run. - When a response ends before the requested
RUN_STARTED, a run ofHttpAgentConnectionfails with aFormatExceptionthat names the cause. The session reports it, and the chat shows a lost connection as before. A secondRUN_STARTEDor an event of another thread inside the run fails it the same way. Before, a repeatedRUN_STARTEDor an event of another thread reached the session, and aRUN_STARTEDof another run dropped the events after it. - A
RUN_ERRORwith the requestedrunIdthat comes after replayed runs fails the run with its code. Before, the run ended as a lost connection. - CI runs the tests of
tandemin Chrome, compiled to JavaScript and to WebAssembly, and builds the example for the web. - The README and the
tandem-in-app-agentskill cover app-supplied thread IDs,request.key, other transports withagUiRunandStoppableAgentConnection, and that the backend must repeatthreadIdandrunIdinRUN_STARTED.
0.3.0 #
- Breaking: Run
dart run build_runner buildagain after upgrading both packages. - Breaking: Hand-written schemas use
AgentType,AgentView.of(() => value).as(...)andAgentTool(parameters: [AgentParameter(...)]). Read JSON withAgentTool.read;ToolArgsnow provides typedreadandreadOrinstead of JSON constructors and collection readers. - Breaking: Mark an object parameter
@TandemInput()when the agent creates its value; otherwise, list the objects it may choose with.seesand pass a path to one of them. - Breaking: Write every
.seesinsideagentCapabilitiesitself and removesuperfrom that getter. - Breaking: Handle
Caller.viewin switches overCaller. - Breaking: Pass the screen's
contextfromext.tandem.describetoext.tandem.callwhen its arguments contain object paths. @TandemCatalog([...])andTandemView(catalog:)let the in-app agent draw with the app's own widgets throughtandem_show_view. Bindings follow the current.seesdata, and components whose required value or action is missing stay hidden until it returns.- A drawn view's buttons call listed methods with the session's checks and approvals, and fields pass the user's entry to methods that need none. Their answers reach
app_notesbeforeonEvent. - Views are checked before drawing, with one line per problem and the previous view kept; after three refusals,
tandem_show_viewstays off until the next message.whenUnavailableshows when the expanded view exceeds 500 components. Thinking(drawing: true)reports that the agent is drawing a view.AgentTypeshares one description between reading, writing and JSON Schema, includingUri,Set, token classes and generic classes.@TandemAgent(converters:)and@TandemCatalog(converters:)takeJsonConverter<T, S>, with built-in converters for colors, insets and alignments.tandemdepends onjson_annotationfor it.- Object paths are checked against what the run saw, and approval requests freeze their resolved arguments so the approved method gets what the request showed.
.seesentries can depend on the state or route throughif,switchand spreads, with getters kept distinct even when their values are equal or null.- A turn that only draws accepted views ends without another model run; its tool answers go with the next message.
- The README and Agent Skills cover app catalogs, object paths, converters, dynamic agent lists and a coding agent's
context.
0.2.3 #
TandemScope(thread:)goes on with aTandemThreadthat the app keeps: the chat, the history and the agent state. The newest session goes on with it, and an older one refuses calls.session.agentStatefollows the backend'sSTATE_SNAPSHOTandSTATE_DELTA, and every run sends it back as the AG-UIstate.tandemdepends onrfc_6902for it.session.note(text)tells the agent on its next run what happened in the app.session.wake()starts that run with aUserMessagewhosefromApplets a chat hide it.AgentCall.callerandApprovalRequest.callersay who called the method:Caller.inAppAgentorCaller.codingAgent.Thinking(backendTool:)names the tool of the agent's backend that runs now, such assearch_catalog.- Every run sends back the history as
@ag-ui/clientbuilds it, so LangGraph no longer reruns a turn and Pydantic AI keeps the results of its own tools. - The messages sent during a run go with the next run as one message. Before, each had a run of its own.
session.startOver()keeps the messages that never reached the agent and sends them with the next message. Before, it dropped them.- A run fails before any method runs when the backend reuses a tool call id under another name. Before, the call ran under the new name.
- The first
TOOL_CALL_CHUNKof a call keeps itsparentMessageId, asTOOL_CALL_STARTdoes. TandemBridgerefuses a call withoutscreenwhile several screens are on the current route, such as tabs, and says so. Before, it said that no screen was in front.OnDeviceAgentfails a run withOnDeviceErrorCode.unsupportedSchemawhen the system rejects a tool's schema, such as a nullable parameter on some iOS 26 versions. Before, Tandem made nullable parameters optional and tried again.ScriptedAgent.repeatingplays one turn on every run, andAgentRequestreads a run's request in a script: its context, tools, app notes and tool results.AgentListing.seengives the.seesvalues by name, andAgentListing.parameters(tool)a method's JSON Schema.- The README names Claude Code as the coding agent Tandem is checked with and marks
OnDeviceAgentexperimental. It lists what an AG-UI backend must do, with reference agents on Google ADK, LangGraph and Pydantic AI. - The Agent Skills say which names reach the agent in snake_case, and keep a headless coding agent's wait for approval in one turn.
0.2.2 #
- When the user sends several messages before a run goes out, the agent gets them as one user message, the texts joined by a blank line: ag-ui-adk passes the model only the last new user message of a run. This covers the messages queued during a run that ends with an
interruptor an outcome of the wrong shape, and a message whose run failed before it went out, such as whenagentCapabilitiesthrows. - When
tandem-coding-agentstarts the app itself, it picks the host's desktop if the project has a folder for it, such as-d macosformacos/on a Mac, and asks for a device otherwise.
0.2.1 #
TandemBridgelets a coding agent, such as Claude Code or Cursor, drive the screens of a running debug build.TandemBridge.enable()inmain()registers the VM service extensionsext.tandem.describeandext.tandem.call; a profile or release build gets none. The coding agent reaches them with thevm_servicetool of the Dart MCP server, or over HTTP at the VM service address thatflutter runprints. It sees what the in-app agent sees and calls only the listed methods.TandemBridge.describe()andTandemBridge.call()give the same JSON in a test.- A coding agent's call of a
.callsWithApprovalmethod waits for the user as anApprovalRequestinsession.items, after the in-app agent's requests.TandemBridge.enable(autoApprove: true)runs it at once instead, for automation.describeshows the last one with its answer aslastApproval, for a coding agent whose client stopped waiting. agent:ofTandemScopeis optional. Without it, the screen has no in-app agent, and a run ofsession.sendfails with a report that says so.- Three Agent Skills, installed with
dart run skills@ get --package tandem --all.tandem-agent-aware-screenis the base: it lists what the agent sees and calls, without a chat or a backend.tandem-coding-agentsets upTandemBridgeand fills a running screen.tandem-in-app-agentadds a chat or a button for the app's users.dart run skills@ getshows an update for them only when there is one. - The
/tandemskill sets up Tandem in an app: it checks the packages and hands the work to these skills. Install it from the GitHub repository withdart run skills@ add leancodepl/tandem --skill tandem.
0.2.0 #
- Breaking:
ChatNoticeKind.startedOver. AswitchoverChatNoticeKindneeds a case for it. - Breaking:
AgentRunException.codeis aRunErrorCode. Wrap a string withRunErrorCode(...)to build one. session.startOver()sends the next message to a new AG-UI thread, without the earlier history. The chat keeps its items.RunFailedhas the error'scode, aRunErrorCode: any string a backend sends. Tandem's own codes are constants by source: the session's onRunErrorCode,ScriptedAgent's onScriptedErrorCode.OnDeviceAgent.apple()runs Apple's on-device model with the same session, capabilities and approvals. The model proposes calls and Tandem runs them. Its errors areOnDeviceErrorCodeconstants, such ascontextWindowExceeded.
0.1.0 #
@TandemAgent()andagentCapabilities: the agent sees the values a state class lists with.seesand calls only the methods it lists with.callsand.callsWithApproval.TandemScope: one session of a screen with an AG-UI agent, for any state library. The state class reports its changes inchanges.HttpAgentConnectiontalks to any AG-UI endpoint, with anhttp.Clientof your own for headers such as a token. A customAgentConnectioncan take its place.- AG-UI 1.0 run outcomes: a run the backend cancels runs none of its calls, and a run that ends with an interrupt fails and the next message starts a new thread. Earlier runs that a response replays are skipped.
- Approvals with
.callback,.fromState()or.none(), one request at a time. A request is invalidated when a value listed with.seeschanges after the agent's run started, also through the agent's own calls. session.statusandonEventfor the app's own chat, buttons and messages. Tandem has no chat widget.- A method refuses a call with a message for the agent by throwing
ToolCallRefused. Any other error goes only to the app's reports, and the agent hears that the call failed. ScriptedAgentandAgentListinginpackage:tandem/testing.dart, for tests, and to try a screen without a model.- An Agent Skill for coding agents, installed with
dart run skills@ get.