prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Support Queue timing in Python agent
  Checking the request headers for officially supported frameworks like Django and Flask should be straight forward.
  
  We should also have a generic API interface for recording Queue time in other cases.
  
  </issue>
  <code>
  [start of src/scout_apm/core/cli/core_agent_manager.py]
  1 # coding=utf-8
  2 from __future__ import absolute_import, division, print_function, unicode_literals
  3 
  4 import argparse
  5 import logging
  6 
  7 
  8 def download(**kwargs):
  9     from scout_apm.core import CoreAgentManager
  10 
  11     core_agent_manager = CoreAgentManager()
  12     core_agent_manager.download()
  13 
  14 
  15 def launch(**kwargs):
  16     from scout_apm.core import CoreAgentManager
  17 
  18     core_agent_manager = CoreAgentManager()
  19     core_agent_manager.launch()
  20 
  21 
  22 def main(**kwargs):
  23     parser = argparse.ArgumentParser()
  24     parser.add_argument(
  25         "-v", "--verbose", help="increase output verbosity", action="count"
  26     )
  27 
  28     subparsers = parser.add_subparsers(dest="subparser")
  29     subparsers.add_parser("download")
  30     subparsers.add_parser("launch")
  31 
  32     args = parser.parse_args()
  33 
  34     if args.verbose is not None:
  35         if args.verbose >= 2:
  36             logging.basicConfig(level=getattr(logging, "DEBUG", None))
  37         elif args.verbose == 1:
  38             logging.basicConfig(level=getattr(logging, "INFO", None))
  39 
  40     kwargs = vars(args)
  41     globals()[kwargs.pop("subparser")](**kwargs)
  42
  [end of src/scout_apm/core/cli/core_agent_manager.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/src/scout_apm/core/cli/core_agent_manager.py b/src/scout_apm/core/cli/core_agent_manager.py
  --- a/src/scout_apm/core/cli/core_agent_manager.py
  +++ b/src/scout_apm/core/cli/core_agent_manager.py
  @@ -4,38 +4,31 @@
   import argparse
   import logging
   
  +from scout_apm.core import AgentContext, CoreAgentManager
   
  -def download(**kwargs):
  -    from scout_apm.core import CoreAgentManager
  -
  -    core_agent_manager = CoreAgentManager()
  -    core_agent_manager.download()
  -
  -
  -def launch(**kwargs):
  -    from scout_apm.core import CoreAgentManager
  -
  -    core_agent_manager = CoreAgentManager()
  -    core_agent_manager.launch()
  +logger = logging.getLogger(__name__)
   
   
  -def main(**kwargs):
  +def main(argv=None):
       parser = argparse.ArgumentParser()
       parser.add_argument(
           "-v", "--verbose", help="increase output verbosity", action="count"
       )
   
  -    subparsers = parser.add_subparsers(dest="subparser")
  +    subparsers = parser.add_subparsers(
  +        title="subcommands", description="valid subcommands", dest="subparser"
  +    )
       subparsers.add_parser("download")
       subparsers.add_parser("launch")
   
  -    args = parser.parse_args()
  +    args = parser.parse_args(argv)
   
       if args.verbose is not None:
           if args.verbose >= 2:
  -            logging.basicConfig(level=getattr(logging, "DEBUG", None))
  -        elif args.verbose == 1:
  -            logging.basicConfig(level=getattr(logging, "INFO", None))
  +            logging.basicConfig(level=logging.DEBUG)
  +        else:
  +            logging.basicConfig(level=logging.INFO)
   
  -    kwargs = vars(args)
  -    globals()[kwargs.pop("subparser")](**kwargs)
  +    AgentContext.build()
  +    core_agent_manager = CoreAgentManager()
  +    getattr(core_agent_manager, args.subparser)()
  
verification_info: {"golden_diff": "diff --git a/src/scout_apm/core/cli/core_agent_manager.py b/src/scout_apm/core/cli/core_agent_manager.py\n--- a/src/scout_apm/core/cli/core_agent_manager.py\n+++ b/src/scout_apm/core/cli/core_agent_manager.py\n@@ -4,38 +4,31 @@\n import argparse\n import logging\n \n+from scout_apm.core import AgentContext, CoreAgentManager\n \n-def download(**kwargs):\n-    from scout_apm.core import CoreAgentManager\n-\n-    core_agent_manager = CoreAgentManager()\n-    core_agent_manager.download()\n-\n-\n-def launch(**kwargs):\n-    from scout_apm.core import CoreAgentManager\n-\n-    core_agent_manager = CoreAgentManager()\n-    core_agent_manager.launch()\n+logger = logging.getLogger(__name__)\n \n \n-def main(**kwargs):\n+def main(argv=None):\n     parser = argparse.ArgumentParser()\n     parser.add_argument(\n         \"-v\", \"--verbose\", help=\"increase output verbosity\", action=\"count\"\n     )\n \n-    subparsers = parser.add_subparsers(dest=\"subparser\")\n+    subparsers = parser.add_subparsers(\n+        title=\"subcommands\", description=\"valid subcommands\", dest=\"subparser\"\n+    )\n     subparsers.add_parser(\"download\")\n     subparsers.add_parser(\"launch\")\n \n-    args = parser.parse_args()\n+    args = parser.parse_args(argv)\n \n     if args.verbose is not None:\n         if args.verbose >= 2:\n-            logging.basicConfig(level=getattr(logging, \"DEBUG\", None))\n-        elif args.verbose == 1:\n-            logging.basicConfig(level=getattr(logging, \"INFO\", None))\n+            logging.basicConfig(level=logging.DEBUG)\n+        else:\n+            logging.basicConfig(level=logging.INFO)\n \n-    kwargs = vars(args)\n-    globals()[kwargs.pop(\"subparser\")](**kwargs)\n+    AgentContext.build()\n+    core_agent_manager = CoreAgentManager()\n+    getattr(core_agent_manager, args.subparser)()\n", "issue": "Support Queue timing in Python agent\nChecking the request headers for officially supported frameworks like Django and Flask should be straight forward.\r\n\r\nWe should also have a generic API interface for recording Queue time in other cases.\n", "before_files": [{"content": "# coding=utf-8\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nimport argparse\nimport logging\n\n\ndef download(**kwargs):\n    from scout_apm.core import CoreAgentManager\n\n    core_agent_manager = CoreAgentManager()\n    core_agent_manager.download()\n\n\ndef launch(**kwargs):\n    from scout_apm.core import CoreAgentManager\n\n    core_agent_manager = CoreAgentManager()\n    core_agent_manager.launch()\n\n\ndef main(**kwargs):\n    parser = argparse.ArgumentParser()\n    parser.add_argument(\n        \"-v\", \"--verbose\", help=\"increase output verbosity\", action=\"count\"\n    )\n\n    subparsers = parser.add_subparsers(dest=\"subparser\")\n    subparsers.add_parser(\"download\")\n    subparsers.add_parser(\"launch\")\n\n    args = parser.parse_args()\n\n    if args.verbose is not None:\n        if args.verbose >= 2:\n            logging.basicConfig(level=getattr(logging, \"DEBUG\", None))\n        elif args.verbose == 1:\n            logging.basicConfig(level=getattr(logging, \"INFO\", None))\n\n    kwargs = vars(args)\n    globals()[kwargs.pop(\"subparser\")](**kwargs)\n", "path": "src/scout_apm/core/cli/core_agent_manager.py"}]}