Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

34 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GoLEM - Go Language Execution Model

GoLEM Logo Go Version License Build Status Coverage

A comprehensive multi-agent system with Large Language Model integration, built in Go

Features β€’ Quick Start β€’ Documentation β€’ Examples β€’ API Reference

πŸš€ Overview

GoLEM is a production-ready, scalable multi-agent system designed for modern AI applications. It provides a clean, extensible architecture for building intelligent agents that can collaborate, execute tasks, and integrate with various LLM providers.

🎯 Key Highlights

  • πŸ€– Multi-Agent Architecture: Create and orchestrate multiple specialized AI agents
  • 🧠 LLM Integration: Support for OpenAI, Anthropic, and Ollama providers
  • πŸ”§ Built-in Tools: 8+ ready-to-use tools (Calculator, Search, Wikipedia, File System, etc.)
  • πŸ’Ύ Memory Management: Multiple backends (In-Memory, Redis, PostgreSQL, SQLite)
  • 🌊 Workflow Orchestration: DAG-based task execution with dependency management
  • πŸ”Œ API Interfaces: Both REST and gRPC APIs with comprehensive endpoints
  • πŸ“Š Monitoring: Prometheus metrics, health checks, and observability
  • 🐳 Container Ready: Full Docker and Kubernetes support
  • βš™οΈ Highly Configurable: Extensive configuration options with environment variable support

✨ Features

πŸ€– Agent Management

  • Dynamic Agent Creation: Create specialized agents with custom LLM providers and tools
  • Tool Integration: Extensible tool system with built-in safety mechanisms
  • Conversation Memory: Persistent conversation history across sessions
  • Multi-Provider Support: Switch between different LLM providers seamlessly

πŸ“‹ Task & Workflow System

  • Task Builder Pattern: Fluent API for creating complex tasks
  • DAG Orchestration: Directed Acyclic Graph workflow execution
  • Priority Queue: Task prioritization and scheduling
  • Retry Mechanism: Automatic retry with exponential backoff
  • Status Tracking: Real-time task and workflow status monitoring

🧠 LLM Provider Support

  • OpenAI: GPT-4, GPT-3.5-turbo with streaming support
  • Anthropic: Claude 3 (Opus, Sonnet, Haiku) models
  • Ollama: Local model execution support
  • Streaming Responses: Real-time response streaming for all providers
  • Tool Calling: Function calling capabilities where supported

οΏ½ Built-in Tools

Tool Description Capabilities
Calculator Mathematical computations Expressions, statistics, conversions
Search Web search capabilities DuckDuckGo integration, result ranking
Wikipedia Wikipedia integration Article search, content extraction
File System File operations Read, write, list files with safety controls
HTTP HTTP requests GET, POST requests with domain restrictions
DateTime Date/time operations Current time, formatting, timezone handling
Text Text processing Analysis, transformation, validation
System System information Hardware info, process monitoring

πŸ’Ύ Memory Backends

  • In-Memory: Fast, ephemeral storage for development
  • Redis: Distributed caching with TTL support
  • PostgreSQL: Full-featured relational database backend
  • SQLite: Lightweight persistent storage
  • Search Capabilities: Full-text search across all backends

🌐 API Interfaces

REST API

  • Comprehensive Endpoints: Agents, tasks, workflows, tools, memory management
  • OpenAPI/Swagger: Auto-generated documentation
  • Authentication: JWT, API key, and OAuth2 support
  • Rate Limiting: Configurable request throttling
  • CORS Support: Cross-origin request handling

