### Start Agno-Go Full Stack with Docker Compose Source: https://github.com/rexleimo/agno-go/blob/main/website/zh/guide/installation.md Sets up and starts the complete Agno-Go stack using Docker Compose. This includes the AgentOS server, PostgreSQL, Redis, and optionally ChromaDB and Ollama. Before starting, you need to copy and edit the `.env.example` file to include your API keys. ```bash # Copy environment template cp .env.example .env # Edit .env and add your API keys nano .env # Start all services docker-compose up -d ``` -------------------------------- ### Build Agno-Go Examples Source: https://github.com/rexleimo/agno-go/blob/main/website/guide/installation.md Commands to build and run example applications included in the Agno-Go project. This is useful for understanding how to use the library's features. ```bash # Build all examples make build # Run specific example ./bin/simple_agent ``` -------------------------------- ### Install Agno-Go by Cloning Repository Source: https://github.com/rexleimo/agno-go/blob/main/website/guide/quick-start.md Installs Agno-Go by cloning the repository and downloading dependencies. This method is useful if you want to access the source code or contribute to the project. Requires Git and Go 1.21+. ```bash git clone https://github.com/rexleimo/agno-Go.git cd agno-Go go mod download ``` -------------------------------- ### Clone Agno-Go Repository and Setup Source: https://github.com/rexleimo/agno-go/blob/main/website/guide/installation.md Clones the Agno-Go repository from GitHub, navigates into the directory, downloads dependencies using Go modules, and verifies the installation by running tests. ```bash # Clone repository git clone https://github.com/rexleimo/agno-Go.git cd agno-Go # Download dependencies go mod download # Verify installation go test ./... ``` -------------------------------- ### Run Go Agent Examples Source: https://github.com/rexleimo/agno-go/blob/main/website/guide/quick-start.md Executes various example agents using Go. These examples demonstrate different functionalities like simple agents, using specific models (Anthropic Claude), local models (Ollama), multi-agent teams, workflow engines, and RAG with ChromaDB. ```bash # Simple agent with calculator go run cmd/examples/simple_agent/main.go # Anthropic Claude go run cmd/examples/claude_agent/main.go # Local models with Ollama go run cmd/examples/ollama_agent/main.go # Multi-agent team go run cmd/examples/team_demo/main.go # Workflow engine go run cmd/examples/workflow_demo/main.go # RAG with ChromaDB go run cmd/examples/rag_demo/main.go ``` -------------------------------- ### Clone Agno-Go Repository and Download Dependencies Source: https://github.com/rexleimo/agno-go/blob/main/docs/QUICK_START.md This sequence clones the Agno-Go repository and downloads its dependencies. It is useful for development or if you need to access the source code directly. Ensure you have Git installed. ```bash git clone https://github.com/rexleimo/agno-go.git cd agno-Go go mod download ``` -------------------------------- ### Go: Server Creation Template Source: https://github.com/rexleimo/agno-go/blob/main/docs/QUICK_START.md A template for creating and starting an AgentOS server in Go. It shows how to configure the server address and debug mode, register an agent, and then start the server. ```go server, err := agentos.NewServer(&agentos.Config{ Address: ":8080", Debug: true, }) server.RegisterAgent("agent-id", agent) server.Start() ``` -------------------------------- ### Create a Multi-Agent Team in Go Source: https://github.com/rexleimo/agno-go/blob/main/docs/QUICK_START.md Go program demonstrating the creation of a multi-agent team using Agno-Go. This example sets up a 'Content Team' with 'Researcher' and 'Writer' agents that operate sequentially. ```go package main import ( "context" "fmt" "log" "os" "github.com/rexleimo/agno-go/pkg/agno/agent" "github.com/rexleimo/agno-go/pkg/agno/models/openai" "github.com/rexleimo/agno-go/pkg/agno/team" ) func main() { model, _ := openai.New("gpt-4o-mini", openai.Config{ APIKey: os.Getenv("OPENAI_API_KEY"), }) // Create researcher agent researcher, _ := agent.New(agent.Config{ Name: "Researcher", Model: model, Instructions: "You are a research specialist. Gather information.", }) // Create writer agent writer, _ := agent.New(agent.Config{ Name: "Writer", Model: model, Instructions: "You are a writing specialist. Create compelling content.", }) // Create team tm, _ := team.New(team.Config{ Name: "Content Team", Agents: []*agent.Agent{researcher, writer}, Mode: team.ModeSequential, // Researcher → Writer }) // Run team output, err := tm.Run(context.Background(), "Write a short article about Go programming") if err != nil { log.Fatal(err) } fmt.Println(output.Content) } ``` -------------------------------- ### PostgreSQL Database Setup Source: https://github.com/rexleimo/agno-go/blob/main/docs/DEPLOYMENT.md Provides commands for installing PostgreSQL on Ubuntu/Debian and macOS, and running it via Docker. Includes instructions for initializing the database using psql or Docker, and verifying the setup. ```bash # Ubuntu/Debian sudo apt-get install postgresql-15 # macOS brew install postgresql@15 # Docker docker run -d \ --name postgres \ -e POSTGRES_USER=agno \ -e POSTGRES_PASSWORD=secure_password \ -e POSTGRES_DB=agentos \ -p 5432:5432 \ postgres:15-alpine # Using psql psql -h localhost -U agno -d agentos -f scripts/init-db.sql # Or using Docker docker exec -i postgres psql -U agno -d agentos < scripts/init-db.sql psql -h localhost -U agno -d agentos -c "\dt" ``` -------------------------------- ### Install Development Tools for Agno-Go Source: https://github.com/rexleimo/agno-go/blob/main/website/zh/guide/installation.md Installs essential development tools for Agno-Go, including `golangci-lint` for code linting and `goimports` for code formatting. Alternatively, the `make install-tools` command can be used to install these dependencies. ```bash # Install golangci-lint (linter) go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest # Install goimports (formatter) go install golang.org/x/tools/cmd/goimports@latest # Or use Make: # make install-tools ``` -------------------------------- ### Install Agno-Go using Go Get Source: https://github.com/rexleimo/agno-go/blob/main/website/zh/guide/installation.md Installs Agno-Go as a Go module dependency. This is the recommended method for integrating Agno-Go into your Go projects. After installation, you can import the necessary packages into your code. ```bash go get github.com/rexleimo/agno-Go ``` ```go import ( "github.com/rexleimo/agno-Go/pkg/agno/agent" "github.com/rexleimo/agno-Go/pkg/agno/models/openai" ) ``` -------------------------------- ### Quick Start: Create and Run an Agent with OpenAI and Calculator Tool (Go) Source: https://github.com/rexleimo/agno-go/blob/main/release_notes/RELEASE_NOTES_v1.0.0.md Demonstrates how to initialize an agent using the OpenAI model and equip it with the Calculator tool. This example requires an OpenAI API key and the 'go get' command for dependencies. It shows basic agent instantiation and running a query. ```go package main import ( "context" "fmt" "log" "github.com/rexleimo/agno-go/pkg/agno/agent" "github.com/rexleimo/agno-go/pkg/agno/models/openai" "github.com/rexleimo/agno-go/pkg/agno/tools/calculator" "github.com/rexleimo/agno-go/pkg/agno/tools/toolkit" ) func main() { // Create model model, err := openai.New("gpt-4o-mini", openai.Config{ APIKey: "your-api-key", }) if err != nil { log.Fatal(err) } // Create agent with tools ag, err := agent.New(agent.Config{ Name: "Assistant", Model: model, Toolkits: []toolkit.Toolkit{calculator.New()}, }) if err != nil { log.Fatal(err) } // Run agent output, err := ag.Run(context.Background(), "What is 25 * 4 + 15?") if err != nil { log.Fatal(err) } fmt.Println(output.Content) // Output: 115 } ``` -------------------------------- ### Clone Repository, Set API Key, and Run Example in Bash Source: https://github.com/rexleimo/agno-go/blob/main/website/index.md Provides shell commands to get started with the Agno-Go project. It includes cloning the repository, navigating into the directory, setting the OpenAI API key as an environment variable, and running a simple agent example. This snippet is for quick setup and testing. ```bash # Clone repository git clone https://github.com/rexleimo/agno-Go.git cd agno-Go # Set API key export OPENAI_API_KEY=sk-your-key-here # Run example go run cmd/examples/simple_agent/main.go # Or start AgentOS server docker-compose up -d curl http://localhost:8080/health ``` -------------------------------- ### Setup Agno-Go Workflow Environment Source: https://github.com/rexleimo/agno-go/blob/main/website/examples/workflow-demo.md Sets up the necessary environment variables and navigates to the example directory for the Agno-Go workflow demo. Requires Go 1.21+ and an OpenAI API key. ```bash export OPENAI_API_KEY=sk-your-api-key-here cd cmd/examples/workflow_demo ``` -------------------------------- ### Local Development Setup | npm Install and Dev Server Source: https://github.com/rexleimo/agno-go/blob/main/docs/VITEPRESS.md Commands to install project dependencies using npm and start the VitePress development server for local testing. Ensure Node.js 18+ is installed. ```bash # Install dependencies | 安装依赖 npm install # Start dev server | 启动开发服务器 npm run docs:dev # Visit http://localhost:5173 ``` -------------------------------- ### Install Go on Linux using Package Managers Source: https://github.com/rexleimo/agno-go/blob/main/website/zh/guide/installation.md Provides commands for installing Go on various Linux distributions using their respective package managers. This includes instructions for Ubuntu/Debian, Fedora, and Arch Linux. ```bash # Ubuntu/Debian sudo apt-get update sudo apt-get install golang-go # Fedora sudo dnf install golang # Arch sudo pacman -S go ``` -------------------------------- ### Quick Start Bash Commands (Bash) Source: https://github.com/rexleimo/agno-go/blob/main/website/zh/index.md Provides essential bash commands for getting started with the Agno-Go project. It covers cloning the repository, setting up an API key environment variable, running a simple agent example, and starting the AgentOS server using Docker Compose. ```bash # 克隆仓库 git clone https://github.com/rexleimo/agno-Go.git cd agno-Go # 设置 API 密钥 export OPENAI_API_KEY=sk-your-key-here # 运行示例 go run cmd/examples/simple_agent/main.go # 或启动 AgentOS 服务器 docker-compose up -d curl http://localhost:8080/health ``` -------------------------------- ### Quick Start with Docker Compose Source: https://github.com/rexleimo/agno-go/blob/main/website/zh/advanced/deployment.md This snippet provides a quick start guide to deploying AgentOS using Docker Compose. It involves cloning the repository, configuring environment variables by copying and editing a .env file, starting the services with `docker-compose up -d`, and verifying the deployment by checking the health endpoint. ```bash # 1. 克隆仓库 / Clone repository git clone https://github.com/rexleimo/agno-Go.git cd agno-Go # 2. 配置环境 / Configure environment cp .env.example .env nano .env # Add your API keys # 3. 启动服务 / Start services docker-compose up -d # 4. 验证 / Verify curl http://localhost:8080/health ``` -------------------------------- ### Quick Start with Docker Compose Source: https://github.com/rexleimo/agno-go/blob/main/website/advanced/deployment.md This snippet outlines the recommended quick start for deploying AgentOS using Docker Compose. It involves cloning the repository, configuring environment variables, starting the services, and verifying the deployment via a health check. ```bash # 1. Clone repository git clone https://github.com/rexleimo/agno-Go.git cd agno-Go # 2. Configure environment cp .env.example .env nano .env # Add your API keys # 3. Start services docker-compose up -d # 4. Verify curl http://localhost:8080/health ``` -------------------------------- ### Install Agno-Go using Go Get Source: https://github.com/rexleimo/agno-go/blob/main/website/guide/installation.md Installs Agno-Go as a Go module dependency using the 'go get' command. This is the recommended method for integrating Agno-Go into your Go projects. ```bash go get github.com/rexleimo/agno-Go ``` -------------------------------- ### Install and Run Agno-Go Docs Locally Source: https://github.com/rexleimo/agno-go/blob/main/website/README.md Commands to install project dependencies, start the development server with hot reload, build for production, and preview the production build for the Agno-Go documentation site. ```bash # Install dependencies npm install # Start dev server npm run docs:dev # Build for production npm run docs:build # Preview production build npm run docs:preview ``` -------------------------------- ### Create and Register an Agent Server in Go Source: https://github.com/rexleimo/agno-go/blob/main/docs/QUICK_START.md Go program to create an AI agent using an OpenAI model, register it with an agentOS server, and start the server. Handles graceful shutdown. ```go package main import ( "context" "log" "os" "os/signal" "syscall" "time" "github.com/rexleimo/agno-go/pkg/agno/agent" "github.com/rexleimo/agno-go/pkg/agno/models/openai" "github.com/rexleimo/agno-go/pkg/agentos" ) func main() { // Create model model, err := openai.New("gpt-4o-mini", openai.Config{ APIKey: os.Getenv("OPENAI_API_KEY"), }) if err != nil { log.Fatal(err) } // Create agent ag, err := agent.New(agent.Config{ Name: "Assistant", Model: model, Instructions: "You are a helpful assistant.", }) if err != nil { log.Fatal(err) } // Create server server, err := agentos.NewServer(&agentos.Config{ Address: ":8080", Debug: true, }) if err != nil { log.Fatal(err) } // Register agent if err := server.RegisterAgent("assistant", ag); err != nil { log.Fatal(err) } // Start server go func() { if err := server.Start(); err != nil { log.Printf("Server error: %v", err) } }() log.Println("Server started on :8080") log.Println("Try: curl -X POST http://localhost:8080/api/v1/agents/assistant/run -H 'Content-Type: application/json' -d '{\"input\":\"Hello\"}'") // Wait for interrupt quit := make(chan os.Signal, 1) signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM) <-quit log.Println("Shutting down...") ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() server.Shutdown(ctx) } ``` -------------------------------- ### Build and Run Agno-Go Server Source: https://github.com/rexleimo/agno-go/blob/main/docs/QUICK_START.md Commands to build and run the Agno-Go agent server. Requires setting the OPENAI_API_KEY environment variable. ```bash go build -o agentos cmd/server/main.go export OPENAI_API_KEY=sk-your-key ./agentos ``` -------------------------------- ### Bash Command for Running an Example Source: https://github.com/rexleimo/agno-go/blob/main/docs/DEVELOPMENT.md This bash command runs a compiled example application, specifically `./bin/simple_agent`. After building the project, this command allows you to execute a particular example binary to test its functionality or observe its behavior. ```bash ./bin/simple_agent ``` -------------------------------- ### Download Ollama for Windows Source: https://github.com/rexleimo/agno-go/blob/main/website/ja/examples/ollama-agent.md Provides instructions for downloading the Ollama installer for Windows operating systems. Users should navigate to the official Ollama download page to obtain the installer. ```html ollama.ai/download ``` -------------------------------- ### Local Documentation Preview (NPM) Source: https://github.com/rexleimo/agno-go/blob/main/docs/DEVELOPMENT.md These npm commands are used to preview the VitePress documentation locally. `npm install` installs dependencies, `npm run docs:dev` starts a development server, and `npm run docs:build` followed by `npm run docs:preview` builds and previews the production version. ```bash npm install npm run docs:dev npm run docs:build npm run docs:preview ``` -------------------------------- ### Import Agno-Go Packages in Go Source: https://github.com/rexleimo/agno-go/blob/main/website/guide/installation.md Demonstrates how to import necessary Agno-Go packages, specifically for agent and OpenAI model integration, after installation. ```go import ( "github.com/rexleimo/agno-Go/pkg/agno/agent" "github.com/rexleimo/agno-Go/pkg/agno/models/openai" ) ``` -------------------------------- ### Test Ollama Installation (Bash) Source: https://github.com/rexleimo/agno-go/blob/main/website/ja/examples/ollama-agent.md Verifies the Ollama installation by running a sample command using a pulled model, such as `llama2`. This command interacts with the local Ollama server to get a response. ```bash # モデルをテスト ollama run llama2 "Hello, how are you?" ``` -------------------------------- ### Go: Using Context with Timeout Source: https://github.com/rexleimo/agno-go/blob/main/docs/QUICK_START.md Demonstrates how to create a context with a timeout in Go using `context.WithTimeout`. This is crucial for managing the lifecycle of requests and preventing indefinite hangs. ```go ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) deferr cancel() output, err := ag.Run(ctx, input) ``` -------------------------------- ### Bash: Install Ollama Source: https://github.com/rexleimo/agno-go/blob/main/website/examples/ollama-agent.md Installs Ollama on macOS and Linux systems using a curl command. For Windows, users should download the installer from the official Ollama website. ```bash curl -fsSL https://ollama.ai/install.sh | sh ``` -------------------------------- ### Go: Common Agno Imports Source: https://github.com/rexleimo/agno-go/blob/main/docs/QUICK_START.md A collection of frequently used imports for the Agno-Go library, covering agent, models, tools, team, workflow, and agentos functionalities. ```go import ( "github.com/rexleimo/agno-go/pkg/agno/agent" "github.com/rexleimo/agno-go/pkg/agno/models/openai" "github.com/rexleimo/agno-go/pkg/agno/tools/calculator" "github.com/rexleimo/agno-go/pkg/agno/team" "github.com/rexleimo/agno-go/pkg/agno/workflow" "github.com/rexleimo/agno-go/pkg/agentos" ) ``` -------------------------------- ### Starting Ollama Server (Bash) Source: https://github.com/rexleimo/agno-go/blob/main/cmd/examples/ollama_agent/README.md Command to start the Ollama local server. Once running, it will be accessible at `http://localhost:11434` by default, allowing applications to interact with the downloaded models. ```bash ollama serve ``` -------------------------------- ### Start AgentOS Server using Docker Compose Source: https://github.com/rexleimo/agno-go/blob/main/docs/QUICK_START.md This command sequence starts the AgentOS HTTP server using Docker Compose. It involves copying an environment file, configuring it with your API key (e.g., OPENAI_API_KEY), and then launching the server in detached mode. It also includes a command to check the server's health. ```bash # Copy environment template cp .env.example .env # Edit .env and add your API key nano .env # Add: OPENAI_API_KEY=sk-your-key # Start server docker-compose up -d # Check health curl http://localhost:8080/health ``` -------------------------------- ### Install Go Development Tools Source: https://github.com/rexleimo/agno-go/blob/main/website/guide/installation.md Installs essential Go development tools like 'golangci-lint' for code linting and 'goimports' for code formatting. These tools help maintain code quality. ```bash # Install golangci-lint (linter) go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest # Install goimports (formatter) go install golang.org/x/tools/cmd/goimports@latest ``` -------------------------------- ### Start AgentOS with Docker Compose (Bash) Source: https://github.com/rexleimo/agno-go/blob/main/docs/DEPLOYMENT.md Starts AgentOS and its dependencies (PostgreSQL, Redis) using Docker Compose. Optional services like Ollama and ChromaDB can be included using profiles. ```bash # Start core services (AgentOS + PostgreSQL + Redis) docker-compose up -d # Or with optional services (Ollama + ChromaDB) docker-compose --profile with-ollama --profile with-vectordb up -d ``` -------------------------------- ### Run AgentOS Server Source: https://github.com/rexleimo/agno-go/blob/main/website/guide/quick-start.md This snippet shows how to set the OpenAI API key environment variable and then run the AgentOS server executable. Ensure the API key is valid before execution. ```bash export OPENAI_API_KEY=sk-your-key ./agentos ``` -------------------------------- ### VS Code Extensions for Agno-Go Source: https://github.com/rexleimo/agno-go/blob/main/website/guide/installation.md A JSON configuration snippet for VS Code 'recommendations' to install the official Go extension and the Docker extension, which are beneficial for developing with Agno-Go. ```json { "recommendations": [ "golang.go", "ms-azuretools.vscode-docker" ] } ``` -------------------------------- ### Run Agent API Source: https://github.com/rexleimo/agno-go/blob/main/website/guide/quick-start.md Executes an agent with the provided input. ```APIDOC ## POST /api/v1/agents/assistant/run ### Description Executes an agent with the provided input and returns the agent's response. ### Method POST ### Endpoint /api/v1/agents/assistant/run ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **input** (string) - Required - The input string to be processed by the agent. ### Request Example ```json { "input": "What is 2+2?" } ``` ### Response #### Success Response (200) - **content** (string) - The output content from the agent. - **metadata** (object) - Additional metadata about the agent's execution. - **agent_id** (string) - The unique identifier of the agent. #### Response Example ```json { "content": "2 + 2 equals 4.", "metadata": { "agent_id": "assistant" } } ``` ``` -------------------------------- ### Bash: Download Go Modules and Tidy Source: https://github.com/rexleimo/agno-go/blob/main/docs/QUICK_START.md Commands to manage Go module dependencies. `go mod download` fetches the required modules, and `go mod tidy` adds missing and removes unused modules. ```bash go mod download go mod tidy ``` -------------------------------- ### PostgreSQL Database Setup with Docker Source: https://github.com/rexleimo/agno-go/blob/main/website/advanced/deployment.md Instructions for setting up a PostgreSQL database using Docker, including naming the container, setting the password and database name, and exposing the port. It also shows how to export the connection URL. ```bash # Using Docker docker run -d \ --name postgres \ -e POSTGRES_PASSWORD=password \ -e POSTGRES_DB=agentos \ -p 5432:5432 \ postgres:15 # Connect export DATABASE_URL=postgresql://postgres:password@localhost:5432/agentos ``` -------------------------------- ### Bash: Verify Ollama Installation Source: https://github.com/rexleimo/agno-go/blob/main/website/examples/ollama-agent.md Tests the Ollama installation by running a model with a simple prompt. This command verifies that the server is running and can process requests. ```bash # Test the model ollama run llama2 "Hello, how are you?" ``` -------------------------------- ### Create Session API Source: https://github.com/rexleimo/agno-go/blob/main/docs/QUICK_START.md Creates a new chat session for an agent. ```APIDOC ## POST /api/v1/sessions ### Description Creates a new chat session for an agent. ### Method POST ### Endpoint /api/v1/sessions ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **agent_id** (string) - Required - The ID of the agent for which to create a session. - **user_id** (string) - Required - The ID of the user initiating the session. - **name** (string) - Required - The name of the session. ### Request Example ```json { "agent_id": "assistant", "user_id": "user-123", "name": "My Chat Session" } ``` ### Response #### Success Response (200) - **session_id** (string) - The unique identifier for the newly created session. - **agent_id** (string) - The ID of the agent associated with the session. - **user_id** (string) - The ID of the user who created the session. - **name** (string) - The name of the session. - **created_at** (string) - The timestamp when the session was created (ISO 8601 format). - **updated_at** (string) - The timestamp when the session was last updated (ISO 8601 format). #### Response Example ```json { "session_id": "550e8400-e29b-41d4-a716-446655440000", "agent_id": "assistant", "user_id": "user-123", "name": "My Chat Session", "created_at": "2025-10-02T00:00:00Z", "updated_at": "2025-10-02T00:00:00Z" } ``` ``` -------------------------------- ### Run Agno-Go Test Program Source: https://github.com/rexleimo/agno-go/blob/main/website/guide/installation.md Commands to set the OpenAI API key and then execute the Go test program. This verifies the integration of the Agno-Go package. ```bash export OPENAI_API_KEY=sk-your-key go run test.go ``` -------------------------------- ### Go: Common AgentOS Imports Source: https://github.com/rexleimo/agno-go/blob/main/website/guide/quick-start.md Lists the essential packages to import when working with the AgentOS library in Go. These imports provide access to agent, model, tool, team, and workflow functionalities. ```go import ( "github.com/rexleimo/agno-Go/pkg/agno/agent" "github.com/rexleimo/agno-Go/pkg/agno/models/openai" "github.com/rexleimo/agno-Go/pkg/agno/tools/calculator" "github.com/rexleimo/agno-Go/pkg/agno/team" "github.com/rexleimo/agno-Go/pkg/agno/workflow" "github.com/rexleimo/agno-Go/pkg/agentos" ) ``` -------------------------------- ### Environment Variable Configuration for AgentOS Source: https://github.com/rexleimo/agno-go/blob/main/docs/DEPLOYMENT.md Instructions for copying the example .env file, editing it with nano, and securing the file by setting permissions and ownership. Includes commands to validate required variables and test the configuration. ```bash cp .env.example .env nano .env chmod 600 .env chown agentos:agentos .env # Check required variables grep -E "^(OPENAI_API_KEY|ANTHROPIC_API_KEY)" .env # Test connection ./agentos --validate-config ``` -------------------------------- ### Go: Agent Creation Template Source: https://github.com/rexleimo/agno-go/blob/main/website/guide/quick-start.md A template for creating an agent in Go using the AgentOS library. It shows how to initialize a model (e.g., OpenAI), configure an agent with name, model, tools, instructions, and max loops, and then run it with a given input. ```go model, err := openai.New("gpt-4o-mini", openai.Config{ APIKey: os.Getenv("OPENAI_API_KEY"), }) ag, err := agent.New(agent.Config{ Name: "Agent Name", Model: model, Toolkits: []toolkit.Toolkit{/* tools */}, Instructions: "System instructions", MaxLoops: 10, }) output, err := ag.Run(context.Background(), "input") ``` -------------------------------- ### Bash: Enable Debug Logging Source: https://github.com/rexleimo/agno-go/blob/main/docs/QUICK_START.md Commands to enable debug logging for AgentOS by setting the AGENTOS_DEBUG and LOG_LEVEL environment variables. ```bash export AGENTOS_DEBUG=true export LOG_LEVEL=debug ``` -------------------------------- ### Bash Command for Building Examples Source: https://github.com/rexleimo/agno-go/blob/main/docs/DEVELOPMENT.md This bash command executes the 'make build' target, which is responsible for compiling the example applications or binaries within the project. This allows developers to create executable versions of the project's features for testing or demonstration purposes. ```bash make build ``` -------------------------------- ### Interact with Agno-Go API - Run Agent Source: https://github.com/rexleimo/agno-go/blob/main/docs/QUICK_START.md Execute an agent on the Agno-Go server with a JSON payload containing user input. Uses cURL for the POST request. ```bash curl -X POST http://localhost:8080/api/v1/agents/assistant/run \ -H "Content-Type: application/json" \ -d '{ "input": "What is 2+2?" }' ``` -------------------------------- ### Create a Simple Go Agent with OpenAI Source: https://github.com/rexleimo/agno-go/blob/main/website/guide/quick-start.md Demonstrates how to create a basic AI agent using Go and the OpenAI API. This agent can respond to simple text prompts. Requires an OpenAI API key set as an environment variable (OPENAI_API_KEY) and Go 1.21+. ```go package main import ( "context" "fmt" "log" "os" "github.com/rexleimo/agno-Go/pkg/agno/agent" "github.com/rexleimo/agno-Go/pkg/agno/models/openai" ) func main() { // Get API key from environment apiKey := os.Getenv("OPENAI_API_KEY") if apiKey == "" { log.Fatal("OPENAI_API_KEY environment variable is required") } // Create OpenAI model model, err := openai.New("gpt-4o-mini", openai.Config{ APIKey: apiKey, }) if err != nil { log.Fatalf("Failed to create model: %v", err) } // Create agent ag, err := agent.New(agent.Config{ Name: "Assistant", Model: model, Instructions: "You are a helpful assistant.", }) if err != nil { log.Fatalf("Failed to create agent: %v", err) } // Run agent output, err := ag.Run(context.Background(), "What is the capital of France?") if err != nil { log.Fatalf("Agent run failed: %v", err) } fmt.Println("Agent:", output.Content) } ``` -------------------------------- ### Interact with Agno-Go API - Create Session Source: https://github.com/rexleimo/agno-go/blob/main/docs/QUICK_START.md Create a new chat session with a specified agent and user ID on the Agno-Go server using cURL. The response includes session details. ```bash curl -X POST http://localhost:8080/api/v1/sessions \ -H "Content-Type: application/json" \ -d '{ "agent_id": "assistant", "user_id": "user-123", "name": "My Chat Session" }' ``` -------------------------------- ### Manage Docker Compose Profiles (Bash) Source: https://github.com/rexleimo/agno-go/blob/main/docs/DEPLOYMENT.md Demonstrates how to start AgentOS with different sets of services using Docker Compose profiles. Profiles allow selective enabling of services like Ollama and ChromaDB. ```bash # Core services only (default) docker-compose up -d # With local Ollama docker-compose --profile with-ollama up -d # With ChromaDB vector database docker-compose --profile with-vectordb up -d # All services docker-compose --profile with-ollama --profile with-vectordb up -d ``` -------------------------------- ### Interact with Agno-Go API - Run Agent with Session Source: https://github.com/rexleimo/agno-go/blob/main/docs/QUICK_START.md Run an agent within an existing session on the Agno-Go server. Subsequent calls with the same session ID maintain conversation context. ```bash curl -X POST http://localhost:8080/api/v1/agents/assistant/run \ -H "Content-Type: application/json" \ -d '{ "input": "My name is Alice", "session_id": "550e8400-e29b-41d4-a716-446655440000" }' # Later, in the same session... curl -X POST http://localhost:8080/api/v1/agents/assistant/run \ -H "Content-Type: application/json" \ -d '{ "input": "What is my name?", "session_id": "550e8400-e29b-41d4-a716-446655440000" }' ``` -------------------------------- ### Bash: Configure AgentOS Address Source: https://github.com/rexleimo/agno-go/blob/main/docs/QUICK_START.md Example of how to change the AGENTOS_ADDRESS environment variable to modify the server's listening port. This is useful for avoiding port conflicts. ```bash # Change port in .env or Config AGENTOS_ADDRESS=:9090 ``` -------------------------------- ### Basic Agent Initialization and Execution - Go Source: https://github.com/rexleimo/agno-go/blob/main/website/guide/agent.md Provides a complete example of setting up and running a simple agent using Go. It initializes an OpenAI model and then creates an agent with basic instructions, finally executing a simple greeting. ```go package main import ( "context" "fmt" "github.com/rexleimo/agno-Go/pkg/agno/agent" "github.com/rexleimo/agno-Go/pkg/agno/models/openai" ) func main() { model, _ := openai.New("gpt-4o-mini", openai.Config{ APIKey: os.Getenv("OPENAI_API_KEY"), }) ag, _ := agent.New(agent.Config{ Name: "Assistant", Model: model, Instructions: "You are a helpful assistant", }) output, _ := ag.Run(context.Background(), "Hello!") fmt.Println(output.Content) } ``` -------------------------------- ### Build and Run Agno-Go Docker Image Source: https://github.com/rexleimo/agno-go/blob/main/website/guide/installation.md Builds a Docker image for Agno-Go with the tag 'agentos:latest' and then runs it as a container, exposing port 8080 and setting the OpenAI API key via an environment variable. ```bash # Build image docker build -t agentos:latest . # Run server docker run -p 8080:8080 \ -e OPENAI_API_KEY=sk-your-key \ agentos:latest ``` -------------------------------- ### Format and Lint Agno-Go Code Source: https://github.com/rexleimo/agno-go/blob/main/website/guide/installation.md Executes make commands to format the Go code using 'goimports' and run the linter ('golangci-lint') and 'go vet' to ensure code quality and style consistency. ```bash # Format code make fmt # Run linter make lint # Run go vet make vet ``` -------------------------------- ### Create a Simple Go Agent with OpenAI Source: https://github.com/rexleimo/agno-go/blob/main/docs/QUICK_START.md This Go program demonstrates how to create a simple AI agent using Agno-Go and the OpenAI API. It requires an OpenAI API key set as an environment variable (OPENAI_API_KEY). The agent is configured with a name, model, and instructions, then used to answer a question. ```go package main import ( "context" "fmt" "log" "os" "github.com/rexleimo/agno-go/pkg/agno/agent" "github.com/rexleimo/agno-go/pkg/agno/models/openai" ) func main() { // Get API key from environment apiKey := os.Getenv("OPENAI_API_KEY") if apiKey == "" { log.Fatal("OPENAI_API_KEY environment variable is required") } // Create OpenAI model model, err := openai.New("gpt-4o-mini", openai.Config{ APIKey: apiKey, }) if err != nil { log.Fatalf("Failed to create model: %v", err) } // Create agent ag, err := agent.New(agent.Config{ Name: "Assistant", Model: model, Instructions: "You are a helpful assistant.", }) if err != nil { log.Fatalf("Failed to create agent: %v", err) } // Run agent output, err := ag.Run(context.Background(), "What is the capital of France?") if err != nil { log.Fatalf("Agent run failed: %v", err) } fmt.Println("Agent:", output.Content) } ``` -------------------------------- ### Run Agno-Go Development Tests Source: https://github.com/rexleimo/agno-go/blob/main/website/guide/installation.md Commands for running tests within the Agno-Go project during development. Includes options to run all tests, specific packages, or generate a coverage report. ```bash # Run all tests make test # Run specific package go test -v ./pkg/agno/agent/... # Generate coverage report make coverage ``` -------------------------------- ### Go: Agent Creation Template Source: https://github.com/rexleimo/agno-go/blob/main/docs/QUICK_START.md A template for creating an agent in Go using the Agno library. It includes initializing a model (e.g., OpenAI), configuring the agent with name, model, toolkits, instructions, and max loops, and running the agent. ```go model, err := openai.New("gpt-4o-mini", openai.Config{ APIKey: os.Getenv("OPENAI_API_KEY"), }) ag, err := agent.New(agent.Config{ Name: "Agent Name", Model: model, Toolkits: []toolkit.Toolkit{/* tools */}, Instructions: "System instructions", MaxLoops: 10, }) output, err := ag.Run(context.Background(), "input") ``` -------------------------------- ### Install Go on Windows using Chocolatey Source: https://github.com/rexleimo/agno-go/blob/main/website/guide/installation.md Installs the Go programming language on Windows using the Chocolatey package manager. This command installs the golang package. ```powershell choco install golang ``` -------------------------------- ### Troubleshoot Docker Port Already in Use Error Source: https://github.com/rexleimo/agno-go/blob/main/website/zh/guide/installation.md Offers a solution for the 'Port already in use' error when running Docker containers. This involves changing the port number used by the AgentOS server by modifying the `AGENTOS_ADDRESS` environment variable in the `.env` file. ```bash # In .env file: AGENTOS_ADDRESS=:9090 ``` -------------------------------- ### Create a Go Agent with Calculator Tools Source: https://github.com/rexleimo/agno-go/blob/main/docs/QUICK_START.md This Go program demonstrates creating an AI agent that can use tools, specifically a calculator, for mathematical operations. It requires an OpenAI API key and imports necessary Agno-Go packages for agents, OpenAI models, and calculator tools. ```go package main import ( "context" "fmt" "log" "os" "github.com/rexleimo/agno-go/pkg/agno/agent" "github.com/rexleimo/agno-go/pkg/agno/models/openai" "github.com/rexleimo/agno-go/pkg/agno/tools/calculator" "github.com/rexleimo/agno-go/pkg/agno/tools/toolkit" ) func main() { apiKey := os.Getenv("OPENAI_API_KEY") if apiKey == "" { log.Fatal("OPENAI_API_KEY required") } // Create model model, _ := openai.New("gpt-4o-mini", openai.Config{ APIKey: apiKey, }) // Create agent WITH tools ag, _ := agent.New(agent.Config{ Name: "Calculator Agent", Model: model, Toolkits: []toolkit.Toolkit{ calculator.New(), }, Instructions: "You are a math assistant. Use the calculator tools for calculations.", }) // Ask a math question output, _ := ag.Run(context.Background(), "What is 123 * 456 + 789?") fmt.Println("Question: What is 123 * 456 + 789?") fmt.Println("Agent:", output.Content) } ``` -------------------------------- ### Install Go on Arch Linux using pacman Source: https://github.com/rexleimo/agno-go/blob/main/website/guide/installation.md Installs the Go programming language on Arch Linux using the pacman package manager. This command installs the go package. ```bash sudo pacman -S go ``` -------------------------------- ### Build and Run Go Example - Bash Source: https://github.com/rexleimo/agno-go/blob/main/website/examples/simple-agent.md Provides commands to compile and execute the Go simple agent example. Users can either run it directly or build an executable first. ```bash # Option 1: Run directly go run main.go # Option 2: Build and run go build -o simple_agent ./simple_agent ``` -------------------------------- ### Install Go on Fedora using dnf Source: https://github.com/rexleimo/agno-go/blob/main/website/guide/installation.md Installs the Go programming language on Fedora Linux using the dnf package manager. This command directly installs the golang package. ```bash sudo dnf install golang ``` -------------------------------- ### Run Agno-Go Agent Example (Bash) Source: https://github.com/rexleimo/agno-go/blob/main/cmd/examples/simple_agent/README.md Executes the simple Agno-Go agent example using 'go run' or by building and then running the compiled binary. This command initiates the agent's operation with predefined instructions and tools. ```bash go run main.go ``` ```bash go build -o simple_agent ./simple_agent ``` -------------------------------- ### Install Go on Ubuntu/Debian using apt-get Source: https://github.com/rexleimo/agno-go/blob/main/website/guide/installation.md Installs the Go programming language on Ubuntu and Debian-based Linux distributions using the apt-get package manager. This command updates the package list and then installs the golang-go package. ```bash sudo apt-get update sudo apt-get install golang-go ``` -------------------------------- ### Build and Deploy Agno-Go Documentation Manually Source: https://github.com/rexleimo/agno-go/blob/main/website/README.md Steps for manually building the Agno-Go documentation site for production and deploying the output to static hosting. ```bash # Build site npm run docs:build # Output in website/.vitepress/dist/ # Deploy dist/ to any static hosting ``` -------------------------------- ### Install and Use Certbot for Let's Encrypt SSL Source: https://github.com/rexleimo/agno-go/blob/main/docs/DEPLOYMENT.md This bash script guides through the process of installing Certbot, obtaining an SSL certificate for a domain using Nginx, and setting up auto-renewal for the certificate. It's a common method for enabling HTTPS on web servers. ```bash # Install certbot sudo apt-get install certbot python3-certbot-nginx # Obtain certificate sudo certbot --nginx -d api.yourdomain.com # Auto-renewal sudo certbot renew --dry-run ``` -------------------------------- ### Install Go on macOS using Homebrew Source: https://github.com/rexleimo/agno-go/blob/main/website/guide/installation.md Installs the Go programming language on macOS using the Homebrew package manager. This is a prerequisite for building and running Agno-Go applications on this platform. ```bash brew install go ``` -------------------------------- ### Running the Go Example Source: https://github.com/rexleimo/agno-go/blob/main/website/examples/workflow-demo.md This bash command shows how to execute the Go program containing the workflow examples. ```bash go run main.go ``` -------------------------------- ### Create and Run an Agent - Go Source: https://github.com/rexleimo/agno-go/blob/main/website/guide/agent.md Demonstrates how to create a new agent with configuration, including name, model, toolkits, instructions, and maximum loops, and then run it with a given prompt. It uses the agent package from the agno-go library. ```go import "github.com/rexleimo/agno-Go/pkg/agno/agent" agent, err := agent.New(agent.Config{ Name: "My Agent", Model: model, Toolkits: []toolkit.Toolkit{calculator.New()}, Instructions: "You are a helpful assistant", MaxLoops: 10, }) output, err := agent.Run(context.Background(), "What is 2+2?") ``` -------------------------------- ### Run Simple Go Agent with OpenAI API Key Source: https://github.com/rexleimo/agno-go/blob/main/docs/QUICK_START.md This command executes the Go program to run a simple AI agent. It requires setting the OpenAI API key as an environment variable before running the Go program. Ensure the API key is valid. ```bash export OPENAI_API_KEY=sk-your-key-here go run main.go ``` -------------------------------- ### Create a Go Agent with Calculator Tools Source: https://github.com/rexleimo/agno-go/blob/main/website/guide/quick-start.md Shows how to create a Go agent that utilizes tools, specifically a calculator, for performing mathematical operations. This agent can handle more complex queries involving calculations. Requires an OpenAI API key and Go 1.21+. ```go package main import ( "context" "fmt" "log" "os" "github.com/rexleimo/agno-Go/pkg/agno/agent" "github.com/rexleimo/agno-Go/pkg/agno/models/openai" "github.com/rexleimo/agno-Go/pkg/agno/tools/calculator" "github.com/rexleimo/agno-Go/pkg/agno/tools/toolkit" ) func main() { apiKey := os.Getenv("OPENAI_API_KEY") if apiKey == "" { log.Fatal("OPENAI_API_KEY required") } // Create model model, _ := openai.New("gpt-4o-mini", openai.Config{ APIKey: apiKey, }) // Create agent WITH tools ag, _ := agent.New(agent.Config{ Name: "Calculator Agent", Model: model, Toolkits: []toolkit.Toolkit{ calculator.New(), }, Instructions: "You are a math assistant. Use the calculator tools for calculations.", }) // Ask a math question output, _ := ag.Run(context.Background(), "What is 123 * 456 + 789?") fmt.Println("Question: What is 123 * 456 + 789?") fmt.Println("Agent:", output.Content) } ``` -------------------------------- ### Install ChromaDB Go Library Source: https://github.com/rexleimo/agno-go/blob/main/pkg/agno/vectordb/chromadb/README.md Installs the ChromaDB Go library using the go get command. This is the primary step to include the ChromaDB client in your Go project. ```bash go get github.com/amikos-tech/chroma-go ```