Production-ready AI Agent framework in Go. Features ReAct pattern, Function Calling, Hierarchical Memory, Reflexion & Orchestrator agents, and multi-LLM support (OpenAI/Claude/Ollama). Clean Architecture + K8s ready.
- Performance: Low latency tool execution with Go's concurrency model
- Differentiation: Stand out in the Python-dominated AI landscape
- Production Quality: Leverage Go's reliability for enterprise deployments
- Full Stack Integration: Seamlessly connect with existing Go microservices
go-ai-agent/
βββ cmd/
β βββ server/ # Application entry point
βββ internal/
β βββ config/ # Configuration management
β βββ llm/ # LLM client abstraction (Multi-provider)
β β βββ client.go # Client interface
β β βββ openai.go # OpenAI implementation
β β βββ claude.go # Claude (Anthropic) implementation
β β βββ ollama.go # Ollama (local models) implementation
β β βββ provider.go # Provider factory & router
β β βββ production.go # Retry, streaming, structured output
β β βββ tools.go # Tool definitions
β βββ handler/ # HTTP handlers
β βββ agent/ # Agent implementations
β β βββ react.go # ReAct agent pattern
β β βββ reflexion.go # Self-improving Reflexion agent
β β βββ orchestrator.go # Multi-agent orchestration
β βββ memory/ # Memory systems
β β βββ hierarchical.go # Working/Episodic/Semantic memory
β βββ vectorstore/ # Vector storage
β β βββ raptor.go # RAPTOR hierarchical retrieval
β βββ embedding/ # Embedding providers
β βββ tools/ # Function calling tools
βββ pkg/
β βββ middleware/ # Shared middleware
βββ deploy/ # Deployment manifests (coming soon)
- Go 1.22+
- OpenAI API key
# Clone the repository
git clone https://github.com/hassan123789/go-ai-agent.git
cd go-ai-agent
# Install dependencies
go mod download
# Copy and edit environment variables
cp .env.example .env
# Edit .env with your OpenAI API key# Run the server
make run
# Or directly with Go
go run ./cmd/server# Health check
curl http://localhost:8080/health
# Chat completion
curl -X POST http://localhost:8080/api/chat \
-H "Content-Type: application/json" \
-d '{
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello, how are you?"}
]
}'
# Streaming response
curl -X POST http://localhost:8080/api/chat \
-H "Content-Type: application/json" \
-d '{
"messages": [{"role": "user", "content": "Tell me a joke"}],
"stream": true
}'# Start full stack (API + PostgreSQL/pgvector + Ollama + Prometheus + Grafana)
docker-compose up -d
# View logs
docker-compose logs -f api
# Stop
docker-compose down# Deploy to Kubernetes
kubectl apply -k deploy/k8s/base/
# Check status
kubectl -n go-ai-agent get pods
# Port forward for local access
kubectl -n go-ai-agent port-forward svc/go-ai-agent 8080:80# Install
helm install go-ai-agent ./deploy/helm/go-ai-agent \
--namespace go-ai-agent \
--create-namespace \
--set secrets.openaiApiKey="your-api-key"
# Upgrade
helm upgrade go-ai-agent ./deploy/helm/go-ai-agent \
--namespace go-ai-agent \
--set replicaCount=3
# Uninstall
helm uninstall go-ai-agent --namespace go-ai-agent# Run tests
make test
# Run linter
make lint
# Format code
make fmt
# Pre-push checks
make pre-push- Phase 1: LLM Client & Basic Chat API
- Phase 2: Function Calling & Tool Integration
- Phase 3: ReAct Agent Pattern
- Phase 4: Advanced Agent Patterns (Reflexion, Orchestrator, Hierarchical Memory, RAPTOR)
- Phase 5: Multi-LLM Support (Claude, Ollama local models)
- Phase 6: Kubernetes Deployment
-
β Multi-LLM Support: OpenAI, Claude (Anthropic), Ollama (local)
-
β Provider Abstraction: Factory pattern with intelligent routing
-
β ReAct Agent: Reasoning + Acting pattern
-
β Reflexion Agent: Self-improving with evaluation loop
-
β Orchestrator Agent: Multi-agent coordination with workers
-
β Hierarchical Memory: Working, Episodic, Semantic memory layers
-
β RAPTOR Store: Tree-structured hierarchical retrieval
-
β Production LLM: Retry, streaming, structured output, error handling
-
β Function Calling: Tool integration with OpenAI-compatible API
-
β Streaming Responses: SSE support
-
β Clean Architecture: Separation of concerns
-
β Docker & K8s: Multi-stage build, Kustomize, Helm chart
-
β PostgreSQL + pgvector: Vector storage in production
-
β Monitoring: Prometheus + Grafana stack
- π gRPC API
- π Web Search Tool Integration
| Category | Technology |
|---|---|
| Language | Go 1.22+ |
| HTTP Framework | Echo v4 |
| LLM Clients | go-openai, anthropic-sdk-go |
| LLM Providers | OpenAI, Claude, Ollama |
| Vector DB | pgvector |
| Container | Docker (multi-stage) |
| Orchestration | Kubernetes, Helm |
| Monitoring | Prometheus, Grafana |
This project is licensed under the MIT License - see the LICENSE file for details.