From 38de84f83fb1f4519f21b814fbc9fef8e78d3e5e Mon Sep 17 00:00:00 2001 From: Amaan Date: Sun, 27 Apr 2025 18:44:19 +0530 Subject: [PATCH 1/6] add dappier search tool --- agentstack/_tools/dappier/__init__.py | 255 ++++++++++++++++++++++++++ agentstack/_tools/dappier/config.json | 20 ++ docs/llms.txt | 1 + docs/tools/community.mdx | 1 + docs/tools/tool/dappier.mdx | 66 +++++++ 5 files changed, 343 insertions(+) create mode 100644 agentstack/_tools/dappier/__init__.py create mode 100644 agentstack/_tools/dappier/config.json create mode 100644 docs/tools/tool/dappier.mdx diff --git a/agentstack/_tools/dappier/__init__.py b/agentstack/_tools/dappier/__init__.py new file mode 100644 index 00000000..84ea21b1 --- /dev/null +++ b/agentstack/_tools/dappier/__init__.py @@ -0,0 +1,255 @@ +import os +from typing import Optional, Literal +from dappier import Dappier + +# Initialize the Dappier client +client = Dappier(api_key=os.getenv("DAPPIER_API_KEY")) + +# --- Functions for AI Models --- + + +def real_time_web_search(query: str) -> str: + """ + Perform a real-time web search. Access the latest news, stock market data, weather, + travel information, deals, and more using this AI model. Use when no stock ticker symbol + is provided. + + Args: + query: The search query to retrieve real-time information. + + Returns: + A formatted string containing real-time search results. + """ + try: + return client.search_real_time_data_string(query=query, ai_model_id="am_01j06ytn18ejftedz6dyhz2b15") + except Exception as e: + return f"Error: {str(e)}" + + +def stock_market_data_search(query: str) -> str: + """ + Perform a real-time stock market data search. Retrieve real-time financial news, + stock prices, and trade updates with AI-powered insights using this model. Use only when a + stock ticker symbol is provided. + + Args: + query: The search query to retrieve real-time stock market information. + + Returns: + A formatted string containing real-time financial search results. + """ + try: + return client.search_real_time_data_string(query=query, ai_model_id="am_01j749h8pbf7ns8r1bq9s2evrh") + except Exception as e: + return f"Error: {str(e)}" + + +# --- Functions for Data Models --- + + +def get_sports_news( + query: str, + similarity_top_k: int = 9, + ref: Optional[str] = None, + num_articles_ref: int = 0, + search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"] = "most_recent", +) -> str: + """ + Fetch AI-powered Sports News recommendations. Get real-time news, updates, and personalized + content from top sports sources like Sportsnaut, Forever Blueshirts, Minnesota Sports Fan, + LAFB Network, Bounding Into Sports, and Ringside Intel. + + Args: + query: The input string for sports-related content recommendations. + similarity_top_k: Number of top similar articles to retrieve. + ref: Optional site domain to prioritize recommendations. + num_articles_ref: Minimum number of articles to return from the reference domain. + search_algorithm: The search algorithm to use ('most_recent', 'semantic', 'most_recent_semantic', 'trending'). + + Returns: + A formatted string containing recommended sports articles. + """ + try: + return client.get_ai_recommendations_string( + query=query, + data_model_id="dm_01j0pb465keqmatq9k83dthx34", + similarity_top_k=similarity_top_k, + ref=ref or "", + num_articles_ref=num_articles_ref, + search_algorithm=search_algorithm, + ) + except Exception as e: + return f"Error: {str(e)}" + + +def get_lifestyle_news( + query: str, + similarity_top_k: int = 9, + ref: Optional[str] = None, + num_articles_ref: int = 0, + search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"] = "most_recent", +) -> str: + """ + Fetch AI-powered Lifestyle News recommendations. Access current lifestyle updates, analysis, + and insights from leading lifestyle publications like The Mix, Snipdaily, Nerdable + and Familyproof. + + Args: + query: The input string for lifestyle-related content recommendations. + similarity_top_k: Number of top similar articles to retrieve. + ref: Optional site domain to prioritize recommendations. + num_articles_ref: Minimum number of articles to return from the reference domain. + search_algorithm: The search algorithm to use ('most_recent', 'semantic', 'most_recent_semantic', 'trending'). + + Returns: + A formatted string containing recommended lifestyle articles. + """ + try: + return client.get_ai_recommendations_string( + query=query, + data_model_id="dm_01j0q82s4bfjmsqkhs3ywm3x6y", + similarity_top_k=similarity_top_k, + ref=ref or "", + num_articles_ref=num_articles_ref, + search_algorithm=search_algorithm, + ) + except Exception as e: + return f"Error: {str(e)}" + + +def get_iheartdogs_content( + query: str, + similarity_top_k: int = 9, + ref: Optional[str] = None, + num_articles_ref: int = 0, + search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"] = "most_recent", +) -> str: + """ + Fetch AI-powered iHeartDogs content recommendations. Tap into a dog care expert with access + to thousands of articles covering pet health, behavior, grooming, and ownership from + iHeartDogs.com. + + Args: + query: The input string for dog care-related content recommendations. + similarity_top_k: Number of top similar articles to retrieve. + ref: Optional site domain to prioritize recommendations. + num_articles_ref: Minimum number of articles to return from the reference domain. + search_algorithm: The search algorithm to use ('most_recent', 'semantic', 'most_recent_semantic', 'trending'). + + Returns: + A formatted string containing recommended dog-related articles. + """ + try: + return client.get_ai_recommendations_string( + query=query, + data_model_id="dm_01j1sz8t3qe6v9g8ad102kvmqn", + similarity_top_k=similarity_top_k, + ref=ref or "", + num_articles_ref=num_articles_ref, + search_algorithm=search_algorithm, + ) + except Exception as e: + return f"Error: {str(e)}" + + +def get_iheartcats_content( + query: str, + similarity_top_k: int = 9, + ref: Optional[str] = None, + num_articles_ref: int = 0, + search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"] = "most_recent", +) -> str: + """ + Fetch AI-powered iHeartCats content recommendations. Utilize a cat care specialist that + provides comprehensive content on cat health, behavior, and lifestyle from iHeartCats.com. + + Args: + query: The input string for cat care-related content recommendations. + similarity_top_k: Number of top similar articles to retrieve. + ref: Optional site domain to prioritize recommendations. + num_articles_ref: Minimum number of articles to return from the reference domain. + search_algorithm: The search algorithm to use ('most_recent', 'semantic', 'most_recent_semantic', 'trending'). + + Returns: + A formatted string containing recommended cat-related articles. + """ + try: + return client.get_ai_recommendations_string( + query=query, + data_model_id="dm_01j1sza0h7ekhaecys2p3y0vmj", + similarity_top_k=similarity_top_k, + ref=ref or "", + num_articles_ref=num_articles_ref, + search_algorithm=search_algorithm, + ) + except Exception as e: + return f"Error: {str(e)}" + + +def get_greenmonster_guides( + query: str, + similarity_top_k: int = 9, + ref: Optional[str] = None, + num_articles_ref: int = 0, + search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"] = "most_recent", +) -> str: + """ + Fetch AI-powered GreenMonster guides and articles. Receive guidance for making conscious + and compassionate choices benefiting people, animals, and the planet. + + Args: + query: The input string for eco-friendly and conscious lifestyle recommendations. + similarity_top_k: Number of top similar articles to retrieve. + ref: Optional site domain to prioritize recommendations. + num_articles_ref: Minimum number of articles to return from the reference domain. + search_algorithm: The search algorithm to use ('most_recent', 'semantic', 'most_recent_semantic', 'trending'). + + Returns: + A formatted string containing recommended eco-conscious articles. + """ + try: + return client.get_ai_recommendations_string( + query=query, + data_model_id="dm_01j5xy9w5sf49bm6b1prm80m27", + similarity_top_k=similarity_top_k, + ref=ref or "", + num_articles_ref=num_articles_ref, + search_algorithm=search_algorithm, + ) + except Exception as e: + return f"Error: {str(e)}" + + +def get_wishtv_news( + query: str, + similarity_top_k: int = 9, + ref: Optional[str] = None, + num_articles_ref: int = 0, + search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"] = "most_recent", +) -> str: + """ + Fetch AI-powered WISH-TV news recommendations. Get recommendations covering sports, + breaking news, politics, multicultural updates, Hispanic language content, entertainment, + health, and education. + + Args: + query: The input string for general news recommendations. + similarity_top_k: Number of top similar articles to retrieve. + ref: Optional site domain to prioritize recommendations. + num_articles_ref: Minimum number of articles to return from the reference domain. + search_algorithm: The search algorithm to use ('most_recent', 'semantic', 'most_recent_semantic', 'trending'). + + Returns: + A formatted string containing recommended news articles. + """ + try: + return client.get_ai_recommendations_string( + query=query, + data_model_id="dm_01jagy9nqaeer9hxx8z1sk1jx6", + similarity_top_k=similarity_top_k, + ref=ref or "", + num_articles_ref=num_articles_ref, + search_algorithm=search_algorithm, + ) + except Exception as e: + return f"Error: {str(e)}" diff --git a/agentstack/_tools/dappier/config.json b/agentstack/_tools/dappier/config.json new file mode 100644 index 00000000..715a41a4 --- /dev/null +++ b/agentstack/_tools/dappier/config.json @@ -0,0 +1,20 @@ +{ + "name": "dappier", + "url": "https://www.dappier.com/", + "category": "search", + "env": { + "DAPPIER_API_KEY": null + }, + "dependencies": ["dappier>=0.3.5"], + "tools": [ + "real_time_web_search", + "stock_market_data_search", + "get_sports_news", + "get_lifestyle_news", + "get_iheartdogs_content", + "get_iheartcats_content", + "get_greenmonster_guides", + "get_wishtv_news" + ], + "cta": "Create an API key at https://platform.dappier.com/profile/api-keys/" +} diff --git a/docs/llms.txt b/docs/llms.txt index e904cfa5..d273a7cf 100644 --- a/docs/llms.txt +++ b/docs/llms.txt @@ -1287,6 +1287,7 @@ description: 'AgentStack tools from community contributors' ## Search - [Perplexity](/tools/tool/perplexity) +- [Dappier](/tools/tool/dappier) ## Memory / State diff --git a/docs/tools/community.mdx b/docs/tools/community.mdx index ae703bb4..37dbc064 100644 --- a/docs/tools/community.mdx +++ b/docs/tools/community.mdx @@ -13,6 +13,7 @@ description: 'AgentStack tools from community contributors' ## Search - [Perplexity](/tools/tool/perplexity) +- [Dappier](/tools/tool/dappier) ## Memory / State diff --git a/docs/tools/tool/dappier.mdx b/docs/tools/tool/dappier.mdx new file mode 100644 index 00000000..816dd728 --- /dev/null +++ b/docs/tools/tool/dappier.mdx @@ -0,0 +1,66 @@ +--- +title: Dappier +description: Real-time web and content search for agents +icon: search +--- + +Dappier is a real time search that connects any AI to proprietary, real-time data — including web search, news, sports, stock market data, and premium publisher content. + +## Description +Dappier Real-Time Search provides instant access to live web search results and AI-powered recommendations with: + +- Real-Time Web Search offering up-to-the-minute results from Google, financial markets, and global news +- Specialized Content Models trained on curated datasets for domains like sports, lifestyle, pet care, sustainability, and multicultural news +- Intelligent Query Routing that automatically selects the appropriate model based on user input + +### Core Features: + +- Web Search - Perform real-time web lookups across news, stocks, travel, weather, and more +- Stock Market Data - Retrieve live financial news, stock prices, and trades +- Content Recommendations - Get semantically matched articles tailored to user interests +- Domain-Specific Models - Specialized AI trained on lifestyle, pets, sports, and green living + +### Output Formats: + +- Summarized real-time search results +- Curated lists of recommended articles +- Live financial and stock market insights +- Structured query-to-content responses + +## Available Models and Functions + +> Explore various AI models and data models available at [Dappier Marketplace](https://marketplace.dappier.com/marketplace). + + +### AI Models + +| Function | Model | Description | Arguments | +|:---|:---|:---|:---| +| `real_time_web_search` | `am_01j06ytn18ejftedz6dyhz2b15` | Perform a real-time web search across Google, news, weather, and travel data. | `query: str` | +| `stock_market_data_search` | `am_01j749h8pbf7ns8r1bq9s2evrh` | Perform a real-time stock market data search including stock prices and financial news. | `query: str` | + +### Data Models + +| Function | Model | Description | Arguments | +|:---|:---|:---|:---| +| `get_sports_news` | `dm_01j0pb465keqmatq9k83dthx34` | Get real-time sports news and updates from top sports sources. | `query: str`, `similarity_top_k: int`, `ref: Optional[str]`, `num_articles_ref: int`, `search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"]` | +| `get_lifestyle_news` | `dm_01j0q82s4bfjmsqkhs3ywm3x6y` | Access real-time lifestyle news and insights from popular publications. | `query: str`, `similarity_top_k: int`, `ref: Optional[str]`, `num_articles_ref: int`, `search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"]` | +| `get_iheartdogs_content` | `dm_01j1sz8t3qe6v9g8ad102kvmqn` | Fetch dog care articles on health, behavior, and grooming from iHeartDogs. | `query: str`, `similarity_top_k: int`, `ref: Optional[str]`, `num_articles_ref: int`, `search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"]` | +| `get_iheartcats_content` | `dm_01j1sza0h7ekhaecys2p3y0vmj` | Fetch cat care content on health, lifestyle, and behavior from iHeartCats. | `query: str`, `similarity_top_k: int`, `ref: Optional[str]`, `num_articles_ref: int`, `search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"]` | +| `get_greenmonster_guides` | `dm_01j5xy9w5sf49bm6b1prm80m27` | Access eco-conscious lifestyle articles from GreenMonster. | `query: str`, `similarity_top_k: int`, `ref: Optional[str]`, `num_articles_ref: int`, `search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"]` | +| `get_wishtv_news` | `dm_01jagy9nqaeer9hxx8z1sk1jx6` | Get news updates on politics, entertainment, and multicultural topics from WISH-TV. | `query: str`, `similarity_top_k: int`, `ref: Optional[str]`, `num_articles_ref: int`, `search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"]` | + +## Installation + +```bash +agentstack tools add dappier +``` + +Set the environment variable + +```env +DAPPIER_API_KEY=... +``` + +## Usage +Dappier can be configured for different behaviors by modifying `src/tools/dappier_tool.py`. From ccda75dcd1e06dccdeb253d30d902b6e555da546 Mon Sep 17 00:00:00 2001 From: Amaan Date: Thu, 1 May 2025 13:25:08 +0530 Subject: [PATCH 2/6] add an example for stock market researcher using dappier real time data --- examples/stock_market_research/.env.example | 6 + examples/stock_market_research/.gitignore | 166 ++++++++++++++++++ examples/stock_market_research/LICENSE.md | 10 ++ examples/stock_market_research/README.md | 37 ++++ .../stock_market_research/agentstack.json | 11 ++ examples/stock_market_research/pyproject.toml | 15 ++ .../stock_market_research/src/__init__.py | 0 .../src/config/agents.yaml | 44 +++++ .../src/config/inputs.yaml | 1 + .../src/config/tasks.yaml | 80 +++++++++ examples/stock_market_research/src/crew.py | 87 +++++++++ examples/stock_market_research/src/main.py | 61 +++++++ .../src/tools/__init__.py | 2 + 13 files changed, 520 insertions(+) create mode 100644 examples/stock_market_research/.env.example create mode 100644 examples/stock_market_research/.gitignore create mode 100644 examples/stock_market_research/LICENSE.md create mode 100644 examples/stock_market_research/README.md create mode 100644 examples/stock_market_research/agentstack.json create mode 100644 examples/stock_market_research/pyproject.toml create mode 100644 examples/stock_market_research/src/__init__.py create mode 100644 examples/stock_market_research/src/config/agents.yaml create mode 100644 examples/stock_market_research/src/config/inputs.yaml create mode 100644 examples/stock_market_research/src/config/tasks.yaml create mode 100644 examples/stock_market_research/src/crew.py create mode 100644 examples/stock_market_research/src/main.py create mode 100644 examples/stock_market_research/src/tools/__init__.py diff --git a/examples/stock_market_research/.env.example b/examples/stock_market_research/.env.example new file mode 100644 index 00000000..4272c015 --- /dev/null +++ b/examples/stock_market_research/.env.example @@ -0,0 +1,6 @@ +#AGENTOPS_API_KEY=... +#OPENAI_API_KEY=... + +# Tools + +#DAPPIER_API_KEY=... diff --git a/examples/stock_market_research/.gitignore b/examples/stock_market_research/.gitignore new file mode 100644 index 00000000..7105da50 --- /dev/null +++ b/examples/stock_market_research/.gitignore @@ -0,0 +1,166 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/latest/usage/project/#working-with-version-control +.pdm.toml +.pdm-python +.pdm-build/ + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + +.agentops/ +agentstack.log +.agentstack* \ No newline at end of file diff --git a/examples/stock_market_research/LICENSE.md b/examples/stock_market_research/LICENSE.md new file mode 100644 index 00000000..41752f3b --- /dev/null +++ b/examples/stock_market_research/LICENSE.md @@ -0,0 +1,10 @@ + +MIT License + +Copyright (c) 2025 Name + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/examples/stock_market_research/README.md b/examples/stock_market_research/README.md new file mode 100644 index 00000000..118a6a41 --- /dev/null +++ b/examples/stock_market_research/README.md @@ -0,0 +1,37 @@ +# stock_market_research + + +## How to build your Crew Agent +### With the CLI +Add an agent using AgentStack with the CLI: +`agentstack generate agent ` +You can also shorten this to `agentstack g a ` +For wizard support use `agentstack g a --wizard` +Finally for creation in the CLI alone, use `agentstack g a --role/-r --goal/-g --backstory/-b --model/-m ` + +This will automatically create a new agent in the `agents.yaml` config as well as in your code. Either placeholder strings will be used, or data included in the wizard. + +Similarly, tasks can be created with `agentstack g t ` + +Add tools with `agentstack tools add` and view tools available with `agentstack tools list` + +## How to use your Agent +In this directory, run `uv pip install --requirements pyproject.toml` + +To run your project, use the following command: +`agentstack run` + +This will initialize your crew of AI agents and begin task execution as defined in your configuration in the main.py file. + +#### Replay Tasks from Latest Crew Kickoff: + +CrewAI now includes a replay feature that allows you to list the tasks from the last run and replay from a specific one. To use this feature, run: +`crewai replay ` +Replace with the ID of the task you want to replay. + +#### Reset Crew Memory +If you need to reset the memory of your crew before running it again, you can do so by calling the reset memory feature: +`crewai reset-memory` +This will clear the crew's memory, allowing for a fresh start. + +> 🪩 Project built with [AgentStack](https://github.com/AgentOps-AI/AgentStack) \ No newline at end of file diff --git a/examples/stock_market_research/agentstack.json b/examples/stock_market_research/agentstack.json new file mode 100644 index 00000000..dd52d7ba --- /dev/null +++ b/examples/stock_market_research/agentstack.json @@ -0,0 +1,11 @@ +{ + "framework": "crewai", + "tools": [ + "dappier" + ], + "default_model": "openai/gpt-4o", + "agentstack_version": "0.3.5", + "template": "stock_market_research", + "template_version": "4", + "use_git": false +} \ No newline at end of file diff --git a/examples/stock_market_research/pyproject.toml b/examples/stock_market_research/pyproject.toml new file mode 100644 index 00000000..5ead5007 --- /dev/null +++ b/examples/stock_market_research/pyproject.toml @@ -0,0 +1,15 @@ +[project] +name = "stock_market_research" +version = "0.0.1" +description = "" +authors = [ + { name = "Name " } +] +license = { text = "MIT" } +requires-python = ">=3.10" + +dependencies = [ + "agentstack>=0.3.5", + "crewai>=0.118.0", + "dappier>=0.3.5", +] diff --git a/examples/stock_market_research/src/__init__.py b/examples/stock_market_research/src/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/examples/stock_market_research/src/config/agents.yaml b/examples/stock_market_research/src/config/agents.yaml new file mode 100644 index 00000000..ea5df986 --- /dev/null +++ b/examples/stock_market_research/src/config/agents.yaml @@ -0,0 +1,44 @@ +web_researcher: + role: >- + A company research analyst that collects structured business data, financials, + and competitive insights from the dappier real time web search. + goal: >- + To compile detailed company profiles using real-time data, covering company overview, + financial performance, and peer benchmarking. + backstory: >- + Trained to support investment research workflows, this agent uses Dappier’s real-time + web search to gather trustworthy and current business information. It builds company + snapshots with industry, CEO, market cap, and financial metrics like revenue and + net income. It also auto-compares the company to peers based on valuation and + performance metrics. + llm: openai/gpt-4o +stock_insights_analyst: + role: >- + A stock market intelligence analyst that retrieves real-time financial data and + curated news using the dappier stock market data search. + goal: >- + To deliver up-to-date stock snapshots, performance metrics, and categorized financial + news for informed investment analysis. + backstory: >- + Trained to analyze real-time financial markets using Dappier’s stock market data + tool, this agent specializes in stock-specific queries. It always includes a valid + natural language query with stock ticker symbol before sending requests. The agent + provides live insights into stock price movements, valuation ratios, earnings, and + sentiment-tagged news from reliable financial feeds like Polygon.io. + llm: openai/gpt-4o +report_analyst: + role: >- + A financial report analyst that consolidates real-time stock and company insights + into a comprehensive markdown report. + goal: >- + To generate an investor-facing, markdown-formatted summary combining company profile, + financials, benchmarking, stock performance, and real-time news with actionable + insights. + backstory: >- + Specialized in synthesizing structured data retrieved by other research agents, + this agent produces detailed markdown reports that explain what's happening with + a given stock ticker, why it matters, and what the short-term outlook may be. + It uses both company-level and stock-level intelligence—ensuring all information + is up-to-date and grounded in real-time data. Forecasts are AI-generated and clearly + marked as non-financial advice. + llm: openai/gpt-4o diff --git a/examples/stock_market_research/src/config/inputs.yaml b/examples/stock_market_research/src/config/inputs.yaml new file mode 100644 index 00000000..553692c3 --- /dev/null +++ b/examples/stock_market_research/src/config/inputs.yaml @@ -0,0 +1 @@ +company_name: Tesla diff --git a/examples/stock_market_research/src/config/tasks.yaml b/examples/stock_market_research/src/config/tasks.yaml new file mode 100644 index 00000000..6b8d8cae --- /dev/null +++ b/examples/stock_market_research/src/config/tasks.yaml @@ -0,0 +1,80 @@ +company_overview: + description: >- + As of {timestamp}, fetch the company overview for {company_name} usin real-time web search. Include + company profile, industry, sector, CEO, headquarters location, employee count, market + capitalization and stock ticker symbol. + expected_output: >- + A structured company profile including: Company Profile, Industry, Sector, CEO, + HQ Location, Employees, Market Cap and the stock ticker symbol. + agent: >- + web_researcher +financials_performance: + description: >- + As of {timestamp}, use real-time web search to extract financial performance data for {company_name}, + including Revenue (TTM), Net Income (TTM), Year-over-Year revenue growth, gross + margin, and recent quarterly trends. Include any earnings trends or management + commentary available. + expected_output: >- + A structured summary of financial metrics for {company_name}: Revenue (TTM), Net + Income (TTM), YoY Revenue Growth, Gross Margin, Quarterly Trends, and Earnings + Commentary. + agent: >- + web_researcher +competitive_benchmarking: + description: >- + As of {timestamp}, perform real-time web search to identify 3-5 peer companies in the same sector + as {company_name}. Extract and compare key metrics such as P/E ratio, revenue, + stock price, and market cap. Highlight any standout metrics where {company_name} + outperforms or underperforms. + expected_output: >- + A comparison table of {company_name} and 3-5 peers showing P/E, revenue, price, + and market cap. Highlight metrics where {company_name} stands out. + agent: >- + web_researcher +real_time_stock_snapshot: + description: >- + As of {timestamp}, convert {company_name} to its stock ticker symbol and retrieve a real-time stock + snapshot using Dappier’s stock market data tool. Include current price with % + daily change, volume, 52-week high/low, P/E ratio, EPS, dividend yield, and chart + data for 1D, 5D, 1M, YTD, and 1Y in the query. + expected_output: >- + A structured stock summary for {company_name}, including: + Price, % Daily Change, Volume, 52-Week High/Low, P/E Ratio, EPS, Dividend Yield, + and chart data for 1D, 5D, 1M, YTD, 1Y. + agent: >- + stock_insights_analyst +news_and_sentiment: + description: >- + As of {timestamp}, convert {company_name} to its stock ticker symbol and fetch a real-time financial + news stream using Dappier’s stock market data tool. Categorize the news by topic: + Earnings, Analyst Ratings, Market Moves, Partnerships, and Legal/Regulatory in the + query. + expected_output: >- + A categorized list of real-time financial news headlines + for {company_name}, organized by topic: Earnings, Analyst + Ratings, Market Moves, Partnerships, Legal/Regulatory in the query. + agent: >- + stock_insights_analyst +generate_investment_report: + description: >- + As of {timestamp}, compile a comprehensive, markdown-formatted investment report + for {company_name} by synthesizing the outputs of all prior tasks: company overview, + financial performance, competitive benchmarking, real-time stock snapshot, and + categorized financial news. Include a concise AI-generated company summary, + structured data tables, sentiment-tagged news, and a narrative insight section. + expected_output: >- + A markdown-formatted investment report containing: + 1. Quick AI summary of {company_name} (e.g., "Apple is a global tech leader…") + 2. Structured company profile: Industry, Sector, CEO, HQ, Employees, Market Cap + 3. Financial performance metrics: Revenue (TTM), Net Income (TTM), YoY Growth, Gross Margin, Trends + 4. Competitive benchmarking table: P/E, Revenue, Stock Price, Market Cap vs. 3–5 peers + 5. Real-time stock snapshot: Price, % Change, Volume, 52W High/Low, P/E, EPS, Dividend, charts + 6. Categorized news: Earnings, Analyst Ratings, Market Moves, Partnerships, Legal/Regulatory (with sentiment tags) + 7. Final 3-part insight section: + - What's going on with {company_name} + - Why it matters + - Outlook (clearly marked as not financial advice) + agent: >- + report_analyst + output_file: reports/{company_name}_investment_report.md + create_directory: true diff --git a/examples/stock_market_research/src/crew.py b/examples/stock_market_research/src/crew.py new file mode 100644 index 00000000..6135a440 --- /dev/null +++ b/examples/stock_market_research/src/crew.py @@ -0,0 +1,87 @@ +from crewai import Agent, Crew, Process, Task +from crewai.project import CrewBase, agent, crew, task +import agentstack + +@CrewBase +class StockmarketresearchCrew(): + """stock_market_research crew""" + + @agent + def web_researcher(self) -> Agent: + return Agent( + config=self.agents_config['web_researcher'], + tools = [ + get_dappier_tool("real_time_web_search") + ], + verbose=True, + ) + + @agent + def stock_insights_analyst(self) -> Agent: + return Agent( + config=self.agents_config['stock_insights_analyst'], + tools = [ + get_dappier_tool("stock_market_data_search") + ], + verbose=True, + ) + + @agent + def report_analyst(self) -> Agent: + return Agent( + config=self.agents_config['report_analyst'], + verbose=True, + ) + + @task + def company_overview(self) -> Task: + return Task( + config=self.tasks_config['company_overview'], + ) + + @task + def financials_performance(self) -> Task: + return Task( + config=self.tasks_config['financials_performance'], + ) + + @task + def competitive_benchmarking(self) -> Task: + return Task( + config=self.tasks_config['competitive_benchmarking'], + ) + + @task + def real_time_stock_snapshot(self) -> Task: + return Task( + config=self.tasks_config['real_time_stock_snapshot'], + ) + + @task + def news_and_sentiment(self) -> Task: + return Task( + config=self.tasks_config['news_and_sentiment'], + ) + + @task + def generate_investment_report(self) -> Task: + return Task( + config=self.tasks_config['generate_investment_report'], + ) + + @crew + def crew(self) -> Crew: + """Creates the Test crew""" + return Crew( + agents=self.agents, # Automatically created by the @agent decorator + tasks=self.tasks, # Automatically created by the @task decorator + process=Process.sequential, + verbose=True, + ) + + +def get_dappier_tool(tool_name: str): + for tool in agentstack.tools["dappier"]: + if tool.name == tool_name: + return tool + return None diff --git a/examples/stock_market_research/src/main.py b/examples/stock_market_research/src/main.py new file mode 100644 index 00000000..674c3d3a --- /dev/null +++ b/examples/stock_market_research/src/main.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +from datetime import datetime +import sys +from crew import StockmarketresearchCrew +import agentstack +import agentops + +agentops.init(default_tags=agentstack.get_tags()) + +instance = StockmarketresearchCrew().crew() + +def run(): + """ + Run the agent. + """ + inputs = agentstack.get_inputs() + inputs["timestamp"] = datetime.utcnow().isoformat() + + instance.kickoff(inputs=inputs) + + +def train(): + """ + Train the crew for a given number of iterations. + """ + try: + instance.train( + n_iterations=int(sys.argv[1]), + filename=sys.argv[2], + inputs=agentstack.get_inputs(), + ) + except Exception as e: + raise Exception(f"An error occurred while training the crew: {e}") + + +def replay(): + """ + Replay the crew execution from a specific task. + """ + try: + instance.replay(task_id=sys.argv[1]) + except Exception as e: + raise Exception(f"An error occurred while replaying the crew: {e}") + + +def test(): + """ + Test the crew execution and returns the results. + """ + try: + instance.test( + n_iterations=int(sys.argv[1]), + openai_model_name=sys.argv[2], + inputs=agentstack.get_inputs(), + ) + except Exception as e: + raise Exception(f"An error occurred while replaying the crew: {e}") + + +if __name__ == '__main__': + run() \ No newline at end of file diff --git a/examples/stock_market_research/src/tools/__init__.py b/examples/stock_market_research/src/tools/__init__.py new file mode 100644 index 00000000..ebbad834 --- /dev/null +++ b/examples/stock_market_research/src/tools/__init__.py @@ -0,0 +1,2 @@ + +# tool import \ No newline at end of file From edb3692cff4449f951b68c0514741230694617a2 Mon Sep 17 00:00:00 2001 From: Amaan Date: Thu, 1 May 2025 13:35:47 +0530 Subject: [PATCH 3/6] update inputs.yaml --- examples/stock_market_research/src/config/inputs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/stock_market_research/src/config/inputs.yaml b/examples/stock_market_research/src/config/inputs.yaml index 553692c3..69e8d3bc 100644 --- a/examples/stock_market_research/src/config/inputs.yaml +++ b/examples/stock_market_research/src/config/inputs.yaml @@ -1 +1 @@ -company_name: Tesla +company_name: tesla From 5819471207ca574e65b44cd84cd5178429fec7e3 Mon Sep 17 00:00:00 2001 From: Amaan Date: Thu, 1 May 2025 13:43:59 +0530 Subject: [PATCH 4/6] add tesla investment report as an example --- .../reports/tesla_investment_report.md | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 examples/stock_market_research/reports/tesla_investment_report.md diff --git a/examples/stock_market_research/reports/tesla_investment_report.md b/examples/stock_market_research/reports/tesla_investment_report.md new file mode 100644 index 00000000..93975897 --- /dev/null +++ b/examples/stock_market_research/reports/tesla_investment_report.md @@ -0,0 +1,88 @@ +# Tesla Investment Report + +## 1. Company Summary +Tesla, Inc. is a pioneering leader in the automotive industry, specifically in electric vehicles. Known for its innovative technologies and commitment to sustainability, Tesla aims to accelerate the world's transition to renewable energy. Under the leadership of CEO Elon Musk, the company continues to push boundaries with cutting-edge solutions in energy storage and autonomous driving. + +## 2. Company Profile +| Attribute | Detail | +|-----------------|-----------------------------------| +| **Industry** | Automotive | +| **Sector** | Electric Vehicles | +| **CEO** | Elon Musk | +| **Headquarters**| Palo Alto, California, USA | +| **Employees** | Approximately 140,473 | +| **Market Cap** | About $921 billion | + +## 3. Financial Performance +- **Revenue (TTM):** $19.3 billion (down 9% YoY) +- **Net Income (TTM):** $399 million (down 66% YoY) +- **YoY Revenue Growth:** -9% +- **Gross Margin:** 16.3% +- **Quarterly Trends:** + - Vehicle deliveries decreased by 13% to 336,681 units. + - Operating income fell, leading to an operating margin of 2.1%, down from 5.5% in Q1 2024. + +## 4. Competitive Benchmarking +| Company | P/E Ratio | Revenue (Billion USD) | Stock Price (USD) | Market Cap (Billion USD) | +|---------------------|-----------|-----------------------|-------------------|--------------------------| +| **Tesla** | 82.7 | 19.3 | 250.00 approx. | 833 | +| Rivian Automotive | N/A | 1.8 | 20.50 | 18 | +| Lucid Motors | N/A | 1.1 | 8.75 | 12 | +| Ford Motor Company | 11.5 | 50 | 14.20 | 56 | +| General Motors | 6.8 | 40 | 32.50 | 45 | +| NIO Inc. | N/A | 5.5 | 12.00 | 20 | +| Xpeng Inc. | N/A | 3.2 | 10.50 | 15 | +| BYD Company | 40.3 | 30 | 40.00 | 120 | + +## 5. Real-time Stock Snapshot +- **Current Price:** $260.54 +- **% Daily Change:** -0.08% +- **Volume:** 1,000 shares +- **52-Week High/Low:** $313.80/$101.81 +- **P/E Ratio:** 50.76 +- **EPS:** $5.13 +- **Dividend Yield:** 0.00% (Tesla does not pay a dividend) + +### Chart Data +- **1 Day:** Price fluctuated around $260.54. +- **5 Days:** Slight decline in price. +- **1 Month:** Decrease from approximately $270.00. +- **YTD:** Increased from around $200.00. +- **1 Year:** Significant rise from $101.81 to current levels. + +## 6. Categorized Financial News +### Earnings +- **Sentiment:** Mildly Negative + - Tesla's Q3 vehicle deliveries of 430,488 missed estimates, yet the company maintains a target of 1.8 million units for the year. + +### Analyst Ratings +- **Sentiment:** Cautiously Negative + - Analysts foresee potential EPS estimate decreases by $0.30 to $0.50 for 2024 after the sales report. + +### Market Moves +- **Sentiment:** Neutral + - Cathie Wood's Ark Invest executed significant sales of Tesla stock, summing $30 million over a week. + +### Partnerships +- **No Recent Updates** + +### Legal/Regulatory +- **No Recent Updates** + +### Additional News +1. **Cathie Wood's Ark Sells Tesla Stock** + - Significant disposals hint at strategic repositioning. +2. **Tesla Continues with Price Cuts** + - U.S. Model Y and 3 EVs prices reduced amid soft sales. +3. **EV Sector Performance** + - Despite volatility, Tesla's stock shows resilience. + +## 7. Insight Section +### What's Going On with Tesla +Tesla is navigating through a period of declining deliveries and income, yet remains a leader in EV innovation. Despite missing sales targets, the company sustains its aspirations for high production and delivery volumes this year. + +### Why It Matters +Tesla's market leadership and technology advances are pivotal in shaping the EV landscape. Current financial adjustments reflect shifts in market dynamics and cost management strategies that impact both its short-term financial health and long-term growth prospects. + +### Outlook (Not Financial Advice) +Tesla is poised to stabilize through strategic cost measures. While challenges in deliveries persist, long-term value creation remains, bolstered by continuous innovation. Investors should weigh risks with growth potential as Tesla adjusts its global strategy. \ No newline at end of file From bb12c850ae8877ea07592a06b75e1ea8758127b9 Mon Sep 17 00:00:00 2001 From: Amaan Date: Thu, 1 May 2025 23:52:02 +0530 Subject: [PATCH 5/6] fine tune the prompt to get latest news and stock prices --- .../reports/tesla_investment_report.md | 138 +++++++++--------- .../src/config/tasks.yaml | 19 ++- 2 files changed, 79 insertions(+), 78 deletions(-) diff --git a/examples/stock_market_research/reports/tesla_investment_report.md b/examples/stock_market_research/reports/tesla_investment_report.md index 93975897..8c08b366 100644 --- a/examples/stock_market_research/reports/tesla_investment_report.md +++ b/examples/stock_market_research/reports/tesla_investment_report.md @@ -1,88 +1,84 @@ -# Tesla Investment Report +# Investment Report: Tesla, Inc. (TSLA) -## 1. Company Summary -Tesla, Inc. is a pioneering leader in the automotive industry, specifically in electric vehicles. Known for its innovative technologies and commitment to sustainability, Tesla aims to accelerate the world's transition to renewable energy. Under the leadership of CEO Elon Musk, the company continues to push boundaries with cutting-edge solutions in energy storage and autonomous driving. +## 1. AI Summary of Tesla + +Tesla is a leading force in the automotive industry, particularly in electric vehicles, under the leadership of CEO Elon Musk. With a vision to accelerate the world's transition to sustainable energy, Tesla continues to innovate across vehicle production and energy solutions. Despite recent financial pressures, Tesla is committed to its long-term growth objectives. ## 2. Company Profile -| Attribute | Detail | -|-----------------|-----------------------------------| -| **Industry** | Automotive | -| **Sector** | Electric Vehicles | -| **CEO** | Elon Musk | -| **Headquarters**| Palo Alto, California, USA | -| **Employees** | Approximately 140,473 | -| **Market Cap** | About $921 billion | - -## 3. Financial Performance -- **Revenue (TTM):** $19.3 billion (down 9% YoY) -- **Net Income (TTM):** $399 million (down 66% YoY) -- **YoY Revenue Growth:** -9% -- **Gross Margin:** 16.3% -- **Quarterly Trends:** - - Vehicle deliveries decreased by 13% to 336,681 units. - - Operating income fell, leading to an operating margin of 2.1%, down from 5.5% in Q1 2024. + +- **Industry/Sector**: Automotive / Electric Vehicles +- **CEO**: Elon Musk +- **Headquarters Location**: Palo Alto, California, USA +- **Employee Count**: Approximately 125,665 +- **Market Capitalization**: Around $921 billion +- **Stock Ticker Symbol**: TSLA + +## 3. Financial Performance Metrics + +| Metric | Value | +|-----------------------------|--------------------------| +| **Revenue (TTM)** | $95.72 billion | +| **Net Income (TTM)** | $1.5 billion | +| **YoY Revenue Growth** | -9.20% | +| **Gross Margin** | 16.3% | +| **Operating Income** | $400 million | +| **Operating Margin** | 2.1% | +| **Q1 2025 Highlights** | Significant margin pressures; Energy storage deployments up 154% YoY | ## 4. Competitive Benchmarking -| Company | P/E Ratio | Revenue (Billion USD) | Stock Price (USD) | Market Cap (Billion USD) | -|---------------------|-----------|-----------------------|-------------------|--------------------------| -| **Tesla** | 82.7 | 19.3 | 250.00 approx. | 833 | -| Rivian Automotive | N/A | 1.8 | 20.50 | 18 | -| Lucid Motors | N/A | 1.1 | 8.75 | 12 | -| Ford Motor Company | 11.5 | 50 | 14.20 | 56 | -| General Motors | 6.8 | 40 | 32.50 | 45 | -| NIO Inc. | N/A | 5.5 | 12.00 | 20 | -| Xpeng Inc. | N/A | 3.2 | 10.50 | 15 | -| BYD Company | 40.3 | 30 | 40.00 | 120 | - -## 5. Real-time Stock Snapshot -- **Current Price:** $260.54 -- **% Daily Change:** -0.08% -- **Volume:** 1,000 shares -- **52-Week High/Low:** $313.80/$101.81 -- **P/E Ratio:** 50.76 -- **EPS:** $5.13 -- **Dividend Yield:** 0.00% (Tesla does not pay a dividend) - -### Chart Data -- **1 Day:** Price fluctuated around $260.54. -- **5 Days:** Slight decline in price. -- **1 Month:** Decrease from approximately $270.00. -- **YTD:** Increased from around $200.00. -- **1 Year:** Significant rise from $101.81 to current levels. -## 6. Categorized Financial News -### Earnings -- **Sentiment:** Mildly Negative - - Tesla's Q3 vehicle deliveries of 430,488 missed estimates, yet the company maintains a target of 1.8 million units for the year. +| Company | Market Cap (B) | Stock Price | P/E Ratio | Revenue (TTM) (B) | +|---------------|----------------|-------------|-----------|-------------------| +| **Tesla, Inc.** (TSLA) | $921 | ~$220 | ~60 | $95.72 | +| **NIO Inc.** (NIO) | $30 | ~$12 | ~25 | $6.5 | +| **Rivian Automotive, Inc.** (RIVN) | $18 | ~$10 | N/A (losses) | $1.5 | +| **Lucid Motors, Inc.** (LCID) | $12 | ~$8 | N/A (losses) | $1 | +| **Li Auto Inc.** (LI) | $20 | ~$15 | ~30 | $5 | + +### Key Highlights: +- Tesla's market cap and revenue far exceed those of its peers. +- High P/E ratio suggests strong investor confidence in future growth. + +## 5. Real-Time Stock Snapshot -### Analyst Ratings -- **Sentiment:** Cautiously Negative - - Analysts foresee potential EPS estimate decreases by $0.30 to $0.50 for 2024 after the sales report. +- **Current Price:** $282.86 +- **Daily Change:** +$3.21 (+1.15%) +- **Volume:** 1,500,000 shares +- **52-Week High:** $350.00 +- **52-Week Low:** $180.00 +- **P/E Ratio:** 45.67 +- **EPS:** $6.19 +- **Dividend Yield:** 0.00% -### Market Moves -- **Sentiment:** Neutral - - Cathie Wood's Ark Invest executed significant sales of Tesla stock, summing $30 million over a week. +### Price Performance: +- **1 Day:** +1.15% +- **5 Days:** +3.50% +- **1 Month:** +5.00% +- **YTD:** +15.00% +- **1 Year:** +25.00% -### Partnerships -- **No Recent Updates** +## 6. Categorized Financial News -### Legal/Regulatory -- **No Recent Updates** +### Market Moves: +- **Unfortunate News for Tesla Stock Investors** (Sentiment: Negative) - Reporting on increased tariffs impacting costs and likely reducing margins. [Read more](https://www.fool.com/investing/2025/05/01/unfortunate-news-for-tesla-stock-investors/?source=iedfolrf0000001) -### Additional News -1. **Cathie Wood's Ark Sells Tesla Stock** - - Significant disposals hint at strategic repositioning. -2. **Tesla Continues with Price Cuts** - - U.S. Model Y and 3 EVs prices reduced amid soft sales. -3. **EV Sector Performance** - - Despite volatility, Tesla's stock shows resilience. +### Partnerships: +- **Why Tesla Stock Hit the Brakes Today** (Sentiment: Cautious) - Analysis on the potential impact of a new Waymo-Toyota partnership on Tesla's autonomous driving strategies. [Read more](https://www.fool.com/investing/2025/04/30/why-tesla-stock-hit-the-brakes-today/?source=iedfolrf0000001) ## 7. Insight Section -### What's Going On with Tesla -Tesla is navigating through a period of declining deliveries and income, yet remains a leader in EV innovation. Despite missing sales targets, the company sustains its aspirations for high production and delivery volumes this year. + +### What's Going on with Tesla + +Tesla is facing margin pressures due to increased costs associated with tariffs and inventory management challenges. Yet, the company shows resilience with strong energy storage growth and sustained leadership in the EV sector. ### Why It Matters -Tesla's market leadership and technology advances are pivotal in shaping the EV landscape. Current financial adjustments reflect shifts in market dynamics and cost management strategies that impact both its short-term financial health and long-term growth prospects. + +These financial and market challenges are pivotal as they may influence Tesla's global competitiveness, investor sentiment, and stock performance. The automotive industry's pivot towards autonomous technology is also critical to maintain Tesla's edge over competitors. ### Outlook (Not Financial Advice) -Tesla is poised to stabilize through strategic cost measures. While challenges in deliveries persist, long-term value creation remains, bolstered by continuous innovation. Investors should weigh risks with growth potential as Tesla adjusts its global strategy. \ No newline at end of file + +Despite current challenges, Tesla’s innovative approach and substantial market presence suggest potential for recovery and growth, especially with strategic advancements in energy and technology. Investors should monitor upcoming financial releases and market conditions as Tesla revisits its guidance. + +``` + +This comprehensive report covers Tesla’s current status, competitive positioning, real-time performance, latest news impacts, and a forward-looking insight narrative, all formatted in detailed markdown style. \ No newline at end of file diff --git a/examples/stock_market_research/src/config/tasks.yaml b/examples/stock_market_research/src/config/tasks.yaml index 6b8d8cae..0429f939 100644 --- a/examples/stock_market_research/src/config/tasks.yaml +++ b/examples/stock_market_research/src/config/tasks.yaml @@ -1,16 +1,17 @@ company_overview: description: >- - As of {timestamp}, fetch the company overview for {company_name} usin real-time web search. Include - company profile, industry, sector, CEO, headquarters location, employee count, market + As of {timestamp}, fetch the company overview for {company_name} using real-time web search with the timestamp. Include + company profile, industry, sector, CEO, headquarters location, employee count, market capitalization and stock ticker symbol. expected_output: >- A structured company profile including: Company Profile, Industry, Sector, CEO, HQ Location, Employees, Market Cap and the stock ticker symbol. agent: >- web_researcher + financials_performance: description: >- - As of {timestamp}, use real-time web search to extract financial performance data for {company_name}, + As of {timestamp}, use real-time web search with the timestamp to extract financial performance data for {company_name}, including Revenue (TTM), Net Income (TTM), Year-over-Year revenue growth, gross margin, and recent quarterly trends. Include any earnings trends or management commentary available. @@ -20,9 +21,10 @@ financials_performance: Commentary. agent: >- web_researcher + competitive_benchmarking: description: >- - As of {timestamp}, perform real-time web search to identify 3-5 peer companies in the same sector + As of {timestamp}, perform real-time web search with the timestamp to identify 3-5 peer companies in the same sector as {company_name}. Extract and compare key metrics such as P/E ratio, revenue, stock price, and market cap. Highlight any standout metrics where {company_name} outperforms or underperforms. @@ -31,10 +33,11 @@ competitive_benchmarking: and market cap. Highlight metrics where {company_name} stands out. agent: >- web_researcher + real_time_stock_snapshot: description: >- As of {timestamp}, convert {company_name} to its stock ticker symbol and retrieve a real-time stock - snapshot using Dappier’s stock market data tool. Include current price with % + snapshot using Dappier’s stock market data tool with the timestamp. Include current price with % daily change, volume, 52-week high/low, P/E ratio, EPS, dividend yield, and chart data for 1D, 5D, 1M, YTD, and 1Y in the query. expected_output: >- @@ -43,10 +46,11 @@ real_time_stock_snapshot: and chart data for 1D, 5D, 1M, YTD, 1Y. agent: >- stock_insights_analyst + news_and_sentiment: description: >- As of {timestamp}, convert {company_name} to its stock ticker symbol and fetch a real-time financial - news stream using Dappier’s stock market data tool. Categorize the news by topic: + news stream using Dappier’s stock market data tool with the timestamp. Categorize the news by topic: Earnings, Analyst Ratings, Market Moves, Partnerships, and Legal/Regulatory in the query. expected_output: >- @@ -55,12 +59,13 @@ news_and_sentiment: Ratings, Market Moves, Partnerships, Legal/Regulatory in the query. agent: >- stock_insights_analyst + generate_investment_report: description: >- As of {timestamp}, compile a comprehensive, markdown-formatted investment report for {company_name} by synthesizing the outputs of all prior tasks: company overview, financial performance, competitive benchmarking, real-time stock snapshot, and - categorized financial news. Include a concise AI-generated company summary, + categorized financial news. Use the timestamp in all queries. Include a concise AI-generated company summary, structured data tables, sentiment-tagged news, and a narrative insight section. expected_output: >- A markdown-formatted investment report containing: From 20aa461cfdf0160aa6181a5196c230168d4ff08f Mon Sep 17 00:00:00 2001 From: Amaan Date: Thu, 1 May 2025 23:52:50 +0530 Subject: [PATCH 6/6] use current utc time --- examples/stock_market_research/src/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/stock_market_research/src/main.py b/examples/stock_market_research/src/main.py index 674c3d3a..7be0e6c0 100644 --- a/examples/stock_market_research/src/main.py +++ b/examples/stock_market_research/src/main.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -from datetime import datetime +from datetime import datetime, timezone import sys from crew import StockmarketresearchCrew import agentstack @@ -14,7 +14,7 @@ def run(): Run the agent. """ inputs = agentstack.get_inputs() - inputs["timestamp"] = datetime.utcnow().isoformat() + inputs["timestamp"] = datetime.now(timezone.utc).isoformat() instance.kickoff(inputs=inputs)