This page contains practical examples demonstrating how to use the RunAgent Go SDK with different types of agents and use cases.

Problem-Solving Agent

This example shows how to use a generic problem-solving agent that can provide multiple solutions to everyday problems.

Basic Problem Solving

package main

import (
	"context"
	"fmt"
	"log"
	"time"

	"github.com/runagent-dev/runagent-go/pkg/client"
)

func main() {
	agentClient, err := client.NewWithAddress(
		"dba4bf28-01f4-4517-b0b2-e7fa92d75317",
		"generic",
		true,
		"localhost",
		8451,
	)
	if err != nil {
		log.Fatalf("Failed to create client: %v", err)
	}
	defer agentClient.Close()

	ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
	defer cancel()

	result, err := agentClient.Run(ctx, map[string]interface{}{
		"query":         "My phone battery is dead",
		"num_solutions": 4,
	})
	if err != nil {
		log.Fatalf("Failed to run agent: %v", err)
	}

	fmt.Printf("Result: %v\n", result)
}