Skip to content

Conversation

@tjirab
Copy link
Contributor

@tjirab tjirab commented Oct 17, 2025

What does this PR do?

Provides a .env template for new users that is automatically created when starting and exploring the project. It will provide the .env shell so that users only will need to fill in the missing API keys.

Why does this PR do it?

To help users onboard.

How does it work?

The .env file will be created/checked upon importing the agent, e.g. from vision_agents import Agent. If it doesn't exist, it'll be created with help and next steps:
Screenshot 2025-10-17 at 10 01 32

Summary by CodeRabbit

  • New Features

    • Added a command-line setup tool for automated project initialization.
    • Automatic creation of a .env configuration file on first use with safety checks.
    • Included a comprehensive environment template covering supported API providers and options.
  • Documentation

    • Expanded README with Quick Start, installation steps, API key requirements, example usage, and setup guidance.

@coderabbitai
Copy link

coderabbitai bot commented Oct 17, 2025

Walkthrough

Adds onboarding for agents-core: expanded README Quick Start, a .env template, a post-install CLI/setup script, automatic .env scaffolding on package import (with safeguards), and a pyproject console-script entry; also exposes Agent, User, and __version__ from the package root.

Changes

Cohort / File(s) Change Summary
Documentation
agents-core/README.md
Replaced single GitHub link with a comprehensive Quick Start and usage guide (install, env keys, setup commands, example, docs links).
Project Configuration
agents-core/pyproject.toml
Added console script entry vision-agents-setupvision_agents.post_install:main.
Package Initialization
agents-core/vision_agents/__init__.py
On-import env bootstrap: _setup_env_file() copies env_template.txt.env (skips in site-packages/dist-packages or if exists); imports/exports Agent, User; adds __version__ = "0.0.0" and updates __all__.
Setup Infrastructure
agents-core/vision_agents/post_install.py, agents-core/vision_agents/env_template.txt
New CLI/script post_install.py with create_env_file(target_dir, force), show_setup_guide(), main() supporting --dir/-d, --force/-f, --guide/-g; env_template.txt added as a commented .env template covering infrastructure, LLM/STT/TTS, VAD, CV, MCP, dev/test, and optional settings.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant Package as vision_agents\n(__init__.py)
    participant FSys as File System
    participant CLI as vision-agents-setup\n(post_install.py)

    rect rgba(0,150,100,0.08)
    note over Package,FSys: Auto-setup on import (guarded)
    User->>Package: import vision_agents
    Package->>FSys: Determine package dir & CWD
    alt running outside site-packages & .env missing
        Package->>FSys: Locate env_template.txt
        Package->>FSys: Copy template to .env
        Package->>User: Print setup guidance
    else in site-packages or .env exists
        Package->>Package: Skip creation
    end
    end

    rect rgba(0,100,200,0.06)
    note over User,CLI: Manual CLI setup flow
    User->>CLI: vision-agents-setup [--dir] [--force] [--guide]
    alt --guide
        CLI->>User: Display setup guide
    else normal
        CLI->>FSys: Resolve target dir & .env path
        alt .env exists & not --force
            CLI->>User: Report exists, exit
        else
            CLI->>FSys: Copy template → .env
            CLI->>User: Print location & next steps
        end
    end
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • maxkahan
  • dangusev
  • d3xvn

Poem

The template breathes; a paper mouth agape,
I copy keys into the hollow night,
The .env — a small bright artery of code,
Scripts chant and stitch the darkness to a file,
Vision wakes in scaffolds, trembling, sharp.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "feat: Onboarding guidance with .env setup" directly aligns with the primary objective of the pull request, which is to improve onboarding by automatically generating a .env template when the package is imported. The changeset supports this theme across multiple files: it adds an environment template file with commented configuration variables, auto-generates .env on first import in init.py, introduces setup tooling in post_install.py, and enhances the README with a comprehensive Quick Start guide. The title is specific, concise, and clearly communicates the main change without vague terminology or unnecessary detail. A reviewer scanning the repository history would immediately understand that this PR focuses on streamlining the new user experience through environment setup automation.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (2)
agents-core/vision_agents/post_install.py (2)

71-91: Consider enhancing docstring (optional).

The function is simple and effective. While the current docstring is adequate, you could optionally enhance it to be more explicit about the function's purpose and side effects.

