# 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
            }
        };
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tars.pro/sona-framework/core-concepts/clients.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
