---
type: email
from: Hemant Kumar Chodipilli <notifications@github.com>
subject: Re: [openai/openai-agents-python] Add Support for Image Return in

 Agent Tools (Issue #341)
received: 2026-03-06 07:28:35
date_header: Thu, 11 Sep 2025 06:27:54 -0700
priority: normal
status: awaiting_approval
uid: 30124
---

## Email Content

**From:** Hemant Kumar Chodipilli <notifications@github.com>
**Subject:** Re: [openai/openai-agents-python] Add Support for Image Return in

 Agent Tools (Issue #341)
**Date:** Thu, 11 Sep 2025 06:27:54 -0700

### Body (preview)

hemant1729 left a comment (openai/openai-agents-python#341)



I was able to getting it working use this `call_model_input_filter` 



```

      def _append_images_filter(data: CallModelData[RunContext]) -> ModelInputData:

            context = data.context

            model_data = data.model_data

            agent = data.agent

            if not isinstance(context, RunContext):

                return model_data

            if not context.pending_image_messages:

                return model_data



            # 1) Immediate injection for this LLM call (tail append)

            # 2) Persist permanently by appending RunItems to new_items

            new_input = list(model_data.input)

            if context.run_result_stream is not None:

                for msg in context.pending_image_messages:

                    new_input.append(msg)

                    context.run_result_stream.new_items.append(

                        HandoffOutputItem(

                            raw_item=msg,

                            agent=agent,

                            source_agent=agent,

                            target_agent=agent,

                        )

                    )



            # Clear the buffer once committed

            context.pending_image_messages.clear()



            return ModelInputData(input=new_input, instructions=model_data.instructions)



        result = Runner.run_streamed(

            agent,

            input=full_conversation,  # type: ignore |openai sdk types are messed up

            run_config=RunConfig(tracing_disabled=True, call_model_input_filter=_append_images_filter),

            max_turns=self.max_turns,

            context=run_context,

        )

```



The images are added to the context in the tool's `on_invoke_tool` function.



-- 

Reply to this email directly or view it on GitHub:

https://github.com/openai/openai-agents-python/issues/341#issuecomment-3280683064

You are receiving this because you are su

---

## Suggested Actions
- [ ] Reply
- [ ] Archive
- [ ] Escalate
