Welcome to Dartantic!

Dartantic

Hello and welcome to Dartantic!

The dartantic_ai package is an agent framework inspired by pydantic-ai and designed to make building client and server-side apps in Dart with generative AI easier and more fun!

Why Dartantic?

Dartantic was born out of frustration with not being able to easily use generative AI in my Dart and Flutter apps without doing things in a very different way based on the model I chose and the type of app I was building, i.e. GUI, CLI or server-side. It's all Dart -- why can't I use all the models with a single API across all the apps?

As an example of the kinds of apps that I wanted to build, consider CalPal, a Flutter app that uses Dartantic to build an agentic workflow for managing a user's calendar. Check out this screenshot:

CalPal screenshot
CalPal in action

In about ~300 LOC, CalPal is able to figure out the events in my schedule based on an English phrase. To do this, it first has to figure out the local date and time to understand what "today" means anyway and then uses the result of that against the Zapier MCP server connected to my Google Calendar.

That multi-step tool usage is all built into Dartantic and it's what makes it an "agentic" framework.

Oh, and then just for fun, I asked CalPal to add a calendar event to my calendar based on a picture of the events at my local pool. I can't image the person-years of effort that would've been required to build this without generative AI, but I couldn't rest until I had that kind of power for all my Dart and Flutter apps.

Combine that with pydantic-ai for inspiration and Dartantic was born.

Enjoy!

Quick Start

Get started with dartantic_ai:

void main() async {
  // Create an agent with a model string and a system prompt
  final agent = Agent(
    'openai',  // Can also use 'openai:gpt-4o' or 'openai/gpt-4o'
    systemPrompt: 'Be concise, reply with one sentence.',
  );

  // Run the agent with a prompt (non-streaming)
  final result = await agent.run('Where does "hello world" come from?');
  print(result.output); // Output: one sentence on the origin of "hello world"
}

Getting Started

Core Features

Advanced Features

Integration & Configuration