This repository is for the AGiXT SDK for Dart.
Want to know more about AGiXT? Check out our documentation or GitHub page.
AGiXT SDK Documentation
Overview
The AGiXT SDK is a Dart library that provides a comprehensive set of APIs for interacting with the AGiXT platform. The SDK allows developers to create agents, manage conversations, execute commands, handle authentication, and utilize various AI capabilities including text generation, image generation, and speech processing.
Getting Started
To use the AGiXT SDK, you need to import the library and create an instance of the AGiXTSDK
class:
import 'agixt.dart';
void main() {
final agixtSDK = AGiXTSDK(
baseUri: 'http://localhost:7437',
apiKey: 'YOUR_API_KEY',
);
}
Authentication
login(String email, String otp)
: Log in with email and OTPregisterUser(String email, String firstName, String lastName)
: Register a new useruserExists(String email)
: Check if a user existsupdateUser(Map<String, dynamic> userData)
: Update user detailsgetUser()
: Get current user detailsoauth2Login(String provider, String code, {String? referrer})
: OAuth2 authentication
Agents
getAgents()
: Retrieves a list of all agentsgetAgentConfig(String agentName)
: Retrieves agent configurationaddAgent(String agentName, {Map settings, Map commands, List trainingUrls})
: Creates a new agentupdateAgentSettings(String agentName, Map settings)
: Updates agent settingsdeleteAgent(String agentName)
: Deletes an agentgetPersona(String agentName)
: Get agent's personaupdatePersona(String agentName, String persona)
: Update agent's persona
Conversations
getConversations()
: Get all conversationsgetConversationsWithIds()
: Get conversations with their IDsgetConversation(String agentName, String conversationName)
: Get specific conversationnewConversation(String agentName, String conversationName)
: Create new conversationdeleteConversation(String agentName, String conversationName)
: Delete conversationforkConversation(String conversationName, String messageId)
: Fork a conversationupdateConversationMessageById(String messageId, String newMessage, String conversationName)
: Update message by IDdeleteConversationMessageById(String messageId, String conversationName)
: Delete message by ID
AI Capabilities
generateImage(String prompt, {String model, int n, String size, String responseFormat})
: Generate imagestranscribeAudio(String file, String model, {String? language, String? prompt})
: Transcribe audio to texttranslateAudio(String file, String model, {String? prompt})
: Translate audiotextToSpeech(String agentName, String text)
: Convert text to speech
Learning & Memory
learnText(String agentName, String userInput, String text)
: Learn from textlearnUrl(String agentName, String url)
: Learn from URLlearnFile(String agentName, String fileName, String fileContent)
: Learn from filelearnGithubRepo(String agentName, String githubRepo)
: Learn from GitHub repositorylearnArxiv({String agentName, String? query, String? arxivIds})
: Learn from arXiv papersgetAgentMemories(String agentName, String userInput)
: Get agent memoriesexportAgentMemories(String agentName)
: Export memoriesimportAgentMemories(String agentName, List<Map> memories)
: Import memoriesgetUniqueExternalSources(String agentName)
: Get unique external sources
Commands & Extensions
getCommands(String agentName)
: Get available commandsexecuteCommand(String agentName, String commandName, Map commandArgs)
: Execute commandgetExtensions()
: Get all extensionsgetExtensionSettings()
: Get extension settingscreateExtension(String agentName, String extensionName, String openapiJsonUrl)
: Create new extension
Chains & Prompts
getChains()
: Get all chainsrunChain({String chainName, String userInput, String agentName})
: Run a chaingetPrompts({String promptCategory})
: Get promptsaddPrompt(String promptName, String prompt)
: Add new promptupdatePrompt(String promptName, String prompt)
: Update prompt
Training
createDataset(String agentName, String datasetName)
: Create training datasettrain({String agentName, String datasetName, String model})
: Train on dataset
Error Handling
The SDK includes comprehensive error handling:
dynamic handleError(dynamic error) {
print("Error: $error");
throw Exception("Unable to retrieve data. $error");
}
All API methods are asynchronous and return Futures. Use try-catch blocks for proper error handling:
try {
final agents = await agixtSDK.getAgents();
print(agents);
} catch (e) {
print('Error: $e');
}