Open
Description
Please read this first
- Have you read the docs?Agents SDK docs
- Have you searched for related issues? Others may have had similar requests
Question
I'm trying to access the result values from a code interpreter used by an agent.
Using the following code, I attempted to retrieve and log the executed code and its results after running Runner.run.
result = await Runner.run(agent, natural_language_query)
for new_item in result.new_items:
if (new_item.type == "tool_call_item"
and new_item.raw_item.type == "code_interpreter_call"):
logger.info(f"Code interpreter ======================================= ")
logger.info(f"code:\n```\n{new_item.raw_item.code}\n```\n")
logger.info(f"Results: {new_item.raw_item}")
if new_item.raw_item.results is not None:
logger.info(f"results:")
for idx, r in enumerate(new_item.raw_item.results):
logger.info(f"Result {idx}")
logger.info(r)
From the traces, I can confirm that the code interpreter runs the code and produces output as expected.
However, the value of new_item.raw_item.results is always None.
I’m not sure if:
- This is the intended behavior,
- This is a bug where the results are not being set, or
- There is a separate step I need to take to retrieve the results properly.
I would appreciate any clarification on this.
Thank you!