This example supplies the three most recent workflow runs, not the full conversation history claimed in the agent instructions. Set
num_history_runs on Step to choose a larger bounded window; the step’s default of 3 takes precedence over the workflow setting.continuous_execution.py
"""
Continuous Execution
====================
Demonstrates single-step conversational execution with workflow history available to the step agent.
"""
from agno.agent import Agent
from agno.db.sqlite import SqliteDb
from agno.models.openai import OpenAIChat
from agno.workflow.step import Step
from agno.workflow.workflow import Workflow
# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
tutor_agent = Agent(
name="AI Tutor",
model=OpenAIChat(id="gpt-4o"),
instructions=[
"You are an expert tutor who provides personalized educational support.",
"You have access to our full conversation history.",
"Build on previous discussions - do not repeat questions or information.",
"Reference what the student has told you earlier in our conversation.",
"Adapt your teaching style based on what you have learned about the student.",
"Be encouraging, patient, and supportive.",
"When asked about conversation history, provide a helpful summary.",
"Focus on helping the student understand concepts and improve their skills.",
],
)
# ---------------------------------------------------------------------------
# Create Workflow
# ---------------------------------------------------------------------------
tutor_workflow = Workflow(
name="Simple AI Tutor",
description="Single-step conversational tutoring with history awareness",
db=SqliteDb(db_file="tmp/simple_tutor_workflow.db"),
steps=[Step(name="AI Tutoring", agent=tutor_agent)],
add_workflow_history_to_steps=True,
)
# ---------------------------------------------------------------------------
# Run Workflow
# ---------------------------------------------------------------------------
def demo_simple_tutoring_cli() -> None:
print("Simple AI Tutor Demo - Type 'exit' to quit")
print("Try asking about:")
print("- 'I'm struggling with calculus derivatives'")
print("- 'Can you help me with algebra?'")
print("-" * 60)
tutor_workflow.cli_app(
session_id="simple_tutor_demo",
user="Student",
emoji="",
stream=True,
show_step_details=True,
)
if __name__ == "__main__":
demo_simple_tutoring_cli()
Run the Example
1
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activate
uv venv --python 3.12
.venv\Scripts\activate
2
Install dependencies
uv pip install -U agno fastapi openai sqlalchemy
3
Export your OpenAI API key
export OPENAI_API_KEY="your_openai_api_key_here"
$Env:OPENAI_API_KEY="your_openai_api_key_here"
4
Run the example
Save the code above as
continuous_execution.py, then run:python continuous_execution.py