am getting this error: ERROR:livekit.agents:Error ...
# ask-ai
b
am getting this error: ERRORlivekit.agentsError in _update_activity_task during agent to agent handoff... not in local dev mode but in deployed livekit cloud.
t
Thanks for reaching out, Samuel. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I'm looking into the agent-to-agent handoff error you reported. To troubleshoot this quickly, please share the following so I can pinpoint the cause and recommend a fix: 1. The full Cloud error log (complete stack trace from
lk agent logs --log-type deploy
). 2. The handoff code you use (either the
session.update_agent()
call or the function/tool return that triggers the handoff). 3. Whether the target agent uses different plugins/tools or credentials than the source agent. 4. Your deployment region and plan type. 5. Confirmation that required secrets (for example
OPENAI_API_KEY
or other provider keys) are set in the cloud deployment. If you prefer, paste the log and code here and I’ll review them and provide specific steps (config fixes, environment checks, or code adjustments) to resolve the
_update_activity_task
error. Sources: Agents and handoffs | LiveKit docs | Deploying to production | LiveKit Docs | Agents Framework | livekit/livekit_composite | DeepWiki | Events and error handling | LiveKit docs | Agent deployment CLI reference | LiveKit docs
b
how do i get the complete stack trace?
t
You're asking how to get the complete stack trace — here’s the quickest way to retrieve it from LiveKit Cloud. 1. Open Agent Insights for the session • Go to your LiveKit Cloud Sessions Dashboard: https://cloud.livekit.io/projects/p_/sessions • Open the session where the handoff failed and click the Agent insights tab. 1. Use the Trace and Logs views • In Trace, find the span for the handoff/agent transfer and expand it — it shows error details and the full call context. • In Logs, view chronological runtime logs (stdout/stderr) aligned with the trace; stack traces from your agent process appear here. 1. If you need streaming or recent instance logs • Run locally to stream the newest instance logs:
Copy code
lk agent logs
Note: this shows only the newest agent server instance, not all instances. 1. Ensure full detail is being captured • Set the agent log level to DEBUG in start command or Dockerfile:
Copy code
CMD ["python", "agent.py", "start", "--log-level=DEBUG"]
• Confirm Agent Observability is enabled in your project’s Data & privacy settings and your SDK version supports observability (Python ≥ 1.3.0, Node ≥ 1.0.18). 1. Download or copy the trace/log • In Agent insights you can expand traces and download session data (transcript, trace, logs) for offline analysis. Observability data is retained for 30 days. If you paste the trace or the Logs output here (or the
lk agent logs
output), I’ll review the full stack trace and point to the likely cause and next steps. Sources: Agent insights in LiveKit Cloud | LiveKit docs | https://blog.livekit.io/streamline-troubleshooting-with-agent-observability/#/portal| | Log collection | LiveKit Docs
b
this is the error i got: DEBUGhttpcore.http11receive_response_body.started request=<Request [b'POST']> DEBUGhttpcore.http11receive_response_body.complete DEBUGhttpcore.http11response_closed.started DEBUGhttpcore.http11response_closed.complete 2025-12-11 175041 - farm_equipment_app.APIClient - INFO - [api_client.py:224] - POST request completed INFOfarm equipment app.APIClientPOST request completed 2025-12-11 175041 - farm_equipment_app.MessagesClient - INFO - [base_farm_client.py:83] - Create successful INFOfarm equipment app.MessagesClientCreate successful 2025-12-11 175041 - farm_equipment_app.APIClient - INFO - [api_client.py:224] - POST request completed INFOfarm equipment app.APIClientPOST request completed {"message": "POST request completed", "level": "INFO", "name": "farm_equipment_app.APIClient", "endpoint": "/api/v1/messages", "status_code": 201, "success": true, "pid": 182, "job_id": "AJ_e2V5WUUQHCZo", "timestamp": "2025-12-11T175041.947267+00:00"} 2025-12-11 175041 - farm_equipment_app.MessagesClient - INFO - [base_farm_client.py:83] - Create successful INFOfarm equipment app.MessagesClientCreate successful {"message": "Create successful", "level": "INFO", "name": "farm_equipment_app.MessagesClient", "pid": 182, "job_id": "AJ_e2V5WUUQHCZo", "timestamp": "2025-12-11T175041.947546+00:00"} ERRORlivekit.agentsError in _update_activity_task
t
Thanks — the snippet shows successful POSTs but not the stack trace. To get the complete stack trace, please do one of the following and paste the output here: 1) From the LiveKit Cloud dashboard (recommended) • Open the session in the Sessions Dashboard: https://cloud.livekit.io/projects/p_/sessions • Click Agent insights → Trace and find the span for the handoff/agent transfer. Expand the span and copy the error details / stack trace shown there. • Also open Logs in Agent insights and copy the runtime error lines around the handoff timestamp (the logs are time‑synchronized with the trace). 2) Via CLI (streams newest instance logs) • Run:
Copy code
lk agent logs
• Reproduce the handoff or scroll back to the timestamp (2025-12-11T175041). Copy the full error block including traceback lines that follow
ERROR:livekit.agents:Error in _update_activity_task
. 3) If observability isn’t enabled or you prefer downloading • In Agent insights you can download the session data (transcript, trace, logs) and paste the trace/log file contents here. What to include when you paste logs: • The full traceback lines (stack frames and exception message) • A few log lines before and after the error for context • The trace span metadata if available (span name, timestamps, any attached error fields) If you paste the full trace here I’ll review it and point to the likely cause and next steps.
b
i did stream it using lk agent logs. but still i get this error: nothing more "`ERRORlivekit.agentsError in _update_activity_task`."
t
Thanks — I hear you: you only see the single line
ERROR:livekit.agents:Error in _update_activity_task
even after streaming logs. To help find the hidden traceback, please try the following short checks and share the results you get: 1. Confirm SDK & agent runtime • Which agent SDK are you running (Python or Node)? Give the exact LiveKit Agents SDK version. 1. Increase log verbosity and restart the agent • Start the agent with DEBUG or TRACE so exceptions and tracebacks are emitted. • Examples: ◦ If running via CLI:
Copy code
lk agent run --log-level=DEBUG
• If running in Docker, set the CMD to include `--log-level=DEBUG`:
Copy code
CMD ["python", "agent.py", "start", "--log-level=DEBUG"]
• After restart, reproduce the handoff and paste the logs for ~30s around the error timestamp. 1. Verify observability is enabled (dashboard) • In the LiveKit Cloud project, under Data & privacy, ensure Agent Observability is enabled. Then open the session → Agent insights → Trace and Logs to copy the expanded handoff span and log entries. 1. Check for swallowed exceptions in your code • If your handoff code or lifecycle hooks use broad try/except blocks, they may catch and re-log without stack traces. Search for
except Exception
or generic catches around handoff and temporarily log the exception with
exc_info=True
(Python) or include the error stack (Node) to surface the traceback. 1. Confirm environment differences • Tell me how you deploy (lk agent deploy, custom container, etc.), and whether the deployed image matches your local one (same dependencies / commit). • Verify required secrets (e.g., provider API keys) are present in the cloud deploy. If you prefer, paste: • The agent start command or Docker CMD, • The handoff code snippet, • The output you see after starting with
--log-level=DEBUG
. I’ll review those and point to the exact line that should produce the full traceback or the specific fix to surface it.
b
i added --log-level=DEBUG to the docker build while deploying it. and enabled observability in the lk cloud.
t
Thanks — I appreciate you enabling DEBUG and observability. Since you're still only seeing the single error line, let’s target the places that reliably surface full tracebacks and a few quick checks to catch swallowed exceptions. Quick checklist (perform in order) — paste results you get: 1. Open Agent Insights → Trace for that session • Find the handoff span and expand it. Copy the span’s error details (the Trace view always shows the error context even when the CLI log is terse). 1. In Agent Insights → Logs, filter around the handoff timestamp • Download the session logs or copy ~50 lines before/after the ERROR line. The dashboard logs are time‑synchronized with the trace and often include the traceback omitted by the CLI stream. 1. Confirm your agent process is logging exceptions with stack traces • In Python, ensure any broad exception handlers log with exc_info=True: ◦ Replace occurrences like
logger.exception("...")
or
logger.error("...", exc_info=True)
where you catch exceptions in lifecycle hooks, handoff logic, or `on_enter`/`on_exit`. • If you have generic
except Exception:
blocks around handoff or tool calls, temporarily re-raise after logging to surface the traceback. 1. Reproduce with a single-instance run (if possible) • Run the agent container locally or via
lk agent run --local
with the same image and env vars and trigger the exact handoff. Local runs often show full tracebacks that get lost in multi-instance cloud logging. 1. Confirm no worker/process is exiting early • Check your Docker/container entrypoint and supervisor: ensure Python isn’t swallowing exceptions because a child process exits. In logs, look for process restarts or termination messages immediately after the ERROR line. If you still only have the single error line after steps 1–2, please paste: • The expanded Trace span error details (from Agent Insights) OR the downloaded logs (50 lines before/after the ERROR). • Your SDK (Python/Node) and exact SDK version. • The handoff code snippet and any `on_enter`/`on_exit` hooks involved. I’ll analyze the trace/log block and the handoff code and point to the exact cause and fix.
b
is there a way to delte all the containers and do a fresh deploy
t
Do you want to delete in LiveKit Cloud or on your own host (Docker/Kubernetes)? Which one should I give steps for? Sources: Deploying to production | LiveKit Docs | Agent deployment CLI reference | LiveKit docs | Deploy to a VM | LiveKit docs | Deploy to Kubernetes | LiveKit docs | Builds and Dockerfiles | LiveKit Docs
b
Livekit Cloud
t
Great — since you're on LiveKit Cloud, follow these steps to delete the existing agent and do a fresh deploy: 1. List agents to get the agent ID:
Copy code
lk agent list
1. Delete the agent (removes the deployed container and its secrets for that deployment):
Copy code
lk agent delete --id <agent_id>
1. Confirm deletion (optional):
Copy code
lk agent list
1. Create/deploy a fresh agent: • Interactive create:
Copy code
lk agent create
• Or deploy from a config:
Copy code
lk agent deploy -f agent.yml
1. Re-add required secrets (they are not retained after delete):
Copy code
lk secret set --agent-id <new_agent_id> OPENAI_API_KEY=<your_key>
# repeat for other secrets
1. Re-enable Agent Observability if needed: • Console → Project Settings → Data & Privacy → toggle Agent Observability on. If you want, tell me the agent ID and I’ll confirm the exact delete/create commands for your setup, or paste any error you see while running these commands.
b
Traceback (most recent call last): File "/opt/venv/lib/python3.11/site-packages/livekit/agents/utils/log.py", line 16, in async_fn_logs return await fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/livekit/agents/voice/agent_session.py", line 1090, in _update_activity_task await self._update_activity(agent) File "/opt/venv/lib/python3.11/site-packages/livekit/agents/voice/agent_session.py", line 1074, in _update_activity await self._activity.start() File "/opt/venv/lib/python3.11/site-packages/livekit/agents/voice/agent_activity.py", line 458, in start await self._start_session() File "/opt/venv/lib/python3.11/site-packages/livekit/agents/voice/agent_activity.py", line 548, in _start_session await self._rt_session.update_chat_ctx(self._agent.chat_ctx) File "/opt/venv/lib/python3.11/site-packages/livekit/plugins/openai/realtime/realtime_model.py", line 1106, in update_chat_ctx events = self._create_update_chat_ctx_events(chat_ctx) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/livekit/plugins/openai/realtime/realtime_model.py", line 1168, in _create_update_chat_ctx_events _create_item(previous_msg_id, msg_id) File "/opt/venv/lib/python3.11/site-packages/livekit/plugins/openai/realtime/realtime_model.py", line 1147, in _create_item item=livekit_item_to_openai_item(chat_item), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/livekit/plugins/openai/realtime/utils.py", line 223, in livekit_item_to_openai_item conversation_item.id = item.id ^^^^^^^^^^^^^^^^^ UnboundLocalError: cannot access local variable 'conversation_item' where it is not associated with a value
t
Thanks — that traceback is helpful. The immediate cause is an UnboundLocalError in the OpenAI realtime plugin:
conversation_item
is referenced before being assigned in
livekit/plugins/openai/realtime/utils.py
. That means the plugin code expects a value that isn’t being created for some chat item during the handoff. What you can do next (quick, prioritized steps): 1. Tell me your LiveKit Agents SDK and OpenAI plugin versions (exact package versions). 2. Patch/workaround to get a quick repro and avoid the crash: ◦ In
livekit/plugins/openai/realtime/utils.py
around the function that defines
conversation_item
, add a safe guard so
conversation_item
is always initialized before being referenced. For example (conceptual): ▪︎ Ensure
conversation_item = None
before conditionals that may set it. ▪︎ Before
conversation_item.id = item.id
, check
if conversation_item is None: create or skip
and log the unexpected item shape. ◦ If you don’t want to change vendor code in production, run your agent locally with the same data and add logging around chat items to see which item shape is missing fields. 1. Verify incoming chat/context items: ◦ Inspect the chat items being passed during handoff (the
chat_ctx
contents). Look for any item lacking expected fields (
id
, type, etc.). Paste a representative chat item here and I’ll inspect it. 1. Recommended long-term fixes: ◦ Upgrade to the latest LiveKit Agents packages (SDK + plugins) if you can — this looks like a bug that may already be fixed in a newer release. ◦ If upgrading isn’t possible, I can give a minimal patch you can apply to
realtime/utils.py
to avoid the UnboundLocalError and log the problematic item so we can root-cause why it’s missing. Which would you like to do first — share your package versions so I can check for a published fix, or I can provide the exact patch to add into
realtime/utils.py
now?
b
PackageVersions: livekit=1.0.20, livekit-agents=1.3.6, livekit-api=1.1.0, livekit-protocol=1.1.1, livekit-plugins-openai=1.3.6, livekit-plugins-silero=1.3.6, livekit-plugins-noise-cancellation=0.2.5, openai=2.6.0 2025-12-12 041217 - farm_equipment_app.AgentMain - INFO - [main.py:51] - PackageVersions: livekit=1.0.20, livekit-agents=1.3.6, livekit-api=1.1.0, livekit-protocol=1.1.1, livekit-plugins-openai=1.3.6, livekit-plugins-silero=1.3.6, livekit-plugins-noise-cancellation=0.2.5, openai=2.6.0
t
Thanks — this shows the root cause:
conversation_item
is referenced before assignment inside
livekit-plugins-openai
(v1.3.6). Two practical fixes: Option A — Recommended: upgrade packages and redeploy 1. Update packages and rebuild your image:
Copy code
pip install --upgrade "livekit>=1.1" "livekit-agents>=1.4" "livekit-plugins-openai>=1.4"
1. Rebuild Docker, then in LiveKit Cloud:
Copy code
lk agent delete --id <agent_id>
   lk agent create   # or lk agent deploy -f agent.yml
   lk secret set --agent-id <new_agent_id> OPENAI_API_KEY=<your_key>
