## on_caller_speech()

Rarely needed. This callback fires for every utterance spoken by the caller. Most implementations will not need it and should instead rely on higher-level callbacks like [`on_question`](https://goguava.ai/docs/on-question) or [`on_task_complete`](https://goguava.ai/docs/on-task-complete). It is most useful for implementing call surveillance or real-time transcription logging.

Register a handler to receive a callback whenever caller speech is detected. The event contains what the caller said and an `utterance_id` that distinguishes new utterances from updates to existing ones.

As transcription progresses, you may receive multiple events with the same `utterance_id`. Usually these updates append new words, but there can be slight corrections to previously transcribed words. For example:

- "Hi." — `utterance_id='0'`
- "I am going to the store" — `utterance_id='1'`
- "I'm going to the store and" — `utterance_id='1'` (update to the same utterance)

The `CallerSpeechEvent` is a pydantic model imported from `guava.events`:

```python
from guava.events import CallerSpeechEvent

class CallerSpeechEvent(BaseEvent):
    event_type: Literal["caller-speech"] = "caller-speech"
    utterance: str
    utterance_id: Optional[str] = None
```

### Signature

```python
@agent.on_caller_speech
def on_caller_speech(call: guava.Call, event: CallerSpeechEvent) -> None:
    ...
```

| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| call | Call | — | The active call object. |
| event | CallerSpeechEvent | — | Contains `utterance` (string) and `utterance_id` (optional string) fields. |

**Return value:** `None`

### Example

```python
import logging
from guava.events import CallerSpeechEvent

logger = logging.getLogger(__name__)

@agent.on_caller_speech
def on_caller_speech(call: guava.Call, event: CallerSpeechEvent):
    logger.info("caller speech event: %s", event)

# Output:
# [INFO  13:30:43] caller speech event: sequence=None event_type='caller-speech'
#   utterance='Hi Grace.' utterance_id='19d92d6c68b'
# [INFO  13:30:45] caller speech event: sequence=None event_type='caller-speech'
#   utterance='Hi Grace. I am looking' utterance_id='19d92d6c68b'
# [INFO  13:30:46] caller speech event: sequence=None event_type='caller-speech'
#   utterance='Hi Grace. I am looking to make a reservation' utterance_id='19d92d6c68b'
# [INFO  13:30:49] caller speech event: sequence=None event_type='caller-speech'
#   utterance="It's for me" utterance_id='19d92d6deec'
# [INFO  13:30:50] caller speech event: sequence=None event_type='caller-speech'
#   utterance="It is for me and a couple friends." utterance_id='19d92d6deec'
```
