Copy
Ask AI
"""
Basic Workflow
==============
Demonstrates basic workflow.
"""
from agno.agent import Agent
from agno.db.postgres import PostgresDb
from agno.models.openai import OpenAIChat
from agno.os import AgentOS
from agno.os.interfaces.slack import Slack
from agno.tools.websearch import WebSearchTools
from agno.workflow.step import Step
from agno.workflow.workflow import Workflow
# ---------------------------------------------------------------------------
# Create Example
# ---------------------------------------------------------------------------
# Define agents for the workflow
researcher_agent = Agent(
name="Research Agent",
model=OpenAIChat(id="gpt-4o-mini"),
tools=[WebSearchTools()],
role="Search the web and gather comprehensive research on the given topic",
instructions=[
"Search for the most recent and relevant information",
"Focus on credible sources and key insights",
"Summarize findings clearly and concisely",
],
)
writer_agent = Agent(
name="Content Writer",
model=OpenAIChat(id="gpt-4o-mini"),
role="Create engaging content based on research findings",
instructions=[
"Write in a clear, engaging, and professional tone",
"Structure content with proper headings and bullet points",
"Include key insights from the research",
"Keep content informative yet accessible",
],
)
# Create workflow steps
research_step = Step(
name="Research Step",
agent=researcher_agent,
)
writing_step = Step(
name="Writing Step",
agent=writer_agent,
)
# Create the workflow
content_workflow = Workflow(
name="Content Creation Workflow",
description="Research and create content on any topic via Slack",
db=PostgresDb(db_url="postgresql+psycopg://ai:ai@localhost:5532/ai"),
steps=[research_step, writing_step],
session_id="slack_workflow_session",
)
# Create AgentOS with Slack interface for the workflow
agent_os = AgentOS(
workflows=[content_workflow],
interfaces=[Slack(workflow=content_workflow)],
)
app = agent_os.get_app()
# ---------------------------------------------------------------------------
# Run Example
# ---------------------------------------------------------------------------
if __name__ == "__main__":
agent_os.serve(app="basic_workflow:app", reload=True)
Run the Example
Copy
Ask AI
# Clone and setup repo
git clone https://github.com/agno-agi/agno.git
cd agno/cookbook/05_agent_os/interfaces/slack
# Create and activate virtual environment
./scripts/demo_setup.sh
source .venvs/demo/bin/activate
python basic_workflow.py