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

# WebSocket Protocol

> WebSocket message format and protocol details.

## Message Types

### Outgoing (SDK → Platform)

#### register\_conversation\_tools

Register available tools when agent starts:

```json theme={null}
{
  "type": "register_conversation_tools",
  "conversation_id": "conv_123",
  "tools": [
    {
      "name": "get_weather",
      "description": "Get current weather for a location",
      "parameters": {
        "type": "object",
        "properties": {
          "location": {"type": "string"}
        },
        "required": ["location"]
      }
    }
  ]
}
```

#### tool\_call\_response

Return tool execution result:

```json theme={null}
{
  "type": "tool_call_response",
  "call_id": "call_abc123",
  "result": {
    "temperature": 72,
    "condition": "sunny"
  }
}
```

#### tool\_call\_error

Report tool execution error:

```json theme={null}
{
  "type": "tool_call_error",
  "call_id": "call_abc123",
  "error": {
    "type": "execution_error",
    "message": "Service unavailable"
  }
}
```

### Incoming (Platform → SDK)

#### tool\_call\_request

Request tool execution:

```json theme={null}
{
  "type": "tool_call_request",
  "call_id": "call_abc123",
  "conversation_id": "conv_123",
  "tool_name": "get_weather",
  "parameters": {
    "location": "San Francisco"
  }
}
```

#### conversation\_lifecycle

Conversation started or ended:

```json theme={null}
{
  "type": "conversation_lifecycle",
  "event": "started",
  "conversation_id": "conv_123",
  "timestamp": "2024-01-15T10:30:00Z"
}
```

## Connection Flow

1. Agent connects to WebSocket
2. Platform authenticates agent
3. Agent registers tools
4. Platform sends tool\_call\_request
5. Agent executes tool
6. Agent sends tool\_call\_response
7. Repeat 4-6 during conversation
8. Platform sends conversation\_lifecycle (ended)
