from pathlib import Path
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."
)
document = Path("document.pdf")
document.write_bytes(b"%PDF-1.1\n")
# Validate PDF file and analyze
pdf_file = File.validate(str(document))
result = await agent(
prompt=["Summarize this document and highlight the main points", pdf_file]
).collect()
print(result.output.collect_text())