from pathlib import Path
from timbal import Agent
from timbal.types.file import File
agent = Agent(
name="DocumentAgent",
model="google/gemini-3.5-flash",
system_prompt="Analyze Word documents and extract key information."
)
document = Path("document.docx")
document.write_bytes(b"PK\x03\x04")
# Validate DOCX file and analyze
docx_file = File.validate(str(document))
result = await agent(
prompt=["Summarize this document and highlight the main sections", docx_file]
).collect()
print(result.output.collect_text())