Skip to content

[Bug]: agentstack run fails with ModuleNotFoundError: No module named 'agents' after project initialization on macOS (Python 3.12)Β #350

@amaan-ai20

Description

@amaan-ai20

Contact Details

amaan@ai20labs.com

πŸ“¦ Package Version

0.3.5

🎞️ Framework Version

No response

πŸ”Ž Describe the Bug

After initializing a new AgentStack project on macOS (Apple Silicon) with agentstack init, running agentstack run immediately fails with:

Failed to import AgentStack project at: /path/to/project
No module named 'agents'

It appears that the generated project is missing a required agents module or dependency.


To Reproduce
Steps to reproduce the behavior:

  1. Install AgentStack CLI.
  2. Run agentstack init agentstack_starter.
  3. Select any template (e.g., hello_alex).
  4. cd agentstack_starter
  5. source .venv/bin/activate
  6. Run agentstack run

Expected behavior
The initialized agent project should run out of the box without missing module errors.


Environment (please complete the following information):

  • OS: macOS (Apple Silicon, M1/M2/M3)
  • Python Version: 3.12.10
  • AgentStack Version: Latest (as of April 2025)
  • Installed using: uv and default agentstack instructions

Additional Context
The full traceback points to agentops trying to import from agents import Span, but the agents module is not found in the generated project or installed packages.

There seems to be a missing dependency, incorrect import, or misconfiguration in the generated starter project.


Full Error Log

(agentstack_starter) amaan@Amaans-MacBook-Pro agentstack_starter % agentstack run --debug
Running your agent...
An error occurred: 
Failed to import AgentStack project at: /Users/amaan/Workspace/GitHub-Issues/agentstack_starter
No module named 'agents'
DEBUG: Full traceback:
Traceback (most recent call last):
  File "/Users/amaan/Workspace/GitHub-Issues/agentstack_starter/.venv/lib/python3.12/site-packages/agentstack/cli/run.py", line 125, in run_project
    project_main = _import_project_module(conf.PATH)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/amaan/Workspace/GitHub-Issues/agentstack_starter/.venv/lib/python3.12/site-packages/agentstack/cli/run.py", line 93, in _import_project_module
    spec.loader.exec_module(project_module)
  File "<frozen importlib._bootstrap_external>", line 999, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/Users/amaan/Workspace/GitHub-Issues/agentstack_starter/src/main.py", line 5, in <module>
    import agentops
  File "/Users/amaan/Workspace/GitHub-Issues/agentstack_starter/.venv/lib/python3.12/site-packages/agentops/__init__.py", line 2, in <module>
    from agentops.client import Client
  File "/Users/amaan/Workspace/GitHub-Issues/agentstack_starter/.venv/lib/python3.12/site-packages/agentops/client/__init__.py", line 1, in <module>
    from .client import Client
  File "/Users/amaan/Workspace/GitHub-Issues/agentstack_starter/.venv/lib/python3.12/site-packages/agentops/client/client.py", line 4, in <module>
    from agentops.client.api import ApiClient
  File "/Users/amaan/Workspace/GitHub-Issues/agentstack_starter/.venv/lib/python3.12/site-packages/agentops/client/api/__init__.py", line 9, in <module>
    from agentops.client.api.base import BaseApiClient
  File "/Users/amaan/Workspace/GitHub-Issues/agentstack_starter/.venv/lib/python3.12/site-packages/agentops/client/api/base.py", line 12, in <module>
    from agentops.client.http.http_client import HttpClient
  File "/Users/amaan/Workspace/GitHub-Issues/agentstack_starter/.venv/lib/python3.12/site-packages/agentops/client/http/http_client.py", line 5, in <module>
    from agentops.client.http.http_adapter import BaseHTTPAdapter
  File "/Users/amaan/Workspace/GitHub-Issues/agentstack_starter/.venv/lib/python3.12/site-packages/agentops/client/http/http_adapter.py", line 7, in <module>
    from agentops.exceptions import AgentOpsApiJwtExpiredException, ApiServerException
  File "/Users/amaan/Workspace/GitHub-Issues/agentstack_starter/.venv/lib/python3.12/site-packages/agentops/exceptions.py", line 1, in <module>
    from agentops.logging import logger
  File "/Users/amaan/Workspace/GitHub-Issues/agentstack_starter/.venv/lib/python3.12/site-packages/agentops/logging/__init__.py", line 2, in <module>
    from .instrument_logging import setup_print_logger, upload_logfile
  File "/Users/amaan/Workspace/GitHub-Issues/agentstack_starter/.venv/lib/python3.12/site-packages/agentops/logging/instrument_logging.py", line 7, in <module>
    from agents import Span
ModuleNotFoundError: No module named 'agents'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/amaan/Workspace/GitHub-Issues/agentstack_starter/.venv/lib/python3.12/site-packages/agentstack/main.py", line 268, in main
    _main()
  File "/Users/amaan/Workspace/GitHub-Issues/agentstack_starter/.venv/lib/python3.12/site-packages/agentstack/main.py", line 254, in _main
    raise e
  File "/Users/amaan/Workspace/GitHub-Issues/agentstack_starter/.venv/lib/python3.12/site-packages/agentstack/main.py", line 224, in _main
    run_project(command=args.function, cli_args=extra_args)
  File "/Users/amaan/Workspace/GitHub-Issues/agentstack_starter/.venv/lib/python3.12/site-packages/agentstack/cli/run.py", line 134, in run_project
    raise ValidationError(f"Failed to import AgentStack project at: {conf.PATH.absolute()}\n{e}")
agentstack.exceptions.ValidationError: Failed to import AgentStack project at: /Users/amaan/Workspace/GitHub-Issues/agentstack_starter
No module named 'agents'

🀝 Contribution

  • Yes, I'd be happy to submit a pull request with these changes.
  • I need some guidance on how to contribute.
  • I'd prefer the AgentStack team to handle this update.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions