A Go microservices framework built on Clean Architecture principles, integrating an Agent runtime and Temporal-based orchestration engine.
- Agent Framework — ReAct loop agent runtime with LLM integration, tool execution, and MCP server support
- Orchestration Engine — Temporal-based workflow orchestration with multi-step, parallel, conditional, and dynamic execution patterns
- Multi-Agent Teams — Hierarchical team composition with recursive sub-team expansion
- Human-in-the-Loop — Workflow pause/resume/cancel and signal-based waiting steps
- Streaming — Server-Sent Events (SSE) and WebSocket support for real-time agent output
- Account & Billing — Credit-based usage tracking with plan assignment
- Clean Architecture — Dependency inversion, interface-based isolation, testability
- Multiple Server Types — REST API, gRPC, AMQP RPC, NATS RPC
- Observability — Structured logging (zerolog), Prometheus metrics, OpenTelemetry tracing
- Database Migrations — golang-migrate for PostgreSQL schema management
- Go 1.26+
- Docker & Docker Compose
- Temporal Server (via Docker)
# Start dependency services (Postgres, RabbitMQ, NATS, Temporal)
make compose-up
# Run the application (includes database migration)
make run# Start full test environment with mock LLM
make compose-up-integration-testmake compose-up-all- REST API:
http://127.0.0.1:8080/healthz— Health checkhttp://127.0.0.1:8080/metrics— Prometheus metricshttp://127.0.0.1:8080/swagger— API documentation
- Agent API (v1):
POST /v1/agent/execute— Execute a single agent run (ReAct loop)GET /v1/agent/status/{run_id}— Poll agent run statusGET /v1/agent/{run_id}/messages— List conversation messagesGET /v1/agent/{run_id}/tools— List tool execution resultsGET /v1/agent/stream— SSE stream of agent outputGET /v1/agent/ws— WebSocket for real-time agent communication
- Orchestration API:
POST /v1/orchestration/execute— Start multi-step orchestration workflowGET /v1/orchestration/status/{run_id}— Poll orchestration status
- Templates API:
POST /v1/templates/import— Import workflow template from YAMLGET /v1/templates/— List templatesGET /v1/templates/{template_id}— Get template detailsDELETE /v1/templates/{template_id}— Delete template
- Triggers API:
POST /v1/triggers/events— Fire trigger event webhook
- gRPC:
tcp://127.0.0.1:8081 - AMQP RPC:
amqp://guest:guest@127.0.0.1:5672/ - NATS RPC:
nats://guest:guest@127.0.0.1:4222/ - PostgreSQL:
postgres://user:myAwEsOm3pa55@w0rd@127.0.0.1:5432/db
GoAgent is structured as a library + application shell following the go-clean-template pattern. Public packages at the root level are importable by external projects; internal/ contains only the application shell.
| Package | Layer | Description |
|---|---|---|
entity/ |
Inner | Domain primitives — zero dependencies, stdlib only |
usecase/ |
Inner | Business logic + input port interfaces (called by controllers) |
repo/ |
Inner/Outer | Output port interfaces (called by use cases) + infrastructure adapters |
state/ |
Inner | State management abstractions — hot/warm/cold layering |
agentfw/ |
Both | Agent runtime — agent/, team/, tool/, stream/ (inner); orchestration/, runtime/, config/ (outer) |
config/ |
Outer | Application configuration (env-based) |
pkg/ |
Outer | Infrastructure wrappers — Postgres, Redis, HTTP server, etc. |
internal/app/— Dependency injection and application bootstrapinternal/controller/— Transport layer (REST, gRPC, AMQP RPC, NATS RPC)cmd/app/— Entry point
docs/— Swagger docs and Proto filesexamples/— Runnable pattern examplesintegration-test/— Integration tests (requires Docker)migrations/— PostgreSQL migrations
Follows the 12-Factor App principles. All configuration is managed through environment variables.
Configuration file: config/config.go
Example configuration: .env.example
The agent framework consists of:
- Agent Runtime — ReAct loop:
think → act → observe → repeat, with LLM provider abstraction - Tool System — Tool definitions with JSON Schema, executor abstraction, MCP server integration
- Team System — Hierarchical team composition with recursive expansion into flat step queues
- Orchestration Engine — Temporal workflow that executes steps with dependency resolution, parallel fan-out, dynamic mutation, and human-in-the-loop signals
| Type | Purpose |
|---|---|
agent |
Execute an agent with a prompt |
tool |
Execute a tool directly |
wait |
Wait for a Temporal signal (HITL) or timeout |
split |
Fan-out into parallel sub-steps |
join |
Fan-in to gather parallel results |
eval |
Conditional evaluation with dynamic step mutation |
The examples/http/ directory contains runnable demonstrations using the HTTP client SDK:
| Pattern | File | Key Concepts |
|---|---|---|
| ReAct | Single agent + tool loop | ExecuteRequest, polling |
| Pipeline | Sequential processing stages | depends_on chain |
| DAG | Directed acyclic graph | Multi-dependency resolution |
| Research | Parallel exploration + synthesis | split/join, wait (HITL) |
| Supervisor-Worker | Decompose + parallel workers | split/join, supervisor agent |
| Router | Conditional branching | eval + OnResult mutation |
| Reflexion | Self-critique quality loop | eval + dynamic refinement |
| Plan-and-Execute | Plan → parallel execute → evaluate | split/join + eval mutation |
| Exploratory | Self-modifying step queue | eval + append_after mutation |
| ToT / LATS | Multiple reasoning paths | Parallel exploration + best-path eval |
| Scientific | Hypothesis → HITL → experiment | wait signal, timeout handling |
| Team | Multi-agent hierarchy | TeamSpec + SubTeams |
| Hierarchical | Executive → departments | Nested TeamSpec with expansion |
The examples/embed/ directory shows how to import GoAgent packages directly:
| Example | File | What It Shows |
|---|---|---|
| ReAct | examples/embed/react/main.go |
agent.New(), ExecuteStep, mock LLM |
| Conversation | examples/embed/conversation/main.go |
Multi-turn with history accumulation |
| Tools | examples/embed/tools/main.go |
Tool calling with repo.ToolExecutor |
The examples/types/ directory shows importing only entity/ for shared type definitions.
GoAgent can be consumed in three ways, from simple to deeply integrated:
Run GoAgent as a standalone service. Your application talks to it via HTTP/gRPC.
import "github.com/TekkenSteve/GoAgent/examples/client"
c := client.New("http://localhost:8080", "my-account")
status, _ := c.ExecuteAgent(ctx, client.ExecuteRequest{
RunID: "run-1", UserMessage: "What is 2+2?",
})Import GoAgent packages directly into your Go application. Bring your own infrastructure adapters or use the built-in ones.
import (
"github.com/TekkenSteve/GoAgent/usecase/agent"
"github.com/TekkenSteve/GoAgent/repo/webapi" // LLM provider
"github.com/TekkenSteve/GoAgent/repo/pipeline" // Redis WAL
"github.com/TekkenSteve/GoAgent/repo/compressor" // Context compression
"github.com/TekkenSteve/GoAgent/repo/toolkit" // Built-in tools
)
llm := webapi.NewBifrostProvider(cfg)
tools := toolkit.NewRegistry(llm)
wal := pipeline.NewRedisWAL(appender, rdb)
agentUC := agent.New(llm, tools, wal, compressor, tools, nil)
result, _ := agentUC.ExecuteStep(ctx, &agent.StepRequest{
RunID: "run-1",
Message: "What is 2+2?",
Config: entity.LLMConfig{Model: "claude-sonnet-4-20250514"},
})Import only entity/ to share domain type definitions across microservices.
import "github.com/TekkenSteve/GoAgent/entity"
type MyService struct {
messages []entity.Message
tools []entity.ToolDef
}This project follows the go-clean-template architecture pattern:
- Input ports (
usecase/contracts.go) — interfaces implemented by business logic, called by controllers - Output ports (
repo/contracts.go) — interfaces called by business logic, implemented by infrastructure adapters - Dependency direction: outer layers import inner layers, never the reverse
- Testability: interface isolation enables easy unit testing with mocks
┌──────────────────────────────────────────────┐
│ entity/ │ state/ │ Inner Layer
│ ──────────┼────────── │ (zero external deps,
│ usecase/contracts.go (input ports) │ stdlib only)
│ repo/contracts.go (output ports) │
├──────────────────────────────────────────────┤
│ usecase/agent/ usecase/template/ ... │ Inner Layer
│ (imports repo/ for output ports) │ (business logic)
├──────────────────────────────────────────────┤
│ repo/persistent/ repo/webapi/ ... │ Outer Layer
│ internal/controller/ internal/app/ │ (infrastructure,
│ agentfw/orchestration/ │ imports inner)
└──────────────────────────────────────────────┘
- Inner layer (
entity/,state/,usecase/,repo/contracts.go) depends only on Go stdlib - Outer layer (
repo/*/,internal/,pkg/) implements interfaces defined by the inner layer usecase/agent/importsrepo/for output port interfaces — the same pattern as go-clean-template'susecase/translation/importingrepo/
Dependencies are injected through constructors, maintaining the independence and testability of business logic:
type UseCase struct {
repo Repository // Interface dependency
}
func New(r Repository) *UseCase {
return &UseCase{repo: r}
}Supports a simple versioning strategy, with versions distinguished by directory structure:
- REST API:
internal/controller/restapi/v1,v2... - gRPC:
internal/controller/grpc/v1,v2... - RPC:
internal/controller/amqp_rpc/v1,v2...
# Run migrations
go run -tags migrate ./cmd/app
# Or use make
make run# Generate Swagger documentation
make swag-v1
# Generate gRPC code
make proto-v1
# Generate Mocks
make mock# Run linter
make linter-golangci
# Format code
make format
# Run unit tests
make testmake linter-golangci # golangci-lint
make linter-hadolint # Dockerfile lint
make linter-dotenv # .env lint
make check-workflow-determinism # Temporal workflow determinism
make test # Unit tests- Clean Architecture — Robert Martin
- The Twelve-Factor App
- Temporal Workflow Platform
- Go Project Layout
MIT License — See LICENSE file for details