Quickstart
In this quickstart guide, we'll walk through the process of creating a Dash Agent that answers questions based on the documentation of any library of your choice. In our case, we will choose Gemini APIs.
We'll use the Dash Agent framework available as dash_agent on pub.dev
Prerequisites
- Dart SDK installed
- Basic knowledge of Dart programming language
Create a New Project
First, let's create a new Dash Agent project using the dash_cli
tool.
-
Activate the
dash_cli
globally:dart pub global activate dash_cli
-
Create a new Dash Agent project:
dash_cli create gemini
This will setup a starter agent project with most of the basic configurations in place.
Configure the Agent
Open the newly created project in your preferred IDE or text editor.
-
Open the
lib
folder. -
In the
lib/data_sources.dart
- add the sitemap of the documentation in the Data Source:class DocsDataSource extends DataSource { @override List<FileDataObject> get fileObjects => []; @override List<ProjectDataObject> get projectObjects => []; @override List<WebDataObject> get webObjects => [ // [Add the sitemap link] WebDataObject.fromSiteMap('https://ai.google.dev/sitemap_0_of_1.xml'), ]; }
Note - You can use this Sitemap Finder to find the sitemap of a website. We are also working on adding support for sites that don't have a map.
-
In
lib/agent.dart
, update theAgentConfiguration
to register the necessary data sources and commands:class MyAgent extends AgentConfiguration { final docsDataSource = DocsDataSource(); @override // [Replace your agent name and optionally provide an avatar and tags] Metadata get metadata => Metadata( name: 'Gemini', avatarProfile: null, tags: []); @override // [Set a detailed persona for your agent] String get registerSystemPrompt => '''You are a Gemini assistant. Help users with their queries to add Gemini to their apps'''; @override List<DataSource> get registerDataSources => [docsDataSource]; @override List<Command> get registerSupportedCommands => [ // AskCommand(docsSource: docsDataSource) ]; }
The agent is now configured to answer queries based on the documentation.
Publish the Agent
Dash Agents can be published in the marketplace to be installed by anyone.
Before publishing the agent in live, it is recommended to first try it yourself by publish it as a test agent.
-
Run the following command to start the agent in test mode:
dash_cli publish --test
-
Open the CommandDash client (e.g., VS Code extension) and install the
gemini
agent from the marketplace.
![Open Marketplace with the `@` icon on the top right.](/_next/image?url=https%3A%2F%2Fraw.githubusercontent.com%2FCommandDash%2Fpackages%2Fdevelop%2Fdash_agent%2Fassets%2Fmarketplace-icon.png&w=1920&q=75)
- In your Dash window, activate the agent by typing
@
andgemini
and selecting it from the dropdown.
![Rendered textFieldLayout in the Dash Panel](/_next/image?url=%2Fimages%2Fdocs%2Factivated-gemini.png&w=1920&q=75)
- Next, you can publish the live agent on the marketplace for everyone to install.
dash_cli publish
Visit our agents repository to check source code of some available agents on marketplace.