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

# Listeners

### `AgentListener`

{/* START */}

A concrete orchestration class that manages the logging lifecycle.
Wraps an `AgentLogger` and manages the concurrent listening task
whilst piping events into the logger.

```python wrap theme={null}
class AgentListener:

    logger: AgentLogger
    connected: asyncio.Event

    def __init__(self, logger: AgentLogger) -> None: ...

    async def listen(self, csm: ClientSessionManager, uid: str, iid: str | None = None) -> None:

    def close(self) -> None: ...
```

The following are key methods:

* `listen` - Starts the async task that receives chunks
* `close` - Cancels the listening task

### `set_default_agent_listener`

{/* START */}

Set the default agent listener for all agents and agentic functions in the current scope.
This is the StandardListener by default.

<Warning>
  This will be over-ridden by any contextual logging or listeners provided on spawning and invoking an agentic function or agent. See [here](/concepts/logging_and_streaming/python) for more information.
</Warning>

{/* START */}

```python wrap theme={null}
def set_default_agent_listener(
    listener: Callable[[], AgentListener] | None, local_context: bool = True
) -> None:
    ...
```

**Parameters**

{/* START */}

<ParamField body="listener" type="Callable[[], AgentListener] | None">
  The listener constructor for logging an agent or agentic function's activity and chat history.
  If None, no listener will be used.
</ParamField>

<ParamField body="local_context" type="bool">
  If True, is only for this Context.
</ParamField>
