feat: solution for '8. Самописный поисковый агент на основе deep agents from scratch'
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
"""
|
||||
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()
|
||||
Reference in New Issue
Block a user