# Go

Use the Go client surface and an explicit HTTP request for capability-authenticated Minds.

Source: https://docs.minds.sh/docs/developers/go



The Go module is `github.com/l1feai/minds-go-sdk`; its package is `akasha`. The module declares Go 1.21. Use the module source approved for your project and keep the selected version pinned.

## Add the module [#add-the-module]

```bash
go get github.com/l1feai/minds-go-sdk/akasha
```

This is the checked-in module path, not a claim that an arbitrary remote branch has been verified. A local checkout can be selected with a Go module `replace` directive during development.

## Client structure [#client-structure]

```go
client := akasha.NewClient(managementURL, credential)
runtime := client.Runtime(instanceURL)
```

The client separates `ControlPlane()` from `Runtime(instanceURL)`. `NewClientWithConfig` accepts a timeout and optional tenant, reservoir, agent, and dataspace header values. All operations take a `context.Context`, so call them with a deadline appropriate to the work.

The default transport places its `APIKey` value in **Authorization Bearer**. It does not set the capability header required by a secured dedicated Mind. Use an explicit HTTP request for that connection in this source version.

## Read memory through the current daemon contract [#read-memory-through-the-current-daemon-contract]

```go
package main

import (
    "bytes"
    "context"
    "encoding/json"
    "fmt"
    "net/http"
    "os"
    "strings"
    "time"
)

func main() {
    ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
    defer cancel()
    body := []byte(`{"name":"recall","arguments":{"query":"launch review","limit":5}}`)
    endpoint := strings.TrimRight(os.Getenv("MINDS_INSTANCE_URL"), "/")
    req, err := http.NewRequestWithContext(ctx, http.MethodPost,
        endpoint+"/v1/mcp/tools/call", bytes.NewReader(body))
    if err != nil { panic(err) }
    req.Header.Set("Content-Type", "application/json")
    req.Header.Set("x-akasha-capability", os.Getenv("MINDS_CAPABILITY"))
    resp, err := http.DefaultClient.Do(req)
    if err != nil { panic(err) }
    defer resp.Body.Close()
    if resp.StatusCode < 200 || resp.StatusCode >= 300 {
        panic(fmt.Errorf("recall: HTTP %d", resp.StatusCode))
    }
    var output struct {
        IsError bool `json:"is_error"`
        Result struct { Memories []json.RawMessage `json:"memories"` } `json:"result"`
    }
    if err := json.NewDecoder(resp.Body).Decode(&output); err != nil { panic(err) }
    if output.IsError { panic("recall tool failed") }
    fmt.Println("matches:", len(output.Result.Memories))
}
```

The example uses Go's standard HTTP library and checks both HTTP and tool errors. Replace panics with your application's error handling. It counts returned matches without logging their private contents.

## Choosing SDK methods [#choosing-sdk-methods]

The package includes typed clients for control-plane resources and runtime services. The [complete Go reference](/docs/developers/reference/go) lists public functions, receivers, request/result structures, and source locations. Read [Compatibility](/docs/developers/compatibility) first: APIs and result shapes are not guaranteed to match the TypeScript, Python, or Rust packages.