-def show_setup_guide():
-    """Show comprehensive setup guide."""
+def show_setup_guide():
+    """Display comprehensive setup guide to stdout.
+    
+    Prints setup instructions, example usage, commands, and documentation links.
+    """

94-141: Enhance docstring to follow Google style guide.

The CLI implementation is well-structured with clear argument handling and appropriate error reporting. The docstring could be enhanced to follow the Google style guide.

As per coding guidelines.

Apply this diff:

-def main():
-    """Main entry point for setup script."""
+def main():
+    """Main entry point for setup script.
+    
+    Parses command-line arguments and executes the appropriate setup action.
+    Creates .env file from template or displays setup guide based on flags.
+    
+    Raises:
+        SystemExit: Exits with code 1 if setup fails.
+    """
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between fc032bf and 0456c67.

📒 Files selected for processing (5)
  • agents-core/README.md (1 hunks)
  • agents-core/pyproject.toml (1 hunks)
  • agents-core/vision_agents/__init__.py (1 hunks)
  • agents-core/vision_agents/env_template.txt (1 hunks)
  • agents-core/vision_agents/post_install.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py

📄 CodeRabbit inference engine (.cursor/rules/python.mdc)

**/*.py: Never adjust sys.path (e.g., sys.path.append/insert/assignment)
Docstrings must follow the Google style guide

Files:

  • agents-core/vision_agents/post_install.py
  • agents-core/vision_agents/__init__.py
🧬 Code graph analysis (1)
agents-core/vision_agents/__init__.py (2)
agents-core/vision_agents/core/agents/agents.py (1)
  • Agent (53-1021)
agents-core/vision_agents/core/edge/types.py (1)
  • User (15-18)
🪛 LanguageTool
agents-core/README.md

[grammar] ~25-~25: There might be a mistake here.
Context: ...dd your API keys: ### Required API Keys - Stream (required): STREAM_API_KEY, `...

(QB_NEW_EN)

🔇 Additional comments (6)
agents-core/pyproject.toml (1)

84-85: LGTM!

The console script configuration is correct and follows standard conventions. The entry point properly references vision_agents.post_install:main.

agents-core/README.md (3)

13-23: LGTM!

The Quick Start instructions accurately reflect the auto-setup behavior implemented in __init__.py. The import command will trigger the .env file creation as expected.


25-30: LGTM!

The API key requirements are clearly documented and align with the env_template.txt file. The categorization into required and optional services is helpful for users.


32-37: LGTM!

The setup commands accurately document the CLI interface defined in post_install.py:main().

agents-core/vision_agents/env_template.txt (1)

1-129: LGTM!

The environment template is comprehensive and well-organized. The section structure, helpful comments with API key URLs, and consistent placeholder format make this an excellent onboarding resource.

agents-core/vision_agents/__init__.py (1)

59-63: LGTM!

The public API exports are clean and properly expose the core components (Agent, User, __version__).

Comment on lines +39 to +53
## Example Usage

```python
from vision_agents import Agent
from vision_agents.plugins import openai, deepgram, cartesia

agent = Agent(
edge=getstream.Edge(),
agent_user=User(name="AI Assistant", id="agent"),
instructions="You're a helpful AI assistant.",
llm=openai.LLM(model="gpt-4o-mini"),
tts=cartesia.TTS(),
stt=deepgram.STT(),
)
```
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add missing import for getstream.

The example code references getstream.Edge() on line 46 but doesn't import getstream. Users following this example will encounter a NameError.

Apply this diff to fix the import:

 from vision_agents import Agent
-from vision_agents.plugins import openai, deepgram, cartesia
+from vision_agents.plugins import openai, deepgram, cartesia, getstream
 
 agent = Agent(
     edge=getstream.Edge(),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## Example Usage
```python
from vision_agents import Agent
from vision_agents.plugins import openai, deepgram, cartesia
agent = Agent(
edge=getstream.Edge(),
agent_user=User(name="AI Assistant", id="agent"),
instructions="You're a helpful AI assistant.",
llm=openai.LLM(model="gpt-4o-mini"),
tts=cartesia.TTS(),
stt=deepgram.STT(),
)
```
from vision_agents import Agent
from vision_agents.plugins import openai, deepgram, cartesia, getstream
agent = Agent(
edge=getstream.Edge(),
agent_user=User(name="AI Assistant", id="agent"),
instructions="You're a helpful AI assistant.",
llm=openai.LLM(model="gpt-4o-mini"),
tts=cartesia.TTS(),
stt=deepgram.STT(),
)
🤖 Prompt for AI Agents
In agents-core/README.md around lines 39 to 53, the example references
getstream.Edge() but never imports getstream; add a top-level import for the
getstream module (e.g., add "import getstream") so the example runs without a
NameError, placing the import with the other example imports at the top of the
code block.

Comment on lines +13 to +57
def _setup_env_file():
"""Automatically create .env file from template if it doesn't exist."""
try:
# Get the package directory
package_dir = Path(__file__).parent

# Template file path
template_path = package_dir / "env_template.txt"

# Target .env file path (in current working directory)
env_path = Path.cwd() / ".env"

# Check if .env already exists
if env_path.exists():
return

# Check if template exists
if not template_path.exists():
return

# Only create .env if we're in a project directory (not in site-packages)
# This prevents creating .env files in unexpected places
if "site-packages" in str(package_dir) or "dist-packages" in str(package_dir):
return

# Copy template to .env
import shutil
shutil.copy2(template_path, env_path)

# Print helpful message
print("🎉 Vision Agents: Created .env file with example configuration!")
print()
print("📁 File location:")
print(f" {env_path.absolute()}")
print()
print("📝 Please edit the .env file and add your actual API keys")
print("🔗 See the comments in the .env file for where to get API keys")
print("💡 Run 'vision-agents-setup' command for more setup options")

except Exception:
# Silently fail - don't break the import if env setup fails
pass

# Run the setup function
_setup_env_file()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Reconsider import-time side effects.

Creating files and printing to stdout during module import is a significant anti-pattern that can cause multiple issues:

  1. Tool breakage: Breaks introspection tools (mypy, sphinx, IDEs) that import modules for analysis
  2. CI/CD issues: Unexpected file creation in containerized or test environments
  3. Principle of least surprise: Users don't expect imports to modify the filesystem
  4. Silent failures: The broad except Exception: pass on line 52 hides all errors including permission issues

Consider refactoring to make setup explicit rather than automatic. Options:

  1. Require users to call vision-agents-setup explicitly (documented in README)
  2. Only print a one-line reminder if .env is missing, without creating it
  3. Move the setup logic to a clearly-named function that users call explicitly

If you want to keep automatic setup, at minimum:

  1. Add a way to disable it (environment variable like VISION_AGENTS_NO_AUTO_SETUP)
  2. Make the message much shorter (one line max)
  3. Log specific exceptions instead of silently suppressing them
  4. Document this behavior prominently in the README
 # Auto-create .env file on first import if it doesn't exist
 def _setup_env_file():
-    """Automatically create .env file from template if it doesn't exist."""
+    """Automatically create .env file from template if it doesn't exist.
+    
+    This function runs at import time. It can be disabled by setting
+    the VISION_AGENTS_NO_AUTO_SETUP environment variable.
+    
+    Returns:
+        bool: True if .env was created, False otherwise.
+    """
+    # Allow users to disable auto-setup
+    if os.environ.get("VISION_AGENTS_NO_AUTO_SETUP"):
+        return False
+    
     try:
         # Get the package directory
         package_dir = Path(__file__).parent

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In agents-core/vision_agents/__init__.py around lines 13 to 57, remove the
import-time side effects by not running _setup_env_file() at module import;
instead expose a clearly named function (e.g., setup_env_file()) and a small
helper (e.g.,
ensure_env_file_exists(disable_auto=os.environ.get("VISION_AGENTS_NO_AUTO_SETUP"))),
remove automatic file creation and prints on import, and implement explicit
control: check VISION_AGENTS_NO_AUTO_SETUP before doing anything, make any
messages a single short log line (use logging.warning/info), and replace the
broad except Exception: pass with catching and logging specific exceptions
(IOError/OSError and Exception with logged error details) so callers can opt
into setup (e.g., via a CLI command or README instruction) and errors are
visible.

Comment on lines +33 to +36
# Only create .env if we're in a project directory (not in site-packages)
# This prevents creating .env files in unexpected places
if "site-packages" in str(package_dir) or "dist-packages" in str(package_dir):
return
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Site-packages detection is fragile.

The string-matching approach for detecting site-packages installations is fragile and may fail for:

  • Editable installs (pip install -e .)
  • Conda environments with non-standard paths
  • Custom installation directories
  • Project directories that happen to contain "site-packages" or "dist-packages" in their path

Consider a more robust check:

-        # Only create .env if we're in a project directory (not in site-packages)
-        # This prevents creating .env files in unexpected places
-        if "site-packages" in str(package_dir) or "dist-packages" in str(package_dir):
-            return
+        # Only create .env if we're in a project directory (not in site-packages)
+        # This prevents creating .env files in unexpected places
+        try:
+            # Check if package is in the same directory as cwd or is in a stdlib/site location
+            package_dir.relative_to(Path.cwd())
+        except ValueError:
+            # Package is not under cwd, likely installed in site-packages
+            return

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In agents-core/vision_agents/__init__.py around lines 33 to 36, the current
string-match check for "site-packages"/"dist-packages" is fragile; replace it
with a robust containment check by resolving package_dir to an absolute Path and
comparing it against the actual site-packages / dist-packages locations returned
by site.getsitepackages(), sysconfig.get_paths() (e.g. "purelib"/"platlib"), and
optionally site.getusersitepackages(); treat any of those canonical paths as
targets and check whether package_dir.resolve() is inside any of them
(Path(...).resolve().is_relative_to(...) or equivalent loop over parents) so
editable installs, conda/custom prefixes, and symlinked paths are handled
correctly.

Comment on lines +52 to +54
except Exception:
# Silently fail - don't break the import if env setup fails
pass
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Log exceptions instead of silently suppressing them.

While not breaking the import is reasonable, silently suppressing all exceptions means users won't know why setup failed (permissions, missing template, etc.).

Apply this diff to at least log failures:

+    import logging
+    
     except Exception:
-        # Silently fail - don't break the import if env setup fails
-        pass
+        # Don't break the import, but log the failure
+        logging.getLogger(__name__).debug(
+            "Failed to auto-create .env file", exc_info=True
+        )

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In agents-core/vision_agents/__init__.py around lines 52 to 54, the code
currently catches Exception and silently passes; change this to catch Exception
as e and log the error (including e and the traceback) using the module's logger
(or the standard logging.getLogger(__name__)) with a clear message like
"vision_agents initialization failed" so import doesn't break but failures are
recorded for debugging; ensure the logging import exists and that the exception
handler does not re-raise.

Comment on lines +14 to +68
def create_env_file(target_dir=None, force=False):
"""Create .env file from template if it doesn't exist."""
# Get the package directory
package_dir = Path(__file__).parent

# Template file path
template_path = package_dir / "env_template.txt"

# Target directory
if target_dir is None:
target_dir = Path.cwd()
else:
target_dir = Path(target_dir)

# Target .env file path
env_path = target_dir / ".env"

# Check if .env already exists
if env_path.exists() and not force:
print(f"✓ .env file already exists at {env_path}")
print("💡 Use --force to overwrite existing .env file")
return True

# Check if template exists
if not template_path.exists():
print(f"❌ Template file not found at {template_path}")
return False

try:
# Ensure target directory exists
target_dir.mkdir(parents=True, exist_ok=True)

# Copy template to .env
shutil.copy2(template_path, env_path)
print(f"✓ Created .env file at: {env_path}")
print()
print("📁 File location:")
print(f" {env_path.absolute()}")
print()
print("📝 Next steps:")
print("1. Edit the .env file and add your actual API keys")
print("2. See the comments in the .env file for where to get API keys")
print("3. Start building your vision agent!")
print()
print("🔗 Quick links for API keys:")
print(" • Stream: https://getstream.io/")
print(" • OpenAI: https://platform.openai.com/api-keys")
print(" • Deepgram: https://console.deepgram.com/")
print(" • Cartesia: https://cartesia.ai/")
print(" • FAL (Smart Turn): https://fal.ai/")
return True

except Exception as e:
print(f"❌ Failed to create .env file: {e}")
return False
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Enhance docstring to follow Google style guide.

The function logic is solid with appropriate error handling and helpful user messaging. However, the docstring doesn't follow the Google style guide as required by the coding guidelines.

As per coding guidelines.

Apply this diff to improve the docstring:

-def create_env_file(target_dir=None, force=False):
-    """Create .env file from template if it doesn't exist."""
+def create_env_file(target_dir=None, force=False):
+    """Create .env file from template if it doesn't exist.
+    
+    Args:
+        target_dir: Directory to create .env file in. Defaults to current working directory.
+        force: If True, overwrite existing .env file.
+        
+    Returns:
+        bool: True if .env file was created or already exists, False on failure.
+    """
🤖 Prompt for AI Agents
In agents-core/vision_agents/post_install.py around lines 14 to 68, the function
docstring for create_env_file should be converted to Google style: replace the
current one-line description with a multiline docstring that includes a short
summary, a longer description of behavior, and sections for Args (target_dir:
Optional path to create .env in; force: bool whether to overwrite), Returns
(bool indicating success), and Raises (propagate or document exceptions if any
are expected), keeping it concise and formatted per Google Python docstring
conventions.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (2)
agents-core/vision_agents/__init__.py (1)

11-52: Import-time side effects and related issues already flagged.

The major concerns with this approach—creating files at import time, fragile site-packages detection, and silent exception suppression—were thoroughly documented in previous review comments.

Additionally, the docstring doesn't follow Google style guide, though this is minor compared to the architectural concerns already raised.

As per coding guidelines.

agents-core/vision_agents/post_install.py (1)

13-67: Docstring still needs Google style formatting.

The docstring remains a single line and doesn't follow the Google style guide required by the coding guidelines. This issue was previously identified.

As per coding guidelines.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 0456c67 and 17a315c.

📒 Files selected for processing (2)
  • agents-core/vision_agents/__init__.py (1 hunks)
  • agents-core/vision_agents/post_install.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py

📄 CodeRabbit inference engine (.cursor/rules/python.mdc)

**/*.py: Never adjust sys.path (e.g., sys.path.append/insert/assignment)
Docstrings must follow the Google style guide

