Skip to main content
Agno supports using Valkey as a storage backend for Workflows using the ValkeyDb class.

Usage

Run Valkey

Install docker desktop and run Valkey on port 6379 using:
docker run -d \
  --name my-valkey \
  -p 6379:6379 \
  valkey/valkey
valkey_for_workflow.py
"""
Run: `uv pip install openai agno valkey-glide-sync fastapi` to install the dependencies
"""
from agno.agent import Agent
from agno.db.valkey import ValkeyDb
from agno.models.openai import OpenAIResponses
from agno.team import Team
from agno.tools.hackernews import HackerNewsTools
from agno.workflow.step import Step
from agno.workflow.workflow import Workflow

# Define agents
hackernews_agent = Agent(
    name="Hackernews Agent",
    model=OpenAIResponses(id="gpt-5.2"),
    tools=[HackerNewsTools()],
    role="Extract key insights and content from Hackernews posts",
)
web_agent = Agent(
    name="Web Agent",
    model=OpenAIResponses(id="gpt-5.2"),
    tools=[HackerNewsTools()],
    role="Search the web for the latest news and trends",
)

# Define research team for complex analysis
research_team = Team(
    name="Research Team",
    members=[hackernews_agent, web_agent],
    instructions="Research tech topics from Hackernews and the web",
)

content_planner = Agent(
    name="Content Planner",
    model=OpenAIResponses(id="gpt-5.2"),
    instructions=[
        "Plan a content schedule over 4 weeks for the provided topic and research content",
        "Ensure that I have posts for 3 posts per week",
    ],
)

# Define steps
research_step = Step(
    name="Research Step",
    team=research_team,
)

content_planning_step = Step(
    name="Content Planning Step",
    agent=content_planner,
)

# Create and use workflow
if __name__ == "__main__":
    content_creation_workflow = Workflow(
        name="Content Creation Workflow",
        description="Automated content creation from blog posts to social media",
        db=ValkeyDb(
            host="localhost",
            port=6379,
        ),
        steps=[research_step, content_planning_step],
    )
    content_creation_workflow.print_response(
        input="AI trends in 2024",
        markdown=True,
    )

Params

ParameterTypeDefaultDescription
idOptional[str]-The ID of the database instance. UUID by default.
valkey_clientOptional[Union[GlideClient, GlideClusterClient]]-Pre-configured Valkey GLIDE client. If not provided a new client will be created.
hoststr"localhost"Valkey server host.
portint6379Valkey server port.
database_idOptional[int]-Logical database index (e.g. 0-15).
usernameOptional[str]-Username for authentication.
passwordOptional[str]-Password for authentication.
use_tlsboolFalseEnable TLS encryption.
request_timeoutOptional[int]-Milliseconds to wait for a request to complete. If unset, the GLIDE client default (250 ms) applies.
db_prefixstr"agno"Prefix for all Valkey keys.
client_namestr"agno_db_client"Connection name, visible in CLIENT LIST.
expireOptional[int]-TTL for Valkey keys in seconds.
session_tableOptional[str]-Name of the table to store sessions.
memory_tableOptional[str]-Name of the table to store memories.
metrics_tableOptional[str]-Name of the table to store metrics.
eval_tableOptional[str]-Name of the table to store evaluation runs.
knowledge_tableOptional[str]-Name of the table to store knowledge documents.
traces_tableOptional[str]-Name of the table to store traces.
spans_tableOptional[str]-Name of the table to store spans.
learnings_tableOptional[str]-Name of the table to store learnings.