Skip to content
Discussion options

You must be logged in to vote

This is achievable today without rebuilding the agent — the trick is that OpenAI's code interpreter tool takes container.file_ids as a list, and within a single agent.run() the tool-loop passes the same tool dict to the Responses API on each iteration by reference. So your function tool can upload the oversized result to Files and append the new file_id to that list before returning. The next round-trip in the same run will see the file.

import io
import json
from agent_framework import Agent
from agent_framework.openai import OpenAIChatClient
from openai import AsyncOpenAI

openai_files = AsyncOpenAI()
client = OpenAIChatClient()

# Hold a reference to the file_ids list that the tool wil…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by GabrelBulz
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
agents Issues related to single agents
2 participants