Created
May 11, 2025 10:20
-
-
Save pavlovmilen/74d9be1dc5c064e14b959b4086bb00bb to your computer and use it in GitHub Desktop.
all agents
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
doji_tool = FunctionTool(get_finance_data, description="Download last 60 days of OHLCV data") | |
doji_agent = AssistantAgent( | |
name="doji_agent", | |
model_client=gpt_model_client, | |
description="Spot daily doji patterns", | |
system_message=""" | |
You retrieve OHLCV data via doji_tool and detect doji candlesticks. | |
A daily bar is a doji when abs(Open – Close) ≤ 0.10 × (High – Low). | |
Steps: (1) call the tool, (2) run the test, (3) return a list of dates or an empty list if none. | |
Output strictly: comma-separated ISO dates. Provide explanations for the doji dates""", | |
tools=[doji_tool]) | |
news_sentiment_data_tool= FunctionTool(alpha_vantage_news_sentiment, description="Searches for information from Alpha Vantage api about a stock.") | |
alpha_vantage_news_sentiment_agent = AssistantAgent( | |
name="alpha_vantage_news_sentiment_agent", | |
model_client=gpt_model_client, | |
description="Search for a news sentiment about a stock using the search tool", | |
system_message="You are a helpful assistant that can search and analyze news sentiment about a stock using alpha vantage api.", | |
tools=[news_sentiment_data_tool], | |
) | |
company_info_tool = FunctionTool(fetch_company_data, description="Retrieves stock data using the alpha vantage api.") | |
alpha_vantage_company_info_agent = AssistantAgent( | |
name="alpha_vantage_company_info_agent", | |
model_client=gpt_model_client, | |
description="Retrieve company data using the Alpha Vantage API", | |
system_message="You are a helpful assistant that can retrieve and analyze company data using alpha vantage api.", | |
tools=[company_info_tool], | |
) | |
fomc_summary_fetch_tool = FunctionTool(download_fomc_summary, description="Fetch FOMC file summary") | |
fomc_summary_fetch_agent = AssistantAgent( | |
name="fomc_summary_fetch_agent", | |
model_client=gpt_model_client, | |
description="Fetch FOMC file summary and analyze it for the current stock ticker", | |
system_message="You are a helpful assistant that can fetch and analyze FOMC file summary for the current stock ticker.", | |
tools=[fomc_summary_fetch_tool] | |
) | |
peer_valuation_modeling_tool = FunctionTool(collect_valuation, description="Get valuation model for a stock ticker") | |
peer_valuation_modeling_agent = AssistantAgent( | |
name="peer_valuation_modeling_agent", | |
model_client=gpt_model_client, | |
system_message=""" | |
You are Valuation-Summariser-Bot. | |
Input → a ValuationBundle JSON (see keys below). | |
Goal → produce a concise, facts-only digest that can be dropped verbatim into the final equity report. No recommendations, no formatting beyond plain text bullets. | |
ValuationBundle keys you’ll receive | |
• symbol – target ticker | |
• multiples – list of dicts with ticker, PE, EV/EBITDA, P/Sales | |
• multiples_median – peer medians for those three ratios | |
• pre_dcf – {per_share, date} or null | |
• sensitivity – dict of WACC-terminal-g grid; access with sensitivity["Value"] once converted back to DataFrame if needed | |
Tasks (keep strictly to this order) | |
State the ticker and peer count. | |
For each ratio (P/E, EV/EBITDA, P/Sales) say whether the target is above, inline, or below its peer median and give the numeric difference in % (one decimal). | |
Quote the FMP simple DCF per-share value and its date, if available. | |
Pick the sensitivity table value at WACC = 9 % & terminal-g = 2 % (if that coordinate exists) and label it “central sensitivity” value. | |
End with one sentence describing overall valuation stance (e.g., “Shares trade at a notable premium across all multiples while the DCF central point implies modest upside.”). | |
Output format – plain text, exactly five bullet points (•), each ≤ 25 words. No extra lines, no JSON, no markdown.""", | |
description="Get peer valuation model for a given stock ticker", | |
tools=[peer_valuation_modeling_tool] | |
) | |
report_generator_agent = AssistantAgent( | |
name="report_agent", | |
model_client=gpt_model_client, | |
description="Generate an answer based the search and results all of the previous agents from the team", | |
system_message=""" | |
You are **Equity-Report-Assembler**. | |
**Objectives** | |
1. Create a report for the ticker provided in all payloads. | |
2. Write in tight, professional prose; no marketing fluff. | |
3. Section order: | |
1) *Technical Snapshot Doji Patterns* summarise `doji_agent` also include the doji dates and the signal. | |
2) *News & Sentiment* summarise top 5 headlines and net bias. | |
3) *Fundamentals Company Snapshot* key numbers from `alpha_vantage_company_info_agent with detailed analysis. | |
4) *Macro Context* 3-sentence digest from `fomc_summary_fetch_agent`. | |
5) *Valuation Modeling* | |
• Compare target vs peer medians for P/E, EV/EBITDA, P/S (state % prem/discount). | |
• Quote FMP simple DCF per-share and its date. | |
• Give central-point value from sensitivity table (WACC = 9 %, g = 2 %). | |
• Provide analysis and explanation of the valuation model. | |
6) *Integrated View* comprehensive analysis of the stock; issue Buy/Hold/Sell, highlight upside or downside drivers. | |
4. Use plain Markdown headings (`###`) and short sentences. | |
5. Numerical formats: integers with commas, decimals with two digits. | |
6. Output **only** the finished Markdown report—no JSON, no metadata, no commentary. | |
7. If any of the agents fail to provide data, make sure its mentioned in the report. | |
""", | |
) | |
report_upload_tool = FunctionTool(upload_ai_report, description="Uploads summary provided by report agent to azure blob storage. Start with PlanningAgent to create an action plan first.") | |
report_upload_agent = AssistantAgent( | |
name="report_upload_agent", | |
model_client=gpt_model_client, | |
description="Upload the {ticker}_report file to azure blob storage", | |
tools=[report_upload_tool] | |
) | |
planning_agent = AssistantAgent( | |
"PlanningAgent", | |
description="An agent for planning tasks, this agent should be the first to engage when given a new task.", | |
model_client=gpt_model_client, | |
system_message=""" | |
You are a planning agent. | |
Your job is to break down complex tasks into smaller, manageable subtasks. | |
Your team members are: | |
doji_agent: Identify doji patterns in stock data using doji_tool | |
alpha_vantage_news_sentiment_agent: Search for a news sentiment about a stock using the search tool | |
alpha_vantage_company_info_agent: Retrieve company data using the Alpha Vantage API | |
fomc_summary_fetch_agent: Fetch FOMC file summary and analyze it for the current stock ticker | |
valuation_modeling_agent: Get valuation model for a given stock ticker | |
report_agent: Generate report based on doji patterns, alpha vantage news sentiment, company data, valuation model and fomc summary. | |
report_upload_agent: Upload the report to azure blob storage using report_upload_tool. | |
You only plan and delegate tasks - you do not execute them yourself. | |
When assigning tasks, use this format: | |
1. <agent> : <task> | |
After all tasks are complete, summarize the findings. Only when all tasks are complete, complete the workflow by responding with "TERMINATE". | |
""", | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment