bpm-agent / main.py
limonad's picture
Upload 24 files
1e49a59 verified
"""Main entry point for running the LangGraph agent."""
import sys
from pathlib import Path
# Add current directory to path for imports
sys.path.insert(0, str(Path(__file__).parent))
from agents.process_aware_agent import run_agent
def main():
"""Run the agent in interactive mode."""
print("=" * 60)
print("LangGraph Agent - Interactive Mode")
print("=" * 60)
print("Type 'exit' or 'quit' to end the conversation")
print("=" * 60)
print()
while True:
try:
# Get user input
user_input = input("You: ").strip()
# Check for exit commands
if user_input.lower() in ["exit", "quit", "q"]:
print("\nGoodbye!")
break
# Skip empty inputs
if not user_input:
continue
# Get agent response
print("\nAgent: ", end="", flush=True)
response = run_agent(user_input)
print(response)
print()
except KeyboardInterrupt:
print("\n\nGoodbye!")
break
except Exception as e:
print(f"\nError: {e}")
print("Please try again.\n")
def run_single_query(query: str):
"""Run a single query and print the response."""
try:
response = run_agent(query)
print(f"Query: {query}")
print(f"Response: {response}")
except Exception as e:
print(f"Error: {e}")
sys.exit(1)
if __name__ == "__main__":
# Check if a query was provided as command line argument
if len(sys.argv) > 1:
query = " ".join(sys.argv[1:])
run_single_query(query)
else:
main()
# Made with Bob