Skip to content

Examples: use agent to interact with Remote PDF Documents #1319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 31, 2025

Conversation

princeaden1
Copy link
Contributor

Changes being requested

Added a new example to use agent to interact with remote pdf. This example demonstrates how to use the Open AI to understand and summarise content from a remote pdf.

What's Included

New example: examples/basic/remote_pdf.py

Why This Matters

Shows how to integrate file-based content into the agent workflow
Useful for summarising reports, papers, or legal docs hosted online
Helps users extend agent capabilities to real-world document formats

Code

import asyncio

from agents import Agent, Runner

URL = "https://www.berkshirehathaway.com/letters/2024ltr.pdf"


async def main():
    agent = Agent(
        name="Assistant",
        instructions="You are a helpful assistant.",
    )

    result = await Runner.run(
        agent,
        [
            {
                "role": "user",
                "content": [{"type": "input_file", "file_url": URL}],
            },
            {
                "role": "user",
                "content": "Can you summarize the letter?",
            },
        ],
    )
    print(result.final_output)


if __name__ == "__main__":
    asyncio.run(main())

@seratch seratch added the documentation Improvements or additions to documentation label Jul 31, 2025
Copy link
Member

@seratch seratch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seratch seratch enabled auto-merge (squash) July 31, 2025 01:34
@seratch seratch merged commit 3a16a24 into openai:main Jul 31, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants