Commit Graph
788 Commits
Author SHA1 Message Date
reuben rouse add3f7bf1e fix(agents): restore task description when replanning fails (#8308) 2026-10-20 07:37:06 +00:00
Vatsal Yadav 78cc9d9e95 fix(memory): preserve records when update serialization fails (#8303)
Build uv cache / build-cache (3.10) (push) Canceled after 0s
Build uv cache / build-cache (3.11) (push) Canceled after 0s
Build uv cache / build-cache (3.12) (push) Canceled after 0s
Build uv cache / build-cache (3.13) (push) Canceled after 0s
CodeQL Advanced / Analyze (actions) (push) Canceled after 0s
CodeQL Advanced / Analyze (python) (push) Canceled after 0s
Check Documentation Broken Links / Check broken links (push) Canceled after 0s
Vulnerability Scan / Detect changes (push) Canceled after 0s
Vulnerability Scan / pip-audit (push) Canceled after 0s
Serialize replacement rows before deleting saved memories so invalid metadata cannot erase the original record. Add regression coverage for serialization failures and successful replacement.

Fixes #8302

Signed-off-by: vatsalyd <vatsal.y.official@gmail.com>
2026-10-20 06:24:03 +00:00
Lorenze Jay d06c91401f feat(flow): add opt-in per-turn conversation tracing (#8291)
* feat(flow): add opt-in per-turn conversation tracing

* fix(flow): avoid completing turns paused for human feedback
2026-10-20 10:19:59 +05:30
Vidit Ostwal b1c9279918 fix: store deferred tool results in tmp (#8229)
* fix: store deferred tool results in tmp

* chore: remove tool result artifact diagnostic
2026-10-19 17:43:43 +00:00
João MouraandClaude Opus 5.5 0b84f8e18b fix(core): send AMP requests through the proxy the environment names (#8186)
* fix(core): send AMP requests through the proxy the environment names

PlusAPI built its httpx clients with trust_env=False, so HTTP(S)_PROXY,
NO_PROXY and SSL_CERT_FILE were ignored and every AMP call tried a direct
connection. On a corporate network or inside a coding-agent sandbox
(Claude Code, Codex), which only allow traffic through that proxy, deploy,
eval, org, triggers, trace upload, skills and repository agents all failed
with "[Errno 8] nodename nor servname provided", while `crewai login`
(module-level httpx.post) worked.

trust_env=False dates from #1455, when the client used requests, where it
also stopped ~/.netrc credentials from replacing the AMP bearer token.
httpx 0.28 no longer reads .netrc, so the flag now only disables proxy and
CA-bundle variables. Remove it from the three clients (core request and
multipart, and the CLI's multipart override).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(core): keep the direct-request proxy test off the OS proxy settings

With no proxy variables set, httpx falls back to urllib's getproxies(),
which reads the macOS or Windows system proxy settings. On a machine
with a system proxy configured, the "no proxy variables" test would have
routed through it. Model a machine with none configured.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): keep a project's .env from choosing how crewai eval sends the login

crewai eval already refuses to send the saved login to an AMP host that only
the project's .env names. With AMP requests now honoring proxy and CA
variables, the same .env could still pick the route: its own proxy and its own
CA bundle, past that check. eval and eval --models now leave *_proxy,
SSL_CERT_FILE and SSL_CERT_DIR out when they load the project's .env, say so,
and keep the machine's own settings (shell exports, OS proxy).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(core): take AMP's proxy and CA from the machine, not a project's .env

AMP requests carry the saved login. Honoring HTTP(S)_PROXY and SSL_CERT_FILE
from the live environment let a cloned project's .env choose both: `crewai run`
on a JSON crew or a declarative flow loads it with override=True, and
`crewai.llm` loads it again on import, which also undid the filter `crewai eval`
applied to its own loader.

PlusAPI now pins the proxy and CA variables when crewai_core.plus_api is first
imported, which the CLI does at startup, and hands them to httpx explicitly with
trust_env=False. With none set, the OS proxy settings apply, read live. The eval
loader goes back to main's, since the client now covers every command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): pin AMP's proxy and CA in the JSON-crew runner too

`crewai run` runs a JSON crew in a fresh `uv run python -c` interpreter that
never imports cli.py, and `_run_json_crew` loads the project's .env with
override=True before tracing first imports crewai_core.plus_api, so the pin
recorded the project's proxy and CA. The runner now imports plus_api before
anything else. Declarative flows re-run through `uv run crewai run`, which
already pins in cli.py.

Also keeps `_requests_sent_by` off machine and OS proxies, so a developer's
proxy can't mount a real transport ahead of its MockTransport.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(core): keep urllib's CGI proxy rule, and surface a broken plus_api import

The pinned proxy map dropped urllib's REQUEST_METHOD rule: in a CGI process
an uppercase HTTP_PROXY can come from a client's Proxy header, and AMP's
login and deployment ZIPs would follow it. REQUEST_METHOD is now pinned with
the other transport variables, and the map is read exactly as urllib reads it.

The JSON-crew runner skipped any ImportError from crewai_core.plus_api. It now
skips only a crewai-core too old to have the module; any other failure stops
the run with its own error instead of running with nothing pinned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): import the proxy pin with the project folder off sys.path

`python -c` puts the working directory, the project, first on sys.path, so a
project folder named crewai_core could supply the module that pins where the
saved login travels. The JSON-crew runner now imports the pin with the project
off the path and restores the path right after, so project code (custom tools
importing their neighbours) still finds its own modules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(core): pin AMP's proxy and CA first thing in `import crewai`

A crew run in its own process (`uv run run_crew`) never imports the CLI, so
`import crewai` is where the pin happens there. It already preceded the
project's .env, loaded by crewai.llm on import, but only by import order. The
pin is now the first import in crewai/__init__.py, and a test runs a fresh
interpreter in a project whose .env names a proxy and CA: the .env loads, and
the pin still holds only what the machine set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): keep the machine's proxy and CA for the crew `crewai eval` runs

`crewai eval` loads the project's .env into its own process and then runs
the crew in a child that inherits that environment. The child pins what it
inherits, so a .env naming HTTPS_PROXY and SSL_CERT_FILE became the run's
machine transport, and that run's traces carry the saved login.

The proxy and CA variables go back to the machine's pin right after the
.env loads; the rest of the .env still applies, and the run loads the .env
itself after its own pin, as under `crewai run`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(core): keep a project's UV_ENV_FILE out of the crew `crewai eval` runs

`crewai eval` loads the project's .env and starts the crew with `uv run`.
A .env naming itself as UV_ENV_FILE had uv load it into the run before
Python started, so the run pinned the project's proxy and CA anyway.
UV_ENV_FILE now counts among the variables restored to the machine's.

The pin test starts the run through `uv run`, as the CLI does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 12:28:26 -03:00
João MouraandClaude Opus 5.5 3da49f872b feat(cli): crewai eval runs the crew itself, so a coding agent gets a verdict from one command (#8270)
Vulnerability Scan / Detect changes (push) Canceled after 0s
Vulnerability Scan / pip-audit (push) Canceled after 0s
CodeQL Advanced / Analyze (actions) (push) Canceled after 0s
CodeQL Advanced / Analyze (python) (push) Canceled after 0s
Check Documentation Broken Links / Check broken links (push) Canceled after 0s
* feat(cli): crewai eval runs the crew itself, so a coding agent gets a verdict from one command

Most `crewai eval` attempts stopped before an evaluation began because the
project had no traced run. Telemetry since Sept 25: 117 projects stopped as
"untraced", 97 of them with no terminal (coding agents), and 67 of those never
got further. With no terminal the command could only print steps, and without
a login those steps could not work: an unattended anonymous run never uploads
its trace.

- With no traced run, or when the project's files changed since the last one,
  `crewai eval` runs the crew and evaluates that run. No question, with or
  without a terminal: running the command is the request to have the run
  graded, and the grade is read off its trace. Tracing is on for that run only;
  nothing is written to the project's `.env`.
- crewAI's tracing approves the upload of that run through the existing
  handshake: a token in CREWAI_EVAL_AWAITING_RUN that counts only while its file
  exists in the user's crewAI data folder, so a `.env` cannot claim it. Shared
  as `crewai_core.eval_handshake`; the run app keeps its own copy because it
  also runs against a project's older crewai-core, and a test pins the two.
- The run app's Evaluate on an untraced run closes the app and runs the crew
  again, traced, through `crewai eval`'s own path, instead of a notice.
- Counts: `eval_ran_crew:{no_traced_run,project_changed,run_again}`,
  `eval_finished:{passed,failed,inconclusive,unknown}`, and
  `eval_stopped:untraced_after_run` replacing the catch-all `untraced`
  (`declined` is gone with the question). The CLI tests no longer send usage
  counts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): a project that turned tracing off is asked before crewai eval runs it

`CREWAI_TRACING_ENABLED=false` is the project's no, and nothing overrules it,
not even a run `crewai eval` started.

- `crewai eval` at a terminal asks to turn tracing on before running the crew.
  A yes writes it to the project's `.env`; a no runs nothing (exit 0,
  `eval_stopped:declined`). With no terminal it stops and says how to turn it
  on (`eval_stopped:tracing_off`), which a coding agent can do itself.
- The run app's Evaluate on an untraced run asks the same question in a modal
  (TurnTracingOnScreen) before running the crew again. Otherwise it still runs
  it again with no question.
- crewAI's tracing respects an explicit off again: `should_enable_tracing`
  checks it before a run `crewai eval` started, and `execution._tracing_disabled`
  is back to what main has.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(tracing): the telemetry opt-out no longer turns tracing off; an evaluated run says where its trace goes

- `OTEL_SDK_DISABLED` is the telemetry opt-out, a separate setting from
  tracing, which has its own (`CREWAI_TRACING_ENABLED`, `tracing=`).
  `execution._tracing_disabled` no longer reads it. The trace session's own
  TracerProvider records even when the OpenTelemetry SDK is switched off
  (`session._trace_provider`), because the SDK otherwise hands out tracers that
  record nothing. A provider a host passes in is left as it is. Tests that used
  `OTEL_SDK_DISABLED` as a way to stop a trace now cover the two real switches;
  new tests show a traced run, anonymous or logged in, recorded and uploaded
  with it set.
- A run app opened to run the crew for an evaluation (`crewai eval`, or
  Evaluate on a run that was not traced) shows one plain note on mount: "This
  run will be evaluated: its trace is sent to CrewAI AMP, which grades it."

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): say where the trace goes only when the yes is inferred from crewai eval

The note, in the run app ("This run will be evaluated: its trace is sent to
CrewAI AMP, which grades it.") and in `crewai eval`'s line, is for the case
where nobody turned tracing on: not `tracing=True` on the crew or flow, not
`CREWAI_TRACING_ENABLED=true`, not a consent a person gave once
(`crewai_core.user_data.is_tracing_enabled`), and not the yes they just gave to
turn it on. A project or a person who opted in is told nothing new.

The run `crewai eval` starts no longer sets `CREWAI_TRACING_ENABLED=true`:
the handshake alone turns tracing on for it, so the setting a run reads is the
project's own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): turn tracing on once with a note, pin the eval handshake, and keep the saved login to trusted AMPs

From the review on #8270, and João's call on the note:

- The first `crewai eval` that infers the yes turns tracing on for the
  project (`CREWAI_TRACING_ENABLED=true` in `.env` and for the run) and says
  so once, in the command and in the run app: "Tracing is now on for this
  project…". Afterwards the project traces and nothing more is said. A run
  whose crew or flow sets `tracing=False` is never told its trace is sent.
- The handshake's folder is found from the account's home in the account
  database, never `HOME` or `XDG_DATA_HOME`, so a project's `.env` cannot plant
  a token file that approves an upload. Both copies (crewai-core, the run app)
  are pinned to the same folder and file by a test.
- The token file carries the AMP origins `crewai eval` trusted before the
  project's `.env` was loaded. A run it started sends the saved login only
  there over HTTPS or loopback; an AMP the `.env` chose gets an anonymous
  grant.
- Evaluate on an untraced run carries that run's definition, inputs (prompted
  ones included) and trained-agents file into the re-run. The conversational
  flow consumes the request too, and a crew or flow that sets `tracing=False`
  says why it cannot be evaluated instead of paying for another run.
- "The project changed" also sees deleted files: each evaluation keeps the
  list of the project's files (`.crewai/eval_project_state.json`) and the next
  one compares against it. That list is taken after this command's own
  project-id write, so the write is no change.
- The OpenTelemetry override probes its provider and warns if an SDK version
  still records nothing, instead of failing silently.
- The stale `sdk` case of `test_disabled_execution_does_not_collect_or_request_grants`
  is gone; the handshake tests are typed (type-checker CI).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): keep the saved login off a project's AMP on every path crewai eval runs

