Skip to content

KeyError: ~TContext #898

Open
Open
@Navashub

Description

@Navashub

I first did the installation from the documentation

pip install openai-agents

then did the imports

from dotenv import load_dotenv
from agents import Agent, Runner

I am on python version Python 3.11.0

and here is the error:

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In[3], [line 4](vscode-notebook-cell:?execution_count=3&line=4)
      1 # The imports
      3 from dotenv import load_dotenv
----> [4](vscode-notebook-cell:?execution_count=3&line=4) from agents import Agent, Runner

File d:\AI-Agents\deep_research_agent\researchenv\Lib\site-packages\agents\__init__.py:8
      5 from openai import AsyncOpenAI
      7 from . import _config
----> [8](file:///D:/AI-Agents/deep_research_agent/researchenv/Lib/site-packages/agents/__init__.py:8) from .agent import Agent, ToolsToFinalOutputFunction, ToolsToFinalOutputResult
      9 from .agent_output import AgentOutputSchema, AgentOutputSchemaBase
     10 from .computer import AsyncComputer, Button, Computer, Environment

File d:\AI-Agents\deep_research_agent\researchenv\Lib\site-packages\agents\agent.py:18
     16 from .items import ItemHelpers
     17 from .logger import logger
---> [18](file:///D:/AI-Agents/deep_research_agent/researchenv/Lib/site-packages/agents/agent.py:18) from .mcp import MCPUtil
     19 from .model_settings import ModelSettings
     20 from .models.interface import Model

File d:\AI-Agents\deep_research_agent\researchenv\Lib\site-packages\agents\mcp\__init__.py:14
     11 except ImportError:
     12     pass
---> [14](file:///D:/AI-Agents/deep_research_agent/researchenv/Lib/site-packages/agents/mcp/__init__.py:14) from .util import MCPUtil
...
   1444     #   C = Callable[[int], str]
   (...)   1451     # ...we need to be careful; `new_args` should end up as
   1452     # `(int, str, float)` rather than `([int, str], float)`.

KeyError: ~TContext

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-more-infoWaiting for a reply/more info from the authorquestionQuestion about using the SDK

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions