{"record":{"id":"2ac6bb40d0501a7d","repo":"crewAIInc/crewAI","slug":"boto3-package-not-found-please-run-uv-add-boto-2ac6bb","errorCode":null,"errorMessage":"`boto3` package not found, please run `uv add boto3`","messagePattern":"`boto3` package not found, please run `uv add boto3`","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/crewai-tools/src/crewai_tools/aws/s3/writer_tool.py","lineNumber":27,"sourceCode":"\n    file_path: str = Field(\n        ..., description=\"S3 file path (e.g., 's3://bucket-name/file-name')\"\n    )\n    content: str = Field(..., description=\"Content to write to the file\")\n\n\nclass S3WriterTool(BaseTool):\n    name: str = \"S3 Writer Tool\"\n    description: str = \"Writes content to a file in Amazon S3 given an S3 file path\"\n    args_schema: type[BaseModel] = S3WriterToolInput\n    package_dependencies: list[str] = Field(default_factory=lambda: [\"boto3\"])\n\n    def _run(self, file_path: str, content: str) -> str:\n        try:\n            import boto3\n            from botocore.exceptions import ClientError\n        except ImportError as e:\n            raise ImportError(\n                \"`boto3` package not found, please run `uv add boto3`\"\n            ) from e\n\n        try:\n            bucket_name, object_key = self._parse_s3_path(file_path)\n\n            s3 = boto3.client(\n                \"s3\",\n                region_name=os.getenv(\"CREW_AWS_REGION\", \"us-east-1\"),\n                aws_access_key_id=os.getenv(\"CREW_AWS_ACCESS_KEY_ID\"),\n                aws_secret_access_key=os.getenv(\"CREW_AWS_SEC_ACCESS_KEY\"),\n            )\n\n            s3.put_object(\n                Bucket=bucket_name, Key=object_key, Body=content.encode(\"utf-8\")\n            )\n            return f\"Successfully wrote content to {file_path}\"\n        except ClientError as e:","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/aws/s3/writer_tool.py#L9-L45","documentation":"Identical lazy-import guard to the reader, but in S3WriterTool._run(): when boto3 is not importable at write time, the ImportError is re-raised with the message telling the user to run `uv add boto3`. Note the S3 tools also rely on CREW_AWS_* env vars for credentials, which is a separate concern after this error is resolved.","triggerScenarios":"Calling S3WriterTool._run(file_path, content) in an environment lacking boto3 — e.g. agent writes to S3 only late in a run, so the dependency gap surfaces at write time rather than at startup.","commonSituations":"Agent pipelines where S3 write is an optional branch; production images built without AWS deps; notebook environments where the tool was never exercised before deploy.","solutions":["Install boto3 in the running environment (uv add boto3 / pip install boto3)","Smoke-test tool availability at app startup: try import boto3 and fail fast with a clear message","Pin boto3 in the project's dependency file so deployments include it"],"exampleFix":"# before: S3WriterTool()._run('s3://b/k', 'data') raises ImportError\n# after (startup check):\ntry:\n    import boto3  # noqa: F401\nexcept ImportError:\n    raise SystemExit('boto3 required for S3 tools: run `uv add boto3`')","handlingStrategy":"validation","validationCode":"try:\n    import boto3  # noqa: F401\nexcept ImportError:\n    raise SystemExit('S3WriterTool needs boto3: run `uv add boto3`')","typeGuard":null,"tryCatchPattern":"try:\n    S3WriterTool()._run('s3://bucket/key', 'data')\nexcept ImportError as e:\n    if 'boto3' in str(e):\n        logger.error('missing dependency: uv add boto3')\n    raise","preventionTips":["Declare boto3 explicitly even though the tool only hints at it via package_dependencies","Smoke-test optional tool dependencies at app startup","Keep write-path and read-path dependency checks identical so failures surface early"],"tags":["aws","s3","boto3","dependency","import-error"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}