Custom Toolsets in Go or Python

The built-in tools cover a lot, but sooner or later your agent needs to call your own pricing engine, internal API, or some deterministic algorithm. That is what custom toolsets are for, and you can write them in Go or Python.

Start with the scaffold:

sam toolset init freight-rates --lang go
# or
sam toolset init weather --lang python

You get a kind: toolset YAML file plus a src/ folder with the code, a manifest.yaml and a build script. The Go skeleton vendors the SDK, so it builds without network access.

Go

Each tool is a function with a typed params struct. The desc tags become the parameter descriptions the agent sees:

type QuoteParams struct {
    Origin      string  `json:"origin" desc:"Origin city or port"`
    Destination string  `json:"destination" desc:"Destination city or port"`
    Mode        string  `json:"mode" desc:"air, ocean, road, or rail"`
    WeightKg    float64 `json:"weight_kg" desc:"Gross weight in kilograms"`
}

func main() {
    sdk.Run(
        sdk.NewTool("quote_freight_rate", "Quotes an all-in lane rate.", quoteFreightRate),
        sdk.NewTool("get_fuel_surcharge", "Returns the weekly fuel surcharge.", getFuelSurcharge),
    )
}

Python

Same idea, with type hints and a docstring:

from sam_tool_sdk import SandboxToolContextFacade, ToolResult, tool_cli

def get_forecast(city: str, ctx: SandboxToolContextFacade) -> ToolResult:
    """Return the current forecast for a city.

    Args:
        city: City to look up the forecast for.
    """
    ctx.send_status(f"looking up forecast for {city}")
    return ToolResult.ok({"forecast": f"Sunny in {city}, 22 C."})

cli = tool_cli(get_forecast)

Before uploading anything, sam toolset validate <name> runs the same schema discovery the runtime does. That catches a bad import or schema in seconds. Then list the toolset in your manifest and sam config apply builds and uploads it. Against the desktop app you can use the reserved desktop target, so there’s no URL to hardcode.

Once it’s uploaded, the tools show up by name, ready to attach to any agent:

My take: pick Go when you want a single binary with no dependencies, and Python when the library you need only exists there. Python toolsets need a desktop release with Python 3.10 or later.

Docs:

Download the Solace Agent Mesh desktop app and scaffold your first toolset in a couple of minutes.

Go or Python for your tools? Tell me what you’d build first and I’ll help you get it running in the replies.