File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -120,10 +120,14 @@ agentstack tools add
120120
121121## Running Your Agent
122122
123- ` agentstack run `
123+ ``` bash
124+ uv run agentstack run
125+ ```
124126
125127Runs the agent project in development mode.<br >
126128
129+ > Note: Always use ` uv run ` when executing AgentStack commands to ensure proper environment management.
130+
127131> 👀 Support for easy production deployment of agents is coming soon.
128132
129133## Philosophy
Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ def init_project_builder(
144144 " uv lock\n "
145145 " uv sync\n \n "
146146 " 6. Try running your agent:\n "
147- " agentstack run\n \n "
147+ " uv run agentstack run\n \n "
148148 " Run `agentstack quickstart` or `agentstack docs` for next steps.\n "
149149 )
150150
Original file line number Diff line number Diff line change 11import sys
22import argparse
33import webbrowser
4+ import os
5+ import subprocess
6+ from pathlib import Path
47
58from agentstack import conf , auth
69from agentstack .cli import (
1720from agentstack .update import check_for_updates
1821
1922
23+ def ensure_uv_environment ():
24+ """Ensure the command is running in a UV-managed environment."""
25+ if not os .environ .get ("VIRTUAL_ENV" ):
26+ # If not in a virtual environment, rerun the command with UV
27+ args = ["uv" , "run" ] + sys .argv
28+ try :
29+ result = subprocess .run (args , check = True )
30+ sys .exit (result .returncode )
31+ except subprocess .CalledProcessError as e :
32+ sys .exit (e .returncode )
33+ except FileNotFoundError :
34+ print ("Error: UV is not installed. Please install UV first with: pip install uv" )
35+ sys .exit (1 )
36+
37+
2038def main ():
39+ # Ensure we're running in a UV environment for all commands except 'init'
40+ if len (sys .argv ) > 1 and sys .argv [1 ] != "init" :
41+ ensure_uv_environment ()
42+
2143 global_parser = argparse .ArgumentParser (add_help = False )
2244 global_parser .add_argument (
2345 "--path" ,
You can’t perform that action at this time.
0 commit comments