Files:

  • agents-core/vision_agents/post_install.py
  • agents-core/vision_agents/__init__.py
🧬 Code graph analysis (1)
agents-core/vision_agents/__init__.py (2)
agents-core/vision_agents/core/agents/agents.py (1)
  • Agent (53-1021)
agents-core/vision_agents/core/edge/types.py (1)
  • User (15-18)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: unit / Test "not integration"
🔇 Additional comments (3)
agents-core/vision_agents/post_install.py (1)

1-11: Imports and module structure look solid.

The imports are appropriate, and no sys.path manipulation is present.

agents-core/vision_agents/__init__.py (2)

1-9: Module header is clean and appropriate.

The version placeholder and imports are correctly structured.


57-61: Public API exports are well-defined.

The exposed components (Agent, User, __version__) provide a clean interface, and the __all__ declaration makes the public API explicit.

Comment on lines +70 to +91
def show_setup_guide():
"""Show comprehensive setup guide."""
print("🚀 Vision Agents Setup Guide")
print("=" * 50)
print()
print("✅ Package already installed!")
print()
print("📝 Next steps:")
print("1. Add your API keys to the .env file")
print("2. Start building your vision agent:")
print()
print(" from vision_agents import Agent")
print(" from vision_agents.plugins import openai, deepgram, cartesia")
print()
print("🔧 Setup commands:")
print(" vision-agents-setup # Create .env file")
print(" vision-agents-setup --force # Overwrite existing .env")
print(" vision-agents-setup --guide # Show this guide")
print()
print("📚 Documentation: https://visionagents.ai/")
print("💬 Examples: https://github.com/GetStream/Vision-Agents/tree/main/examples")

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Enhance docstring to follow Google style guide.

