hi, one question, was `LK_OPENAI_DEBUG` removed in...
# agents
a
hi, one question, was
LK_OPENAI_DEBUG
removed in agents 1.3? i no longer see the openai logs when running playground in debug mode
q
a
yep i checked it (even hardcoded it locally) but still no logs show up
q
let me try on my side
On my side, i can see chat completion log
a
could it be only with OpenAI Realtime the issue?
👀 1
q
i can confirm i can see the debug with openai realtime set up as well , can you run pip list | grep livekit and if our livekit set up are alligned?
Screenshot 2025-12-07 at 18.44.01.png
a
yep same
q
what does your AgentSession() set up looks like?
a
image.png
this are the constants
👀 1
it's weird, i added a INFO level log directly on realtime file on ws connection and is not showing neither
image.png
q
ya I am sensing you mite not be using the python virtual env that you think you are using (or some stale one), are you using uv?
a
yep using uv
uv run --env-file .env python src/agent_server.py dev
running it like this
q
maybe delete the .venv and uv sync again, in case if there is any stale files
a
will try
q
We have a member that reinstall and works
a
mmm still not working, do i have to redeploy it too?
q
can you see the logs locally like uv run --env-file .env python src/agent_server.py console?
a
oh interesting issue here:
Copy code
Traceback (most recent call last):
  File "/.venv/lib/python3.13/site-packages/opentelemetry/util/_decorator.py", line 71, in async_wrapper
    return await func(*args, **kwargs)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.venv/lib/python3.13/site-packages/livekit/agents/ipc/job_proc_lazy_main.py", line 286, in _traceable_entrypoint
    await self._job_entrypoint_fnc(job_ctx)
  File "/src/agent_server.py", line 12, in entrypoint
    from agent import run_session
  File "/src/agent.py", line 18, in <module>
    from core import EventHandlerRegistry, RPCHandlerRegistry, SessionManager
  File "/src/core/__init__.py", line 7, in <module>
    from .session_manager import SessionManager
  File "/src/core/session_manager.py", line 10, in <module>
    from livekit.plugins.openai.realtime import RealtimeModel
  File "/.venv/lib/python3.13/site-packages/livekit/plugins/openai/__init__.py", line 66, in <module>
    Plugin.register_plugin(OpenAIPlugin())
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/.venv/lib/python3.13/site-packages/livekit/agents/plugin.py", line 33, in register_plugin
    raise RuntimeError("Plugins must be registered on the main thread")
RuntimeError: Plugins must be registered on the main thread
q
ok fix that first and did u name your agent?
a
yep it's named
✅ 1
why this error only happens in
console
mode but not in dev or even deployed?
like the agent runs correctly in cloud
q
i was wondering if there is some old version deployed and running that got dispatched to your room
a
i know its the agent that im running locally because the usual logs i can see them in my terminal, its just the OpenAI debug logs not showing
✅ 1
oh there they show
👀 1
i have to ask then because i followed a suggestion from the AI bot, on splitting files like this: agent_server.py
Copy code
from livekit.agents import AgentServer, JobContext, cli

from config import Config

config = Config.from_env()

server = AgentServer()


@server.rtc_session(agent_name=config.agent_name)
async def entrypoint(ctx: JobContext):
    from agent import run_session

    await run_session(ctx)


if __name__ == "__main__":
    cli.run_app(server)
agent.py
Copy code
"""Main entrypoint for the LiveKit Agent application."""

import logging
from pathlib import Path

from livekit import api
from livekit.agents import (
    JobContext,
)
from livekit.agents.voice.room_io import (
    AudioInputOptions,
    RoomOptions,
)
from livekit.plugins import noise_cancellation

from api import AtoApi
from config import Config
from core import EventHandlerRegistry, RPCHandlerRegistry, SessionManager
from core.delivery_tracker import DeliveryTracker
from extended_background_audio import ExtendedBackgroundAudioPlayer
from utils import DisconnectTimer, RecordingManager

logger = logging.getLogger("agent")

# Audio assets path
AUDIO_PATH = Path(__file__).parent
THINKING_AUDIO_FILE = f"{AUDIO_PATH}/assets/thinking.wav"


async def run_session(ctx: JobContext) -> None:
    """Main entrypoint for the LiveKit agent.

    Args:
        ctx: Job context from LiveKit
    """
    # Initialize configuration
    config = Config.from_job(ctx.job.metadata)
    lkapi = api.LiveKitAPI()
    room = ctx.room
#... omitted for simplicity
if i import SessionManager (the file where i define all AgentSession related code) on
agent_server.py
console mode runs, and OA debug logs are showing
✅ 1
well just importing the plugins on
agent_server.py
fix this, interesting
q
must be some sort of module import that reset the value somehow
👍 1
a
thank u @quaint-ambulance-32873 🙌