SDK · Go

Give your Go service lasting context.

Store what your service needs to remember and retrieve it in later requests. The Minds Go SDK connects your application to a dedicated Mind with familiar contexts, HTTP calls, and explicit errors.

Go · explicit request lifetimes

Know when the work should stop.

A request, its context, and an outcome your service handles.

Go request.goREQUEST INSPECTOR
01ctx, cancel := context.WithCancel(parent)02defer cancel()03record, err := runtime.KV().Get(ctx, "user:1001")04if err != nil {05    return nil, err06 }07return record.Value, nil
context.ContextHandler returnedcontext.Canceled
EVENT ORDERIllustrative request
01handlercontext.WithCancelcreated
02runtime.KVGet(ctx, "user:1001")interrupted
03contextctx.Done()closed
04handlerdefer cancel()complete

Leave the caller with a clear outcome.

Return the error, run deferred cleanup, and stop the local work. A canceled request does not roll back an operation that has already completed on the server.

Choose a chapter to explore

Example KV read with a Go context. Cancellation stops the client waiting; a completed server operation remains completed.

Capabilities

Build on the Go patterns you already use.

Start with a stored record, then add memory, connected knowledge, or analytics. Keep request cancellation and error handling in your application’s normal flow.

01

Connect to your Mind.

Create a client with your API URL and token, then choose the dedicated instance your service will use.

02

Separate data from administration.

Use the instance client for data and memory. Use the account client for backups, monitoring, and administration.

03

Keep the connection familiar.

Requests use Go’s standard HTTP client and JSON, fitting into existing service configuration and diagnostics.

04

Control the request lifecycle.

Pass a context to set deadlines or cancel work. Inspect typed errors to decide how your service should respond.

05

Use the right way to query.

Read a record by key, analyze stored data with SQL, or follow relationships with a graph query.

06

Add model operations.

Request predictions, classifications, or embeddings from models configured on your Mind, including batch inference.

API

Find a decision from your Go service.

This standard-library HTTP example makes the request and authentication explicit. Set AKASHA_URL to your MCP-enabled Mind, AKASHA_TOKEN to your access token, and AKASHA_CAPABILITY to a signed credential with memory-read permission.

Memory request · Go HTTPgo
package main

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

func main() {
    ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
    defer cancel()

    endpoint := strings.TrimRight(os.Getenv("AKASHA_URL"), "/") + "/v1/mcp/tools/call"
    payload := strings.NewReader(`{"name":"recall","arguments":{"query":"What release schedule did we choose?","limit":5}}`)
    req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint, payload)
    if err != nil { panic(err) }
    req.Header.Set("Content-Type", "application/json")
    req.Header.Set("Authorization", "Bearer " + os.Getenv("AKASHA_TOKEN"))
    req.Header.Set("X-Akasha-Capability", os.Getenv("AKASHA_CAPABILITY"))

    response, err := http.DefaultClient.Do(req)
    if err != nil { panic(err) }
    defer response.Body.Close()
    if response.StatusCode >= 300 { panic(response.Status) }

    var output struct {
        IsError bool            `json:"is_error"`
        Result  json.RawMessage `json:"result"`
    }
    if err := json.NewDecoder(response.Body).Decode(&output); err != nil { panic(err) }
    if output.IsError { panic("Memory tool failed") }
    fmt.Println(string(output.Result))
}
Specs

What ships in the package.

At a glance
Module
github.com/l1feai/minds-go-sdk
Package
akasha
Constructor
NewClient(baseURL, apiKey)
Connection
HTTP · JSON
Errors
*akasha.Error

Bring persistent context to your service.

Connect your Go application to a dedicated Mind and bring saved context into your next request.