The function's docstring should be expanded to follow Google style.

As per coding guidelines.

Apply this diff:

-def show_setup_guide():
-    """Show comprehensive setup guide."""
+def show_setup_guide():
+    """Show comprehensive setup guide.
+    
+    Prints setup instructions, commands, and documentation links to stdout.
+    """
🤖 Prompt for AI Agents
In agents-core/vision_agents/post_install.py around lines 70 to 91, the
show_setup_guide() function currently has a one-line docstring; update it to a
multi-line Google-style docstring that includes a short summary, a longer
description of what the function prints, an "Args" section indicating there are
no parameters, a "Returns" section stating None, an optional "Raises" section if
relevant (or state that no exceptions are raised), and an "Examples" section
showing how to call the function; keep the docstring concise and follow Google
docstring formatting conventions.

Comment on lines +93 to +140
def main():
"""Main entry point for setup script."""
parser = argparse.ArgumentParser(
description="Vision Agents setup script",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog="""
Examples:
vision-agents-setup # Create .env in current directory
vision-agents-setup --dir /path/to/project # Create .env in specific directory
vision-agents-setup --force # Overwrite existing .env file
vision-agents-setup --guide # Show setup guide
"""
)

parser.add_argument(
"--dir", "-d",
help="Directory to create .env file in (default: current directory)"
)

