# Clients

Clients serve as bridges between SONA agents and various platforms, providing core capabilities:

1. **Message Processing**
   * Platform-specific message formatting and delivery
   * Media handling and attachments via `Memory` objects
   * Reply threading and context management
   * Support for different content types
2. **State & Memory Management**
   * Each client maintains independent state to prevent cross-platform contamination
   * Integrates with runtime memory managers for different types of content:
   * Messages processed by one client don't automatically appear in other clients' contexts
   * `State` persists across agent restarts through the database adapter
3. **Platform Integration**
   * Authentication and API compliance
   * Event processing and webhooks
   * Rate limiting and cache management
   * Platform-specific feature support

## Configuration:

```typescript
export type Character = {
    // ... other properties ...
    clientConfig?: {
        uniswap?: {
            shouldTradeInNative?: boolean;
            shouldAllowNewTokens?: boolean;
            enableWrappedETH?: boolean;
            hooks?: string[];
            nativeLimitOrders?: boolean;
        };
        raydium?: {
            raydiumVersion?: string;
        };
        lifi?: {
            enableEfficientRouting?: boolean;
            maxTxTimeLimit?: number;
        };
        nameSystem?: {
            snsVersionHash?: string;
            ensVersionHash?: string;
        };
   
        // ... other client configs
    };
};
```

## Implementation:

```typescript
import { Client, IAgentRuntime, ClientInstance } from "@sona/core";

export class CustomClient implements Client {
    name = "custom";
    
    async start(runtime: IAgentRuntime): Promise<ClientInstance> {
        // Initialize platform connection
        // Set up event handlers
        // Configure message processing

        return {
            stop: async () => {
                // Cleanup resources
                // Close connections
            }
        };
    }
}
```
