# Monitoring

You can set `monitoring=True` on any agent to log that agent’s sessions or set `BITCA_MONITORING=true` in your environment to log all agent sessions.

Create a file `monitoring.py` with the following code:\
monitoring.py

```python
from bitca.agent import Agent

agent = Agent(markdown=True, monitoring=True)
agent.print_response("Share a 2 sentence horror story")
```

#### Authenticate with bitca <a href="#authenticate-with-phidata" id="authenticate-with-phidata"></a>

Authenticate with bitca by running the following command:

```
bitca auth
```

or by exporting the BITCA`_API_KEY` for your workspace from bitcadata.app

```bash
export BITCA_API_KEY=bitca-***
```

#### Run the agent <a href="#run-the-agent" id="run-the-agent"></a>

Run the agent and view the session on bitca.app/sessions

```python
python monitoring.py
```

### Debugging <a href="#debugging" id="debugging"></a>

Bitca also includes a built-in debugger that will show debug logs in the terminal. You can set `debug_mode=True` on any agent to view debug logs or set `BITCA_DEBUG=true` in your environment.&#x20;

\
debugging.py

```python
from bitca.agent import Agent

agent = Agent(markdown=True, debug_mode=True)
agent.print_response("Share a 2 sentence horror story")
```

Run the agent to view debug logs in the terminal:

```shell
python debugging.py
```
