> ## Documentation Index
> Fetch the complete documentation index at: https://docs.taskforceai.chat/llms.txt
> Use this file to discover all available pages before exploring further.

# Go SDK

> Idiomatic Go client for TaskForceAI

The TaskForceAI Go SDK provides a robust, idiomatic way to integrate multi-agent workflows into your Go applications.

The package README is the canonical reference for constructor options, status polling, streaming, mock mode, and release-specific usage details. This page is intentionally limited to install plus a minimal example.

## Canonical Reference

* Package README: [packages/sdk/go/README.md](https://github.com/TaskForceAI/taskforceai/blob/main/packages/sdk/go/README.md)
* REST API reference: [/docs/api](/docs/api)

## Installation

```bash theme={null}
go get github.com/ClayWarren/taskforceai-open/packages/sdk-go
```

## Quick Start

```go theme={null}
package main

import (
	"context"
	"fmt"
	"log"

	"github.com/ClayWarren/taskforceai-open/packages/sdk-go"
)

func main() {
	client, err := taskforceai.NewClient(taskforceai.TaskForceAIOptions{
		APIKey: "your-api-key-here",
	})
	if err != nil {
		log.Fatal(err)
	}

	status, err := client.RunTask(context.Background(), "Analyze this repository", nil, 0, 0, nil)
	if err != nil {
		log.Fatal(err)
	}

	if status.Result != nil {
		fmt.Printf("Result: %s\n", *status.Result)
	}
}
```

## Streaming

```go theme={null}
stream, err := client.RunTaskStream(context.Background(), "Summarize this article", nil)
if err != nil {
	log.Fatal(err)
}
defer stream.Close()
```

## Files and Threads

```go theme={null}
uploaded, err := client.UploadFile(
	context.Background(),
	"brief.txt",
	strings.NewReader("Context for the run"),
	&taskforceai.FileUploadOptions{Purpose: "assistants", MimeType: "text/plain"},
)

thread, err := client.CreateThread(context.Background(), &taskforceai.CreateThreadOptions{
	Title: "Security review",
})

run, err := client.RunInThread(context.Background(), thread.ID, taskforceai.ThreadRunOptions{
	Prompt: "Review the uploaded brief.",
	Options: map[string]any{"agentCount": 4},
})
```

Use `UploadAttachment` for task-scoped images that should be submitted as transient `attachment_ids`; use `UploadFile` for persistent Developer API files.
