Skip to main content

Go SDK

Go Reference License: MIT The official Go SDK for interacting with Plugged.in’s Library API. Features context-aware operations, comprehensive error handling, and full type safety.

Go Package

View on pkg.go.dev

GitHub Repository

Source code and examples

Installation

Requirements

  • Go 1.18 or higher
  • No external dependencies beyond the standard library

Quick Start

Authentication

Get your API key from your Plugged.in Profile:

Core Features

Document Management

List Documents

Get Document

Search Documents

Create AI-Generated Document

Update Document

Delete Document

RAG Operations

Simple Query

Query with Sources

Find Relevant Documents

File Uploads

Important: The Go SDK no longer exposes binary upload helpers. All previous upload functions now return descriptive errors so legacy code fails fast. Continue using DocumentsService.Create for AI-generated content and the Plugged.in web interface (or forthcoming ingestion tools) for binary files.

Error Handling

The SDK provides typed error structs for comprehensive error handling:

PAP Agents

The SDK provides full support for managing PAP (Plugged.in Agent Protocol) agents:

Creating Agents

Listing and Managing Agents

Heartbeats and Metrics

CRITICAL: Heartbeats contain ONLY liveness data. Resource telemetry goes in metrics (separate channel). This separation is PAP’s zombie prevention superpower.

Concurrent Agent Operations

Agent States

Agents follow the PAP lifecycle state machine:
See PAP Agents Documentation for complete details on the Plugged.in Agent Protocol.

Context and Cancellation

All SDK methods accept a context for cancellation and timeout control:

Concurrent Operations

Leverage Go’s concurrency for parallel operations:

Testing

Unit Testing with Interfaces

Integration Testing

Benchmarking

Advanced Configuration

Custom HTTP Transport

Environment Variables

Rate Limiting

The SDK handles rate limiting automatically:
  • API Endpoints: 60 requests per minute
  • Document Search: 10 requests per hour for AI documents
  • RAG Queries: Subject to plan limits

Examples

Complete working examples are available in the GitHub repository:

API Reference

Client Functions

Client Methods

Document Service Methods

RAG Service Methods

Upload Service Methods

Upload helpers now emit descriptive errors because binary ingestion is no longer exposed via the public API.

Clipboard Service Methods

Clipboard (Memory) Service

The Clipboard service provides persistent key-value storage for MCP tools and AI agents.

Named Access

Indexed (Stack) Access

List All Entries

Type Definitions

Support