Skip to content

Repository files navigation

AgentKit

Go CIGo LintGo SASTDocsDocsVisualizationLicense

A Go library for building AI agent applications. Provides server factories, LLM abstractions, workflow orchestration, and multi-runtime deployment support.

Features

  • 🏭 Server Factories - A2A and HTTP servers in 5 lines (saves ~475 lines per project)
  • 🧠 Multi-Provider LLM - Gemini, Claude, OpenAI, xAI, Ollama via OmniLLM
  • 🔀 Workflow Orchestration - Type-safe graph-based execution with Eino
  • ☁️ Multi-Runtime Deployment - Kubernetes (Helm) or AWS AgentCore
  • 🔒 VaultGuard Integration - Security-gated credential access

Architecture

agentkit/
├── # Core (platform-agnostic)
├── a2a/ # A2A protocol server factory
├── agent/ # Base agent framework
├── config/ # Configuration management
├── deploy/ # Deployment provider system
├── http/ # HTTP client utilities
├── httpserver/ # HTTP server factory
├── llm/ # Multi-provider LLM abstraction
├── orchestration/ # Eino workflow orchestration
│
├── # Platform-specific
└── platforms/
├── agentcore/ # AWS Bedrock AgentCore runtime
└── kubernetes/ # Kubernetes + Helm deployment

Installation

go get github.com/plexusone/agentkit

Quick Start

Complete Agent with HTTP + A2A Servers

package main
import (
"context""github.com/plexusone/agentkit/a2a""github.com/plexusone/agentkit/agent""github.com/plexusone/agentkit/config""github.com/plexusone/agentkit/httpserver"
)
funcmain() {
ctx:=context.Background()
cfg:=config.LoadConfig()
// Create agentba, _:=agent.NewBaseAgent(cfg, "research-agent", 30)
researchAgent:=NewResearchAgent(ba, cfg)
// HTTP server - 5 lineshttpServer, _:=httpserver.NewBuilder("research-agent", 8001).
WithHandlerFunc("/research", researchAgent.HandleResearch).
WithDualModeLog().
Build()
// A2A server - 5 linesa2aServer, _:=a2a.NewServer(a2a.Config{
Agent: researchAgent.ADKAgent(),
Port: "9001",
Description: "Research agent for web search",
})
// Start serversa2aServer.StartAsync(ctx)
httpServer.Start()
}

This replaces ~100 lines of boilerplate with ~15 lines.

A2A Server Factory

import"github.com/plexusone/agentkit/a2a"// Create and start A2A serverserver, _:=a2a.NewServer(a2a.Config{
Agent: myAgent, // Google ADK agentPort: "9001", // Empty = random portDescription: "My agent",
})
server.Start(ctx) // Blocking// orserver.StartAsync(ctx) // Non-blocking// Useful methodsserver.URL() // "http://localhost:9001"server.AgentCardURL() // "http://localhost:9001/.well-known/agent.json"server.InvokeURL() // "http://localhost:9001/invoke"server.Stop(ctx) // Graceful shutdown

HTTP Server Factory

import"github.com/plexusone/agentkit/httpserver"// Config-basedserver, _:=httpserver.New(httpserver.Config{
Name: "my-agent",
Port: 8001,
HandlerFuncs: map[string]http.HandlerFunc{
"/process": agent.HandleProcess,
},
})
// Builder pattern (fluent API)server, _:=httpserver.NewBuilder("my-agent", 8001).
WithHandlerFunc("/research", agent.HandleResearch).
WithHandlerFunc("/synthesize", agent.HandleSynthesize).
WithHandler("/orchestrate", orchestration.NewHTTPHandler(exec)).
WithTimeouts(30*time.Second, 120*time.Second, 60*time.Second).
WithDualModeLog().
Build()
server.Start()

Basic Agent

import (
"github.com/plexusone/agentkit/agent""github.com/plexusone/agentkit/config"
)
cfg:=config.LoadConfig()
ba, err:=agent.NewBaseAgent(cfg, "my-agent", 30)
iferr!=nil {
log.Fatal(err)
}
deferba.Close()
// Utility methodscontent, err:=ba.FetchURL(ctx, url, maxSizeMB)
ba.LogInfo("message %s", arg)
ba.LogError("error %s", arg)

Secure Agent with VaultGuard

