Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# Virtual environments
.venv/
venv/
ENV/
env/

# IDE
.vscode/
.idea/
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db

# SQLite
*.db-journal

# Temporary files
*.tmp
.cache/
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ Detailed ETL notes live in `markdown/project_overview.md`, while `markdown/view_
- See `markdown/view_scoring_details.md` for the full breakdown.

## Agent Workflow
1. **System prompt** (`utils/prompts.py`): enforces plan-first tool usage, schema inspection, SQL-only answers, and markdown outputs containing identifiers, geography, RAUM, component scores, and contact info.
2. **Tools**: the Agno agent loads two tools—`SequentialThinkingTools` (custom planner) and `SQLTools` (runs queries against `data/staging.sqlite`).
3. **Run**: edit `USER_INPUT` in `main.py` or wrap the agent in your own CLI/web interface; when executed, it stores responses under `markdown/output_<timestamp>.md`.
1. **Greeting Handler**: The agent now includes a friendly greeting handler that responds to simple greetings (hi, hello, hey, etc.) with a welcome message and usage guide, making it more user-friendly for first-time interactions.
2. **System prompt** (`utils/prompts.py`): enforces plan-first tool usage, schema inspection, SQL-only answers, and markdown outputs containing identifiers, geography, RAUM, component scores, and contact info.
3. **Tools**: the Agno agent loads two tools—`SequentialThinkingTools` (custom planner) and `SQLTools` (runs queries against `data/staging.sqlite`).
4. **Run**: edit `USER_INPUT` in `main.py` or wrap the agent in your own CLI/web interface; when executed, it stores responses under `markdown/output_<timestamp>.md`.

## Getting Started
1. Install dependencies (example):
Expand Down
57 changes: 55 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,48 @@
from agno.os import AgentOS


def handle_greeting(user_input: str) -> str | None:
"""
Handle simple greetings and return a friendly welcome message.

Args:
user_input: The user's input string

Returns:
A welcome message string if greeting detected, None otherwise
"""
greetings = ["hi", "hello", "hey", "greetings", "good morning", "good afternoon", "good evening"]
user_lower = user_input.lower().strip()

# Check if input is exactly a greeting or starts with a greeting
is_greeting = (
user_lower in greetings or
any(user_lower.startswith(greeting + " ") for greeting in greetings) or
any(user_lower.startswith(greeting + ",") for greeting in greetings)
)

if is_greeting:
return """# Welcome to the Matchmaking Agent!

I'm here to help you pair SEC Form D / Reg CF deals with Form ADV advisers using our comprehensive database.

## What I Can Do

- **Find advisers for a deal**: Provide a Form D accession number, and I'll find the top matching advisers
- **Find deals for an adviser**: Provide an adviser FilingID, and I'll show suitable deals
- **Analyze fit scores**: I'll explain why advisers match specific deals based on geography, capital, audience, and more
- **Query the database**: Ask about specific deals, advisers, or market trends

## Example Queries

- "Find the top 5 advisers for Form D accession 0000005108-25-000002"
- "Show deals that adviser FilingID 1620806 is a fit for"
- "List Reg CF offerings that allow retail investors"

How can I assist you today?"""
return None


db_path = Path("data/staging.sqlite").resolve()
db_url = f"sqlite:///{db_path}"

Expand Down Expand Up @@ -37,13 +79,24 @@
plus the geography/capital/audience component scores.
Explain briefly why each adviser is a good fit.
"""
res = agno_agent.run(USER_INPUT)

# Check if input is a simple greeting
greeting_response = handle_greeting(USER_INPUT)

if greeting_response:
# Handle greeting without invoking the agent
print(greeting_response)
res_content = greeting_response
else:
# Run the agent for actual queries
res = agno_agent.run(USER_INPUT)
res_content = res.content

markdown_dir = Path("markdown")
os.makedirs(markdown_dir, exist_ok=True)

timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
output_path = markdown_dir / f"output_{timestamp}.md"
with open(output_path, "w", encoding="utf-8") as md_file:
md_file.write(res.content)
md_file.write(res_content)