gRPC API

  • High Performance: Binary protocol for efficient communication
  • Streaming Support: Real-time bidirectional streaming
  • Type Safety: Strongly typed protobuf definitions
  • Load Balancing: Native gRPC load balancing support

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      GoLEM Architecture                     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  API Layer          β”‚  REST API  β”‚  gRPC API  β”‚  Metrics    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Core Engine        β”‚  Task Queue β”‚ Workers   β”‚  Event Bus  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Agent System       β”‚  Agents     β”‚ Tools     β”‚  Memory     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  LLM Providers      β”‚  OpenAI     β”‚ Anthropic β”‚  Ollama     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Storage Layer      β”‚  Redis      β”‚ PostgreSQLβ”‚  SQLite     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  • Task execution tracing
  • Agent performance monitoring

Quick Start

package main

import (
    "context"
    "fmt"
    "log"
    
    "github.com/astrica1/GoLEM/pkg/golem"
    "github.com/astrica1/GoLEM/pkg/agent"
    "github.com/astrica1/GoLEM/pkg/task"
    "github.com/astrica1/GoLEM/pkg/llm/openai"
)

func main() {
    // Initialize GoLEM
    engine := golem.NewEngine()
    
    // Create LLM provider
    llmProvider := openai.NewProvider("your-api-key")
    
    // Create quantum scientist agent
    quantumScientist := agent.NewAgent("quantum-scientist", agent.Config{
        Role: "You are a quantum physics researcher",
        LLMProvider: llmProvider,
        Model: "gpt-4",
    })
    
    // Create speaker agent
    speaker := agent.NewAgent("speaker", agent.Config{
        Role: "You are a professional speaker who creates engaging presentations",
        LLMProvider: llmProvider,
        Model: "gpt-4",
    })
    
    // Register agents
    engine.RegisterAgent(quantumScientist)
    engine.RegisterAgent(speaker)
    
    // Create research task
    researchTask := task.NewTask("research-quantum", task.Config{
        Description: "Research recent quantum computing breakthroughs",
        AssignedAgent: "quantum-scientist",
    })
    
    // Create presentation task
    presentationTask := task.NewTask("create-presentation", task.Config{
        Description: "Create a 2000-word presentation about quantum computing",
        AssignedAgent: "speaker",
        Dependencies: []string{"research-quantum"},
    })
    
    // Execute workflow
    workflow := engine.NewWorkflow()
    workflow.AddTask(researchTask)
    workflow.AddTask(presentationTask)
    
    result, err := workflow.Execute(context.Background())
    if err != nil {
        log.Fatal(err)
    }
    
    fmt.Println("Workflow completed:", result)
}

Architecture

GoLEM follows clean architecture principles with clear separation of concerns:

pkg/
β”œβ”€β”€ golem/          # Core engine and orchestration
β”œβ”€β”€ agent/          # Agent management and execution
β”œβ”€β”€ task/           # Task definition and management  
β”œβ”€β”€ llm/            # LLM provider integrations
β”œβ”€β”€ memory/         # Memory and storage backends
β”œβ”€β”€ tools/          # Built-in and custom tools
β”œβ”€β”€ api/            # REST and gRPC interfaces
β”œβ”€β”€ workflow/       # Workflow orchestration
└── utils/          # Utility functions

Configuration

# config.yaml
golem:
  engine:
    max_concurrent_tasks: 10
    default_timeout: "30m"
    
  llm:
    openai:
      api_key: "${OPENAI_API_KEY}"
      base_url: "https://api.openai.com/v1"
    anthropic:
      api_key: "${ANTHROPIC_API_KEY}"
    ollama:
      base_url: "http://localhost:11434"
      
  memory:
    backend: "redis"
    redis:
      addr: "localhost:6379"
      password: ""
      db: 0
      
  api:
    rest:
      port: 8080
      enable_swagger: true
    grpc:
      port: 9090
      
  monitoring:
    prometheus:
      enabled: true
      port: 2112
    logging:
      level: "info"
      format: "json"

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

License

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

About

GoLEM (Go Language Execution Model) is a robust and flexible Go library designed to streamline the development of AI agents and the orchestration of Large Language Model (LLM)-related tasks. It provides a clear and intuitive framework for defining, managing, and executing complex AI workflows directly within your Go applications.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages