39 lines
782 B
Python
39 lines
782 B
Python
"""
|
|
Entry point for the Deep Agents from Scratch search agent.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
from src.agent import run_query
|
|
|
|
# Load environment variables from .env if present
|
|
load_dotenv(dotenv_path=Path(".env"))
|
|
|
|
def main() -> None:
|
|
"""
|
|
Main function to run the search agent with a user-provided query.
|
|
"""
|
|
if len(sys.argv) < 2:
|
|
print("Usage: python main.py \"Your search query here\"")
|
|
sys.exit(1)
|
|
|
|
query = " ".join(sys.argv[1:])
|
|
|
|
try:
|
|
answer = run_query(query)
|
|
except RuntimeError as err:
|
|
print(f"Error: {err}")
|
|
sys.exit(1)
|
|
|
|
print("\n=== Agent Response ===")
|
|
print(answer)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main() |