Skip to main content
Agents automatically handle PDF files when included in prompts. First validate your PDF file with Timbal’s File type, then pass it alongside text in a list:
from timbal import Agent
from timbal.types.file import File

agent = Agent(
    name="DocumentAgent",
    model="openai/gpt-4.1", # Vision-capable model
    system_prompt="Analyze PDF documents and extract key information."
)

# Validate PDF file and analyze
pdf_file = File.validate("path/to/document.pdf")
result = await agent(
    prompt=["Summarize this document and highlight the main points", pdf_file]
).collect()

print(result.output.content[0].text)
PDFs are converted to images, so vision-capable models are required. Check Model Capabilities to see which models support image input.

Key Features

  • Automatic Processing: PDF files are automatically converted to images and parsed for text content
  • Document Analysis: Extract text, structure, and insights from PDF documents
  • File Support: Works with local files, URLs, and base64 data