ba, secCfg, err:=agent.NewBaseAgentSecure(ctx, "secure-agent", 30,
config.WithPolicy(nil), // Use default policy
)
iferr!=nil {
log.Fatalf("Security check failed: %v", err)
}
deferba.Close()
defersecCfg.Close()
log.Printf("Security score: %d", secCfg.SecurityResult().Score)

Workflow Orchestration with Eino

import (
"github.com/cloudwego/eino/compose""github.com/plexusone/agentkit/orchestration"
)
// Build workflow graphbuilder:= orchestration.NewGraphBuilder[*Input, *Output]("my-workflow")
graph:=builder.Graph()
// Add nodes using Eino's InvokableLambdaprocessLambda:=compose.InvokableLambda(processFunc)
graph.AddLambdaNode("process", processLambda)
formatLambda:=compose.InvokableLambda(formatFunc)
graph.AddLambdaNode("format", formatLambda)
// Connect nodesbuilder.AddStartEdge("process")
builder.AddEdge("process", "format")
builder.AddEndEdge("format")
// ExecutefinalGraph:=builder.Build()
executor:=orchestration.NewExecutor(finalGraph, "my-workflow")
result, err:=executor.Execute(ctx, input)
// Expose as HTTP handlerhandler:=orchestration.NewHTTPHandler(executor)
http.Handle("/execute", handler)

Multi-Runtime Deployment

AgentKit supports two deployment runtimes:

AspectKubernetesAWS AgentCore
DistributionsEKS, GKE, AKS, Minikube, kindAWS only
Config toolHelmCDK / Terraform
ScalingHPAAutomatic
IsolationContainersFirecracker microVMs
PricingAlways-onPay-per-use

Kubernetes Deployment

import"github.com/plexusone/agentkit/platforms/kubernetes"// Load and validate Helm valuesvalues, errs:=kubernetes.LoadAndValidate("values.yaml")
// Merge base and overlay valuesvalues, err:=kubernetes.LoadAndMerge("values.yaml", "values-prod.yaml")

Example values.yaml:

global:
image:
registry: ghcr.io/myorgpullPolicy: IfNotPresenttag: "latest"namespace:
create: truename: my-agentsllm:
provider: geminigeminiModel: "gemini-2.0-flash-exp"agents:
research:
enabled: truereplicaCount: 1image:
repository: my-research-agentservice:
type: ClusterIPport: 8001a2aPort: 9001resources:
requests:
cpu: 100mmemory: 128Mivaultguard:
enabled: trueminSecurityScore: 50

AWS AgentCore Deployment

import"github.com/plexusone/agentkit/platforms/agentcore"// Simple setupserver:=agentcore.NewBuilder().
WithPort(8080).
WithAgent(researchAgent).
WithAgent(synthesisAgent).
WithDefaultAgent("research").
MustBuild(ctx)
server.Start()

Wrap Eino executors for AgentCore:

// Build Eino workflowgraph:=buildOrchestrationGraph()
executor:=orchestration.NewExecutor(graph, "stats-workflow")
// Wrap for AgentCoreagent:=agentcore.WrapExecutor("stats", executor)
// Or with custom I/O transformationagent:=agentcore.WrapExecutorWithPrompt("stats", executor,
func(promptstring) StatsReq { returnStatsReq{Topic: prompt} },
func(outStatsResp) string { returnout.Summary },
)

Same Code, Different Runtimes

// Agent implementation - runtime agnosticexecutor:=orchestration.NewExecutor(graph, "stats")
// Runtime 1: KuberneteshttpServer, _:=httpserver.NewBuilder("stats", 8001).
WithHandler("/stats", orchestration.NewHTTPHandler(executor)).
Build()
// Runtime 2: AWS AgentCoreacServer:=agentcore.NewBuilder().
WithAgent(agentcore.WrapExecutor("stats", executor)).
MustBuild(ctx)

Local Development

AgentCore code runs locally without AWS - same binary, different infrastructure:

go run main.go
curl localhost:8080/ping
curl -X POST localhost:8080/invocations -d '{"prompt":"test"}'
AspectLocalAWS AgentCore
ProcessGo binaryFirecracker microVM
SessionsIn-memoryIsolated per microVM
ScalingManualAutomatic

No code changes needed between local development and production.

Packages

a2a

A2A (Agent-to-Agent) protocol server factory.

server, _:=a2a.NewServer(a2a.Config{
Agent: myAgent,
Port: "9001",
Description: "My agent",
InvokePath: "/invoke", // Default: /invokeReadHeaderTimeout: 10*time.Second,
SessionService: customService, // Default: in-memory
})