From the second review round on #8270:

- Evaluate's re-run runs in a process that already loaded the project's
  `.env`, so it passes this machine's AMPs (`_machine_amp_origins`) as the
  trusted set instead of reading `CREWAI_PLUS_URL` there (`eval_crew(
  trusted_amp_origins=…)`).
- A project's `.env` can neither set nor replace `crewai eval`'s token:
  `run_crew.load_project_env` keeps the token the process was started with and
  drops one a `.env` sets. The JSON-crew, declarative-flow and eval paths all
  load `.env` through it.
- `crewai eval` turns tracing on only when every credential this machine holds
  (the saved login, or a PAT or integration token from before the `.env`) may
  go to the AMP the run would trace to. A project's crewai older than the
  handshake would otherwise send it to an AMP the `.env` names. A newer crewai
  still traces the run anonymously through the handshake.
- A conversational flow named by its definition is re-run by that definition.
- Code quality: no redundant assignment in `_awaiting_dir`, no unused names in
  the credential test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): crewai eval does not run a crew whose trace would carry the login to an untrusted AMP

When tracing is on for the run (the project's .env, or a consent given once)
and a credential of this machine would go to an AMP the command does not
trust, the crew is not run. A project's crewai older than the handshake would
send the login there, and the CLI cannot tell which crewai the project runs.
The command stops (`eval_stopped:untrusted_amp`) and says how to go on: log
in to that AMP, or remove CREWAI_PLUS_URL from the project's .env. A project
that turned tracing off is not asked to turn it on toward such an AMP. With
no credential on the machine, there is nothing to protect and the run goes on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Ask at a terminal before tracing is first turned on

A person running `crewai eval` at a terminal, in a project that never
turned tracing on, is now asked on crewAI's trace consent screen before
the crew runs; a yes turns tracing on for the project, a no (or the
screen timing out) runs nothing and is counted as `declined`. The run
app's Evaluate on an untraced run asks on its own consent screen the same
way. With nobody at a terminal (a coding agent, a script) the yes is
still inferred from the command, tracing is turned on and said once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Keep main's Iterator import, which the rebase over #8187 dropped

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* A run-app test no longer leaves .crewai/last_eval.json in the repo

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Two run-app tests from #7963 no longer leave .crewai/last_eval.json in the repo

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Never run the crew toward an AMP the login must not reach; check before asking

`crewai eval` now refuses to run the crew whenever a credential of this
machine would go with the trace to an AMP it does not trust, whatever the
tracing setting: `tracing=True` in code is invisible to the CLI, and a
project's crewai older than the handshake sends the credential wherever
the run traces. The run app's Evaluate makes the same check before it
asks anything, so a yes can never write CREWAI_TRACING_ENABLED=true to
`.env` for a re-run that is then refused.

Which credentials are this machine's is read from the environment as it
was before any project `.env` was loaded (`run_crew.environment_before_project`),
so on Evaluate's re-run a CREWAI_USER_PAT the project's own `.env` brought
is the project's, as on any run of it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Run the crew only toward an AMP this machine trusts, login or not

Whether this machine holds a login right now no longer decides: with no
login yet, `crewai eval` still wrote CREWAI_TRACING_ENABLED=true toward a
CREWAI_PLUS_URL the project's `.env` chose, and the first run after
`crewai login` would have carried the login there. Toward an AMP this
command does not trust, the crew is now never run, nobody is asked and
nothing is written, in `crewai eval` and the run app's Evaluate alike.
That also drops the credential bookkeeping from b26ccaf44, which the
rule no longer needs.

The telemetry docs no longer say OTEL_SDK_DISABLED turns off everything:
it disables OpenTelemetry instrumentation and CrewAI's telemetry, not AMP
tracing, which has its own switches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Pin that a project's own token never blocks Evaluate's re-run

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 04:11:15 -03:00
40bb2d3b58 fix(memory): escape scope and id values in LanceDB filters (#7820)
Vulnerability Scan / Detect changes (push) Has been cancelled
Vulnerability Scan / pip-audit (push) Has been cancelled
Nightly Canary Release / Check for new commits (push) Has been cancelled
Nightly Canary Release / Build nightly packages (push) Has been cancelled
Nightly Canary Release / Publish nightly to PyPI (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
* fix(memory): escape scope and id values in LanceDB filters

LanceDBStorage built its where() filters by interpolating scope prefixes
and record ids into SQL strings. Route every interpolated value through a
quote-escaping helper, and match scope prefixes with LIKE ... ESCAPE '\'
so %, _ and \ in scope names match literally while the trailing prefix
wildcard is kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(memory): keep delete calls out of assert expressions

Run each storage.delete() on its own line and assert on the returned
count, so the deletion does not live inside an assert statement.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Craig Estep <craig.estep@crewai.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 21:04:46 +05:30
iris-clawdandVidit cf9f08a4a1 fix: resolve pip-audit dependency findings (#8221)
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Vulnerability Scan / Detect changes (push) Has been cancelled
Vulnerability Scan / pip-audit (push) Has been cancelled
Build uv cache / build-cache (3.10) (push) Has been cancelled
Build uv cache / build-cache (3.11) (push) Has been cancelled
Build uv cache / build-cache (3.13) (push) Has been cancelled
Build uv cache / build-cache (3.12) (push) Has been cancelled
Raise the MCP Python SDK and TinyTag version floors to releases patched
for the two vulnerabilities reported by the pip-audit workflow.

- mcp: ~=1.28.1 / >=1.28.1 → >=1.30.0,<2
- tinytag: ~=2.2.1 → >=2.3.0,<3
- Regenerated uv.lock

Co-authored-by: Vidit <vidit@crewai.com>
2026-10-16 09:14:52 +00:00
Matt Aitchison 6115839576 fix(mcp): name tools from IP-addressed MCP servers so providers accept them (#8117)
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Vulnerability Scan / pip-audit (push) Has been cancelled
Nightly Canary Release / Check for new commits (push) Has been cancelled
Nightly Canary Release / Build nightly packages (push) Has been cancelled
Nightly Canary Release / Publish nightly to PyPI (push) Has been cancelled
Check Documentation Broken Links / Check broken links (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
Vulnerability Scan / Detect changes (push) Has been cancelled
* fix(mcp): name tools from IP-addressed MCP servers so providers accept them

Tools from an MCP server addressed by IP (http://127.0.0.1:8800/mcp) were named 127_0_0_1_8800_mcp_<tool>. validate_function_name requires a leading letter, so every provider rejected them. _extract_server_name now prepends mcp_ when the derived name starts with anything other than an ASCII letter; hostname-based names keep their current form.

The server name also copied the user:pass@ part of the URL into every tool name, which sends credentials to the model. It is now stripped.

* fix(mcp): prefix stdio server names that start with a digit

Stdio servers built their tool prefix from the command and args without the leading-letter check, so a command like 3d-server produced 3d_server_<tool>, which providers reject. Both stdio and URL server names now go through _ensure_letter_prefix.

The check now looks at the sanitized name. A non-ASCII host such as ñandu.example sanitizes to a leading n and keeps its name, and a path like /usr/bin/python never gets a prefix.
2026-10-15 17:55:00 -05:00
Vidit Ostwal c661df9816 feat(agents): promote AgentExecutor out of experimental (#8192)
* feat(agents): promote AgentExecutor out of experimental

The default executor was still imported from crewai.experimental. Move it to a stable module and keep the old import as a deprecation warning.

* fix(agents): stabilize executor discriminator

* feat(agents): remove CrewAgentExecutor

AgentExecutor is the only executor. Selecting the deleted class fails immediately, with no compatibility path.

* feat(agents): drop experimental AgentExecutor compatibility

The experimental import path and the legacy experimental discriminator are no longer accepted.

* docs: address executor review comments

Translate the remaining hook comments, document the full executor type, and stop the removal test from hiding an eager export.

* docs: keep translated hook sketches on AgentExecutor

The locale class sketches only needed the CrewAgentExecutor rename. LiteAgent and None stay on the English page, which documents the full type.
2026-10-15 14:33:38 -07:00
Vidit Ostwal 912f491b67 feat: proactively summarize oversized LLM context (#8191)
Build uv cache / build-cache (3.10) (push) Has been cancelled
Build uv cache / build-cache (3.11) (push) Has been cancelled
Build uv cache / build-cache (3.12) (push) Has been cancelled
Build uv cache / build-cache (3.13) (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Vulnerability Scan / Detect changes (push) Has been cancelled
Vulnerability Scan / pip-audit (push) Has been cancelled
* feat(llm): summarize before context limit

* test(llm): cover proactive context compaction

* test(agent): cover proactive compaction routes

* test(agent): cover async proactive compaction

* test(lite-agent): cover proactive compaction

* test(agent): cover executor context preflight

* feat(agent): show context summarization status

* fix(llm): harden proactive context preflight

* test(llm): configure proactive preflight mocks

* test(agent): remove flaky async preflight coverage

* feat(events): emit context summarization lifecycle

* fix(agent): preserve sole pending request

* fix(agent): fail open proactive compaction

* fix(agent): offload proactive compaction

* test(agent): align proactive compaction fixture

* test(agent): add history to compaction fixtures

* fix(events): close failed summarization lifecycle
2026-10-15 23:59:13 +05:30
Gabe Milani c069653b83 fix: stop an agent that repeats the same tool call (#8164)
* fix: stop an agent that repeats the same tool call

* count tool calls within method only
2026-10-15 15:14:20 -03:00
Vidit Ostwal e9f682222a feat: defer oversized native tool results (#8110)
* feat: add temporary tool result artifacts

* feat: detect oversized tool results

* feat: allow deferred tool results in file reader

* feat: preview deferred tool results

* test: cover deferred native tool results

* test: cover multiple deferred tool results

* test: cover existing file reader with deferred results

* feat: clean up deferred tool result artifacts

* test: cover deferred tool result fallbacks

* feat(agent): describe deferred tool result size

* feat(agent): display deferred tool artifacts

* style(agent): label deferred results with emoji

* feat(agent): recommend deferred result chunks

* feat(agent): expose deferred artifact directory

* feat(agent): add better compaction flag

* feat(agent): add deferred result reader

* fix(agent): reference native deferred reader name

* fix(agent): render deferred results as plain text

* fix(agent): size deferred result reads by context

* fix(agent): reuse overflow token count for deferred reads

Keep the provider token count from the overflow check and store that same count so read-size recommendations do not recalculate it.

* fix(agent): keep deferred reader available after text tool downgrade

* fix: avoid re-deferring deferred tool results

* revert(tools): remove deferred file reader support
2026-10-15 23:34:07 +05:30
Vidit Ostwal c7c0d8969a Rename the platform token and preselect default app actions (#7990)
* Rename the platform integration token to the Enterprise Action Auth Token.

The CLI now asks for that token under Settings → Account and stores it as CREWAI_ENTERPRISE_ACTION_AUTH_TOKEN.

* Add the latest Clipper platform applications to the catalog.

SharePoint Graph, Resend, Vercel, and Pinecone come from clipper v5 and are grouped in the platform picker.

* Preselect three default actions for every platform application.

The create wizard checks those actions in the picker, and a test keeps the defaults list the same length as the catalog.

* Fail the Clipper client test when the Enterprise Action Auth Token is absent.

A deployment instance id is not a substitute for that token, so the test no longer sets one.

* fix(agent): name the Enterprise Action Auth Token when apps resolve to no tools
2026-10-15 01:17:41 +05:30
Vidit Ostwal aaaa312cba feat(llm): add provider input token count support (#8109)
* feat(llm): add token estimation interface

* feat(openai): add input token count support

* test(openai): cover input token counting

* feat(anthropic): add input token count support

* feat(llm): extend input token count providers

* feat(litellm): add input token estimation

* fix(llm): address token count provider gaps

* fix(llm): count LiteLLM structured output tokens

* fix(anthropic): align token count payload

* fix(snowflake): reject unsupported token counts

* fix(openai): reject compatible token counts

* refactor(llm): simplify token count interface

* fix(llm): fall back to character token estimates

* fix(llm): warn on token count fallback

* fix(anthropic): fall back when token counting fails
2026-10-14 23:22:45 +05:30
João MouraandClaude Opus 5.5 acd4b33a17 test(llms): Claude 3.5 Sonnet v2 on Bedrock has a 200k window in the refreshed catalog (#8151)
The 1.15.28 release refreshed the packaged LiteLLM catalog, which now lists
anthropic.claude-3-5-sonnet-20241022-v2:0 at 200,000 input tokens (it had
1,000,000), the model's documented window. The test still expected 1M, so
every PR's test job failed on main's own catalog.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 09:39:57 -03:00
João Moura eb15c66cef [docs-freeze] docs: snapshot and changelog for v1.15.28 (#8147)
Mark stale issues and pull requests / stale (push) Has been cancelled
Check Documentation Broken Links / Check broken links (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
Vulnerability Scan / Detect changes (push) Has been cancelled
Vulnerability Scan / pip-audit (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
2026-10-14 01:46:47 -03:00
João Moura 7056fe1fe2 feat: bump versions to 1.15.28 (#8146) 2026-10-14 01:42:13 -03:00
João MouraandClaude Opus 5.5 75808b0eca fix(flow): learn from resumed human feedback and keep the reviewed output's type (#8142)
Nightly Canary Release / Check for new commits (push) Has been cancelled
Nightly Canary Release / Build nightly packages (push) Has been cancelled
Nightly Canary Release / Publish nightly to PyPI (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Check Documentation Broken Links / Check broken links (push) Has been cancelled
Vulnerability Scan / Detect changes (push) Has been cancelled
Vulnerability Scan / pip-audit (push) Has been cancelled
* fix(flow): learn from human feedback that resumes a paused flow

With learn=True, lessons were distilled only when the reply arrived
during the same run. A reply that resumes a paused flow (resume /
resume_async after from_pending, which is how async providers such as
AMP's email review work) went through outcome collapse and routing but
never reached _distill_and_store_lessons, so it taught nothing.

Resume now stores lessons under the same conditions as an in-run reply:
memory available, non-empty feedback, the method's learn_source and
learn_strict, and the persisted LLM config. Both paths share one helper.
A strict distillation failure fails the resume before the pending review
is cleared, so it can be retried.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(flow): undo the recorded reply when strict learning fails on resume

_finalize_human_feedback appends the reply to human_feedback_history and
sets last_human_feedback before lessons are stored. With learn_strict, a
distillation failure re-raises and the review stays pending, so a retry
on the same instance recorded the reply twice. Restore both on failure.
Lesson storage stays after outcome collapse, so a collapse failure never
leaves lessons behind to be stored again on retry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(flow): keep the reviewed output's type when learn=True pre-reviews it

Pre-review always returned PreReviewResult.improved_output, a str, so a
method returning a Pydantic model or a dict reached the reviewer, and
last_human_feedback.output, as a repr string. Text output is still
rewritten as text; a Pydantic model is now rewritten as the same model
(response_model=type(output)); other outputs are shown unchanged.

LiteLLM-routed models return structured output as a JSON string, which
PreReviewResult/DistilledLessons.model_validate rejected, so pre-review
and lesson storage silently did nothing for them. One parser now accepts
an instance, a JSON string, or a dict.

Docs (en, ar, ko, pt-BR): drop the nonexistent learn_limit, document
learn_source and learn_strict, say lessons are also learned from replies
that resume a paused flow, how each output type is pre-reviewed, and that
downstream steps should read last_human_feedback.output. Correct the
HumanFeedbackResult.output docstring and the learn/learn_strict field
descriptions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(flow): keep pre-review failures and unseen fields from leaking into the output

model_dump_json() ran before the pre-review try, so a Pydantic output that
cannot be serialized failed the feedback step even with learn_strict off.
It now runs inside the try and falls back to the original output.

A reviewed Pydantic model is rebuilt from what the LLM saw, so a SecretStr
(sent masked) or an excluded field (not sent) came back as the mask or the
default. Fields the review left unchanged now keep their original values.

Also pin that a retry after a persistence failure that follows lesson
storage offers the lessons to memory again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(flow): keep nested hidden values when pre-review edits sibling fields

The unchanged-field restore only looked at top-level fields, so editing a
sibling inside a nested model, or one item of a list of models, kept the
LLM's masked secret and default excluded values for that whole object.
The restore now recurses into nested models and same-length lists of
models.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(flow): skip pre-review for models holding secrets or excluded fields

Restoring hidden values after the review kept growing edge cases: aliased
fields compared by name discarded the review's edit, dicts of models were
not recursed, and reordered lists paired the wrong items, which could
copy one account's secret onto another. Drop the merge. A Pydantic output
is pre-reviewed only when the LLM sees all of it; one holding a Secret,
SecretStr, SecretBytes or Field(exclude=True) value at any depth reaches
the reviewer unchanged. Docs updated in en, ar, ko and pt-BR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(flow): say a resumed review's Pydantic output arrives as a dict

PendingFeedbackContext persists method_output as JSON, so after
from_pending and resume, last_human_feedback.output is a dict even when
the method returned a model. The docstring and docs said "same type"
without that qualification. Also say learn_strict covers distillation
and submitting lessons, not the background memory write. Pin the dict
behavior with a pause/resume test. Docs in en, ar, ko and pt-BR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 03:05:26 +00:00
João MouraandClaude Opus 5.5 ba36746169 fix(agent): warn when non-empty apps resolve to zero platform tools (#6469)
* fix(agent): warn when non-empty apps resolve to zero platform tools

When an agent declares `apps` (enterprise integrations) but they resolve to no
tools — unknown/misspelled app, app not connected, no actions, or a missing
CREWAI_PLATFORM_INTEGRATION_TOKEN — the agent silently runs without them and
can't do what those apps were for. CrewaiPlatformTools returns an empty list in
all those cases, and both resolution sites dropped it silently (agent kickoff
`if platform_tools:` and crew `_inject_platform_tools` merge), while the only
existing signal is a verbose-gated Logger.log.

Emit a loud UserWarning from Agent.get_platform_tools() — the shared choke point
for the agent-kickoff path (core.py:_prepare_kickoff), the crew task path
(crew.py:_inject_platform_tools), and declarative flows (agent actions route
through the same kickoff). The warning names the unresolved apps and the likely
causes.

Tests: warns on zero-tool resolution (direct + crew-prepare paths), stays quiet
when tools resolve.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RBYGqJHC2TMC6fonFziuuh

* test(agent): cover empty platform-tool resolution through the real factory

Address review on the empty-apps warning: document get_platform_tools,
trim the inline comment, and use one import style for crewai_tools in the
tests. Two new tests run the real CrewaiPlatformTools factory (it returns
a plain list) with only requests.get mocked: a selector that matches no
action, and a missing integration token. Both reach the warning, and
messages are now asserted in full.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-10-13 17:18:20 -07:00
João MouraandClaude Opus 5.5 7b07ee5b6a fix(utilities): stop json-schema models warning about BaseModel-shadowing fields (#8085)
* fix(utilities): stop json-schema models warning about BaseModel-shadowing fields

Tool schemas legitimately name arguments schema, json or copy. Pydantic warns
that these shadow BaseModel attributes every time create_model_from_schema
builds such a model, which clutters CLI and agent output when platform or MCP
tools load. The fields already validate and dump under their own names, so
silence only that warning, and only while building a model that has a
colliding name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(utilities): serialize the shadow-warning filter swap across threads

Two threads building colliding models could overlap their catch_warnings
blocks; the later exit then restored a filter list that still held the
earlier build's ignore rule, leaking it to every later model. A lock now
serializes the swap. Also replace a class defined only for its warning
with create_model in the test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(utilities): pin that rebuilt recursive models emit no shadow warning

A recursive $defs schema builds one model incomplete and finishes it with
model_rebuild outside the suppression context. Pydantic only warns while
collecting fields at class creation, so the rebuild stays silent; this
test keeps that true.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 17:29:09 +00:00
Lorenze Jay bea8c03649 fix: preserve native tool aborts and post-hook cache identity (#8107)
* fix: preserve native tool aborts and post-hook cache identity

* fix: limit native hook changes to active executors
2026-10-12 19:32:15 -03:00
Vidit Ostwal 60a55f565f Use the LiteLLM catalog for context windows (#8077)
* Use the LiteLLM catalog for context windows.

Handwritten provider limits drift from published model IDs, so look up each exact catalog entry instead.

* Restore context windows for routed model ID variants.

Exact catalog keys miss Bedrock revision suffixes, dated Claude inference IDs, and three Gemini Gemma models that CrewAI still routes.

* Revert "Restore context windows for routed model ID variants."

This reverts commit 6915db1358.

* Match context windows by bare catalog model name.

Exact IDs still win, and a miss falls back to the full catalog after provider, region, date, and version are removed.

* Move the LiteLLM catalog into litellm_catalog.

* Skip bare aliases when the same model id has conflicting context limits.

* Use the most common bare-name context limit, and the smaller one on a tie.

* Do not let an unknown provider prefix inherit the bare model context window.
2026-10-12 21:07:29 +05:30
SIDDARTHA REDDY 753d192366 Make evaluator regression test collectible; repair rotted tests (#8031)
Mark stale issues and pull requests / stale (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Vulnerability Scan / Detect changes (push) Has been cancelled
Vulnerability Scan / pip-audit (push) Has been cancelled
Signed-off-by: SIDDARTHA REDDY <75976672+SIDDARTHAREDDY8@users.noreply.github.com>
2026-10-12 04:30:15 +00:00
Nagizaaz Shaik be64826f09 fix: emit call completed event for streamed anthropic tool calls (#8061) 2026-10-12 04:15:43 +00:00
Lucas KimandClaude 6dd895fd72 fix(bedrock): allow image input_files for OpenAI GPT-6 Sol/Luna/Astra (#7733)
* fix(bedrock): allow image input_files for OpenAI GPT-6 Sol/Luna

supports_multimodal() only listed Claude and Nova ids, so the documented
files/input_files path raised "does not support multimodal input" for
GPT-6 Sol and Luna before any request was sent, although Bedrock accepts
image blocks for them. Add their bare, us. and global. ids to the
vision allow-list, following the existing us. entries. Bedrock
rejects image blocks for gpt-oss, so it stays excluded.

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(bedrock): accept image input_files for GPT-6 Astra too

GPT-6 Astra takes image input on Bedrock like Sol and Luna, but the
allow-list named only Sol and Luna, so files/input_files still raised
"does not support multimodal input" for Astra. Match the GPT-6 family
prefix instead, the way the Claude and Nova entries match their
families. gpt-oss has no image input and is still excluded.

The parametrized test now also covers the bare openai.gpt-6-* ids.

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-12 03:36:02 +00:00
Lorenze Jay d522c31339 feat: bump versions to 1.15.27 (#8001) 2026-10-09 19:25:10 -03:00
Melanie Hart Buehler 140bfcb89a docs(rag): add XPU to OpenCLIP provider device options (#7923)
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Check Documentation Broken Links / Check broken links (push) Has been cancelled
Vulnerability Scan / Detect changes (push) Has been cancelled
Vulnerability Scan / pip-audit (push) Has been cancelled
2026-10-09 14:05:39 +00:00
Lucas KimandClaude 107fab8c85 fix(bedrock): don't send stopSequences to OpenAI GPT-6/GPT-5.6/gpt-oss (#7731)
OpenAI models on Bedrock reject inferenceConfig.stopSequences with a 400,
and crewAI adds the "\nObservation:" stop word to every agent call, so
Agent.kickoff() and Crew.kickoff() failed on GPT-6 Sol/Luna, GPT-5.6 and
gpt-oss.

supports_stop_words() now returns False for "openai." model ids and
_get_inference_config() only sends stopSequences when it returns True,
mirroring the Azure provider. Stop words are still applied client-side
by _apply_stop_words, and executors fall back to use_stop_words=False.

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-09 13:16:55 +00:00
Georgi AtsevandJoão Moura d38ceafb68 feat(llms): add deepinfra as an openai-compatible provider (#7459)
Mark stale issues and pull requests / stale (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
Check Documentation Broken Links / Check broken links (push) Has been cancelled
Vulnerability Scan / Detect changes (push) Has been cancelled
Vulnerability Scan / pip-audit (push) Has been cancelled
* feat(llms): add deepinfra as an openai-compatible provider

Register deepinfra in the OpenAI-compatible provider registry so
LLM(model="deepinfra/<org>/<model>") routes natively with DEEPINFRA_API_KEY
and no LiteLLM install. Model ids keep their org/model form,
DEEPINFRA_BASE_URL overrides the endpoint, and the docs accordion is added
in en, ar, ko and pt-BR, stating that the provider uses the native OpenAI
client and needs no LiteLLM install.

The model id check requires exactly one slash with both parts non-empty, and
it also runs on the explicit provider="deepinfra" path, where a malformed id
raises a ValueError that shows the expected form.

deepinfra/ model strings previously routed through LiteLLM; is_litellm=True
keeps that path.

* fix(llms): reject malformed deepinfra/ ids before the LiteLLM fallback

A deepinfra/<model> reference that is not org/model fell through to
LiteLLM, so the same bad id failed later and differently depending on
what was installed. The prefixed form now raises the same ValueError as
provider="deepinfra", with the example and the echoed value written the
way the caller wrote the id; both branches share one helper.

---------

Co-authored-by: João Moura <joaomdmoura@gmail.com>
2026-10-09 05:12:19 -03:00
Stoyan Dimitrov 274fba60f9 COR-891 Fix SQLite flow initialization contention (#7821)
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Check Documentation Broken Links / Check broken links (push) Has been cancelled
Vulnerability Scan / Detect changes (push) Has been cancelled
Vulnerability Scan / pip-audit (push) Has been cancelled
Build uv cache / build-cache (3.10) (push) Has been cancelled
Build uv cache / build-cache (3.11) (push) Has been cancelled
Build uv cache / build-cache (3.12) (push) Has been cancelled
Build uv cache / build-cache (3.13) (push) Has been cancelled
Nightly Canary Release / Check for new commits (push) Has been cancelled
Nightly Canary Release / Build nightly packages (push) Has been cancelled
Nightly Canary Release / Publish nightly to PyPI (push) Has been cancelled
* COR-891 Fix SQLite flow initialization contention

* fix: update vulnerable auth dependencies (COR-891)

* COR-891 Fix SQLite flow initialization contention
2026-10-08 16:19:30 -07:00
João Moura 1eff1d6bc9 feat: bump versions to 1.15.26 (#7961) 2026-10-08 18:42:32 -03:00
leilei3167 42ae4bf2c0 fix: keep rwlock ownership when acquisition is interrupted (#7944)
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Vulnerability Scan / Detect changes (push) Has been cancelled
Vulnerability Scan / pip-audit (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Move r_locked and w_locked acquire calls ahead of the try/finally
that releases them, so an interrupted wait does not release a lock
that was never acquired.
2026-10-08 06:03:58 +00:00
Lorenze Jay 7ed27d764a feat: bump versions to 1.15.25 (#7945) 2026-10-07 18:48:27 -05:00
Lorenze Jayandgithub-actions[bot] 82d09de711 feat: bump versions to 1.15.24 (#7941)
* feat: bump versions to 1.15.24

* chore: update tool specifications

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-10-07 17:35:48 +00:00
Lorenze Jay c6bf5ef5d4 feat(flow): queue relevant background replies (OSS-192) (#7911)
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Check Documentation Broken Links / Check broken links (push) Has been cancelled
Vulnerability Scan / Detect changes (push) Has been cancelled
Vulnerability Scan / pip-audit (push) Has been cancelled
* feat(flow): queue relevant background replies (OSS-192)

* fix(flow): fence queued output after shared reply interruption

* fix(flow): keep prepared delivery retries side effect free
2026-10-07 09:18:05 -07:00
Lorenze JayandVidit Ostwal 19d4154b0b feat(flow): add experimental turn and reply identities (OSS-197) (#7909)
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Check Documentation Broken Links / Check broken links (push) Has been cancelled
Vulnerability Scan / Detect changes (push) Has been cancelled
Vulnerability Scan / pip-audit (push) Has been cancelled
Build uv cache / build-cache (3.10) (push) Has been cancelled
Build uv cache / build-cache (3.11) (push) Has been cancelled
Build uv cache / build-cache (3.12) (push) Has been cancelled
Build uv cache / build-cache (3.13) (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
* feat(flow): introduce experimental turn and public reply identities

This update adds a new module for handling public replies within an existing conversational flow. It introduces the `TurnRunner`, which manages the lifecycle of turns and replies, allowing for experimental features such as tracking input revisions and reply identities. The changes include new classes for `TurnRecord`, `ReplyRecord`, and `TurnState`, enhancing the flow's capabilities while maintaining backward compatibility with existing APIs. Additionally, tests have been added to ensure the functionality of the new features.

* fix docs

* fix(flow): preserve live turn state and terminal events

* fix(flow): remove redundant failure terminal marker

---------

Co-authored-by: Vidit Ostwal <110953813+Vidit-Ostwal@users.noreply.github.com>
2026-10-07 13:56:34 +05:30
Elif Sema BalciogluandVidit Ostwal 68f82f936d Add Oracle Integrations (#6026)
* Add Oracle Integrations

* Update uv.lock

* Fix bugs

* Fix bugs

* fix: resolve Oracle vector search review findings

* fix: ensure Oracle test cleanup and satisfy lint checks

* fix: correct Oracle filters limits and batch rollback

* fix: address Oracle embedding and vector search review findings

* fix: validate Oracle filters and environment configuration

---------

Co-authored-by: Vidit Ostwal <110953813+Vidit-Ostwal@users.noreply.github.com>
2026-10-07 11:58:18 +05:30
Gabe Milani 19dd81148c fix(flow): let a start step re-run on the events it listens to (#7922) 2026-10-06 18:34:31 +00:00
Vidit Ostwal 8225e322e5 fix(deps): clear docling, fsspec, multidict, pymongo, and snowflake advisories (#7916)
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Vulnerability Scan / Detect changes (push) Has been cancelled
Vulnerability Scan / pip-audit (push) Has been cancelled
Build uv cache / build-cache (3.10) (push) Has been cancelled
Build uv cache / build-cache (3.11) (push) Has been cancelled
Build uv cache / build-cache (3.12) (push) Has been cancelled
Build uv cache / build-cache (3.13) (push) Has been cancelled
The lock was still on versions flagged by GHSA-q43m-vhcp-mhvm, GHSA-27vj-qcqg-25rc, GHSA-54p9-h82j-f925, the pymongo 4.18.2 fixes, and GHSA-qqj6-54q6-cxv6.
2026-10-06 09:32:22 -07:00
Lorenze Jay 738c8e19e3 feat(flow): add experimental job lifecycle and runner (#7864)
Mark stale issues and pull requests / stale (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Check Documentation Broken Links / Check broken links (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
Vulnerability Scan / Detect changes (push) Has been cancelled
Vulnerability Scan / pip-audit (push) Has been cancelled
Nightly Canary Release / Check for new commits (push) Has been cancelled
Nightly Canary Release / Build nightly packages (push) Has been cancelled
Nightly Canary Release / Publish nightly to PyPI (push) Has been cancelled
Build uv cache / build-cache (3.10) (push) Has been cancelled
Build uv cache / build-cache (3.11) (push) Has been cancelled
Build uv cache / build-cache (3.12) (push) Has been cancelled
Build uv cache / build-cache (3.13) (push) Has been cancelled
2026-10-02 17:03:54 -07:00
Gabe Milani 8078f9130c fix(flow): let human_feedback emit steps expose the review in outputs (#7850)
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Build uv cache / build-cache (3.10) (push) Has been cancelled
Build uv cache / build-cache (3.11) (push) Has been cancelled
Build uv cache / build-cache (3.12) (push) Has been cancelled
Build uv cache / build-cache (3.13) (push) Has been cancelled
Vulnerability Scan / Detect changes (push) Has been cancelled
Vulnerability Scan / pip-audit (push) Has been cancelled
Nightly Canary Release / Check for new commits (push) Has been cancelled
Nightly Canary Release / Build nightly packages (push) Has been cancelled
Nightly Canary Release / Publish nightly to PyPI (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
2026-10-01 17:31:55 +00:00
João MouraandClaude Opus 5.5 fbcf2de39d fix(tracing): keep tool and task outputs whole in exported spans (#7833)
Build uv cache / build-cache (3.10) (push) Has been cancelled
Build uv cache / build-cache (3.11) (push) Has been cancelled
Build uv cache / build-cache (3.12) (push) Has been cancelled
Build uv cache / build-cache (3.13) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
Vulnerability Scan / Detect changes (push) Has been cancelled
Vulnerability Scan / pip-audit (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
* fix(tracing): keep tool and task outputs whole in exported spans

Every gen_ai.* content attribute was capped at 32 KiB, and a value over the
cap that was not a message array became an envelope holding a 4 KiB preview:
a 33 KB tool result reached the trace as 4 KB. Graders checking a summary
against the data a tool returned could not decide.

- DEFAULT_MAX_ATTR_BYTES is 384 KiB, sized to Wharf's 3,072,000-byte request
  limit: seven attributes at the bound still fit one request.
- Over the bound, a value loses only what is over it (the envelope preview
  fills the bound; a message's text is cut by the overshoot, not halved), with
  the existing <attr>.truncated / <attr>.original_size_bytes markers.
- Every other string attribute (crewai.task.output, crewai.mcp.tool_result,
  serialized flow state) gets the same bound and markers; before, one huge
  value made the span too large for Wharf and the exporter dropped it whole.
- An OpenTelemetry SDK attribute length limit, when set, lowers the bound, so
  the SDK (which cuts without a marker) never has anything left to cut.
  CREWAI_OTEL_MAX_ATTR_BYTES still replaces the bound; no new setting.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(tracing): honour SDK length limits as the SDK reads them; cut plain attributes plainly

- The span attribute length limit is read like SpanLimits: the span setting
  wins over the general one, an explicitly empty value means unlimited, and 0
  is a limit (every string cut to nothing, with crewAI's marker).
- Plain attributes (crewai.task.output, crewai.mcp.tool_result, flow state)
  keep their head up to the bound with the .truncated / .original_size_bytes
  markers; only gen_ai.* messages get message-aware truncation, so a
  role-bearing JSON list a task produced is never reshaped as a conversation.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(tracing): clamp the attribute bound at the Wharf-safe ceiling; shrink a span that does not fit instead of dropping it

- CREWAI_OTEL_MAX_ATTR_BYTES and the OTel SDK span attribute length limit
  can lower the 384 KiB bound, never raise it. A higher
  CREWAI_OTEL_MAX_ATTR_BYTES is clamped with one warning naming the value,
  the ceiling and why (Wharf's 3,072,000-byte request). No new setting.
- GrantSpanExporter no longer drops a span whose attributes, each within its
  bound, add up to more than one request: the largest string attributes are
  cut by the overshoot, each with .truncated / .original_size_bytes, until it
  fits. A span whose excess is in its resource, scope or events is still
  skipped, as before.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-01 03:37:42 -03:00
ca1d55abb3 fix(tracing): a refused trace grant runs the crew untraced instead of failing it (#7812)
* fix(tracing): a refused trace grant runs the crew untraced instead of failing it

An authenticated run asks AMP for a trace grant as it starts, and a refusal
raised out of `begin_execution` — so when a `crewai login` expired or a token
was revoked, every traced crew and flow failed with "AMP trace grant request
failed (HTTP 401)" before it did any work. A trace is a record of the run, not
a condition of it.

Now the run goes on untraced and logs one warning naming the fix: for a 401/403,
"Run `crewai login` again to trace your runs"; otherwise that the run itself is
unaffected. It never falls back to an anonymous upload of a logged-in user's run
(the grant client's "never downgrade a supplied credential" still holds). The
test that pinned the raise now pins the run completing, the context restored,
nothing uploaded, and the warning.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(tracing): name the credential AMP refused, not always the saved login

`tracing_credential()` sends CREWAI_USER_PAT first, then the platform
integration token, then the saved `crewai login` — so "run `crewai login`
again" was the wrong fix for two of the three, and sent somebody to refresh a
credential that was never the problem. `tracing_credential_source()` follows
the same order (one private resolver behind both), and the warning names the
credential that was refused and the fix for that one.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(tracing): a blank credential runs the crew untraced too

The grant client refuses a blank credential in its constructor with the same
TraceGrantError a refused grant raises, and the constructor sat outside the
boundary — so that case still failed the run. It is inside now. The new tests
also import the grants module one way only.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(tracing): the refused credential is the one that was sent

Resolve the tracing credential and its source once, as a pair, and use that
pair for both the grant request and the warning. Reading the source again
after the request could name a credential AMP never saw.

Also assert a refused grant never builds a span exporter.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(deps): bump pyjwt to >=2.14.0 and defer oauthlib 4.0.0

PyJWT 2.14.0 fixes GHSA-w6j9-cwv2-h6wq and several other advisories in
PyJWKClient and JWK parsing, which crewai-core uses to verify CLI login
tokens. Raise the floor in crewai, crewai-cli and crewai-core so installs
cannot resolve a vulnerable release, and lock 2.14.0 (2.15.0 rejects
padded tokens until 2.15.1, which is still inside the uv cooldown).

oauthlib 4.0.0, the fix for GHSA-xpv3-w29h-x7cv, is under two days old
and inside the 3-day exclude-newer cooldown. The flaw is in the
server-side PKCE verifier check; oauthlib reaches CrewAI only as an OAuth
client (chromadb -> kubernetes -> requests-oauthlib). Ignore the advisory
in pip-audit until 4.0.0 clears the cooldown, with a dated TODO.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(deps): bump pyjwt to 2.15.0, urllib3 to 2.8.0 and virtualenv to 21.13.0

Advisories published 2026-09-30 against the versions #7823 locks:
- PyJWT 2.14.0: GHSA-42vr-xj54-vc7v (fixed in 2.15.0); floor raised to >=2.15.0 in crewai, crewai-core and crewai-cli
- urllib3 2.7.0: GHSA-8988-9cw3-xx77, GHSA-gh4c-6fx4-qh6g, GHSA-vxq7-64xx-v4gw (fixed in 2.8.0); override raised to >=2.8.0
- virtualenv 21.4.2: PYSEC-2026-4011..4014 (fixed by 21.7.13); override >=21.7.13, locked at 21.13.0

All three fixes are older than the 3-day exclude-newer cutoff, so no per-package override is needed.
Local pip-audit over the exported lock: no known vulnerabilities (8 ignored, the repo's list).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Craig Estep <craig.estep@crewai.com>
2026-09-30 21:47:17 -07:00
João MouraandClaude Opus 5.5 b6bfae60b5 fix(deps): bump litellm to 1.88.6 for GHSA-3cv6-jpf6-8222 (#7835)
litellm <1.88.6 has GHSA-3cv6-jpf6-8222 (CVE-2026-84377): authenticated
SSRF and provider-credential exfiltration via unvalidated request-body
routing parameters in the LiteLLM proxy server. crewAI uses litellm as a
client SDK and never runs the proxy, but pip-audit flags the package and
fails the vulnerability scan on every PR.

- lib/crewai/pyproject.toml: crewai[litellm] floor litellm>=1.84.0 -> >=1.88.6
- pyproject.toml: advisory comment beside the other overrides
- uv.lock: litellm 1.84.8 -> 1.88.6; nothing else moved (same dependency set)

1.88.6 (2026-08-09) is older than the 3-day exclude-newer cutoff, so no
exclude-newer-package override is needed.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-01 01:34:20 -03:00
dependabot[bot] fad444da95 chore(deps): bump the security-updates group across 1 directory with 2 updates (#7832)
Bumps the security-updates group with 2 updates in the / directory: [chromadb](https://github.com/chroma-core/chroma) and [accelerate](https://github.com/huggingface/accelerate).


Updates `chromadb` from 1.1.1 to 1.5.9
- [Release notes](https://github.com/chroma-core/chroma/releases)
- [Changelog](https://github.com/chroma-core/chroma/blob/main/RELEASE_PROCESS.md)
- [Commits](https://github.com/chroma-core/chroma/compare/1.1.1...1.5.9)

Updates `accelerate` from 1.13.0 to 1.15.0
- [Release notes](https://github.com/huggingface/accelerate/releases)
- [Commits](https://github.com/huggingface/accelerate/compare/v1.13.0...v1.15.0)

---
updated-dependencies:
- dependency-name: chromadb
  dependency-version: 1.5.9
  dependency-type: direct:production
  dependency-group: security-updates
- dependency-name: accelerate
  dependency-version: 1.15.0
  dependency-type: indirect
  dependency-group: security-updates
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-01 00:17:03 -03:00
João MouraandClaude Opus 5.5 1b9bbccbed feat(cli): crewai eval --models, and llm_overlay swaps models as well as roles (#7811)
Build uv cache / build-cache (3.10) (push) Has been cancelled
Build uv cache / build-cache (3.11) (push) Has been cancelled
Build uv cache / build-cache (3.12) (push) Has been cancelled
Build uv cache / build-cache (3.13) (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Vulnerability Scan / Detect changes (push) Has been cancelled
Vulnerability Scan / pip-audit (push) Has been cancelled
Nightly Canary Release / Check for new commits (push) Has been cancelled
Nightly Canary Release / Build nightly packages (push) Has been cancelled
Nightly Canary Release / Publish nightly to PyPI (push) Has been cancelled
* feat(llm): llm_overlay maps models too, not only agent roles

A key `model:<provider/model>` maps every LLM built from that model string
inside the block, and `model:*` every LLM built from any model string. That
reaches what a role cannot: a flow step's own `LLM(...).call()`. The key is
read in `LLM.__new__` (and so `create_llm` and an agent's `llm="..."`), and
on an agent's declared llm built outside the block; a role key still wins for
that agent. The caller's settings follow the mapped model by the rule a
declared llm's do. `MODEL_KEY_PREFIX` is public so another package can
feature-detect the form.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* feat(telemetry): allow-list cli_usage:eval_models attributes

The span `crewai eval --models` records carries whether the caller was
logged in, the models compared (provider/model names) and how many, in both
telemetry classes. Nothing about the run, its output or the organization.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* feat(cli): crewai eval --models compares models on the deployment

`crewai eval --models "a,b"` (and `--deployment UUID` when AMP cannot tell
the deployment from the project id) asks AMP for a models evaluation: the
project id, the models from one comma-separated list (stripped, repeats
dropped, provider/model required, 1-5) and the project's eval.jsonc. It
needs the login, prints and opens the report link, says where the
comparison is while it runs, then prints one row per model (goal, tasks,
agents, tools, cost, time; the deployed one marked, the best per column
starred) and the top three suggestions. Exit 0 when it finished, 1 when it
failed or could not start. Everything from the wire is printed as Text.
The comparison is counted as `cli_usage:eval_models` once AMP accepts it.

Mode 1 now sends the project id with `create_evaluation` too, so every
evaluation is filed under the project it is about.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* feat(cli): crewai deploy create and push send the project id

Every create (git or ZIP) and every push (redeploy by name or uuid, or a
ZIP update) carries `[tool.crewai].project_id` when the project has one, so
AMP knows which project a deployment runs and `crewai eval --models` can find
it. The id is read, never minted: a deploy does not rewrite pyproject.toml.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(llm): a model key maps an LLM whose declared SDK is not installed

Nothing is built on the declared model, so a missing SDK for it is no
reason to fail the mapped build; its credentials cannot be matched to the
new provider, so none are carried.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* feat(cli): crewai eval --models leaves its criteria behind as eval.jsonc

When the comparison's answer carries `eval_config` and the project has no
eval.jsonc, it is written through `write_eval_config` and the same one line
Mode 1 prints says so. An existing file is never overwritten.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(llm): a model key compares providers by provider, not by class

`_same_route_provider` now follows `_same_provider`'s rule case for case: a
LiteLLM-routed `LLM(...)` is on the same provider as a native route when its
provider names that native class, so its key and endpoint follow a model
key to another model of the same provider. Another provider still gets none.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* chore(llm): say why mark_mapped may skip an object, and one import form in its tests

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(cli): usage stats name a compared model only when it is a public one

`cli_usage:eval_models` carried the `--models` strings as typed, and those
can identify a customer: a fine-tune id, an Azure deployment name, a
self-hosted model or host. A model is now sent by name only when it is an
exact entry of crewAI's model catalog (`LLM_CONTEXT_WINDOW_SIZES`), else as
`<provider>/other`, and a provider crewAI does not route as `other/other`.
An `ft:` id is never sent.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test(cli): a refused comparison's test no longer keeps a None return

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test(llms): re-importing OpenAI's completion module restores its package attribute

`test_openai_completion_module_is_imported` deletes the module from
sys.modules and lets `LLM(...)` import it again, which binds the new module
on `crewai.llms.providers.openai` as well. monkeypatch restored only the
sys.modules entry, so every later test on that worker saw two module
objects for one name: `patch("crewai.llms.providers.openai.completion.X")`
patched the attribute's module while `from ... import X` read sys.modules'.
On Python 3.10 that made tests/llms/azure/test_azure_responses.py fail
whenever it shared a worker with test_openai.py and test_crew_loader.py,
which the new tests' even split now did. The attribute is restored too.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(llm): model keys strip only a model's own prefix; a role builds from the declaration

Two review findings on the model-for-model overlay:

- `overlay_model_for_model` took the text after the first slash as another
  name for the model, so an aggregator's route (`openrouter/openai/gpt-4o`)
  matched a `model:openai/gpt-4o` or `model:gpt-4o` key meant for the
  native model. A prefix is now stripped only when it is a native provider's
  own and what remains has no slash; an instance on an aggregator is compared
  as `<provider>/<its model id>`.
- With a role key and a model key both active, the model key mapped the
  declared llm first and the role's model was built like that mapped
  instance, losing the caller's key and endpoint. The overlay now remembers
  what the caller declared for every llm it built, and a role key is built
  from that declaration.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(llm): model keys read a provider's other names; a LiteLLM choice survives a missing SDK

- The router's provider aliases are now one table, `crewai.llm.PROVIDER_ALIASES`,
  and `llm_overlay` compares model names through it: `google/x` and
  `gemini/x` are one model whether the llm is built in the block or was
  built before it (a prebuilt instance records `gemini`). An exact key still
  wins, and an aggregator's route is still compared whole.
- When the declared model's SDK is missing, a caller's explicit
  `is_litellm=True` is kept for the mapped model instead of dropping to a
  native route.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(deploy): a git create sends the project id once, at the top level

AMP reads project_id at the top level on every deploy route, so the git
create no longer repeats it inside `deploy`. The redeploy docstring records
why its optional body is safe on an AMP that predates project ids.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 10:53:42 -07:00
Vidit Ostwal a0d16dde6e refactor: move message summarization into SummarizeMessages (#7815)
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Vulnerability Scan / Detect changes (push) Has been cancelled
Vulnerability Scan / pip-audit (push) Has been cancelled
Nightly Canary Release / Check for new commits (push) Has been cancelled
Nightly Canary Release / Build nightly packages (push) Has been cancelled
Nightly Canary Release / Publish nightly to PyPI (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
* refactor: move message summarization into SummarizeMessages

Keep context compaction in one class so agent_utils only starts the summary when the context window is exceeded.

* refactor: keep SummarizeMessages inside agent_utils

Reuse one summarizer instance and drop the separate module now that compaction lives next to summarize_messages.

* fix: retry summarizer chunks with tighter token estimates on overflow

When a chunk hits the context window during summarization, re-chunk at 3 and 2.5 chars per token before failing.

* refactor: drive summarizer retries with char_level_index on summarize

Chunk at levels 4/3/2.5 chars per token and recurse through summarize until index 3 raises.

* refactor: colocate summarizer token levels on SummarizeMessages

Keep chars-per-token retry levels as a class constant instead of module scope.

* test: cover summarizer retries across all char-per-token levels

Assert chunking uses indices 0–2 when context overflows twice before a successful summary.

* fix: use a new SummarizeMessages instance per compaction

Avoid sharing one summarizer across concurrent context-window recoveries.

* fix: keep summarizer context retries inside async _summarize_one

Re-chunk failed chunks at tighter token levels with gather instead of calling summarize recursively.

* refactor: nest _summarize_one inside _summarize_all

Per-chunk summarization is only reachable from _summarize_all or its own retry path; tests exercise _summarize_all instead of calling _summarize_one directly.
2026-09-29 21:23:28 +05:30
João MouraandClaude Opus 5.5 243e819952 fix(tracing): report tracing sent usage from the grant exporter (#7810)
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Vulnerability Scan / Detect changes (push) Has been cancelled
Vulnerability Scan / pip-audit (push) Has been cancelled
Since 1.15.22 every crew and flow kickoff owns an execution uuid, so the
legacy TraceBatchManager handlers never finalize a batch and the
`tracing:ephemeral_sent` / `tracing:authenticated_sent` Feature Usage
events stopped. Emit them from GrantSpanExporter.record_export, the point
both upload tiers reach once every span has arrived.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 13:10:04 +05:30
Vidit Ostwal a6e6d0f9d8 refactor(llms): centralize and refresh context windows (#7796)
* feat(llms): centralize context window definitions

* refactor(llm): use shared context window resolver

* refactor(llms): share native context window lookup

* test(llms): cover context window parity

* fix(llms): preserve regional Bedrock context window

* chore(llms): refresh provider context window catalogs

* fix(llms): restore affected model context windows

* fix(llms): add active Azure and Anthropic context windows

Record catalog limits for current Azure OpenAI and Claude model IDs so lookups match the providers' active context windows.

* fix(llms): sync Gemini and Bedrock context windows

Drop retired catalog IDs and record the active Gemini and Bedrock text-model limits from the current provider docs.

* fix(llms): add missing OpenAI context windows

Record active OpenAI IDs that do not match an existing prefix, including gpt-5.6-cyber so it keeps its 400k window.

* fix(llms): keep Gemini thinking snapshot window in sync

Restore the retired thinking snapshot so native Gemini and LiteLLM resolve the same 1M context window.

* test(llms): drop retired Gemini thinking snapshot from parity

The model is no longer in the Gemini catalog, so native and LiteLLM no longer need to agree on its context window.

* test(llms): expect Azure GPT-4 and GPT-4o to share a 128k window

Azure GPT-4 is no longer smaller than GPT-4o, so the comparison asserted equal usable windows.

* fix(llms): address context-window review findings

Keep provider catalogs from overwriting each other, restore Gemma and legacy Bedrock Claude windows, and match the global Kimi inference id.

* fix(llms): drop unused context-window re-exports from LLM

Import the usage ratio from context_window in tests so llm.py no longer re-exports unused constants.
2026-09-29 07:07:59 +00:00