AgentConfiguration class abstract

Base class for creating agent. AgentConfiguration requires following properties passed:

  • registerDataSources - List of DataSources that will be used by agent commands to perform designated tasks
  • registerSupportedCommands - List of Commands that will be supported by the agent. This should contain atleast one Command for the agent to be meanigful
  • metadata - Metadata for the agent including display name, avatar path, and list of tags associated with the agent.
  • registerSystemPrompt - System prompt for default chat mode (also known as the commandless mode) for the agent. This mode will be active by default when the agent is activated.

Agents are like bots for IDE who can do tasks that predefined in the form of Commands. This tasks can vary from code generation, code analysis, code refactoring, and many more. Agent Configuration also requires the mention of list of DataSource that can be used as a reference/knowledge for the agent to perform the tasks with proper context knowledge.

Sample example of AgentConfiguration for demonstration purpose:

class MyAgent extends AgentConfiguration {
  final docsSource = DocsDataSource();
  final blogsSource = BlogsDataSource();

  @override
  List<DataSource> get registerDataSources => [docsSource, blogsSource];

  @override
  List<Command> get registerSupportedCommands =>
      [AskCommand(docsSource: docsSource)];

  @override
  Metadata get metadata => Metadata(
    name: 'My Agent',
    avatarProfile: 'assets/images/agent_avatar.png',
    tags: ['flutter', 'dart'],
  );

  @override
  String get registerSystemPrompt => '''You are a Flutter expert who answers user queries related to the framework.

  Note:
  1. If the references don't address the question, state that "I couldn't fetch your answer from the doc sources, but I'll try to answer from my own knowledge".
  2. Be truthful, complete and detailed with your responses and include code snippets wherever required''';
}

Constructors

AgentConfiguration()

Properties

hashCode int
The hash code for this object.
no setterinherited
metadata Metadata
Metadata for agent like agent name and agent avatar can be provided using the getter. You can also share the tags related to agent that are related to agent's domain of use for better visibility in the marketplace.
no setter
registerDataSources List<DataSource>
List of DataSources that will be used by agent commands to perform designated tasks.
no setter
registerSupportedCommands List<Command>
List of Commands that will be supported by the agent. This should contain atleast one Command for the agent to be meanigful. Learn more about Command by looking at its definition.
no setter
registerSystemPrompt String
System prompt for default chat mode (also known as the commandless mode) for the agent. This mode will be active by default when the agent is activated.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited