mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-09-25 12:20:49 +00:00
fix(tools): fall back to CREWAI_API_URL/CREWAI_BEARER_TOKEN env vars
InvokeCrewAIAutomationTool required crew_api_url and crew_bearer_token as positional __init__ arguments with no environment-variable fallback, even though docs.crewai.com documents CREWAI_API_URL/CREWAI_BEARER_TOKEN as alternatives. It also could not be instantiated with zero arguments, which blocks CrewAI AMP Studio's "Invoke Amp Automation" internal tool: the Studio runtime resolves tools by class reference and instantiates them with no arguments. - crew_api_url/crew_bearer_token become optional, falling back to CREWAI_API_URL/CREWAI_BEARER_TOKEN (explicit args still win), mirroring the env-var pattern already used by GenerateCrewaiAutomationTool. - crew_name/crew_description become optional too, defaulting to the tool's existing generic name/description, so InvokeCrewAIAutomationTool() never raises at construction time. - Declare env_vars: list[EnvVar] so the tool catalog surfaces the two env vars, matching the sibling tool. - Raise a clear ValueError at use time when crew_api_url/crew_bearer_token are still missing, instead of failing inside `requests` or with the previous confusing TypeError about positional arguments. - Update the tool's README and the edge docs page (docs/edge/en/tools/integration/crewaiautomationtool.mdx) so the "Tool Arguments" table matches the corrected code. Fully backward compatible: existing positional/keyword constructor calls are unchanged. tool.specs.json is left untouched; the "Generate Tool Specifications" CI workflow regenerates and commits it automatically once this is pushed. crewAIInc/crewAI-tools (the previous home of this tool) is archived and can no longer receive pushes, so this fix targets the actively maintained copy of the tool under lib/crewai-tools/ instead.
This commit is contained in:
@@ -68,13 +68,17 @@ print(result)
|
||||
|
||||
| Argument | Type | Required | Default | Description |
|
||||
|:---------|:-----|:---------|:--------|:------------|
|
||||
| **crew_api_url** | `str` | Yes | None | Base URL of the CrewAI Platform automation API |
|
||||
| **crew_bearer_token** | `str` | Yes | None | Bearer token for API authentication |
|
||||
| **crew_name** | `str` | Yes | None | Name of the crew automation |
|
||||
| **crew_description** | `str` | Yes | None | Description of what the crew automation does |
|
||||
| **crew_api_url** | `str` | No | `None` | Base URL of the CrewAI Platform automation API. Falls back to the `CREWAI_API_URL` environment variable when omitted. |
|
||||
| **crew_bearer_token** | `str` | No | `None` | Bearer token for API authentication. Falls back to the `CREWAI_BEARER_TOKEN` environment variable when omitted. |
|
||||
| **crew_name** | `str` | No | generic name | Name of the crew automation. Set explicitly outside CrewAI AMP Studio so the LLM sees a meaningful tool name. |
|
||||
| **crew_description** | `str` | No | generic description | Description of what the crew automation does. Set explicitly for the same reason as `crew_name`. |
|
||||
| **max_polling_time** | `int` | No | 600 | Maximum time in seconds to wait for task completion |
|
||||
| **crew_inputs** | `dict` | No | None | Dictionary defining custom input schema fields |
|
||||
|
||||
If `crew_api_url`/`crew_bearer_token` are still missing at run time (neither passed
|
||||
explicitly nor available via the environment variables below), the tool raises a clear
|
||||
error explaining what's missing.
|
||||
|
||||
## Environment Variables
|
||||
|
||||
```bash
|
||||
|
||||
Reference in New Issue
Block a user