from pathlib import Path
from timbal import Agent
from timbal.types.file import File
agent = Agent(
name="EmailSummarizer",
model="openai/gpt-4.1-mini",
system_prompt="Summarize emails and extract key information like sender, subject, main points, and action items."
)
email = Path("email.eml")
email.write_text("From: ada@example.com\nSubject: Hello\n\nHello\n", encoding="utf-8")
# Validate EML file and summarize
eml_file = File.validate(str(email))
result = await agent(
prompt=["Summarize this email and extract the key points", eml_file]
).collect()
print(result.output.collect_text())