Python SDK
Installation
Requirements
- Python 3.8 or higher
- httpx for HTTP client
- pydantic for data validation
- typing-extensions for Python < 3.11
Quick Start
Synchronous Client
Asynchronous Client
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
RAG Operations
Simple Query
Query with Sources
Find Relevant Documents
File Uploads
Important: Direct file uploads are no longer available via the public API. Theclient.uploadshelpers now raise descriptive errors so legacy code fails fast. Use the Plugged.in web interface or upcoming ingestion pipeline for binary assets. AI-generated documents remain available throughclient.documents.createandclient.uploads.upload_document.
Async Operations
Concurrent Operations
Async RAG Queries
Error Handling
The SDK provides typed exceptions for better 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.
Async Agent Operations
Agent States
Agents follow the PAP lifecycle state machine:Type Safety with Pydantic
The SDK uses Pydantic models for comprehensive type safety:Advanced Configuration
Custom HTTP Client
Retry Configuration
Logging Configuration
Environment Variables
Store your API key securely using environment variables:Rate Limiting
The SDK automatically handles rate limiting with exponential backoff:- API Endpoints: 60 requests per minute
- Document Search: 10 requests per hour for AI documents
- RAG Queries: Subject to plan limits
Testing
Unit Testing with Mock
Integration Testing
Examples
Complete working examples are available in the GitHub repository:- Basic Usage
- Document Management
- RAG Queries
- File Upload (deprecated)
- Async Operations
- Error Handling
API Reference
Client Classes
| Class | Description |
|---|---|
PluggedInClient | Synchronous API client |
AsyncPluggedInClient | Asynchronous API client |
Configuration Options
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key | str | required | Your Plugged.in API key |
base_url | str | https://plugged.in | API base URL |
timeout | float | 60.0 | Request timeout in seconds |
max_retries | int | 5 | Maximum retry attempts |
debug | bool | False | Enable debug logging |
Document Methods
| Method | Description |
|---|---|
list(filters) | List documents with optional filters |
get(id, include_content, include_versions) | Get a specific document |
search(query, filters, limit, offset) | Search documents semantically |
create(title, content, metadata) | Create a new document |
update(id, request) | Update an existing document |
delete(id) | Delete a document |
RAG Methods
| Method | Description |
|---|---|
query(query) | Returns RagResponse with answer and metadata |
ask_question(query) | Simple RAG query (answer text only) |
query_with_sources(query) | Query with structured source metadata |
find_relevant_documents(query, limit) | Find relevant documents |
check_availability() | Check RAG service availability |
get_storage_stats(user_id) | Get storage statistics |
Upload Methods
Upload helpers now raise descriptive errors because binary ingestion is no longer available via the public API.Clipboard Methods
| Method | Description |
|---|---|
list() | List all clipboard entries |
get(name, idx) | Get entry by name or index |
set(...) | Create or update named entry |
push(...) | Push value to indexed stack |
pop() | Pop and remove most recent entry |
delete(name, idx) | Delete specific entry |
clear_all() | Delete all entries |
Clipboard (Memory) Service
The Clipboard service provides persistent key-value storage for MCP tools and AI agents. Both sync and async clients are supported.Named Access (Sync)
Named Access (Async)
Indexed (Stack) Access
List All Entries
Pydantic Models
Support
- PyPI Package: https://pypi.org/project/pluggedinkit/
- GitHub Issues: Report bugs and request features
- Documentation: https://docs.plugged.in
- Discord: Join our community

