Workflow With File Input
Demonstrates passing file inputs through workflow steps for reading and summarization.
"""
Workflow With File Input
========================
Demonstrates passing file inputs through workflow steps for reading and summarization.
"""
from agno.agent import Agent
from agno.db.sqlite import SqliteDb
from agno.media import File
from agno.models.anthropic import Claude
from agno.models.openai import OpenAIChat
from agno.workflow.step import Step
from agno.workflow.workflow import Workflow
# ---------------------------------------------------------------------------
# Create Agents
# ---------------------------------------------------------------------------
read_agent = Agent(
name="Agent",
model=Claude(id="claude-sonnet-4-20250514"),
role="Read the contents of the attached file.",
)
summarize_agent = Agent(
name="Summarize Agent",
model=OpenAIChat(id="gpt-5.6-luna"),
instructions=[
"Summarize the contents of the attached file.",
],
)
# ---------------------------------------------------------------------------
# Define Steps
# ---------------------------------------------------------------------------
read_step = Step(
name="Read Step",
agent=read_agent,
)
summarize_step = Step(
name="Summarize Step",
agent=summarize_agent,
)
# ---------------------------------------------------------------------------
# Create Workflow
# ---------------------------------------------------------------------------
content_creation_workflow = Workflow(
name="Content Creation Workflow",
description="Automated content creation from blog posts to social media",
db=SqliteDb(
session_table="workflow",
db_file="tmp/workflow.db",
),
steps=[read_step, summarize_step],
)
# ---------------------------------------------------------------------------
# Run Workflow
# ---------------------------------------------------------------------------
if __name__ == "__main__":
content_creation_workflow.print_response(
input="Summarize the contents of the attached file.",
files=[
File(url="https://agno-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf")
],
markdown=True,
)Use an active Claude model
Before running your saved copy, replace the one occurrence of claude-sonnet-4-20250514 with claude-sonnet-4-6. The original model was retired on June 15, 2026; see Anthropic’s model lifecycle.
Run the Example
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activateInstall dependencies
uv pip install -U agno anthropic fastapi openai sqlalchemyExport your API keys
export ANTHROPIC_API_KEY="your_anthropic_api_key_here"
export OPENAI_API_KEY="your_openai_api_key_here"Run the example
Save the code above as workflow_with_file_input.py, then run:
python workflow_with_file_input.pyFull source: cookbook/04_workflows/01_basic_workflows/01_sequence_of_steps/workflow_with_file_input.py