1. Enable Agent Observability and reproduce the handoff; trace/logs should no longer hit that UnboundLocalError. Option B — Temporary workaround (if you cannot upgrade immediately) Add a small monkey-patch at startup (place in your main entry before agents start) to avoid the UnboundLocalError and log the offending item:
Copy code
import logging
from livekit.plugins.openai.realtime import utils as openai_utils

_original = openai_utils.livekit_item_to_openai_item

def _patched(chat_item):
    try:
        return _original(chat_item)
    except UnboundLocalError as e:
        if "conversation_item" in str(e):
            logging.warning("Missing conversation_item for chat_item %s; skipping.", getattr(chat_item, "id", None))
            placeholder = type("P", (), {})()
            placeholder.id = getattr(chat_item, "id", None)
            placeholder.role = getattr(chat_item, "role", None)
            placeholder.content = getattr(chat_item, "content", "")
            return placeholder
        raise

openai_utils.livekit_item_to_openai_item = _patched
Which path would you like to take — upgrade+redeploy now, or apply the monkey-patch so you can keep running while scheduling an upgrade? If you choose upgrade, paste the agent ID and I’ll confirm the exact deploy commands for your setup. Sources: Agent deployment CLI reference | LiveKit docs
b
good enough? livekit >= "1.1" livekit-agents >= "1.4" livekit-blingfire = "1.0.0" livekit-plugins-openai >= "1.4" livekit-plugins-silero = "1.3.6" livekit-plugins-noise-cancellation = "0.2.5"
t
Yes — those upgrades look sufficient to include the fix. Next steps to update and redeploy: 1. Update your dependencies (example for pip/pyproject):
Copy code
pip install --upgrade "livekit>=1.1" "livekit-agents>=1.4" "livekit-plugins-openai>=1.4"
# keep others as specified:
pip install "livekit-blingfire==1.0.0" "livekit-plugins-silero==1.3.6" "livekit-plugins-noise-cancellation==0.2.5"
1. Rebuild your Docker image:
Copy code
docker build -t my-agent:latest .
1. Delete the existing agent in LiveKit Cloud and create/deploy a fresh one:
Copy code
lk agent list
lk agent delete --id <old_agent_id>
lk agent create          # or: lk agent deploy -f agent.yml
1. Re-set secrets (they are not retained after delete):
Copy code
lk secret set --agent-id <new_agent_id> OPENAI_API_KEY=<your_key>
# repeat for any other secrets
1. Enable/confirm Agent Observability and run a repro: • Console → Project Settings → Data & Privacy → Agent Observability ON • Reproduce the handoff and check Agent Insights → Trace and Logs for absence of the UnboundLocalError. If you need, I can provide: • The exact pip/pyproject snippet you should add, or • The minimal monkey-patch (temporary) if you must avoid an immediate redeploy. Which would you like?
b
there's no 1.4 livekit-agents
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!
b
fix: Traceback (most recent call last): File "/opt/venv/lib/python3.11/site-packages/livekit/agents/utils/log.py", line 16, in async_fn_logs return await fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/livekit/agents/voice/agent_session.py", line 1090, in _update_activity_task await self._update_activity(agent) File "/opt/venv/lib/python3.11/site-packages/livekit/agents/voice/agent_session.py", line 1074, in _update_activity await self._activity.start() File "/opt/venv/lib/python3.11/site-packages/livekit/agents/voice/agent_activity.py", line 458, in start await self._start_session() File "/opt/venv/lib/python3.11/site-packages/livekit/agents/voice/agent_activity.py", line 553, in _start_session await self._rt_session.update_tools(self.tools) File "/opt/venv/lib/python3.11/site-packages/livekit/plugins/openai/realtime/realtime_model.py", line 1183, in update_tools ev = self._create_tools_update_event(tools) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/livekit/plugins/openai/realtime/realtime_model.py", line 1212, in _create_tools_update_event tool_desc = llm.utils.build_legacy_openai_schema(tool, internally_tagged=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/livekit/agents/llm/utils.py", line 203, in build_legacy_openai_schema model = function_arguments_to_pydantic_model(function_tool) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/livekit/agents/llm/utils.py", line 345, in function_arguments_to_pydantic_model return create_model(model_name, **fields) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/pydantic/main.py", line 1441, in create_model return meta( ^^^^^ File "/opt/venv/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py", line 182, in new complete_model_class( File "/opt/venv/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py", line 491, in complete_model_class schema = cls.__get_pydantic_core_schema__(cls, handler) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/pydantic/main.py", line 578, in __get_pydantic_core_schema__ return __handler(__source) ^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/pydantic/_internal/_schema_generation_shared.py", line 82, in call schema = self._handler(__source_type) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 468, in generate_schema schema = self._generate_schema(obj) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 700, in _generate_schema schema = self._post_process_generated_schema(self._generate_schema_inner(obj)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 722, in _generate_schema_inner return self._model_schema(obj) ^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 541, in _model_schema {k: self._generate_md_field_schema(k, v, decorators) for k, v in fields.items()}, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 541, in <dictcomp> {k: self._generate_md_field_schema(k, v, decorators) for k, v in fields.items()}, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 886, in _generate_md_field_schema common_field = self._common_field_schema(name, field_info, decorators) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 951, in _common_field_schema schema = self._apply_annotations( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 1654, in _apply_annotations schema = get_inner_schema(source_type) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/pydantic/_internal/_schema_generation_shared.py", line 82, in call schema = self._handler(__source_type) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 1635, in inner_handler schema = self._generate_schema(obj) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 700, in _generate_schema schema = self._post_process_generated_schema(self._generate_schema_inner(obj)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 727, in _generate_schema_inner return self.match_type(obj) ^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 810, in match_type return self._match_generic_type(obj, origin) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 834, in _match_generic_type return self._union_schema(obj) ^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 1036, in _union_schema choices.append(self.generate_schema(arg)) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 468, in generate_schema schema = self._generate_schema(obj) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 700, in _generate_schema schema = self._post_process_generated_schema(self._generate_schema_inner(obj)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 727, in _generate_schema_inner return self.match_type(obj) ^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 775, in match_type return self._typed_dict_schema(obj, None) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 1115, in _typed_dict_schema raise PydanticUserError( pydantic.errors.PydanticUserError: Please use
typing_extensions.TypedDict
instead of
typing.TypedDict
on Python < 3.12. For further information visit https://errors.pydantic.dev/2.5/u/typed-dict-version