> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dartantic.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Dartantic Overview

> Welcome to Dartantic!

The [dartantic\_ai package](https://pub.dev/packages/dartantic_ai) 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](https://github.com/csells/calpal), a Flutter app that uses Dartantic to
build an agentic workflow for managing a user's calendar. Check out this
screenshot:

<img src="https://mintcdn.com/sellsbrothersinc/-usYY2OoXYRXJ_pI/images/calpal.png?fit=max&auto=format&n=-usYY2OoXYRXJ_pI&q=85&s=d661fdb375c2e0bf26a2d552ee4b6be4" alt="CalPal screenshot" width="2346" height="1544" data-path="images/calpal.png" />

*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 imagine 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](https://ai.pydantic.dev/) for inspiration and
Dartantic was born.

Enjoy!

## What is Dartantic AI?

One API, multiple provider configurations out of the box:

* **Agentic behavior with multi-step tool calling:** Let your AI agents
  autonomously chain tool calls together to solve multi-step problems without
  human intervention.
* **Multiple Providers Out of the Box** - OpenAI, OpenAI Responses, Google,
  Anthropic, Mistral, Cohere, Ollama, OpenRouter, xAI (Grok), xAI Responses, and
  more; optional
  [`dartantic_firebase_ai`](https://pub.dev/packages/dartantic_firebase_ai) for
  Gemini via Firebase on Flutter
* **OpenAI-Compatibility** - Access to literally thousands of providers via the
  OpenAI API that nearly every single modern LLM provider implements
* **Streaming Output** - Real-time response generation
* **Typed Outputs and Tool Calling** - Uses Dart types and JSON serialization
* **Multimedia Input** - Process text, images, and files
* **Media Generation** - Stream images, PDFs, and other artifacts from OpenAI
  Responses, xAI Responses (Grok Imagine), Google Gemini (Nana Banana), and
  Anthropic code execution
* **Embeddings** - Vector generation and semantic search
* **Model Reasoning ("Thinking")** - Extended reasoning support across OpenAI
  Responses, xAI Responses, Anthropic, and Google
* **Provider-Hosted Server-Side Tools** - Web search, file search, image
  generation, and code interpreter via OpenAI Responses, xAI Responses,
  Anthropic, and Google
* **MCP Support** - Model Context Protocol server integration
* **Provider Switching** - Switch between AI providers mid-conversation
* **Production Ready**: Built-in logging, error handling, and retry handling
* **Extensible**: Easy to add custom providers as well as tools of your own or
  from your favorite MCP servers

Switch providers with one line of code. All models. Single API. Enjoy!

## Installation

```yaml theme={null}
dependencies:
  dartantic_ai: ^VERSION
```

## Quick Examples

### Basic Chat

```dart theme={null}
import 'package:dartantic_ai/dartantic_ai.dart';

final agent = Agent('claude'); // or 'openai', 'gemini', etc.
final result = await agent.send('Hello!');
print(result.output);
```

### Streaming

```dart theme={null}
await for (final chunk in agent.sendStream('Tell me a story')) {
  stdout.write(chunk.output);
}
```

### Tools

```dart theme={null}
final weatherTool = Tool(
  name: 'get_weather',
  description: 'Get weather for a location',
  inputSchema: S.object(properties: {
    'location': S.string(),
  }),
  onCall: (args) async => {'temp': 72, 'condition': 'sunny'},
);

final agent = Agent('openai', tools: [weatherTool]);
final result = await agent.send("Weather in Seattle?");
```

### Embeddings

```dart theme={null}
final agent = Agent('openai');
final embed = await agent.embedQuery('Hello world');
print(embed.embeddings.length); // 1536
```

### Multi-Provider Conversations

```dart theme={null}
final history = <ChatMessage>[];

// Start with Gemini
final gemini = Agent('google');
final result1 = await gemini.send('Hi, I\'m Alice', history: history);
history.addAll(result1.messages);

// Switch to Claude
final claude = Agent('anthropic');
final result2 = await claude.send('What\'s my name?', history: history);
print(result2.output); // "Your name is Alice"
```

## Examples

See complete working examples:

* [Basic
  chat](https://github.com/csells/dartantic_ai/blob/main/packages/dartantic_ai/example/bin/chat.dart)
* [Multi-turn
  conversations](https://github.com/csells/dartantic_ai/blob/main/packages/dartantic_ai/example/bin/multi_turn_chat.dart)
* [Tool
  calling](https://github.com/csells/dartantic_ai/blob/main/packages/dartantic_ai/example/bin/single_tool_call.dart)
* [Multi-provider
  chat](https://github.com/csells/dartantic_ai/blob/main/packages/dartantic_ai/example/bin/multi_provider.dart)
* [Agent with
  tools](https://github.com/csells/dartantic_ai/blob/main/packages/dartantic_ai/example/bin/agent.dart)

## Next Steps

* [Quick Start Guide](/quick-start)
* [Providers](/providers) - Available providers and capabilities
* [Extended Thinking](/thinking) - Surface model reasoning alongside responses
* [Server-Side Tools](/server-side-tools) - Built-in provider tools
