Skip to main content
Shopping assistant with web search for price comparison across stores.

Simple

Agents: 1 — Single agent with search tool handles product research and comparison.

Workflow

  1. Receive product query
  2. Search multiple stores
  3. Compare prices and generate report

Setup

pip install praisonaiagents praisonai duckduckgo-search
export OPENAI_API_KEY="your-key"

Run — Python

from praisonaiagents import Agent
from praisonaiagents.tools import duckduckgo

agent = Agent(
    name="ShoppingAssistant",
    instructions="You are a shopping agent. Compare prices in table format.",
    tools=[duckduckgo]
)

result = agent.start("Compare prices for iPhone 16 Pro Max")
print(result)

Run — CLI

praisonai "Compare MacBook Pro prices" --web-search

Run — agents.yaml

framework: praisonai
topic: Price Comparison
roles:
  shopping_assistant:
    role: Shopping Specialist
    goal: Find the best prices across stores
    backstory: You are an expert at finding deals
    tools:
      - duckduckgo
    tasks:
      compare_prices:
        description: Compare prices for iPhone 16 Pro Max
        expected_output: A price comparison table
praisonai agents.yaml

Serve API

from praisonaiagents import Agent
from praisonaiagents.tools import duckduckgo

agent = Agent(
    name="ShoppingAssistant",
    instructions="You are a shopping agent.",
    tools=[duckduckgo]
)

agent.launch(port=8080)
curl -X POST http://localhost:8080/chat \
  -H "Content-Type: application/json" \
  -d '{"message": "Find best deals on Sony headphones"}'

Advanced Workflow (All Features)

Agents: 1 — Single agent with memory, persistence, structured output, and session resumability.

Workflow

  1. Initialize session for shopping history
  2. Configure SQLite persistence for price tracking
  3. Search and compare with structured output
  4. Store results in memory for price alerts
  5. Resume session for ongoing comparisons

Setup

pip install praisonaiagents praisonai duckduckgo-search pydantic
export OPENAI_API_KEY="your-key"

Run — Python

from praisonaiagents import Agent, Task, Agents, Session
from praisonaiagents.tools import duckduckgo
from pydantic import BaseModel

class PriceComparison(BaseModel):
    product: str
    stores: list[str]
    prices: list[str]
    best_deal: str
    recommendation: str

session = Session(session_id="shop-001", user_id="user-1")

agent = Agent(
    name="ShoppingAssistant",
    instructions="Compare prices and return structured results.",
    tools=[duckduckgo],
    memory=True
)

task = Task(
    description="Compare iPhone 16 Pro Max prices across stores",
    expected_output="Structured price comparison",
    agent=agent,
    output_pydantic=PriceComparison
)

agents = Agents(
    agents=[agent],
    tasks=[task],
    memory=True,
    memory_config={"provider": "sqlite", "db_path": "shopping.db"},
    verbose=1
)

result = agents.start()
print(result)

Run — CLI

praisonai "Compare iPhone prices" --web-search --memory --verbose

Run — agents.yaml

framework: praisonai
topic: Price Comparison
memory: true
memory_config:
  provider: sqlite
  db_path: shopping.db
roles:
  shopping_assistant:
    role: Shopping Specialist
    goal: Find best prices with structured output
    backstory: You are an expert at finding deals
    tools:
      - duckduckgo
    memory: true
    tasks:
      compare_prices:
        description: Compare iPhone 16 Pro Max prices
        expected_output: Structured price comparison
        output_json:
          product: string
          stores: array
          prices: array
          best_deal: string
          recommendation: string
praisonai agents.yaml --verbose

Serve API

from praisonaiagents import Agent
from praisonaiagents.tools import duckduckgo

agent = Agent(
    name="ShoppingAssistant",
    instructions="Compare prices and return structured results.",
    tools=[duckduckgo],
    memory=True
)

agent.launch(port=8080)
curl -X POST http://localhost:8080/chat \
  -H "Content-Type: application/json" \
  -d '{"message": "Compare laptop prices", "session_id": "shop-001"}'

Monitor / Verify

praisonai "test shopping" --web-search --verbose

Cleanup

rm -f shopping.db

Features Demonstrated

FeatureImplementation
WorkflowMulti-store price comparison
DB PersistenceSQLite via memory_config
Observability--verbose flag
ToolsDuckDuckGo search
ResumabilitySession with session_id
Structured OutputPydantic PriceComparison model

Next Steps