parser.add_argument(
"--force", "-f",
action="store_true",
help="Overwrite existing .env file"
)

parser.add_argument(
"--guide", "-g",
action="store_true",
help="Show setup guide"
)

args = parser.parse_args()

if args.guide:
show_setup_guide()
return

try:
success = create_env_file(target_dir=args.dir, force=args.force)
if not success:
sys.exit(1)
except Exception as e:
print(f"❌ Setup script failed: {e}")
sys.exit(1)


if __name__ == "__main__":
main()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Enhance docstring to follow Google style guide.

The main function's implementation is solid with proper argument parsing and error handling. However, the docstring needs expansion.

As per coding guidelines.

Apply this diff:

-def main():
-    """Main entry point for setup script."""
+def main():
+    """Main entry point for setup script.
+    
+    Parses CLI arguments and executes the requested action:
+    - Creates .env file in specified or current directory
+    - Shows setup guide if --guide flag is provided
+    - Supports --force to overwrite existing .env files
+    
+    Exits with code 1 on failure, 0 on success.
+    """
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def main():
"""Main entry point for setup script."""
parser = argparse.ArgumentParser(
description="Vision Agents setup script",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog="""
Examples:
vision-agents-setup # Create .env in current directory
vision-agents-setup --dir /path/to/project # Create .env in specific directory
vision-agents-setup --force # Overwrite existing .env file
vision-agents-setup --guide # Show setup guide
"""
)
parser.add_argument(
"--dir", "-d",
help="Directory to create .env file in (default: current directory)"
)
parser.add_argument(
"--force", "-f",
action="store_true",
help="Overwrite existing .env file"
)
parser.add_argument(
"--guide", "-g",
action="store_true",
help="Show setup guide"
)
args = parser.parse_args()
if args.guide:
show_setup_guide()
return
try:
success = create_env_file(target_dir=args.dir, force=args.force)
if not success:
sys.exit(1)
except Exception as e:
print(f"❌ Setup script failed: {e}")
sys.exit(1)
if __name__ == "__main__":
main()
def main():
"""Main entry point for setup script.
Parses CLI arguments and executes the requested action:
- Creates .env file in specified or current directory
- Shows setup guide if --guide flag is provided
- Supports --force to overwrite existing .env files
Exits with code 1 on failure, 0 on success.
"""
parser = argparse.ArgumentParser(
description="Vision Agents setup script",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog="""
Examples:
vision-agents-setup # Create .env in current directory
vision-agents-setup --dir /path/to/project # Create .env in specific directory
vision-agents-setup --force # Overwrite existing .env file
vision-agents-setup --guide # Show setup guide
"""
)
parser.add_argument(
"--dir", "-d",
help="Directory to create .env file in (default: current directory)"
)
parser.add_argument(
"--force", "-f",
action="store_true",
help="Overwrite existing .env file"
)
parser.add_argument(
"--guide", "-g",
action="store_true",
help="Show setup guide"
)
args = parser.parse_args()
if args.guide:
show_setup_guide()
return
try:
success = create_env_file(target_dir=args.dir, force=args.force)
if not success:
sys.exit(1)
except Exception as e:
print(f"❌ Setup script failed: {e}")
sys.exit(1)
if __name__ == "__main__":
main()
🤖 Prompt for AI Agents
In agents-core/vision_agents/post_install.py around lines 93 to 140, the
module-level main() docstring is too brief; replace it with a Google-style
docstring that documents the function purpose and parameters: add a short
summary line, an Args section describing none (or that CLI args are parsed via
argparse), a Returns section (e.g., None), and a Raises section listing
SystemExit on failure or Exception if propagated; ensure formatting follows
Google style (sections labeled Args:, Returns:, Raises:) and keep it concise.

Comment on lines +28 to +29
if not template_path.exists():
return
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a possibility? The files comes in the repo.

__version__ = "0.0.0"

# Auto-create .env file on first import if it doesn't exist
def _setup_env_file():
Copy link

@ulgens ulgens Oct 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this run every time the project starts? "Onboarding script" feels fancy but as a user, I'd prefer a simple copy-paste over a script over a fancy alternative. I'd recommend providing the template and instructing the users to copy that to .env when it's necessary.

Comment on lines +50 to +52
except Exception:
# Silently fail - don't break the import if env setup fails
pass
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any expected failures?

@Nash0x7E2 Nash0x7E2 closed this Nov 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants