Skip to content

Commit a57ad81

Browse files
Refactor agentfield SDK and update Go versions
Updates the AgentField Go SDK to use a new organization name (`github.com/your-org/agentfield`). Adds new dependencies (`bubbletea`, `lipgloss`, `exp`) to the control-plane's `go.mod` file. This also updates the Go toolchain to 1.24.2 in the control-plane and Dockerfiles. Adjusts error handling in `LocalStorage.CleanupWorkflow` to consistently use `errors.New` instead of `fmt.Errorf` for specific error messages, improving error type consistency.
1 parent 8ca4334 commit a57ad81

24 files changed

Lines changed: 83 additions & 44 deletions

CLAUDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ af run
199199

200200
### Creating a New Agent (Go)
201201
```go
202-
import agentfieldagent "github.com/agentfield/agentfield/sdk/go/agent"
202+
import agentfieldagent "github.com/your-org/agentfield/sdk/go/agent"
203203

204204
agent, _ := agentfieldagent.New(agentfieldagent.Config{
205205
NodeID: "my-agent",
@@ -279,7 +279,7 @@ Automatically synced by control plane. Agents access via SDK methods: `agent.mem
279279

280280
**SDKs:**
281281
- Python: `agentfield` (PyPI package)
282-
- Go: `github.com/agentfield/agentfield/sdk/go` (import path)
282+
- Go: `github.com/your-org/agentfield/sdk/go` (import path)
283283

284284
## Release Process
285285

control-plane/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ toolchain go1.24.2
66

77
require (
88
github.com/boltdb/bolt v1.3.1
9+
github.com/charmbracelet/bubbletea v1.3.10
10+
github.com/charmbracelet/lipgloss v1.1.0
911
github.com/fatih/color v1.18.0
1012
github.com/fsnotify/fsnotify v1.8.0
1113
github.com/gin-contrib/cors v1.7.5
@@ -37,9 +39,7 @@ require (
3739
github.com/bytedance/sonic v1.13.2 // indirect
3840
github.com/bytedance/sonic/loader v0.2.4 // indirect
3941
github.com/cespare/xxhash/v2 v2.3.0 // indirect
40-
github.com/charmbracelet/bubbletea v1.3.10 // indirect
4142
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect
42-
github.com/charmbracelet/lipgloss v1.1.0 // indirect
4343
github.com/charmbracelet/x/ansi v0.10.1 // indirect
4444
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect
4545
github.com/charmbracelet/x/term v0.2.1 // indirect

control-plane/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,8 @@ golang.org/x/arch v0.15.0 h1:QtOrQd0bTUnhNVNndMpLHNWrDmYzZ2KDqSrEymqInZw=
202202
golang.org/x/arch v0.15.0/go.mod h1:JmwW7aLIoRUKgaTzhkiEFxvcEiQGyOg9BMonBJUS7EE=
203203
golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE=
204204
golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc=
205+
golang.org/x/exp v0.0.0-20231108232855-2478ac86f678 h1:mchzmB1XO2pMaKFRqk/+MV3mgGG96aqaPXaMifQU47w=
206+
golang.org/x/exp v0.0.0-20231108232855-2478ac86f678/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE=
205207
golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=
206208
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
207209
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
@@ -212,8 +214,6 @@ golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBc
212214
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
213215
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
214216
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
215-
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
216-
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
217217
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
218218
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
219219
golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg=

control-plane/internal/storage/local.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2727,14 +2727,14 @@ func (ls *LocalStorage) CleanupWorkflow(ctx context.Context, identifier string,
27272727
if trimmedID == "" {
27282728
errMsg := "workflow ID cannot be empty"
27292729
result.ErrorMessage = &errMsg
2730-
return result, fmt.Errorf(errMsg)
2730+
return result, errors.New(errMsg)
27312731
}
27322732

27332733
targets, err := ls.resolveWorkflowCleanupTargets(ctx, trimmedID)
27342734
if err != nil {
27352735
errMsg := fmt.Sprintf("failed to resolve workflow cleanup targets: %v", err)
27362736
result.ErrorMessage = &errMsg
2737-
return result, fmt.Errorf(errMsg)
2737+
return result, errors.New(errMsg)
27382738
}
27392739

27402740
if targets.primaryWorkflowID != "" {
@@ -2759,20 +2759,20 @@ func (ls *LocalStorage) CleanupWorkflow(ctx context.Context, identifier string,
27592759
if err != nil {
27602760
errMsg := fmt.Sprintf("failed to begin cleanup transaction: %v", err)
27612761
result.ErrorMessage = &errMsg
2762-
return result, fmt.Errorf(errMsg)
2762+
return result, errors.New(errMsg)
27632763
}
27642764
defer tx.Rollback()
27652765

27662766
if err := ls.performWorkflowCleanup(ctx, tx, targets); err != nil {
27672767
errMsg := fmt.Sprintf("failed to cleanup workflow: %v", err)
27682768
result.ErrorMessage = &errMsg
2769-
return result, fmt.Errorf(errMsg)
2769+
return result, errors.New(errMsg)
27702770
}
27712771

27722772
if err := tx.Commit(); err != nil {
27732773
errMsg := fmt.Sprintf("failed to commit cleanup transaction: %v", err)
27742774
result.ErrorMessage = &errMsg
2775-
return result, fmt.Errorf(errMsg)
2775+
return result, errors.New(errMsg)
27762776
}
27772777

27782778
result.Success = true

control-plane/internal/templates/go/go.mod.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ module {{.GoModule}}
22

33
go 1.23
44

5-
require github.com/agentfield/agentfield/sdk/go v0.1.0
5+
require github.com/your-org/agentfield/sdk/go v0.1.0

control-plane/internal/templates/go/main.go.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"log"
66
"os"
77

8-
"github.com/agentfield/agentfield/sdk/go/agent"
9-
"github.com/agentfield/agentfield/sdk/go/ai"
8+
"github.com/your-org/agentfield/sdk/go/agent"
9+
"github.com/your-org/agentfield/sdk/go/ai"
1010
)
1111

1212
func main() {

control-plane/internal/templates/go/reasoners.go.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"context"
55
"fmt"
66

7-
"github.com/agentfield/agentfield/sdk/go/agent"
8-
"github.com/agentfield/agentfield/sdk/go/ai"
7+
"github.com/your-org/agentfield/sdk/go/agent"
8+
"github.com/your-org/agentfield/sdk/go/ai"
99
)
1010

1111
func registerReasoners(app *agent.Agent) {

deployments/docker/Dockerfile.control-plane

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ RUN npm install
66
COPY control-plane/web/client/ .
77
RUN npm run build
88

9-
FROM golang:1.23-alpine AS go-builder
9+
FROM golang:1.24-alpine AS go-builder
1010
WORKDIR /app
1111

1212
COPY control-plane/go.mod control-plane/go.sum ./control-plane/

deployments/docker/Dockerfile.go-agent

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.23-alpine
1+
FROM golang:1.24-alpine
22

33
WORKDIR /workspace
44

sdk/go/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ The AgentField Go SDK provides idiomatic Go bindings for interacting with the Ag
55
## Installation
66

77
```bash
8-
go get github.com/agentfield/agentfield/sdk/go
8+
go get github.com/your-org/agentfield/sdk/go
99
```
1010

1111
## Quick Start
@@ -17,7 +17,7 @@ import (
1717
"context"
1818
"log"
1919

20-
agentfieldagent "github.com/agentfield/agentfield/sdk/go/agent"
20+
agentfieldagent "github.com/your-org/agentfield/sdk/go/agent"
2121
)
2222

2323
func main() {

0 commit comments

Comments
 (0)