Skip to content

drujensen/aiagent

Repository files navigation

AIAgent

Go License: MIT

AIAgent is an open-source framework for building and interacting with AI agents. It provides a terminal user interface (TUI) and a web server, supporting multiple AI providers and a suite of powerful tools. Built with Domain-Driven Design in Go, it's modular, extensible, and easy to use.

-- NOTE: This project is in active development. Features and APIs may change frequently. It was fully developed via vibe coding with Grok. If you like it, I rock, if you don't, blame Grok. --

Features

  • Multi-Mode Interfaces:
    • Interactive Terminal User Interface (TUI) using Bubble Tea for console-based interactions.
    • Web server mode with a modern UI for browser access.
  • AI Provider Integrations: Seamless support for OpenAI, Anthropic, Google, DeepSeek, Ollama, Groq, Mistral, Together, and xAI, with easy extensibility for more.
  • Powerful Tools: Built-in tools including Bash execution, web search, file operations (read/write/search), directory management, image generation, vision capabilities, and more.
  • Storage Options: Flexible persistence with file-based or MongoDB storage.
  • Chat Management: Create, manage, and interact with multiple chat sessions, complete with message history and usage tracking.
  • Agent Configuration: Easily define agents with custom prompts, temperature settings, tools, and context windows.
  • Docker Support: Run the entire application with Docker Compose for easy deployment.
  • Testing and Best Practices: Comprehensive unit tests, error handling, and code style guidelines following Go best practices.

Installation

Using Go Install

To install the latest version:

go install github.com/drujensen/aiagent@latest

Build from Source

Clone the repository and build:

git clone https://github.com/drujensen/aiagent.git
cd aiagent
go build -o aiagent main.go

To generate Swagger API documentation:

go install github.com/swaggo/swag/cmd/swag@latest
swag init --dir ./internal/api --output ./internal/api

This generates docs.go, swagger.json, and swagger.yaml in the internal/api directory, which are used to serve the Swagger UI at http://localhost:8080/swagger/index.html when running in web server mode.

Using Docker

Copy .env.example to .env and configure as needed. Then:

docker-compose up --build

Usage

Terminal User Interface (TUI)

The TUI is the default mode for terminal use:

aiagent [--storage=file|mongo]

Navigate agents, chats, and tools interactively.

Web Server

Run the web server:

aiagent serve [--storage=file|mongo]

Access at http://localhost:8080 for a browser-based experience, including the Swagger UI at http://localhost:8080/swagger/index.html.

Examples

  • Create an Agent: Use the TUI or web UI to configure an agent with a specific AI model and tools.
  • Start a Chat: Initiate a new chat session and interact with your AI agent.
  • Use Tools: In a chat, invoke tools like web search or file read to enhance interactions.

For detailed examples, check the documentation.

Configuration

  • Storage: Use --storage=file for local JSON storage or --storage=mongo for MongoDB (configure via .env).
  • Environment Variables: Set API keys and other configs in .env (see .env.example).

Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bugfix.
  3. Commit your changes with clear messages.
  4. Push your branch and create a pull request.

For more details, see CONTRIBUTING.md (if available) or the project guidelines in AIAGENT.md.

Contributors

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Build an AI Agent using Go Language

Resources

License

Stars

Watchers

Forks

Packages

No packages published