httpserver

HTTP server factory with builder pattern.

server, _:=httpserver.NewBuilder("name", 8001).
WithHandlerFunc("/path", handlerFunc).
WithHandler("/path2", handler).
WithTimeouts(read, write, idle).
WithDualModeLog().
Build()

agent

Base agent implementation with LLM integration.

ba, err:=agent.NewBaseAgent(cfg, "name", timeoutSec)
ba, secCfg, err:=agent.NewBaseAgentSecure(ctx, "name", timeout, opts...)

config

Configuration management with VaultGuard integration.

deploy

Deployment provider system for multi-cloud container deployments.

import (
"github.com/plexusone/agentkit/deploy"
_ "github.com/plexusone/agentkit-aws-pulumi/deploy/providers/lightsail"
)
cfg, _:=deploy.LoadDeployConfig("deploy.yaml")
provider, _:=deploy.GetProvider(cfg) // Respects AGENTKIT_DEPLOY_PROVIDERdeferprovider.Close()
status, _:=provider.Deploy(ctx, cfg)
fmt.Println(status.Outputs["serviceUrl"])
cfg:=config.LoadConfig()
secCfg, err:=config.LoadSecureConfig(ctx, config.WithDevPolicy())
apiKey, err:=secCfg.GetCredential(ctx, "API_KEY")

llm

LLM model factory and adapters.

factory:=llm.NewModelFactory(cfg)
model, err:=factory.CreateModel(ctx)

orchestration

Eino-based workflow orchestration.

builder:= orchestration.NewGraphBuilder[Input, Output]("name")
executor:=orchestration.NewExecutor(graph, "name")
handler:=orchestration.NewHTTPHandler(executor)

http

HTTP client utilities for inter-agent communication.

err:=http.PostJSON(ctx, client, url, request, &response)
err:=http.GetJSON(ctx, client, url, &response)
err:=http.HealthCheck(ctx, client, baseURL)

platforms/kubernetes

Helm chart value structs and validation for Kubernetes deployments.

values, errs:=kubernetes.LoadAndValidate("values.yaml")
values, err:=kubernetes.LoadAndMerge("values.yaml", "values-prod.yaml")

platforms/agentcore

AWS Bedrock AgentCore runtime support.

server:=agentcore.NewBuilder().
WithAgent(agent).
MustBuild(ctx)
// Wrap Eino executorsagent:=agentcore.WrapExecutor("name", executor)

Configuration

AgentKit loads configuration from environment variables:

VariableDescriptionDefault
LLM_PROVIDERLLM provider (gemini, claude, openai, xai, ollama)gemini
LLM_MODELModel nameProvider default
GEMINI_API_KEYGemini API key-
CLAUDE_API_KEYClaude/Anthropic API key-
OPENAI_API_KEYOpenAI API key-
XAI_API_KEYxAI API key-
OLLAMA_URLOllama server URLhttp://localhost:11434
OBSERVABILITY_ENABLEDEnable LLM observabilityfalse
OBSERVABILITY_PROVIDERProvider (opik, langfuse, phoenix)opik

Benefits

AgentKit eliminates ~1,500 lines of boilerplate per project:

ComponentLines Saved
A2A server factory~350 lines
HTTP server factory~125 lines
Shared pkg/ code~930 lines

See BENEFITS.md for detailed analysis.

Companion Modules

AgentKit has companion modules for Infrastructure-as-Code (IaC) deployment:

ModulePurposeDependencies
agentkit-aws-cdkAWS CDK constructs for AgentCore21
agentkit-aws-pulumiPulumi components for AWS Lightsail340
agentkit-k8s-pulumiPulumi components for Kubernetes (EKS/GKE/AKS)-

All modules share the same YAML/JSON configuration schema from platforms/agentcore/iac/.

For pure CloudFormation (no CDK/Pulumi runtime), use the built-in generator:

import"github.com/plexusone/agentkit/platforms/agentcore/iac"config, _:=iac.LoadStackConfigFromFile("config.yaml")
iac.GenerateCloudFormationFile(config, "template.yaml")

See ROADMAP.md for planned modules including Terraform support.

Dependencies

License

MIT License

About

A Go library for building AI agent applications. Provides server factories, LLM abstractions, workflow orchestration, and multi-runtime deployment support.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Contributors

Languages