Using a voice agent to generate Preswald apps

Amrutha GujjarAmrutha Gujjar3 min read

Category: Community


We’re excited to feature Pramod Nagaraj in this edition of the Preswald Community Showcase! 🎉 Pramod has taken Preswald in a fresh direction by building an incredible voice-driven AI agent that analyzes and visualizes Amazon stock data (2000–2025) using interactive charts and tables — all via natural language commands.

🌟 Project Overview

📊 Preswald + Voice-Powered AI Agent

This blog highlights how Pramod leveraged Preswald to build a voice agent that allows users to interact with Amazon stock data just by speaking commands. You can ask the agent to generate charts, analyze stock trends, and much more — all with no need to touch a keyboard or write any code.

📊 Description

Pramod's project features an AI-powered voice agent that connects with Preswald to process natural language requests. The agent listens to user commands and automatically fetches the relevant data, analyzes it, and generates visualizations. This capability makes it incredibly easy for users to get quick insights from stock data without needing to understand any code.

Some of the tasks the agent can handle include:

  • Generating stock charts like volume vs. price and moving averages.
  • Analyzing data and returning insights like stock performance over time.
  • Creating dynamic visualizations based on spoken queries, all without the need for any coding experience.

This integration demonstrates the power of combining AI, voice interfaces, and Preswald's visualization capabilities.

Project Name: Amazon Stock Data Explorer
Built by: Pramod Nagaraj
Dataset: Amazon Stock Data (2000-2025)

img


🚀 Code Snippets

Loading the Data

from preswald import connect, get_df, text
import pandas as pd

connect()  # Establish connection to data sources

# Load Amazon stock dataset
df = get_df("amazon")
df['date'] = pd.to_datetime(df['date'])  # Convert to datetime

Scatter Plot: Volume vs. Close Price

from preswald import plotly
import plotly.express as px

fig_scatter = px.scatter(
    df, x='volume', y='close',
    title='Volume vs. Closing Price',
    labels={'volume': 'Trading Volume', 'close': 'Close Price (USD)'},
    template='plotly_white'
)
plotly(fig_scatter)

Distribution of Daily Returns

df['daily_return'] = df['close'].pct_change()
fig_returns = px.histogram(
    df.dropna(subset=['daily_return']),
    x='daily_return', nbins=50,
    title='Distribution of Daily Returns',
    labels={'daily_return': 'Daily Return'},
    template='plotly_white'
)
plotly(fig_returns)

Correlation Heatmap

import plotly.figure_factory as ff  # for the correlation heatmap
numeric_cols = ['open', 'high', 'low', 'close', 'adj_close', 'volume']
corr_matrix = df[numeric_cols].corr()
fig_corr = ff.create_annotated_heatmap(
    z=corr_matrix.values,
    x=corr_matrix.columns.tolist(),
    y=corr_matrix.columns.tolist(),
    colorscale='Viridis', showscale=True
)
fig_corr.update_layout(title='Correlation Matrix', template='plotly_white')
plotly(fig_corr)

Time Series Plot: Closing Price Over Time

fig_time_series = px.line(
    df, x='date', y='close',
    title='Closing Price Over Time',
    labels={'date': 'Date', 'close': 'Close Price (USD)'},
    template='plotly_white'
)
plotly(fig_time_series)

Moving Averages Chart

df['ma_50'] = df['close'].rolling(window=50).mean()
df['ma_200'] = df['close'].rolling(window=200).mean()
fig_ma = px.line(df, x='date', y=['close', 'ma_50', 'ma_200'],
                 labels={'value': 'Price (USD)', 'date': 'Date'},
                 title='Closing Price with Moving Averages')
plotly(fig_ma)

img

AI Insights Project

On a related note, Pramod has also developed an AI-driven insights tool that dynamically processes user queries and runs Pandas scripts in real time to extract insights from datasets.

GitHub Repo: AI Driven Insights

This system integrates LiveKit AI Agents, WebSockets, and OpenAI models, allowing users to interact with structured marketing data and get instant insights. The agent:

  • Extracts and sanitizes Python code from user input
  • Executes it safely on a Pandas DataFrame
  • Returns meaningful insights in real time

Upcoming Preswald Integration

Pramod is also in the process of integrating Preswald into this system to generate real-time graphs and visualizations based on user queries. This will allow users to not only receive insights but also see trends and patterns visually.


🚀 Getting Started

Installation

pip install preswald

👩‍💻 Quick Start

preswald init my_project
cd my_project
preswald run

Deploying to Structured Cloud

preswald deploy --target structured

Your app will be built and accessible online.


Huge Thanks to Pramod Nagaraj!

A big thank you to Pramod Nagaraj for sharing his work and inspiring the Preswald community! Explore more of his projects on LinkedIn | GitHub.

Want to Contribute?

Have an idea for a Preswald app? We'd love to see it! Get started here: https://github.com/StructuredLabs/preswald and you might be featured in our next Community Showcase.

Happy building! 🚀