Migrating from 0.9.7 to 1.0.0
This release went through a major refactoring to support many more providers for both chat and embeddings, as well as to support more features. The API is different in a lot of tiny ways, but the core concepts remain largely the same. This is a list of changes (some of them breaking) to help you migrate. And as long as this list is, I’m sure I’ve missed some. If you find something that’s not here, please let me know!Dynamic => Static Provider instances
Provider instances are now static, so you can use theProviders class to get
them by name or alias:
providerMap property of the Providers class:
Agent.runXxx => Agent.sendXxx
TheAgent.runXxx methods have been renamed for consistency with chat models
and the new Chat class:
Agent.provider => Agent.forProvider
TheAgent.provider constructor has been renamed to Agent.forProvider for
clarity:
Message => ChatMessage
TheMessage type has been renamed to ChatMessage for consistency with chat
models:
toSchema => JsonSchema.create
ThetoSchema method has been dropped in favor of the built-in
JsonSchema.create method for simplicity:
systemPrompt + Message.system() => ChatMessage.system()
ThesystemPrompt parameter has been removed from Agent and model constructors.
It was confusing to have both a system prompt and a system message, so I’ve
simplified the implementation to use just an optional ChatMessage.system()
instead. In practice, you’ll want to keep the system message in the history
anyway, so think of this as a “pit of success” thing:
Agent chat and streaming
The agent now streams new messages as they’re created along with the output:Chat class to collect messages for you:
DataPart.file(File) => DataPart.fromFile(XFile)
TheDataPart.file constructor has been replaced with DataPart.fromFile to
support cross-platform file handling, i.e. the web:
Model String Format Enhanced
The model string format has been enhanced to support chat, embeddings and other model names using custom relative URI. This was important to be able to specify the model for chat and embeddings separately:Agent.embedXxx
The agent gets newAgent.embedXxx methods for creating embeddings for
documents and queries:
cosineSimilarity method has been moved to the EmbeddingsModel.
Automatic Retry
The agent now supports automatic retry for rate limits and failures:Agent<TOutput>(outputSchema) => sendForXxx<TOutput>(outputSchema)
Instead of putting the output schema on theAgent class, it’s now on the
sendForXxx method:
AgentResponse to ChatResult<MyType>
The AgentResponse type has been renamed to ChatResult.
DotPrompt Support Removed
The dependency on the dotprompt_dart package has been removed from dartantic_ai. However, you can still use theDotPrompt class to parse
.prompt files:
Tool Calls with Typed Output
TheAgent.sendForXxx method now supports specifying the output type of the
tool call:
ChatMessage Part Helpers
TheChatMessage class has been enhanced with helpers for extracting specific
types of parts from a list:
Usage Tracking
The agent now supports usage tracking:Logging
The agent now supports logging:Migrating from 0.9.6 to 0.9.7
Breaking Change: DataPart.file → DataPart.stream
TheDataPart.file constructor has been removed and replaced with
DataPart.stream for file and image attachments. This change was made to enable
compatibility with web and WASM platforms, where direct file access is not
available.
What you need to do
- Replace all usages of
DataPart.file(File(...))withawait DataPart.stream(file.openRead(), name: file.path). - Always provide a
nameargument for best results (especially for web/WASM).
Before (0.9.6 and earlier)
After (0.9.7 and later)
Why?
- This approach works on all Dart platforms, including web and WASM, by using streams instead of direct file APIs.
- It also makes it easier to support file uploads from sources other than the local filesystem.

