You can set monitoring=True on any agent to log that agent’s sessions or set PHI_MONITORING=true in your environment to log all agent sessions. Create a file monitoring.py with the following code:
monitoring.py
from phi.agent import Agent

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

Authenticate with phidata

Authenticate with phidata by running the following command:
phi auth
or by exporting the PHI_API_KEY for your workspace from phidata.app
export PHI_API_KEY=phi-***

Run the agent

Run the agent and view the session on phidata.app/sessions
python monitoring.py

Debugging

Phidata 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 PHI_DEBUG=true in your environment.
debugging.py
from phi.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:
python debugging.py