View tracing-related environment variables.
()
| 936 | |
| 937 | @env.command("view") |
| 938 | def env_view() -> None: |
| 939 | """View tracing-related environment variables.""" |
| 940 | from pathlib import Path |
| 941 | |
| 942 | from rich.console import Console |
| 943 | from rich.panel import Panel |
| 944 | from rich.table import Table |
| 945 | |
| 946 | console = Console() |
| 947 | |
| 948 | env_file = Path(".env") |
| 949 | env_file_exists = env_file.exists() |
| 950 | |
| 951 | table = Table(show_header=True, header_style="bold cyan", expand=True) |
| 952 | table.add_column("Environment Variable", style="cyan", width=30) |
| 953 | table.add_column("Value", style="white", width=20) |
| 954 | table.add_column("Source", style="yellow", width=20) |
| 955 | |
| 956 | crewai_tracing = os.getenv("CREWAI_TRACING_ENABLED", "") |
| 957 | if crewai_tracing: |
| 958 | table.add_row( |
| 959 | "CREWAI_TRACING_ENABLED", |
| 960 | crewai_tracing, |
| 961 | "Environment/Shell", |
| 962 | ) |
| 963 | else: |
| 964 | table.add_row( |
| 965 | "CREWAI_TRACING_ENABLED", |
| 966 | "[dim]Not set[/dim]", |
| 967 | "[dim]—[/dim]", |
| 968 | ) |
| 969 | |
| 970 | crewai_testing = os.getenv("CREWAI_TESTING", "") |
| 971 | if crewai_testing: |
| 972 | table.add_row("CREWAI_TESTING", crewai_testing, "Environment/Shell") |
| 973 | |
| 974 | crewai_user_id = os.getenv("CREWAI_USER_ID", "") |
| 975 | if crewai_user_id: |
| 976 | table.add_row("CREWAI_USER_ID", crewai_user_id, "Environment/Shell") |
| 977 | |
| 978 | crewai_org_id = os.getenv("CREWAI_ORG_ID", "") |
| 979 | if crewai_org_id: |
| 980 | table.add_row("CREWAI_ORG_ID", crewai_org_id, "Environment/Shell") |
| 981 | |
| 982 | table.add_row( |
| 983 | ".env file", |
| 984 | "✅ Found" if env_file_exists else "❌ Not found", |
| 985 | str(env_file.resolve()) if env_file_exists else "N/A", |
| 986 | ) |
| 987 | |
| 988 | panel = Panel( |
| 989 | table, |
| 990 | title="Tracing Environment Variables", |
| 991 | border_style="blue", |
| 992 | padding=(1, 2), |
| 993 | ) |
| 994 | console.print("\n") |
| 995 | console.print(panel) |