Compare commits

...

39 Commits

Author SHA1 Message Date
Rip&Tear
69e35def95 Update security reporting guidelines 2026-07-30 15:41:51 +08:00
João Moura
112762a7fa [docs-freeze] docs: snapshot and changelog for v1.15.9 (#6726)
Some checks are pending
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (python) (push) Waiting to run
Check Documentation Broken Links / Check broken links (push) Waiting to run
Vulnerability Scan / pip-audit (push) Waiting to run
2026-07-30 05:45:17 +00:00
João Moura
bfe8df4471 feat: bump versions to 1.15.9 (#6725) 2026-07-29 22:40:32 -07:00
João Moura
453676c61a feat(tools): surface tool failures instead of reporting them as success (#6712)
Some checks failed
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 / pip-audit (push) Has been cancelled
* feat(tools): surface tool failures instead of reporting them as success

A tool can finish without raising and still fail to do what it was asked.
Slack answers HTTP 200 with `{"ok": false, "error": "channel_not_found"}`;
an MCP server sets `isError`; a CrewAI AMP action returns
`API request failed: ...`. In every case the call "worked", so the error
text reached the agent as an ordinary result, the agent narrated the
problem in prose, and the run was recorded as a success.

Concretely: five failed `slackbot_send_message` calls each rendered as
"Tool Execution Completed", the task passed, and the crew passed -- with
the only evidence being a sentence in the final answer. Nothing
downstream could tell the difference, and an agent that keeps going on a
step that silently did nothing builds the rest of its work on it.

Give that outcome a type and a reaction:

- `ToolFailure` -- what a tool returns instead of an error string. The
  agent still reads prose via `as_agent_message()`, so model behavior is
  unchanged; the framework now knows the call failed.
- `ToolFailurePolicy` -- `ignore` (previous behavior), `warn` (default:
  record + emit, keep going), `raise` (abort with
  `ToolExecutionFailedError`). Resolved most-specific-first: tool, task,
  agent, crew.
- `ToolFailureDetectedEvent` -- emitted before a `raise` aborts, so
  subscribers always observe the failure. `ToolUsageFinishedEvent` also
  carries a `failure` field so a trace UI can mark the call failed
  without correlating two events.
- `tool_failures` on `TaskOutput`, `CrewOutput` and `LiteAgentOutput`,
  plus `has_tool_failures`, so consumers never parse a string.

Detection is strictly declarative -- no string sniffing, so a tool that
legitimately returns text about an error is never misread as failing.
Failures come from a returned `ToolFailure`, a raised exception, MCP
`isError`, a spent `max_usage_count`, or an unknown tool.

Wired into all four tool-execution paths (the ReAct path and the three
native function-calling implementations). Sources updated to report
structurally: `MCPClient.call_tool_result()` preserves `isError` that
`call_tool()` dropped, and `CrewAIPlatformActionTool` returns a
`ToolFailure` for non-2xx and for caught exceptions.

Two latent bugs fixed along the way: `ToolUsage` assumed every agent has
a `fingerprint` (LiteAgent does not), and policy resolution now tolerates
malformed values rather than letting telemetry take down a tool call.

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

* fix(tools): address review round 1 on tool-failure signalling

Five real defects from Bugbot, none of them cosmetic.

Tool-scoped policy never applied (high). `resolve_tool_failure_policy`
read `tool_failure_policy` off the object handed to it, but every
execution path passes the `CrewStructuredTool` wrapper, which never
carried the attribute -- and `BaseTool` never declared it in the first
place. A tool-scoped `raise`/`ignore` was silently ignored while the
docs and a unit test claimed otherwise; the test passed only because it
called the resolver directly with an authored tool. Declared the field on
`BaseTool`, propagated it through `to_structured_tool()` and
`CrewStructuredTool`, and made resolution fall back through
`_original_tool` so either shape works.

A failed call still printed the green "Completed" panel, then the red
one. That is the terminal version of the exact bug this PR is about.
Suppressed the success panel when the call reported failure.

A raised tool printed twice: `ToolUsageErrorEvent` already renders a red
panel, and the new failure panel repeated it. The event is still emitted
-- policy and traces need it -- but the duplicate console output is gone.
Both decisions now live in named predicates on `ConsoleFormatter` rather
than inline in the listener closure, so they are directly testable.

Unknown tools were reported on the ReAct path but silently ignored on all
three native paths, so the same miss was loud or silent depending on
executor style. Native paths now record `UNKNOWN_TOOL` too. This also
surfaced a live `NameError`: ruff had pruned `ToolFailureReason` from
`agent_utils` as unused, so the new branch would have crashed at runtime.

`LiteAgentOutput` had `tool_failures` but not `has_tool_failures`, which
the PR promised on all three output types -- an `AttributeError` for any
caller sharing one check across result types.

Testing: 16 further tests, 45 total. Two console tests were passing
vacuously because `emit()` dispatches sync handlers on a thread pool, so
the assertions raced the handler; they now assert on the predicates
directly, and the native-path test drains the bus with `flush()` and
checks the synchronously-written record. Full suite still matches
baseline exactly at 377 pre-existing failures.

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

* chore: update tool specifications

* fix(tools): address review round 2 and fix CI type failure

CI caught a type error I should have: widening `agent` to accept a
`LiteAgent` (so a standalone LiteAgent resolves its own policy) left the
declared signatures behind. Widened `execute_tool_and_check_finality`,
its async twin, and `ToolCallHookContext` to `Agent | BaseAgent |
LiteAgent | None`, which is what those actually receive now.

Seven CodeRabbit findings, all verified against the code first:

`raise` was being downgraded by three enclosing handlers. With
`max_execution_time` set, `_execute_with_timeout` wrapped every exception
in `RuntimeError`, so `_check_execution_error` no longer recognized the
passthrough and sent the task through the retry loop instead of aborting.
`StepExecutor.execute` turned it into `StepResult(success=False)` and let
the plan continue. `LiteAgent.kickoff` ran it through
`handle_unknown_error` and printed "This is likely a bug - please report
it" for what is a deliberate, configured stop.

Failure records were dropped on two paths. `reset_tool_failures()` only
ran in `_prepare_task_execution`, so `Agent.kickoff()` / `kickoff_async()`
— which enter through `_prepare_kickoff` — accumulated records across
runs. And a guardrail retry calls `execute_task` again, which resets the
agent, so a tool that failed on a blocked attempt vanished from the final
output entirely: a run could report zero failures having demonstrably
failed one. Failures now accumulate across guardrail attempts.

Writing the tests for that surfaced a further miss of my own:
`Agent.kickoff()` builds its `LiteAgentOutput` in `agent/core.py` via
`AgentExecutor`, not through `LiteAgent`, so `tool_failures` was always
empty there regardless of the recording fix. Wired up, and the LiteAgent
path now reads from whichever agent the executor was handed
(`original_agent` under kickoff, `self` standalone) rather than assuming.

`last_tool_failures` returns a copy, so a caller cannot mutate the
agent's record or watch it shift mid-run.

Testing: 7 further tests, 52 total, covering the timeout wrapper, the
retry limit, kickoff reset, the kickoff output path, copy semantics and
guardrail accumulation. Full suite matches baseline exactly at 377
pre-existing failures; mypy clean on every changed file.

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

* fix(tools): make crew-scoped policy real and close the last raise leak

Two findings, and the first was a documented feature that never worked.

`resolve_tool_failure_policy` consulted a crew, and the docs advertised
crew as a scope, but `Crew` had no `tool_failure_policy` field at all --
and even with one it was unreachable, because `BaseAgent` defaulted the
policy to `WARN` rather than `None`, so resolution always stopped at the
agent. Crew-level configuration was silently ignored.

Fixed by making "inherit" the default everywhere instead of baking `warn`
into one layer: `Crew` gains the field, and `BaseAgent`/`LiteAgent`
default to `None` like `Task` and `BaseTool` already did. The resolver
owns the single fallback, so the chain is genuinely
tool > task > agent > crew > warn and the effective default with nothing
configured is still `warn`. Reading `agent.tool_failure_policy` now
returns `None` (meaning "inherit") rather than `WARN`.

The other: `StepExecutor` re-raised `ToolExecutionFailedError` from its
outer handler, but the nested handler around the native-to-text tooling
fallback still caught it and returned `StepResult(success=False)`. An
agent whose LLM lacked native tool calling would therefore not abort
under `raise`. That is the third distinct place this exception was being
downgraded; it now re-raises there too.

Testing: 8 further tests, 60 total, including the full precedence chain
walked one level at a time and crew-scoped `raise`/`ignore` driven
end-to-end through `kickoff()` rather than only through the resolver --
the gap that let the original crew bug pass review. Full suite matches
baseline exactly at 377 pre-existing failures; mypy clean on every
changed file.

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

* docs: trim comments and docstrings on tool-failure signalling

Prose only -- no behavior change. Cut the module docstring, the longer
class and method docstrings, the multi-line inline comments, and the
verbose Field descriptions down to what actually earns its place. Net 87
lines lighter.

Kept the "why" in every case where the reason is non-obvious (why the
event fires before a raise, why the policy reads through the tool wrapper,
why the bus needs draining in tests) and dropped the restatements of what
the code already says.

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

* fix(tools): make ignore truly silent, stop caching failures, close 4 gaps

Six findings from the latest review round, all verified against the code
before touching it.

`ignore` was not silent. `ToolUsageFinishedEvent.failure` was set before
the policy ran, so traces still saw a failed call under a policy documented
as surfacing nothing. Worse, the console then showed *no* panel at all:
green was suppressed because `failure` was present, red was skipped because
`ignore` never emits `ToolFailureDetectedEvent`. New `reportable_failure()`
resolves the policy before the finished event and drops the flag under
`ignore`; wired into all four execution paths.

Failures were being cached. `CacheHandler.add` stored a `ToolFailure` like
any other result, so a transient error became permanent for the rest of the
run and every later hit re-reported a call that never re-ran. The cache now
refuses to store declared failures -- fixed at the single choke point rather
than at each of the four call sites.

A spent `max_usage_count` was invisible on the shared native path.
`BaseTool._claim_usage` returned a bare string that only the executors
recognising that exact message treated as a failure. It now returns a
`ToolFailure` with `USAGE_LIMIT`, so every path records it.

A guardrail returning a whole `TaskOutput` replaced the output without
carrying accumulated failures over, so earlier attempts vanished from
`CrewOutput.tool_failures`. New `merge_tool_failures()` combines and
deduplicates, and the retry-rebuild path uses it too.

A hook-blocked call inherited a cached failure and attributed it to a call
that never ran. Now cleared. Not reachable through the built-in cache once
failures stop being cached, so the test injects a custom cache handler that
does retain them -- verified to fail without the guard.

Also removed a `datetime` import left unused by the earlier console-test
rewrite.

Testing: 13 further tests, 73 total. Full suite matches baseline exactly at
377 pre-existing failures; the usage-limit suites that `_claim_usage`
touches pass unchanged; mypy clean on every changed file.

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

* fix(tools): let raise through the parallel native path, guard all handlers

Chasing down CodeRabbit's note about callers of
execute_single_native_tool_call turned up a fifth place this exception was
being downgraded: the experimental executor's parallel branch wrapped
future.result() in a broad except and folded the abort into a fake tool
result, so the remaining parallel calls carried on. The sequential path and
crew_agent_executor's parallel branch were already fine.

Five separate handlers have swallowed this during review, so added a guard
test asserting the passthrough at every site rather than trusting the next
one gets spotted.

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

* fix(tools): keep a failed tool out of the final answer, finish crew scope

Three more findings, all confirmed against the code.

A failed `result_as_answer` tool still became the task's output. The native
paths already excluded raised errors and hook blocks from short-circuiting,
but not declared failures -- so an error message silently became the answer,
which is the exact shape of bug this PR exists to prevent. Fixed on all
paths, and there were three independent override points, not one:
`ToolResult.result_as_answer` in tool_utils, the `execution_result`
finality checks in both executors, and `process_tool_results()`, which
reads `agent.tools_results` back separately. The first two fixes alone left
the behavior unchanged; only the third made the test pass.

`ToolUsage` never received a crew, so a crew-level `ignore` half-applied:
recording and `ToolFailureDetectedEvent` stayed quiet, but the flag was
still attached to `ToolUsageFinishedEvent`. It now takes and stores `crew`.

`CrewAgentExecutor.invoke`/`ainvoke` routed a deliberate stop through
`handle_unknown_error`, printing "An unknown error occurred" on verbose
runs. LiteAgent already special-cased this; both now do.

Testing: 5 further tests, 79 total, including that a *successful*
`result_as_answer` tool still short-circuits. Full suite matches baseline
exactly at 377 pre-existing failures; mypy clean on every changed file.

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

* fix(tools): report malformed tool args, correlate the failure event

Two findings from the latest round.

Malformed native tool arguments returned early with a plain error dict and
never reported a failure, so `ToolFailureReason.INVALID_INPUT` was declared
but unreferenced -- a bad tool call was absent from records, events and
`raise` aborts. `parse_tool_call_args` now carries an INVALID_INPUT failure
on the error dict and both executors report it before returning.

`ToolFailureDetectedEvent` never set `agent_id`, so a trace could not tie it
to a specific agent instance. Fixing that exposed the same gap running the
other way: `ToolUsage`'s own started/finished/error events never set
`agent_id` either, so on the ReAct path the paired finished event had
nothing to correlate against. Both now set it.

Set explicitly rather than via `from_agent`, which would also overwrite
`agent_role` and lose the `_original_role` preference those events already
apply -- a behavior change that has nothing to do with correlation.

Testing: 5 further tests, 84 total, asserting the ids match between the
failure event and its paired finished event. One existing test pinned the
exact key set of the parse-error dict and was updated for the new key. Full
suite matches baseline at 377 pre-existing failures; the one apparent
addition was the known `test_trace_enable_disable` order-flake, confirmed by
re-running rather than assumed.

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

* fix(tools): scope failure accumulation per execution, drop deprecated executor

Two review requests from @lorenzejay.

Accumulation no longer lives as mutable state on the shared agent. A
ContextVar collector is opened around each execution -- task, kickoff, and
each guardrail retry -- and the output reads that collector directly instead
of copying the agent's list. ContextVars are copied per asyncio task and per
thread, so concurrent executions cannot see each other's records, and
nesting is safe for retries. `last_tool_failures` prefers the active
collector and falls back to the last completed execution, so the accessor is
correct during a run too. The per-execution reset that caused the erasure is
gone.

Reproducing this took some digging and the finding is worth recording: crew
tasks *cannot* hit it, because `AgentExecutor` refuses concurrent reuse of
one instance and raises. `agent.kickoff()` has no such guard, and there the
bug reproduces exactly as reported -- two concurrent kickoffs each returned
two records. The regression test forces the overlap with a barrier so it is
deterministic rather than timing-dependent, and I verified it reports [2, 2]
against the old behavior and [1, 1] now.

Removed the tool-failure integration from `CrewAgentExecutor` entirely; that
file is back to its state on main. Note the shared ReAct helper it calls
still records failures, since that is common code rather than new behavior in
the deprecated file -- so a `raise` policy will be swallowed by that
executor's generic handler. Flagged on the PR rather than papered over.

Testing: 89 total. Two tests I wrote for this were vacuous on the first
attempt -- they passed against the simulated pre-fix code -- so each
concurrency test was checked against the old behavior before being kept.

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

* fix(tools): report malformed calls everywhere, drop the unused block reason

Four findings.

`execute_single_native_tool_call` swallowed a JSON decode error into an empty
args dict and ran the tool with no input at all -- worse than not reporting
it. It now routes through `parse_tool_call_args` like the executors do, so
the StepExecutor/planning path reports INVALID_INPUT and returns instead of
executing. That also removes a duplicated inline parse.

The ReAct path returned a `ToolUsageError` message as an ordinary result
without reporting it, so a malformed call there was invisible while the
equivalent native failure was recorded. Now reported as INVALID_INPUT too.

`Agent.kickoff` opened a collector but no longer reset the agent-level list,
so `last_tool_failures` grew across kickoffs. Reset restored, matching task
execution.

`ToolFailureReason.BLOCKED_BY_HOOK` was declared and never produced. Rather
than start reporting hook blocks as failures, the member is removed: a block
is a deliberate decision by the hook author, and treating it as a failure
would make `raise` abort on an intentional veto. Added a guard test that every
remaining reason is actually produced somewhere, so a dead member cannot
reappear -- the same smell that flagged INVALID_INPUT last round.

Also switched the deprecation guard test to a single import style.

Testing: 6 further tests, 95 total, including that the tool does not run when
its args fail to parse. Full suite matches baseline at 377 pre-existing
failures; mypy clean.

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

* fix(tools): merge failures across kickoff guardrail retries, cancel siblings

Kickoff guardrail retries discarded the blocked attempt's failures. Each
retry calls `_execute_and_build_output`, which opens a fresh collector and
builds a new output, so a run could report zero failures having demonstrably
failed one -- the same bug already fixed on the task guardrail path, which
merges. Now merged there too. Verified the test fails without the fix.

Under `raise`, one parallel native tool aborting left its siblings running:
the pool waited for them and pending ones still started. It now shuts the
pool down with `cancel_futures=True` so a not-yet-started sibling never runs.
Threads already in flight cannot be interrupted in Python, so a concurrent
tool may still complete before the abort surfaces; that is noted at the call
site rather than left implied.

Also satisfied CodeQL by materialising the enum in the guard test's loop.

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

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Lorenze Jay <63378463+lorenzejay@users.noreply.github.com>
2026-07-29 19:30:14 -07:00
Lucas Gomide
d52d0a1628 feat: emit FlowFailedEvent when a flow execution fails (#6718)
Some checks failed
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 / pip-audit (push) Has been cancelled
* feat: emit FlowFailedEvent when a flow execution fails

A failed flow never emitted a terminal lifecycle event, so the
`flow_started` scope stayed open and consumers such as tracing closed the
root span with a generic orphaned message instead of the real error.
`kickoff_async` and the resume path now emit `FlowFailedEvent`, paired
with `flow_started` and carrying the exception, after draining pending
handlers and background memory writes. The resume path also emits the
`MethodExecutionStartedEvent` it was missing for the method being resumed,
so its finished or failed event pairs with its own scope instead of
popping the flow's.

* fix: skip FlowFailedEvent when the run never opened a scope

The `kickoff_async` try block starts before `FlowStartedEvent` is emitted,
so an abort in the execution-start hooks, in input handling or in state
restore emitted a `flow_failed` with no opener, which pops an unrelated
scope and warns about an empty scope stack. The failure event is now
gated on the flow scope actually being open, either from this kickoff's
`flow_started` or from a restored deferred session scope.
2026-07-29 14:44:55 -04:00
Lorenze Jay
f15844b219 Lorenze/imp/skills progressive disclosure (#6675)
Some checks failed
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 / 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
* skills progressive disclosure

* skills progressive disclosure

* improving progressive disclosure

* addressed comment

* fix test

---------

Co-authored-by: João Moura <joaomdmoura@gmail.com>
2026-07-28 09:33:43 -07:00
João Moura
e9caf1e1b8 [docs-freeze] docs: snapshot and changelog for v1.15.8 (#6703) 2026-07-28 15:05:44 +00:00
João Moura
133baf39b8 feat: bump versions to 1.15.8 (#6702) 2026-07-28 14:59:36 +00:00
João Moura
2e95bfb4e8 fix(tools): sandbox FileWriterTool writes and fix file tool rough edges (#6692)
Some checks failed
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 / pip-audit (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
* fix(tools): sandbox FileWriterTool writes and fix file tool rough edges

FileReadTool confined reads to the working directory, but FileWriterTool
only checked that `filename` stayed inside `directory` — and `directory`
itself is an LLM-supplied schema field. An agent could therefore write
anywhere the process had permission to, including ~/.ssh and site-packages,
while the reader refused to read back what the writer had just written.
FileWriterTool was the only filesystem tool in the package that did not go
through validate_file_path; files_compressor_tool validates even its
output path.

Writes are now confined to base_dir (the working directory by default):
the resolved directory must sit inside base_dir, and the resolved file
must sit inside that directory. The pre-existing filename containment
check is kept as-is and still applies even when the unsafe-paths escape
hatch is on, so no existing guarantee is weakened.

Both tools gain a base_dir field so a developer can widen the sandbox
deliberately instead of reaching for the process-wide
CREWAI_TOOLS_ALLOW_UNSAFE_PATHS kill switch. FileReadTool also stops
rejecting a file_path given to its own constructor: that is
developer-declared intent, and declaring one file does not expose its
siblings.

Also fixed:

- FileReadTool scanned the whole file when reading a line window; it now
  stops via islice once the requested lines are collected.
- FileWriterTool._run(**kwargs) made the documented positional call
  signature raise TypeError and turned a missing overwrite into
  "error accessing key". It now takes named parameters in the documented
  (filename, content, directory) order.
- A directory naming an existing file reported "already exists and
  overwrite option was not passed" even with overwrite=True; it now
  explains the real problem.
- Subdirectories inside filename are created, matching what passing
  directory already did.
- Both tools now write and decode UTF-8 by default instead of the
  platform locale encoding, with an encoding field to override. The docs
  already claimed UTF-8 and recommended the writer to Windows users.
- The writer's schema fields had no descriptions for the LLM.
- Docs claimed FileReadTool parses JSON into a dict (it never has),
  shipped a snippet that raised TypeError, and did not mention the path
  sandbox. The writer README also began with a stray "Here's the
  rewritten README" preamble.

BREAKING CHANGE: FileWriterTool no longer writes outside the working
directory. Pass base_dir to authorize a different tree.

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

* chore: update tool specifications

* fix(tools): make the declared FileReadTool file reachable by agents

Addresses review feedback on #6692.

The constructor-path exemption did not actually work the way an agent
calls the tool. The description only advertises a redacted label (the
basename, when the file sits outside the sandbox), but resolution
required the exact absolute path, so the model's call was sandboxed and
the declared file was never read. Worse, file_path was a required schema
field, so the long-documented "call with no arguments to read the default
file" raised a validation error instead:

    FileReadTool(file_path="/outside/declared.txt")
    .run()                          -> ValueError: validation failed
    .run(file_path="declared.txt")  -> Error: File not found
    .run(file_path="/outside/declared.txt") -> works, but the model was
                                               never told this path

file_path is now optional in the schema, so omitting it reads the default,
and the declared file is addressable by the label the description shows
the model as well as by its real path. Declaring one file still does not
expose its siblings.

The declared path is also pinned to its real path at construction, so a
later chdir cannot silently repoint it at a different file — previously a
relative constructor path re-resolved against the new working directory
on every call.

Also guards the writer's filepath resolution, which could raise
ValueError out of _run for a filename containing a null byte, breaking
the contract of always returning a descriptive string. The directory and
read paths were already guarded.

Adds docstrings to strtobool and both _run methods, corrects an Arabic
tanween spelling and a kaf-as-descriptor calque in the localized read
docs, and regenerates tool.specs.json for the schema change.

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

* fix(tools): anchor the declared read path to base_dir, not the cwd

Addresses the second round of review feedback on #6692.

The previous commit pinned a relative constructor file_path with
os.path.realpath, which anchors to the working directory, while both
format_path_for_display and validate_file_path anchor a relative path to
base_dir. With the two roots disagreeing, the same relative string meant
two different files — and the tool served the cwd one under a label that
looks like it belongs to the sandbox:

    FileReadTool(file_path="data.txt", base_dir="/allowed")   # cwd=/work
    label advertised to the model -> "data.txt"
    run(file_path="data.txt")     -> contents of /work/data.txt

That reads a file from outside base_dir, so it was a sandbox escape
introduced by the exemption itself, not just a wrong-file bug.

Resolution now goes through a single _resolve_against_base helper that
anchors relative paths exactly the way the sandbox does, so the pinned
path, the advertised label and the containment check all agree. Covered
by test_relative_declared_path_anchors_to_base_dir.

Also softens "always readable" to "always allowed past the containment
check" in the docstring, README and docs, since bypassing containment
does not guarantee the read succeeds — it can still fail on a missing
file, a directory, or permissions.

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

* fix(tools): tell the LLM about the path sandbox in tool descriptions

Addresses the low-confidence notes from the Copilot review on #6692.

Both tools' descriptions were pre-sandbox wording, so the model learned
about containment only by attempting a path and reading the error back.
Both now state that access is confined to the tool's allowed directory
and that a path resolving outside it is rejected.

The wording deliberately says "the tool's allowed directory" rather than
"the working directory", because the root is base_dir when one is set,
and naming the absolute root would leak it into the prompt — the same
reason paths are redacted in errors.

Not changed: the notes also suggested advertising `encoding`. That is a
constructor-only field the model cannot set, so describing it to the LLM
would be misleading.

Also fixes a test docstring that contradicted its own assertion — the
public run() path does raise on schema validation failure, which is what
the test asserts.

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

* fix(tools): anchor base_dir at construction so the sandbox cannot move

Addresses the third review round on #6692.

Both remaining findings came from the same habit: storing an unanchored
string and re-resolving it later.

A relative base_dir was kept verbatim and re-resolved against getcwd() on
every call, while the declared file was pinned once at construction. After
a chdir the sandbox root moved but the declared default did not, so one
tool applied two different roots. base_dir is now resolved once — in the
reader's __init__, and via a field_validator on the writer so it also
applies on the model_validate path.

That also covers the serialization concern. model_dump drops the private
pin, and __init__ re-runs on restore, so a relative file_path was
re-anchored against whatever the working directory happened to be at load
time. With base_dir anchored, restore rebuilds the identical pin.

The residual case is a relative file_path with no base_dir, where the
sandbox root is the working directory too — so both move together and the
tool stays self-consistent. Covered by
test_declared_path_survives_a_serialization_round_trip and
test_relative_base_dir_is_anchored_at_construction on both tools.

Also corrects the writer's 'directory' description, README and docs: the
default resolves inside the tool's allowed directory, which is base_dir
when one is set, not always the working directory.

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

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-07-28 02:20:26 -07:00
João Moura
97981ed31b feat(tools): add WaitTool for pausing on long-running jobs (#6690)
Some checks failed
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 / 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(tools): add WaitTool for pausing on long-running jobs

Agents that kick off out-of-band work (a sandbox build, a deployment, an
async API job) have no way to let clock time pass: they either poll in a
tight loop or give up before the work finishes.

WaitTool pauses for a given number of seconds, with an optional reason
echoed back for traces. A single call waits at most max_seconds (default
300, configurable). Longer requests are clamped to the cap and the result
says so, so the model calls again rather than failing. Sync and async
execution are both implemented; stdlib only, no new dependencies.

The tool description spells out when to reach for it (builds, deploys,
batch jobs, async polling, backoff) and when not to, so models pick it up
for the right reason.

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

* fix(tools): enforce non-negative wait on positional calls, fix doc snippets

BaseTool.run() skips args_schema validation when called with positional
arguments, so tool.run(-5) reached time.sleep(-5) and failed with an
unrelated error. _resolve_duration now enforces the seconds >= 0 contract
itself, covered for both run() and arun().

Docs and README examples are now self-contained: check_build_status_tool
is defined with the @tool decorator instead of referenced out of nowhere,
and the async example awaits inside asyncio.run() rather than at top level.

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

* docs: point the wait tool card at the edge path

Unprefixed links resolve against the default docs version (v1.15.7),
where the wait tool page does not exist, so the card 404'd in the broken
link check. Prefixing with /edge matches how other edge pages link.

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

* fix(tools): never cache waits and keep the advertised cap accurate

Two issues from review, both confirmed against the code.

Waits inherited the default cache_function, which always allows caching.
With crew cache enabled, a repeat call with the same arguments returned
"Waited N seconds." straight from the cache without sleeping, turning a
poll-wait-check loop into a busy loop. WaitTool now declares a
cache_function that always refuses.

The description advertising the cap was only rebuilt when max_seconds
reached __init__ without an explicit description. Passing both (as a
platform building from tool.specs.json init params would), calling
model_validate, or assigning max_seconds left the text claiming 300
seconds while clamping to something else. A model_validator now derives
the description from max_seconds on construction, validation, and
assignment, and leaves a caller-supplied description untouched.

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

* fix(tools): reject NaN waits and pluralize single-second results

_resolve_duration now rejects NaN with its own message instead of letting
time.sleep raise "Invalid value NaN (not a number)" from a positional
call. Infinity keeps clamping to the cap like any other oversized wait.

Result and description text no longer says "1 seconds". Tests use the
public WaitTool().description as the baseline rather than reaching for
module-private helpers.

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

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-27 17:12:27 -07:00
Thiago Moretto
e2c8d7ca88 fix: mark E2B_API_KEY as a required env var for E2B tools (#6688)
E2B_API_KEY was declared with required=False on the shared E2B tool
base (E2BExecTool, E2BFileTool, E2BPythonTool), even though none of
the three tools can create or attach to a sandbox without it.
E2B_DOMAIN stays optional since it genuinely defaults to e2b.dev.

Regenerated lib/crewai-tools/tool.specs.json via
generate_tool_specs.py to reflect the change.
2026-07-27 18:31:51 +00:00
Lucas Gomide
ca5ef810be ci: check doc links only on edge and latest versions (#6633)
Some checks failed
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Vulnerability Scan / pip-audit (push) Has been cancelled
`mintlify broken-links` walks every frozen version snapshot under
`docs/` (currently 22 of them), pushing docs PR checks past 14 minutes
and growing with each release. Prune the immutable snapshots — keeping
`edge` and the default (latest) version, which unprefixed links resolve
against — before running the checker, cutting the run to ~30 seconds.
`workflow_dispatch` still checks the full tree, and the deprecated
`mintlify` CLI is swapped for `mint`, which drops the `yes` prompt hack.
2026-07-27 08:22:01 -04:00
Ossama Alami
daa7019898 docs(llms): refresh model availability guidance (#6676)
Some checks failed
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Vulnerability Scan / pip-audit (push) Has been cancelled
Check Documentation Broken Links / Check broken links (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
* docs(llms): refresh model availability guidance

* docs: clarify structured output support

* docs: address LLM guide review feedback

* docs: refresh streaming model examples
2026-07-26 16:13:36 -07:00
João Moura
1870b444e7 [docs-freeze] docs: snapshot and changelog for v1.15.7 (#6673) 2026-07-26 11:19:47 -07:00
João Moura
38ca5edce2 feat: bump versions to 1.15.7 (#6672) 2026-07-26 18:07:46 +00:00
Lorenze Jay
213d9485fe docs: snapshot and changelog for v1.15.7a1 (#6665)
Some checks failed
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 / pip-audit (push) Has been cancelled
2026-07-26 14:04:16 -03:00
Lorenze Jay
c459d01c35 feat: bump versions to 1.15.7a1 (#6661) 2026-07-26 13:47:11 -03:00
João Moura
cc0759854d fix(skills): resolve registry skills through the runtime's CrewAI+ client (#6658)
* fix(skills): resolve registry skills through the installed AMP client

Skill downloads built their own `PlusAPI` and authenticated it from
`CREWAI_USER_PAT`, the platform integration token, or the saved CLI login.
Managed runtimes have no user credential to offer: they install a client of
their own, which `load_agent_from_repository` already resolves through, so
Agent Repository lookups worked while the skill downloads beside them failed
with 401.

Skills now resolve their client the same way, via `resolve_plus_client()` next
to the hook it reads. A client that can't fetch skills falls back to
environment credentials and warns, so older runtimes behave as they do today.
`resolve_plus_response()` shares the sync/async bridging both lookups need,
since `PlusAPI` is synchronous while managed clients are not.

Version pinning, which the same bug was hiding:

- Registry refs accept `@org/name@version`, and `@org/name@v1.2.0` since people
  write it both ways. `parse_skill_ref()` returns a `SkillRef(org, name,
  version)`; `parse_registry_ref()` keeps its `(org, name)` shape and drops the
  pin, so existing callers are unaffected
- Agent Repository agents record a version per skill, which was parsed off the
  response and dropped. Those pins now travel with the refs, so publishing a
  new version of a skill no longer changes every agent that uses it
- A pinned ref only accepts a project-local copy declaring that version in its
  `metadata.version` frontmatter, and the cache reports a miss when the version
  it recorded differs — so a pin re-resolves rather than loading another
  version. Unpinned refs keep hitting the cache as before
- An unknown pin fails instead of quietly falling back to the newest version

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

* fix(skills): reject a blank version pin instead of floating to latest

A blank `version` passed to `download_skill` read as "unpinned" and quietly
resolved the latest version, which is not what a caller supplying one asked
for — and it disagreed with `parse_skill_ref`, which already rejects empty
pins. Not reachable through `resolve_registry_ref` or the Agent Repository
auto-pinning, both of which only ever pass a non-empty version.

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

* fix(skills): carry the caller's context into the worker thread

When resolve_plus_response bridges an async client from inside a running loop
it runs the coroutine on a worker thread, which starts with empty ContextVars.
A client reading runtime state there — the platform integration token, flow
context — would see defaults rather than the caller's values, which is hard to
diagnose from the resulting auth or routing failure.

Copy the context across, matching how the parallel-summarization bridge in this
module already does it.

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

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-26 13:27:29 -03:00
alex-clawd
bd2cb0f23e fix(openai): recover from the GPT-5.6 tools + reasoning_effort 400 (#6660)
An ordinary agent with a tool fails on the whole GPT-5.6 family:

    Agent(role=..., goal=..., backstory=...,
          llm=LLM(model="openai/gpt-5.6-sol"), tools=[multiply])

    Function tools with reasoning_effort are not supported for gpt-5.6-sol in
    /v1/chat/completions. To use function tools, use /v1/responses or set
    reasoning_effort to 'none'.

Nothing sets reasoning_effort -- not the user, not CrewAI. The family applies a
server-side default and then refuses it once tools are present. Confirmed with
raw HTTP, no CrewAI involved, on a payload with no reasoning_effort key at all:

    gpt-5.6-sol  tools, no reasoning_effort key   -> 400
    gpt-5.6-sol  tools, reasoning_effort="none"   -> OK
    gpt-5.5      tools, no reasoning_effort key   -> OK
    gpt-5.4      tools, no reasoning_effort key   -> OK
    gpt-5.2      tools, no reasoning_effort key   -> OK

So this is GPT-5.6 only, and it needs an explicit "none" -- dropping the key is
what the rejected request already looked like.

Recovered from the error rather than a model list: catch the 400, resend with
reasoning_effort="none", once. No model names, so a family OpenAI restricts later
works without a release here. Detection matches the structured `param` field plus
the message, so the unrelated "Unsupported value" 400 that o1/o3 return for
"none" isn't mistaken for this one, and the retry can't loop.

Verified against main with real agents (no reasoning_effort anywhere):

    model          no tools   tools        tools + reasoning=True
    gpt-5.6-sol    ok / ok    400 / ok     hang / ok
    gpt-5.6-terra  ok / ok    400 / ok        - / ok
    gpt-5.6-luna   ok / ok    400 / ok        - / ok
    gpt-5.5        ok         ok              -
    gpt-5.2        ok         ok           ok / ok
    gpt-4o         ok         ok              -

On main, tools + Agent(reasoning=True) produced no output and no error and was
killed at 420s; gpt-5.2 with the same config finishes in ~40s. Both the 400 and
that hang are fixed.

Tests: 15 cases, including agent definitions with tools, with tools plus
reasoning=True, and without tools. tests/llms + tests/agents -> 961 passed
(1 pre-existing unrelated failure from a local OLLAMA_API_KEY env leak).
Ruff + mypy clean.
2026-07-26 12:48:17 -03:00
alex-clawd
c52d0d9530 fix(openai): make tool calling work on the Responses API path (#6657)
* fix(openai): make tool calling work on the Responses API path

An agent with tools on api="responses" never produced an answer. It returned the
raw tool-call list instead:

    [{'id': 'call_...', 'name': 'multiply', 'arguments': '{"a":17,"b":23}'}]

Three defects in the chain, all on the Responses side only:

1. `is_tool_call_list()` knew the OpenAI-nested, Anthropic, Bedrock and Gemini
   shapes but not the Responses one ({"id", "name", "arguments"} -- no nested
   "function", no "input"). The list wasn't recognized as tool calls, so the
   executor handed it back verbatim as the final answer.

2. `extract_tool_call_info()` read "arguments" only from a nested "function"
   object, falling back to "input". For the Responses shape both missed and the
   arguments silently became {}, so the tool would have run with no input.

3. With those fixed the tool ran, then the follow-up request 400'd:

       Invalid type for 'input[1].content': expected one of an array of objects
       or string, but got null instead.

   Tool calling is expressed differently by the two APIs. Chat Completions uses an
   assistant message carrying `tool_calls` with content: None, then role: "tool"
   results. The Responses API uses flat function_call / function_call_output items
   keyed by call_id. Those messages were passed through untranslated.

`_to_responses_input()` now converts them. Messages without tool calls pass
through unchanged, so nothing else moves.

Verified end to end against the live API:

    api="responses" + tools           -> 391   (was raw tool-call JSON)
    chained multi-step tool calls     -> 400   (17*23, then +9)
    completions path (control)        -> 391   (unchanged)

The generated `input` payload was also posted to /v1/responses directly and
accepted, and the pre-fix chat-shaped payload confirmed as a 400.

This is why api="responses" never worked for agents: the provider side has had a
full Responses implementation since #4258/c4c9208, but the executor never learned
the shape it emits. Fixing it also unblocks routing gpt-5.4+ tool calls to the
Responses API instead of dropping reasoning_effort.

Tests: 12 cases covering recognition, extraction (including that the Chat
Completions and Bedrock shapes are unaffected), translation of assistant/tool
messages, parallel calls, assistant text alongside tool calls, non-string tool
output, and the full prepared `input` list.

* fix(openai): prefer Responses "call_id" over the item's own "id"

Per CodeRabbit review. A raw Responses function_call item carries both keys with
different values, confirmed against the live API:

    keys    ['arguments', 'call_id', 'id', 'name', 'status', 'type']
    id      fc_0adeb715c5d740c7006a65ccb72b948199872ad8b5a5c53108
    call_id call_dEoHFrYnOgWYvk17FymdcDZ5

function_call_output must reference call_id. Reading the item's own "id" would
produce a tool result the model can't correlate back to its invocation.

Our own _extract_function_calls_from_response already maps item.call_id into "id",
so the normal path was correct and the existing tests passed. But
extract_tool_call_info is a shared helper reached from every provider's tool loop,
and a raw Responses item is a plausible thing to hand it -- silently picking the
wrong identifier is a bad trap to leave in place for one line of guard.

Tests: raw item extraction asserting call_id is chosen over id, and a round-trip
check that the id extracted from a call is the one sent back with its result.
997 passed across tests/llms, test_agent_utils and tests/agents (1 pre-existing
unrelated failure from a local OLLAMA_API_KEY env leak). Real two-agent chained-tool
run still returns the correct answer.

---------

Co-authored-by: João Moura <joaomdmoura@gmail.com>
2026-07-26 06:18:20 -03:00
alex-clawd
b64c92c87b fix(openai): route responses-only models instead of failing with 404 (#6656)
Some checks failed
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (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
The pro tier is not served by /v1/chat/completions. Probing the live endpoints:

    model         /v1/chat/completions   /v1/responses
    gpt-5-pro     404                    OK
    gpt-5.5-pro   404                    OK
    gpt-5.4-pro   404                    OK
    gpt-5.2-pro   404                    OK
    o1-pro        404                    OK
    o3-pro        404                    OK

Since api defaults to "completions", LLM(model="openai/gpt-5-pro") fails with
"Model ... not found", which is misleading -- the model exists, the endpoint is
wrong. OpenAI's own 404 text ("This is not a chat model") doesn't make the fix
obvious either.

These requests now route to the Responses API automatically, which is verified to
work for every model above. An explicit api= setting is always honoured.

Model matching normalizes the configured string first, so "openai/gpt-5-pro" and
"gpt-5-pro-2025-10-06" both resolve to "gpt-5-pro". It's an exact list rather
than a "-pro" substring, so a custom deployment named "gpt-4-pro-custom" isn't
swept up.

The chat-completions 404 handler also gained an actionable message: when the
response says responses-only, or the model is a known pro model, the error names
api="responses" instead of just reporting "not found".

Tests: 29 cases covering name normalization, detection, routing (including that
call() reaches the Responses handler), and both 404 message paths.
2026-07-26 06:03:09 -03:00
alex-clawd
80fa0295c4 Emit skill usage events at runtime for observability (#6652)
* feat: emit skill usage events at runtime

* test: cover skill events via execute_task paths
2026-07-26 05:04:19 -03:00
alex-clawd
728183e420 fix(deps): bump bedrock-agentcore to patch CVE-2026-16796 (#6654)
bedrock-agentcore 1.7.0 has GHSA-j6g5-3hh3-pgw8 (CVE-2026-16796, high):
argument-delimiter injection in CodeInterpreter.install_packages(). It fails
the pip-audit vulnerability scan on every PR in the repo.

The patch is 1.18.1, which requires boto3>=1.43.31. The old <1.8.0 cap plus
aiobotocore~=3.5.0 (botocore<1.42.92) made that unsatisfiable, so the AWS
stack moves together:

- bedrock-agentcore >=1.7.0,<1.8.0 -> >=1.18.1,<2.0.0
- boto3 ~=1.42.90 -> ~=1.43.46  (aws + bedrock extras)
- aiobotocore ~=3.5.0 -> ~=3.8.0 (aws + bedrock extras)

aiobotocore 3.8.0 allows botocore <1.43.47 and boto3 1.43.46 pins botocore
1.43.46, so the ranges overlap.

Verified: uv lock resolves, pip-audit reports no vulnerabilities (3 existing
ignores, none new), 48 bedrock tests pass, and both bedrock toolkits import
cleanly. BrowserClient.{start,stop,generate_ws_headers} and
CodeInterpreter.{start,stop,invoke} are unchanged in 1.18.1.
2026-07-26 04:55:05 -03:00
Lorenze Jay
b3aaaab023 [docs-freeze] docs: snapshot and changelog for v1.15.6 (#6632)
Some checks failed
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
Check Documentation Broken Links / Check broken links (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-07-24 20:30:21 +00:00
Lorenze Jay
a4cbeacca5 feat: bump versions to 1.15.6 (#6631) 2026-07-24 20:21:58 +00:00
alex-clawd
c528e8bdee fix: detect Anthropic preview tool-use blocks (#6629)
* fix: detect anthropic preview tool-use blocks

* fix: preserve typed Anthropic tool-use blocks

* fix: bump gitpython for vulnerability scan

* docs: clarify gitpython advisory ranges

---------

Co-authored-by: Lorenze Jay <63378463+lorenzejay@users.noreply.github.com>
2026-07-24 15:32:38 -03:00
alex-clawd
c06043f7e8 fix: preserve strict tool schema property names (#6628) 2026-07-24 09:49:05 -07:00
Rip&Tear
b14d36bfe4 chore: bump json-repair to 0.60.1, drop fixed vuln ignores in scan (#6612)
Some checks failed
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 / pip-audit (push) Has been cancelled
Mark stale issues and pull requests / stale (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
* chore: bump json-repair to 0.60.1 and un-ignore fixed vulns in scan

- json-repair 0.25.3 -> 0.60.1 (fixes GHSA-xf7x-x43h-rpqh)
- pyOpenSSL already at 26.2.0 in lock (covers CVE-2026-27448, CVE-2026-27459)
- remove the corresponding --ignore-vuln flags from vulnerability-scan.yml

* fix: adapt _safe_repair_json to json-repair 0.60 semantics

json-repair >= 0.60 returns an empty string for plain-text input and
wraps brace-enclosed junk in a single-element list instead of the old
""/{} sentinel values. Treat both as unrepairable so the original
tool input is preserved.

* chore: fix CI - bump gitpython/pyasn1, drop stale type ignores

- gitpython 3.1.50 -> 3.1.52 (GHSA-2f96-g7mh-g2hx, GHSA-v396-v7q4-x2qj,
  GHSA-956x-8gvw-wg5v; fixed in 3.1.51)
- pyasn1 0.6.3 -> 0.6.4 (GHSA-8ppf-4f7h-5ppj, GHSA-hm4w-wwcw-mr6r)
- json-repair 0.60 ships type stubs; remove now-unused
  type: ignore[import-untyped] comments flagged by mypy
2026-07-22 16:47:33 -07:00
Lucas Gomide
3bb87532da fix: dispatch execution_end hook on failed crew and flow executions (#6607)
Some checks failed
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 / 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
* fix: dispatch execution_end hook on failed crew and flow executions

The `execution_end` interception point only fired after a successful
kickoff, so consumers never learned about failed runs. Crew kickoff
paths (`kickoff`/`akickoff`) and the flow runtime (`kickoff_async`,
`resume_async`) now dispatch it on the failure path too, with new
additive `status` ("completed"/"failed") and `error` fields on
`ExecutionEndContext`. Pairing flags guarantee exactly-once dispatch,
keep the start/end pairing invariant, and the original exception
propagates unchanged.

* fix: track execution_end pairing per invocation for reentrant flows

Reentrant kickoffs on the same Flow instance are supported (usage
aggregation already accommodates them), but the instance-level pairing
booleans let an inner kickoff's completion mark the outer execution as
ended, skipping the outer failure's `execution_end`. The pairing state
now lives in each `kickoff_async` invocation's locals, and the resume
path passes a per-invocation holder into `_resume_async_body`. Crew
keeps its instance flags since crew kickoffs are not reentrant on the
same instance (`kickoff_for_each` copies the crew).
2026-07-21 15:25:06 -04:00
iris-clawd
6d496f799b fix: handle async get_agent in load_agent_from_repository (#6608)
* fix: handle async get_agent in load_agent_from_repository

The enterprise PlusClient.get_agent() is async, but
load_agent_from_repository() calls it synchronously. When the enterprise
client is hooked in, client.get_agent() returns a coroutine instead of a
response, causing "'coroutine' object has no attribute 'status_code'".

This adds an inspect.isawaitable() check after the call: if the response
is a coroutine, it is properly awaited via asyncio.run() (or via a
thread-pool executor if an event loop is already running).

Co-authored-by: Joe Moura <joao@crewai.com>

* fix: resolve mypy type-checker errors for async awaitable handling

* fix: remove unused type: ignore comment

---------

Co-authored-by: Joe Moura <joao@crewai.com>
2026-07-21 15:21:41 -03:00
Lorenze Jay
40279e3152 fix dep resolution (#6605)
Some checks failed
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (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
2026-07-21 08:37:08 -03:00
Vinicius Brasil
ce739e28c7 [docs-freeze] docs: snapshot and changelog for v1.15.5 (#6602)
Some checks failed
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Vulnerability Scan / pip-audit (push) Has been cancelled
Check Documentation Broken Links / Check broken links (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
Mark stale issues and pull requests / stale (push) Has been cancelled
2026-07-20 12:33:16 -04:00
Vinicius Brasil
4c7e483936 feat: bump versions to 1.15.5 (#6601) 2026-07-20 16:20:33 +00:00
Vinicius Brasil
fa255387a3 Authenticate skill registry downloads (#6600)
Registry downloads initialized PlusAPI without credentials, so uncached skills failed outside CLI-authenticated flows and were blocked entirely in non-interactive environments.

Use CREWAI_USER_PAT first, then the platform integration token, then the saved login token, and pass CREWAI_ORGANIZATION_UUID. Remove the non-interactive cache-only restriction so runtime downloads work.
2026-07-20 12:43:03 -03:00
Vinicius Brasil
69c0308f2c [docs-freeze] docs: snapshot and changelog for v1.15.4 (#6583)
Some checks failed
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 / 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-07-17 14:33:07 +00:00
Vinicius Brasil
e0bd967484 feat: bump versions to 1.15.4 (#6582) 2026-07-17 14:27:15 +00:00
João Moura
f0704ebb22 feat(skills)!: promote Skills Repository out of experimental (#6579)
* feat(skills)!: promote Skills Repository out of experimental

The registry-backed Skills Repository (crewai skill create/publish/
install/list, @org/name refs, global cache) is now mainline:

- CLI: `crewai skill ...` is a top-level group; the CREWAI_EXPERIMENTAL
  gate and the now-empty `crewai experimental` group are removed.
- Runtime: registry.py, cache.py, and events.py move from
  crewai.experimental.skills into crewai.skills next to the loader;
  the require_experimental_skills() gate is gone.
  crewai.experimental.skills remains as a deprecated re-export shim.
- Docs: concepts/skills now leads with the CLI workflow and documents
  the create -> publish -> install lifecycle.

Linear: n/a (requested promotion)

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

* feat(skills): org-scoped publish only + docs in all languages

Skills are always scoped to the publishing organization, like tools:
drop the --public/--private flags from `crewai skill publish` and
always send is_public=False to the registry. CLI tests assert the flag
is rejected and the API never receives a public publish.

Translate the new CLI-first Quick Start and the create -> publish ->
install lifecycle section into ar, pt-BR, and ko concepts/skills docs.

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

* fix(skills): address review comments on the promotion PR

- Back-compat shim now aliases the old submodules in sys.modules so
  `crewai.experimental.skills.registry/cache/events` imports (and patch
  targets) resolve to the real crewai.skills modules, not just the
  package-root re-exports.
- `crewai skill publish` actually enforces the git-state check that
  --force claims to skip: unsynced repos block publishing (mirroring
  tool publish); standalone skill dirs outside any git repo publish
  without a check.
- Explicit UTF-8 encoding on SKILL.md and cache-metadata reads/writes.

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

* fix(skills): fail closed when git state cannot be validated on publish

Follow deploy's pattern: construct git.Repository(fetch=False) and only
treat "not a Git repository" as skippable — any other git error
(fetch/auth/misconfiguration) now blocks publish with a --force escape
hatch instead of silently bypassing the sync check.

Also single-style imports in the shim test (CodeQL) with the dotted
shim import covered via importlib.

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

* fix(skills): fetch before sync check on publish; bump mcp past advisories

Publish now refreshes remote-tracking refs (repository.fetch()) before
is_synced(), so ahead/behind is judged against the actual remote rather
than stale local refs; a failing fetch blocks publish with the --force
escape hatch. Adds a fail-closed test for fetch errors.

Raise mcp to >=1.28.1,<2 (locks 1.28.1): the ~=1.26.0 pin blocked
GHSA-hvrp-rf83-w775 / GHSA-jpw9-pfvf-9f58 (fixed 1.27.2) and
GHSA-vj7q-gjh5-988w (fixed 1.28.1), which were failing pip-audit on
this PR.

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

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Vinicius Brasil <vini@hey.com>
2026-07-17 14:21:15 +00:00
Vinicius Brasil
4e23bf6d45 Update dependencies with security fixes (#6580)
Some checks failed
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (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
* Pillow 12.1.1 → 12.3.0 (CVE-2026-55798, CVE-2026-54059, CVE-2026-54060,
  CVE-2026-55379, CVE-2026-55380, CVE-2026-59197, CVE-2026-59203)
* mcp 1.26.0 → 1.28.1 (CVE-2026-59950)
* couchbase 4.3.5 → 4.6.0
2026-07-17 09:12:45 -03:00
Jesse Miller
df2e68fe0a docs: add Flows in Studio documentation (#6575)
Some checks failed
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 / pip-audit (push) Has been cancelled
Check Documentation Broken Links / Check broken links (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
* docs: add Flows in Studio documentation

Documents the new Flows build mode in Studio: why deterministic
workflows with agentic steps matter, the three core node types
(Single Agent, Crews, Router), and Agent Repository publish/pull
sync across organizations.

Includes a rollout banner for the week of July 20th, English source
plus pt-BR, Korean, and Arabic translations, and nav entries for
both edge and v1.15.2 (Crew Studio group renamed to Studio).

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

* docs: limit Flows in Studio docs to edge version

Versioned snapshots are updated by a separate script, so remove the
v1.15.2 copies and revert its nav changes; the page now lives only
under edge.

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

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-16 20:05:59 +00:00
6689 changed files with 1481715 additions and 2098 deletions

2
.github/security.md vendored
View File

@@ -12,4 +12,4 @@ Please submit reports through one of the following channels:
- **Please do not** disclose vulnerabilities via public GitHub issues, pull requests,
or social media
- Reports submitted via channels other than this Bugcrowd submission email will not be reviewed and will be dismissed
- Reports submitted via channels other than the methods above will not be reviewed and will be dismissed

View File

@@ -4,13 +4,11 @@ on:
pull_request:
paths:
- "docs/**"
- "docs.json"
push:
branches:
- main
paths:
- "docs/**"
- "docs.json"
workflow_dispatch:
permissions:
@@ -28,11 +26,40 @@ jobs:
with:
node-version: "22"
- name: Install Mintlify CLI
run: npm i -g mintlify
- name: Install Mint CLI
run: npm i -g mint@4.2.741
# Pruning immutable snapshots keeps the check fast (--files still parses every
# page); the default version must stay because unprefixed links resolve to it.
- name: Prune frozen doc versions (keep edge and latest)
if: github.event_name != 'workflow_dispatch'
run: |
python3 - <<'EOF'
import json
import shutil
from pathlib import Path
docs = Path("docs")
spec_path = docs / "docs.json"
spec = json.loads(spec_path.read_text())
keep_dirs = {"edge"}
for lang in spec["navigation"]["languages"]:
kept = [v for v in lang["versions"] if v["version"] == "Edge" or v.get("default")]
lang["versions"] = kept
keep_dirs.update(v["version"] for v in kept if v["version"] != "Edge")
missing = [d for d in keep_dirs if not (docs / d).is_dir()]
if missing:
raise SystemExit(f"docs.json version labels do not match directories: {missing}")
spec_path.write_text(json.dumps(spec, indent=2))
for path in docs.glob("v*"):
if path.is_dir() and path.name not in keep_dirs:
shutil.rmtree(path)
EOF
- name: Run broken link checker
run: |
# Auto-answer the prompt with yes command
yes "" | mintlify broken-links || test $? -eq 141
run: mint broken-links
working-directory: ./docs

View File

@@ -47,52 +47,17 @@ jobs:
- name: Run pip-audit
run: |
uv run pip-audit --desc --aliases --skip-editable --format json --output pip-audit-report.json \
--ignore-vuln PYSEC-2024-277 \
--ignore-vuln PYSEC-2026-89 \
--ignore-vuln PYSEC-2026-97 \
--ignore-vuln PYSEC-2025-148 \
--ignore-vuln PYSEC-2025-183 \
--ignore-vuln PYSEC-2025-189 \
--ignore-vuln PYSEC-2025-190 \
--ignore-vuln PYSEC-2025-191 \
--ignore-vuln PYSEC-2025-192 \
--ignore-vuln PYSEC-2025-193 \
--ignore-vuln PYSEC-2025-194 \
--ignore-vuln PYSEC-2025-195 \
--ignore-vuln PYSEC-2025-196 \
--ignore-vuln PYSEC-2025-197 \
--ignore-vuln PYSEC-2025-210 \
--ignore-vuln PYSEC-2026-139 \
--ignore-vuln GHSA-rrmf-rvhw-rf47 \
--ignore-vuln PYSEC-2025-211 \
--ignore-vuln PYSEC-2025-212 \
--ignore-vuln PYSEC-2025-213 \
--ignore-vuln PYSEC-2025-214 \
--ignore-vuln PYSEC-2025-215 \
--ignore-vuln PYSEC-2025-216 \
--ignore-vuln PYSEC-2025-217 \
--ignore-vuln PYSEC-2025-218 \
--ignore-vuln PYSEC-2026-597 \
--ignore-vuln GHSA-f4j7-r4q5-qw2c \
--ignore-vuln GHSA-xf7x-x43h-rpqh
# Ignored CVEs:
# PYSEC-2024-277 - joblib 1.5.3: disputed; NumpyArrayWrapper only used with trusted caches
# PYSEC-2026-89 - markdown 3.10.2: DoS via malformed HTML; fix 3.8.1 — already past, advisory range is stale
# PYSEC-2026-97 - nltk 3.9.4: arbitrary file read in filestring(); no fix available
# PYSEC-2026-597 - nltk 3.9.4 (CVE-2026-12243): path traversal via _UNSAFE_NO_PROTOCOL_RE bypass (incomplete fix of nltk#3504); 3.9.4 is the latest release, no fix available
# PYSEC-2025-148 - onnx 1.21.0: path traversal in save_external_data; no fix available
# PYSEC-2025-183 - pyjwt 2.12.1: disputed weak-encryption claim; key length is application-chosen
# PYSEC-2025-189..197 - torch 2.11.0: memory-corruption/DoS in functions only reachable via untrusted models; no fix available
# PYSEC-2025-210, PYSEC-2026-139 - torch 2.11.0: profiler/deserialization issues; no fix available
# GHSA-rrmf-rvhw-rf47 - torch 2.11.0 (CVE-2025-3000, alias of PYSEC-2025-194): memory corruption in torch.jit.script, CVSS 1.9, local-only; affected <=2.12.0, no fix available. pip-audit reports it under the GHSA id so the PYSEC ignore above does not catch it.
# PYSEC-2025-211..218 - transformers 5.5.4: deserialization/code injection via malicious model checkpoints; no fix available
# GHSA-f4j7-r4q5-qw2c - chromadb 1.1.1 (CVE-2026-45829): pre-auth RCE via /api/v2/tenants/{tenant}/databases/{db}/collections when trust_remote_code=true.
# Advisory: vulnerable >=1.0.0,<=1.5.9, firstPatchedVersion=none. We only use chromadb.PersistentClient (lib/crewai/src/crewai/rag/chromadb/factory.py)
# and chromadb.utils.embedding_functions; the chromadb HTTP server is never started, so the vulnerable route is not exposed.
# GHSA-xf7x-x43h-rpqh - json-repair 0.25.3 (published 2026-07-13): CPU DoS via circular $ref in SchemaRepairer.resolve_schema().
# The vulnerable schema_repair module does not exist in 0.25.x (added in later releases), and CrewAI only calls
# repair_json() without schemas. The fixed release 0.60.1 is outside the json-repair~=0.25.2 pin.
pip_audit_args=(
--desc
--aliases
--skip-editable
--format json
--output pip-audit-report.json
--ignore-vuln PYSEC-2026-597 # nltk 3.9.4 (CVE-2026-12243): no fix available, transitive through crewai-tools[xml] -> unstructured.
--ignore-vuln GHSA-rrmf-rvhw-rf47 # torch 2.12.0 (CVE-2025-3000): local-only memory corruption in torch.jit.script; no fix available.
--ignore-vuln GHSA-f4j7-r4q5-qw2c # chromadb 1.1.1 (CVE-2026-45829): pre-auth RCE in the HTTP server; no fix available.
)
uv run pip-audit "${pip_audit_args[@]}"
continue-on-error: true
- name: Display results
@@ -138,4 +103,3 @@ jobs:
~/.local/share/uv
.venv
key: uv-main-py3.11-${{ hashFiles('uv.lock') }}

File diff suppressed because it is too large Load Diff

View File

@@ -4,6 +4,163 @@ description: "تحديثات المنتج والتحسينات وإصلاحات
icon: "clock"
mode: "wide"
---
<Update label="29 يوليو 2026">
## v1.15.9
[عرض الإصدار على GitHub](https://github.com/crewAIInc/crewAI/releases/tag/1.15.9)
## ما الذي تغير
### الميزات
- عرض فشل الأدوات بدلاً من الإبلاغ عنها كنجاح
- إصدار FlowFailedEvent عندما يفشل تنفيذ التدفق
- تنفيذ الكشف التدريجي للمهارات
### الوثائق
- تحديث اللقطة وسجل التغييرات للإصدار v1.15.8
## المساهمون
@github-actions[bot], @joaomdmoura, @lorenzejay, @lucasgomide
</Update>
<Update label="28 يوليو 2026">
## v1.15.8
[عرض الإصدار على GitHub](https://github.com/crewAIInc/crewAI/releases/tag/1.15.8)
## ما الذي تغير
### الميزات
- إضافة WaitTool لإيقاف التنفيذ في المهام الطويلة.
### إصلاحات الأخطاء
- إصلاح كتابات FileWriterTool ومعالجة الحواف الخشنة في أداة الملف.
- وضع E2B_API_KEY كمتغير بيئي مطلوب لأدوات E2B.
### الوثائق
- تحديث إرشادات توفر النموذج.
## المساهمون
@github-actions[bot], @joaomdmoura, @lucasgomide, @oalami, @thiagomoretto
</Update>
<Update label="26 يوليو 2026">
## v1.15.7
[عرض الإصدار على GitHub](https://github.com/crewAIInc/crewAI/releases/tag/1.15.7)
## ما الذي تغير
### إصلاحات الأخطاء
- حل مهارات السجل من خلال عميل CrewAI+ الخاص بالوقت الفعلي
- استعادة من أدوات GPT-5.6 + reasoning_effort 400
- جعل استدعاء الأدوات يعمل على مسار واجهة برمجة التطبيقات Responses
- توجيه النماذج التي تعيد الاستجابات فقط بدلاً من الفشل مع 404
- رفع bedrock-agentcore لتصحيح CVE-2026-16796
### الرصد
- إصدار أحداث استخدام المهارات في الوقت الفعلي للرصد
### الوثائق
- إضافة لقطة وتغيير السجل للإصدار v1.15.7a1
## المساهمون
@alex-clawd, @joaomdmoura, @lorenzejay
</Update>
<Update label="26 يوليو 2026">
## v1.15.7a1
[عرض الإصدار على GitHub](https://github.com/crewAIInc/crewAI/releases/tag/1.15.7a1)
## ما الذي تغير
### إصلاحات الأخطاء
- إصلاح حل مهارات السجل من خلال عميل CrewAI+ الخاص بالوقت الفعلي.
- استعادة الأداء من أخطاء أدوات GPT-5.6 وجهد الاستدلال 400.
- جعل استدعاء الأدوات يعمل على مسار واجهة برمجة التطبيقات للاستجابات.
- توجيه نماذج الاستجابات فقط لمنع أخطاء 404.
- رفع اعتماد bedrock-agentcore لإصلاح CVE-2026-16796.
### الرصد
- إصدار أحداث استخدام المهارات في الوقت الفعلي لتحسين الرصد.
### الوثائق
- تحديثات لقطة وتغيير للإصدار 1.15.6.
## المساهمون
@alex-clawd, @joaomdmoura, @lorenzejay
</Update>
<Update label="24 يوليو 2026">
## v1.15.6
[عرض الإصدار على GitHub](https://github.com/crewAIInc/crewAI/releases/tag/1.15.6)
## ما الذي تغير
### إصلاحات الأخطاء
- إصلاح الكشف عن أدوات معاينة Anthropic.
- الحفاظ على أسماء خصائص مخطط الأدوات الصارمة.
- تنفيذ حدث execution_end عند فشل تنفيذ الطاقم والتدفق.
- التعامل مع get_agent غير المتزامن في load_agent_from_repository.
- إصلاح مشكلات حل الاعتماد.
### الوثائق
- لقطة وتاريخ التغييرات للإصدار v1.15.5.
## المساهمون
@alex-clawd, @iris-clawd, @lorenzejay, @lucasgomide, @theCyberTech, @vinibrsl
</Update>
<Update label="20 يوليو 2026">
## v1.15.5
[عرض الإصدار على GitHub](https://github.com/crewAIInc/crewAI/releases/tag/1.15.5)
## ما الذي تغير
### الميزات
- مصادقة تنزيلات سجل المهارات
### الوثائق
- تحديث اللقطة وسجل التغييرات للإصدار v1.15.4
## المساهمون
@vinibrsl
</Update>
<Update label="17 يوليو 2026">
## v1.15.4
[عرض الإصدار على GitHub](https://github.com/crewAIInc/crewAI/releases/tag/1.15.4)
## ما الذي تغير
### الميزات
- ترقية مستودع المهارات من حالة تجريبية
### الوثائق
- إضافة تدفقات في وثائق الاستوديو
## المساهمون
@jessemiller, @joaomdmoura, @vinibrsl
</Update>
<Update label="16 يوليو 2026">
## v1.15.3

View File

@@ -157,6 +157,7 @@ class MyCustomCrew:
- **FlowCreatedEvent**: يُرسل عند إنشاء تدفق
- **FlowStartedEvent**: يُرسل عند بدء تنفيذ تدفق
- **FlowFinishedEvent**: يُرسل عند اكتمال تنفيذ تدفق
- **FlowFailedEvent**: يُرسل عند فشل تنفيذ تدفق. يحتوي على اسم التدفق والاستثناء الذي أنهى التنفيذ.
- **FlowPausedEvent**: يُرسل عند إيقاف تدفق مؤقتًا بانتظار ملاحظات بشرية
### أحداث LLM

View File

@@ -22,7 +22,7 @@ mode: "wide"
تحدد نافذة السياق مقدار النص الذي يمكن لـ LLM معالجته في وقت واحد. النوافذ الأكبر (مثل 128K رمز) تتيح سياقًا أكثر لكنها قد تكون أكثر تكلفة وأبطأ.
</Card>
<Card title="درجة الحرارة" icon="temperature-three-quarters">
تتحكم درجة الحرارة (0.0 إلى 1.0) في عشوائية الاستجابة. القيم المنخفضة (مثل 0.2) تنتج مخرجات أكثر تركيزًا وحتمية، بينما القيم الأعلى (مثل 0.8) تزيد الإبداع والتنوع.
درجة الحرارة هي أداة للتحكم في أخذ العينات تدعمها بعض النماذج. تجعل القيم المنخفضة أخذ العينات أكثر تركيزًا عمومًا، بينما تزيد القيم الأعلى التباين. تتجاهل بعض نماذج الاستدلال الأحدث هذا المعامل أو توقف دعمه أو ترفضه، لذا راجع وثائق النموذج المحدد قبل ضبطه.
</Card>
<Card title="اختيار المزود" icon="server">
يقدم كل مزود LLM (مثل OpenAI و Anthropic و Google) نماذج مختلفة بقدرات وأسعار وميزات متفاوتة. اختر بناءً على احتياجاتك من الدقة والسرعة والتكلفة.
@@ -38,7 +38,7 @@ mode: "wide"
أبسط طريقة للبدء. عيّن النموذج في بيئتك مباشرة، من خلال ملف `.env` أو في كود تطبيقك. إذا استخدمت `crewai create` لبدء مشروعك، سيكون مُعيّنًا بالفعل.
```bash .env
MODEL=model-id # e.g. gpt-4o, gemini-2.0-flash, claude-3-sonnet-...
MODEL=provider/model-id # e.g. openai/gpt-5.6-terra
# Be sure to set your API keys here too. See the Provider
# section below.
@@ -57,7 +57,7 @@ mode: "wide"
goal: Conduct comprehensive research and analysis
backstory: A dedicated research professional with years of experience
verbose: true
llm: provider/model-id # e.g. openai/gpt-4o, google/gemini-2.0-flash, anthropic/claude...
llm: provider/model-id # e.g. anthropic/claude-sonnet-4-6
# (see provider configuration examples below for more)
```
@@ -76,32 +76,24 @@ mode: "wide"
from crewai import LLM
# Basic configuration
llm = LLM(model="model-id-here") # gpt-4o, gemini-2.0-flash, anthropic/claude...
llm = LLM(model="provider/model-id") # e.g. gemini/gemini-3.6-flash
# Advanced configuration with detailed parameters
llm = LLM(
model="model-id-here", # gpt-4o, gemini-2.0-flash, anthropic/claude...
temperature=0.7, # Higher for more creative outputs
timeout=120, # Seconds to wait for response
max_tokens=4000, # Maximum length of response
top_p=0.9, # Nucleus sampling parameter
frequency_penalty=0.1 , # Reduce repetition
presence_penalty=0.1, # Encourage topic diversity
model="provider/model-id",
timeout=120,
max_tokens=4000,
response_format={"type": "json"}, # For structured outputs
seed=42 # For reproducible results
)
```
<Info>
شرح المعاملات:
- `temperature`: تتحكم في العشوائية (0.0-1.0)
- `timeout`: أقصى وقت انتظار للاستجابة
- `max_tokens`: تحدد طول الاستجابة
- `top_p`: بديل لدرجة الحرارة للعينات
- `frequency_penalty`: تقلل تكرار الكلمات
- `presence_penalty`: تشجع موضوعات جديدة
- `response_format`: تحدد هيكل المخرجات
- `seed`: تضمن مخرجات متسقة
عناصر التحكم في أخذ العينات مثل `temperature` و`top_p`، ومعاملات العقوبة، وأسماء حدود الرموز، وعناصر التحكم في الاستدلال خاصة بكل نموذج. أضفها فقط عندما يدعمها المزود والنموذج المحددان. راجع أمثلة المزودين أدناه ووثائق النموذج لدى المزود.
</Info>
</Tab>
</Tabs>
@@ -120,6 +112,10 @@ mode: "wide"
يدعم CrewAI العديد من مزودي LLM، كل منهم يقدم ميزات فريدة وطرق مصادقة وقدرات نماذج.
في هذا القسم، ستجد أمثلة مفصلة تساعدك في اختيار وإعداد وتحسين LLM الأنسب لاحتياجات مشروعك.
<Warning>
يتغير توفر النماذج باستمرار وقد يختلف حسب الحساب والمنطقة والمنصة السحابية. تستخدم الأمثلة أدناه نماذج متاحة وقت كتابة هذا الدليل، لكنها ليست قوائم دعم شاملة. قبل النشر، تحقق من معرّف النموذج وحالة دورة حياته في كتالوج المزود المرتبط.
</Warning>
<AccordionGroup>
<Accordion title="OpenAI">
يوفر CrewAI تكاملًا أصليًا مع OpenAI من خلال OpenAI Python SDK.
@@ -137,10 +133,10 @@ mode: "wide"
from crewai import LLM
llm = LLM(
model="openai/gpt-4o",
model="openai/gpt-5.6-terra",
api_key="your-api-key", # Or set OPENAI_API_KEY
temperature=0.7,
max_tokens=4000
reasoning_effort="medium",
max_completion_tokens=4000
)
```
@@ -149,25 +145,16 @@ mode: "wide"
from crewai import LLM
llm = LLM(
model="openai/gpt-4o",
model="openai/gpt-5.6-terra",
api_key="your-api-key",
base_url="https://api.openai.com/v1", # Optional custom endpoint
organization="org-...", # Optional organization ID
project="proj_...", # Optional project ID
temperature=0.7,
max_tokens=4000,
max_completion_tokens=4000, # For newer models
top_p=0.9,
frequency_penalty=0.1,
presence_penalty=0.1,
stop=["END"],
seed=42, # For reproducible outputs
max_completion_tokens=4000,
reasoning_effort="medium",
stream=True, # Enable streaming
timeout=60.0, # Request timeout in seconds
max_retries=3, # Maximum retry attempts
logprobs=True, # Return log probabilities
top_logprobs=5, # Number of most likely tokens
reasoning_effort="medium" # For o1 models: low, medium, high
max_retries=3 # Maximum retry attempts
)
```
@@ -182,7 +169,7 @@ mode: "wide"
summary: str
llm = LLM(
model="openai/gpt-4o",
model="openai/gpt-5.6-terra",
)
```
@@ -191,30 +178,15 @@ mode: "wide"
- `OPENAI_BASE_URL`: عنوان URL مخصص لـ OpenAI API (اختياري)
**الميزات:**
- دعم استدعاء الدوال الأصلي (باستثناء نماذج o1)
- دعم أصلي لاستدعاء الدوال
- مخرجات منظمة مع JSON schema
- دعم البث للاستجابات في الوقت الفعلي
- تتبع استخدام الرموز
- دعم تسلسلات التوقف (باستثناء نماذج o1)
- عناصر تحكم في التوليد خاصة بالمزود
- احتمالات السجل لرؤى على مستوى الرموز
- التحكم في جهد الاستدلال لنماذج o1
- التحكم في جهد الاستدلال للنماذج المتوافقة
**النماذج المدعومة:**
| النموذج | نافذة السياق | الأفضل لـ |
|---------------------|------------------|-----------------------------------------------|
| gpt-4.1 | 1M tokens | أحدث نموذج بقدرات محسّنة |
| gpt-4.1-mini | 1M tokens | إصدار فعال بسياق كبير |
| gpt-4.1-nano | 1M tokens | متغير فائق الكفاءة |
| gpt-4o | 128,000 tokens | محسّن للسرعة والذكاء |
| gpt-4o-mini | 200,000 tokens | فعال من حيث التكلفة بسياق كبير |
| gpt-4-turbo | 128,000 tokens | المحتوى الطويل، تحليل المستندات |
| gpt-4 | 8,192 tokens | مهام الدقة العالية، الاستدلال المعقد |
| o1 | 200,000 tokens | الاستدلال المتقدم، حل المشكلات المعقدة |
| o1-preview | 128,000 tokens | معاينة قدرات الاستدلال |
| o1-mini | 128,000 tokens | نموذج استدلال فعال |
| o3-mini | 200,000 tokens | نموذج استدلال خفيف |
| o4-mini | 200,000 tokens | استدلال فعال من الجيل التالي |
تضيف OpenAI نماذج جديدة وتسحب snapshots قديمة بانتظام. راجع [كتالوج نماذج OpenAI](https://developers.openai.com/api/docs/models) للحصول على معرّفات النماذج الحالية ونوافذ السياق وتوافق endpoints ومعلومات دورة الحياة.
**Responses API:**
@@ -276,14 +248,7 @@ mode: "wide"
)
```
جميع النماذج المدرجة هنا https://llama.developer.meta.com/docs/models/ مدعومة.
| معرّف النموذج | طول سياق الإدخال | طول سياق المخرجات | وسائط الإدخال | وسائط المخرجات |
| --- | --- | --- | --- | --- |
| `meta_llama/Llama-4-Scout-17B-16E-Instruct-FP8` | 128k | 4028 | نص، صورة | نص |
| `meta_llama/Llama-4-Maverick-17B-128E-Instruct-FP8` | 128k | 4028 | نص، صورة | نص |
| `meta_llama/Llama-3.3-70B-Instruct` | 128k | 4028 | نص | نص |
| `meta_llama/Llama-3.3-8B-Instruct` | 128k | 4028 | نص | نص |
راجع [نظرة عامة على نماذج Meta Llama](https://ai.meta.com/llama/get-started/) للتعرّف على عائلات النماذج والوسائط وإرشادات حدود السياق الحالية.
**ملاحظة:** يستخدم هذا المزود LiteLLM. أضفه كتبعية لمشروعك:
```bash
@@ -353,7 +318,7 @@ mode: "wide"
from crewai import LLM
llm = LLM(
model="anthropic/claude-3-5-sonnet-20241022",
model="anthropic/claude-sonnet-4-6",
api_key="your-api-key", # Or set ANTHROPIC_API_KEY
max_tokens=4096 # Required for Anthropic
)
@@ -364,12 +329,10 @@ mode: "wide"
from crewai import LLM
llm = LLM(
model="anthropic/claude-3-5-sonnet-20241022",
model="anthropic/claude-sonnet-4-6",
api_key="your-api-key",
base_url="https://api.anthropic.com", # Optional custom endpoint
temperature=0.7,
max_tokens=4096, # Required parameter
top_p=0.9,
stop_sequences=["END", "STOP"], # Anthropic uses stop_sequences
stream=True, # Enable streaming
timeout=60.0, # Request timeout in seconds
@@ -377,7 +340,7 @@ mode: "wide"
)
```
**التفكير الموسّع (Claude Sonnet 4 وما بعده):**
**التفكير الموسّع:**
يدعم CrewAI ميزة التفكير الموسّع من Anthropic، التي تتيح لـ Claude التفكير في المشكلات بطريقة أكثر شبهًا بالبشر قبل الاستجابة. مفيد بشكل خاص لمهام الاستدلال والتحليل وحل المشكلات المعقدة.
@@ -386,14 +349,14 @@ mode: "wide"
# Enable extended thinking with default settings
llm = LLM(
model="anthropic/claude-sonnet-4",
model="anthropic/claude-sonnet-4-6",
thinking={"type": "enabled"},
max_tokens=10000
)
# Configure thinking with budget control
llm = LLM(
model="anthropic/claude-sonnet-4",
model="anthropic/claude-sonnet-4-6",
thinking={
"type": "enabled",
"budget_tokens": 5000 # Limit thinking tokens
@@ -406,9 +369,7 @@ mode: "wide"
- `type`: عيّن إلى `"enabled"` لتفعيل وضع التفكير الموسّع
- `budget_tokens` (اختياري): أقصى رموز للتفكير (يساعد في التحكم بالتكاليف)
**النماذج التي تدعم التفكير الموسّع:**
- `claude-sonnet-4` والنماذج الأحدث
- `claude-3-7-sonnet` (مع قدرات التفكير الموسّع)
تختلف أوضاع التفكير والمعاملات المقبولة بين أجيال Claude. تحقق من قدرات النموذج المحدد قبل تفعيل `thinking`.
**متى تستخدم التفكير الموسّع:**
- الاستدلال المعقد وحل المشكلات متعددة الخطوات
@@ -424,7 +385,7 @@ mode: "wide"
**الميزات:**
- دعم استخدام الأدوات الأصلي لنماذج Claude 3+
- دعم التفكير الموسّع لـ Claude Sonnet 4+
- دعم التفكير الموسّع لنماذج Claude المتوافقة
- دعم البث للاستجابات في الوقت الفعلي
- معالجة تلقائية لرسائل النظام
- تسلسلات التوقف للتحكم في المخرجات
@@ -438,20 +399,7 @@ mode: "wide"
- يجب أن تكون الرسالة الأولى من المستخدم (يتم التعامل معها تلقائيًا)
- يجب أن تتناوب الرسائل بين المستخدم والمساعد
**النماذج المدعومة:**
| النموذج | نافذة السياق | الأفضل لـ |
|------------------------------|------------------|-----------------------------------------------|
| claude-sonnet-4 | 200,000 tokens | الأحدث مع قدرات التفكير الموسّع |
| claude-3-7-sonnet | 200,000 tokens | الاستدلال المتقدم والمهام الوكيلية |
| claude-3-5-sonnet-20241022 | 200,000 tokens | أحدث Sonnet بأفضل أداء |
| claude-3-5-haiku | 200,000 tokens | نموذج سريع وصغير للاستجابات السريعة |
| claude-3-opus | 200,000 tokens | الأكثر قدرة للمهام المعقدة |
| claude-3-sonnet | 200,000 tokens | توازن بين الذكاء والسرعة |
| claude-3-haiku | 200,000 tokens | الأسرع للمهام البسيطة |
| claude-2.1 | 200,000 tokens | سياق موسّع، هلوسات أقل |
| claude-2 | 100,000 tokens | نموذج متعدد الاستخدامات |
| claude-instant | 100,000 tokens | سريع وفعال من حيث التكلفة للمهام اليومية |
راجع [نظرة عامة على نماذج Anthropic](https://platform.claude.com/docs/en/about-claude/models/overview) للحصول على معرّفات النماذج وقدراتها الحالية، وراجع [جدول إيقاف النماذج](https://platform.claude.com/docs/en/about-claude/model-deprecations) قبل تثبيت نموذج في الإنتاج.
**ملاحظة:** لاستخدام Anthropic، ثبّت التبعيات المطلوبة:
```bash
@@ -483,9 +431,8 @@ mode: "wide"
from crewai import LLM
llm = LLM(
model="gemini/gemini-2.0-flash",
model="gemini/gemini-3.6-flash",
api_key="your-api-key", # Or set GOOGLE_API_KEY/GEMINI_API_KEY
temperature=0.7
)
```
@@ -494,11 +441,8 @@ mode: "wide"
from crewai import LLM
llm = LLM(
model="gemini/gemini-2.5-flash",
model="gemini/gemini-3.6-flash",
api_key="your-api-key",
temperature=0.7,
top_p=0.9,
top_k=40, # Top-k sampling parameter
max_output_tokens=8192,
stop_sequences=["END", "STOP"],
stream=True, # Enable streaming
@@ -524,8 +468,7 @@ mode: "wide"
from crewai import LLM
llm = LLM(
model="gemini/gemini-2.0-flash",
temperature=0.7
model="gemini/gemini-3.6-flash"
)
```
@@ -542,7 +485,7 @@ mode: "wide"
from crewai import LLM
llm = LLM(
model="gemini/gemini-1.5-pro",
model="gemini/gemini-3.6-flash",
project="your-gcp-project-id",
location="us-central1" # GCP region
)
@@ -555,7 +498,7 @@ mode: "wide"
- `GOOGLE_CLOUD_LOCATION`: موقع GCP (الافتراضي `us-central1`)
**الميزات:**
- دعم استدعاء الدوال الأصلي لنماذج Gemini 1.5+ و 2.x
- دعم أصلي لاستدعاء الدوال لنماذج Gemini المتوافقة
- دعم البث للاستجابات في الوقت الفعلي
- قدرات متعددة الوسائط (نص، صور، فيديو)
- إعداد إعدادات الأمان
@@ -563,41 +506,21 @@ mode: "wide"
- معالجة تلقائية لتعليمات النظام
- تتبع استخدام الرموز
**نماذج Gemini:**
| النموذج | نافذة السياق | الأفضل لـ |
|--------------------------------|-----------------|-------------------------------------------------------------------|
| gemini-2.5-flash | 1M tokens | التفكير التكيفي، كفاءة التكلفة |
| gemini-2.5-pro | 1M tokens | التفكير والاستدلال المحسّن، الفهم متعدد الوسائط |
| gemini-2.0-flash | 1M tokens | ميزات الجيل التالي، السرعة، التفكير |
| gemini-2.0-flash-thinking | 32,768 tokens | الاستدلال المتقدم مع عملية التفكير |
| gemini-2.0-flash-lite | 1M tokens | كفاءة التكلفة ووقت الاستجابة المنخفض |
| gemini-1.5-pro | 2M tokens | الأفضل أداءً، الاستدلال المنطقي، البرمجة |
| gemini-1.5-flash | 1M tokens | نموذج متعدد الوسائط متوازن، جيد لمعظم المهام |
| gemini-1.5-flash-8b | 1M tokens | الأسرع والأكثر كفاءة من حيث التكلفة |
| gemini-1.0-pro | 32,768 tokens | نموذج الجيل السابق |
تنشر Google معرّفات Gemini الحالية وقدراتها ومراحل دورة حياتها في [كتالوج نماذج Gemini](https://ai.google.dev/gemini-api/docs/models). تحقق من [جدول الإيقاف](https://ai.google.dev/gemini-api/docs/deprecations) قبل اختيار نموذج مستقر أو preview. وتستضيف Gemini API أيضًا [نماذج Gemma](https://ai.google.dev/gemma/docs).
**ملاحظة:** لاستخدام Google Gemini، ثبّت التبعيات المطلوبة:
```bash
uv add "crewai[google-genai]"
```
القائمة الكاملة للنماذج متاحة في [وثائق نماذج Gemini](https://ai.google.dev/gemini-api/docs/models).
</Accordion>
<Accordion title="Google (Vertex AI)">
احصل على بيانات الاعتماد من Google Cloud Console واحفظها في ملف JSON، ثم حمّلها بالكود التالي:
```python Code
import json
file_path = 'path/to/vertex_ai_service_account.json'
# Load the JSON file
with open(file_path, 'r') as file:
vertex_credentials = json.load(file)
# Convert the credentials to a JSON string
vertex_credentials_json = json.dumps(vertex_credentials)
صادِق باستخدام [بيانات الاعتماد التلقائية للتطبيق](https://cloud.google.com/docs/authentication/provide-credentials-adc)، ثم اضبط مزود Gemini الأصلي لاستخدام Vertex AI:
```toml .env
GOOGLE_GENAI_USE_VERTEXAI=true
GOOGLE_CLOUD_PROJECT=<your-project-id>
GOOGLE_CLOUD_LOCATION=<location>
```
مثال الاستخدام في مشروع CrewAI:
@@ -605,15 +528,15 @@ mode: "wide"
from crewai import LLM
llm = LLM(
model="gemini-1.5-pro-latest", # or vertex_ai/gemini-1.5-pro-latest
temperature=0.7,
vertex_credentials=vertex_credentials_json
model="gemini/gemini-3.6-flash"
)
```
**ملاحظة:** يستخدم هذا المزود LiteLLM. أضفه كتبعية لمشروعك:
تختلف إتاحة Vertex AI باختلاف المنطقة. استخدم [كتالوج نماذج Vertex AI](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models) للتحقق من معرّف النموذج والمنطقة قبل النشر.
**ملاحظة:** يستخدم هذا المسار تكامل Gemini الأصلي في CrewAI. أضفه كتبعية لمشروعك:
```bash
uv add 'crewai[litellm]'
uv add "crewai[google-genai]"
```
</Accordion>
@@ -664,7 +587,7 @@ mode: "wide"
from crewai import LLM
llm = LLM(
model="bedrock/anthropic.claude-3-5-sonnet-20241022-v2:0",
model="bedrock/us.anthropic.claude-sonnet-4-6",
region_name="us-east-1"
)
```
@@ -674,7 +597,7 @@ mode: "wide"
from crewai import LLM
llm = LLM(
model="bedrock/anthropic.claude-3-5-sonnet-20241022-v2:0",
model="bedrock/us.anthropic.claude-sonnet-4-6",
aws_access_key_id="your-access-key", # Or set AWS_ACCESS_KEY_ID
aws_secret_access_key="your-secret-key", # Or set AWS_SECRET_ACCESS_KEY
aws_session_token="your-session-token", # For temporary credentials
@@ -719,37 +642,9 @@ mode: "wide"
- يجب أن تكون الرسالة الأولى من المستخدم (يتم التعامل معها تلقائيًا)
- بعض النماذج (مثل Cohere) تتطلب أن تنتهي المحادثة برسالة المستخدم
[Amazon Bedrock](https://docs.aws.amazon.com/bedrock/latest/userguide/models-regions.html) هو خدمة مُدارة توفر الوصول إلى نماذج أساسية متعددة من أبرز شركات الذكاء الاصطناعي عبر واجهة API موحدة.
| النموذج | نافذة السياق | الأفضل لـ |
|-------------------------|----------------------|-------------------------------------------------------------------|
| Amazon Nova Pro | حتى 300k tokens | أداء عالٍ، نموذج يوازن بين الدقة والسرعة والفعالية من حيث التكلفة عبر مهام متنوعة. |
| Amazon Nova Micro | حتى 128k tokens | نموذج نصي فقط عالي الأداء وفعال من حيث التكلفة ومحسّن لأقل وقت استجابة. |
| Amazon Nova Lite | حتى 300k tokens | معالجة متعددة الوسائط بأسعار معقولة للصور والفيديو والنص مع قدرات في الوقت الفعلي. |
| Claude 3.7 Sonnet | حتى 128k tokens | الأفضل أداءً للاستدلال المعقد والبرمجة ووكلاء الذكاء الاصطناعي |
| Claude 3.5 Sonnet v2 | حتى 200k tokens | نموذج متطور متخصص في هندسة البرمجيات والقدرات الوكيلية والتفاعل مع الحاسوب بتكلفة محسّنة. |
| Claude 3.5 Sonnet | حتى 200k tokens | نموذج عالي الأداء يقدم ذكاءً واستدلالًا فائقين عبر مهام متنوعة مع توازن مثالي بين السرعة والتكلفة. |
| Claude 3.5 Haiku | حتى 200k tokens | نموذج متعدد الوسائط سريع وصغير محسّن للاستجابات السريعة والتفاعلات الشبيهة بالبشر |
| Claude 3 Sonnet | حتى 200k tokens | نموذج متعدد الوسائط يوازن بين الذكاء والسرعة للنشر بكميات كبيرة. |
| Claude 3 Haiku | حتى 200k tokens | نموذج متعدد الوسائط صغير وسريع محسّن للاستجابات السريعة والتفاعلات المحادثية الطبيعية |
| Claude 3 Opus | حتى 200k tokens | أكثر النماذج متعددة الوسائط تقدمًا يتفوق في المهام المعقدة بالاستدلال الشبيه بالبشر والفهم السياقي الفائق. |
| Claude 2.1 | حتى 200k tokens | إصدار محسّن بنافذة سياق موسّعة وموثوقية محسّنة وهلوسات أقل لتطبيقات النصوص الطويلة وRAG |
| Claude | حتى 100k tokens | نموذج متعدد الاستخدامات يتفوق في الحوار المتقدم والمحتوى الإبداعي واتباع التعليمات الدقيقة. |
| Claude Instant | حتى 100k tokens | نموذج سريع وفعال من حيث التكلفة للمهام اليومية مثل الحوار والتحليل والتلخيص والأسئلة والأجوبة |
| Llama 3.1 405B Instruct | حتى 128k tokens | نموذج LLM متقدم لتوليد البيانات الاصطناعية والتقطير والاستدلال لروبوتات المحادثة والبرمجة والمهام المتخصصة. |
| Llama 3.1 70B Instruct | حتى 128k tokens | يدعم المحادثات المعقدة مع فهم سياقي فائق واستدلال وتوليد نص. |
| Llama 3.1 8B Instruct | حتى 128k tokens | نموذج متطور مع فهم اللغة واستدلال فائق وتوليد النص. |
| Llama 3 70B Instruct | حتى 8k tokens | يدعم المحادثات المعقدة مع فهم سياقي فائق واستدلال وتوليد نص. |
| Llama 3 8B Instruct | حتى 8k tokens | نموذج LLM متطور مع فهم اللغة واستدلال فائق وتوليد النص. |
| Titan Text G1 - Lite | حتى 4k tokens | نموذج خفيف وفعال من حيث التكلفة محسّن لمهام اللغة الإنجليزية والضبط الدقيق مع التركيز على التلخيص وتوليد المحتوى. |
| Titan Text G1 - Express | حتى 8k tokens | نموذج متعدد الاستخدامات لمهام اللغة العامة والمحادثة وتطبيقات RAG مع دعم الإنجليزية وأكثر من 100 لغة. |
| Cohere Command | حتى 4k tokens | نموذج متخصص في اتباع أوامر المستخدم وتقديم حلول عملية للمؤسسات. |
| Jurassic-2 Mid | حتى 8,191 tokens | نموذج فعال من حيث التكلفة يوازن بين الجودة والسعر لمهام اللغة المتنوعة مثل الأسئلة والأجوبة والتلخيص وتوليد المحتوى. |
| Jurassic-2 Ultra | حتى 8,191 tokens | نموذج لتوليد النص المتقدم والفهم، يتفوق في المهام المعقدة مثل التحليل وإنشاء المحتوى. |
| Jamba-Instruct | حتى 256k tokens | نموذج بنافذة سياق موسّعة محسّن لتوليد النص الفعال من حيث التكلفة والتلخيص والأسئلة والأجوبة. |
| Mistral 7B Instruct | حتى 32k tokens | نموذج LLM يتبع التعليمات ويكمل الطلبات ويولد نصًا إبداعيًا. |
| Mistral 8x7B Instruct | حتى 32k tokens | نموذج LLM بمعمارية MOE يتبع التعليمات ويكمل الطلبات ويولد نصًا إبداعيًا. |
| DeepSeek R1 | 32,768 tokens | نموذج استدلال متقدم |
تختلف إتاحة نماذج Amazon Bedrock ومعرّفاتها باختلاف المنطقة. استخدم مرجع
[النماذج والمناطق المدعومة](https://docs.aws.amazon.com/bedrock/latest/userguide/models-regions.html)
لاختيار نموذج والتحقق من دعم Converse API.
**ملاحظة:** لاستخدام AWS Bedrock، ثبّت التبعيات المطلوبة:
```bash
@@ -806,81 +701,13 @@ mode: "wide"
مثال الاستخدام في مشروع CrewAI:
```python Code
llm = LLM(
model="nvidia_nim/meta/llama3-70b-instruct",
model="nvidia_nim/nvidia/nvidia-nemotron-3-ultra-550b-a55b",
temperature=0.7
)
```
يوفر Nvidia NIM مجموعة شاملة من النماذج لحالات الاستخدام المتنوعة، من المهام ذات الأغراض العامة إلى التطبيقات المتخصصة.
يتغير كتالوج NVIDIA NIM المستضاف باستمرار. استخدم [كتالوج نماذج NVIDIA NIM](https://build.nvidia.com/models) لاختيار endpoint حالي والتحقق من معرّف النموذج والوسائط وحدود السياق.
| النموذج | نافذة السياق | الأفضل لـ |
|-------------------------------------------------------------------------|----------------|-------------------------------------------------------------------|
| nvidia/mistral-nemo-minitron-8b-8k-instruct | 8,192 tokens | نموذج لغة صغير متطور يقدم دقة فائقة لروبوتات المحادثة والمساعدين الافتراضيين وتوليد المحتوى. |
| nvidia/nemotron-4-mini-hindi-4b-instruct | 4,096 tokens | نموذج لغة صغير ثنائي اللغة هندي-إنجليزي للاستدلال على الجهاز، مصمم خصيصًا للغة الهندية. |
| nvidia/llama-3.1-nemotron-70b-instruct | 128k tokens | مخصص لتعزيز فائدة الاستجابات |
| nvidia/llama3-chatqa-1.5-8b | 128k tokens | نموذج LLM متقدم لتوليد استجابات عالية الجودة ومدركة للسياق لروبوتات المحادثة ومحركات البحث. |
| nvidia/llama3-chatqa-1.5-70b | 128k tokens | نموذج LLM متقدم لتوليد استجابات عالية الجودة ومدركة للسياق لروبوتات المحادثة ومحركات البحث. |
| nvidia/vila | 128k tokens | نموذج رؤية-لغة متعدد الوسائط يفهم النص والصور والفيديو وينشئ استجابات غنية بالمعلومات |
| nvidia/neva-22 | 4,096 tokens | نموذج رؤية-لغة متعدد الوسائط يفهم النص والصور ويولد استجابات غنية بالمعلومات |
| nvidia/nemotron-mini-4b-instruct | 8,192 tokens | مهام ذات أغراض عامة |
| nvidia/usdcode-llama3-70b-instruct | 128k tokens | نموذج LLM متطور يجيب على استعلامات معرفة OpenUSD ويولد كود USD-Python. |
| nvidia/nemotron-4-340b-instruct | 4,096 tokens | ينشئ بيانات اصطناعية متنوعة تحاكي خصائص بيانات العالم الحقيقي. |
| meta/codellama-70b | 100k tokens | نموذج LLM قادر على توليد الكود من اللغة الطبيعية والعكس. |
| meta/llama2-70b | 4,096 tokens | نموذج لغة كبير متطور قادر على توليد النص والكود استجابة للمطالبات. |
| meta/llama3-8b-instruct | 8,192 tokens | نموذج LLM متطور مع فهم اللغة واستدلال فائق وتوليد النص. |
| meta/llama3-70b-instruct | 8,192 tokens | يدعم المحادثات المعقدة مع فهم سياقي فائق واستدلال وتوليد نص. |
| meta/llama-3.1-8b-instruct | 128k tokens | نموذج متطور مع فهم اللغة واستدلال فائق وتوليد النص. |
| meta/llama-3.1-70b-instruct | 128k tokens | يدعم المحادثات المعقدة مع فهم سياقي فائق واستدلال وتوليد نص. |
| meta/llama-3.1-405b-instruct | 128k tokens | نموذج LLM متقدم لتوليد البيانات الاصطناعية والتقطير والاستدلال لروبوتات المحادثة والبرمجة والمهام المتخصصة. |
| meta/llama-3.2-1b-instruct | 128k tokens | نموذج لغة صغير متطور مع فهم اللغة واستدلال فائق وتوليد النص. |
| meta/llama-3.2-3b-instruct | 128k tokens | نموذج لغة صغير متطور مع فهم اللغة واستدلال فائق وتوليد النص. |
| meta/llama-3.2-11b-vision-instruct | 128k tokens | نموذج لغة صغير متطور مع فهم اللغة واستدلال فائق وتوليد النص. |
| meta/llama-3.2-90b-vision-instruct | 128k tokens | نموذج لغة صغير متطور مع فهم اللغة واستدلال فائق وتوليد النص. |
| google/gemma-7b | 8,192 tokens | نموذج متطور لتوليد النص وفهمه وتحويله وتوليد الكود. |
| google/gemma-2b | 8,192 tokens | نموذج متطور لتوليد النص وفهمه وتحويله وتوليد الكود. |
| google/codegemma-7b | 8,192 tokens | نموذج متطور مبني على Gemma-7B من Google متخصص في توليد الكود وإكماله. |
| google/codegemma-1.1-7b | 8,192 tokens | نموذج برمجة متقدم لتوليد الكود وإكماله والاستدلال واتباع التعليمات. |
| google/recurrentgemma-2b | 8,192 tokens | نموذج لغة بمعمارية تكرارية جديدة لاستدلال أسرع عند توليد تسلسلات طويلة. |
| google/gemma-2-9b-it | 8,192 tokens | نموذج متطور لتوليد النص وفهمه وتحويله وتوليد الكود. |
| google/gemma-2-27b-it | 8,192 tokens | نموذج متطور لتوليد النص وفهمه وتحويله وتوليد الكود. |
| google/gemma-2-2b-it | 8,192 tokens | نموذج متطور لتوليد النص وفهمه وتحويله وتوليد الكود. |
| google/deplot | 512 tokens | نموذج فهم لغة بصرية بلقطة واحدة يترجم صور الرسوم البيانية إلى جداول. |
| google/paligemma | 8,192 tokens | نموذج لغة بصري بارع في استيعاب مدخلات النص والصور لإنتاج استجابات غنية بالمعلومات. |
| mistralai/mistral-7b-instruct-v0.2 | 32k tokens | نموذج LLM يتبع التعليمات ويكمل الطلبات ويولد نصًا إبداعيًا. |
| mistralai/mixtral-8x7b-instruct-v0.1 | 8,192 tokens | نموذج LLM بمعمارية MOE يتبع التعليمات ويكمل الطلبات ويولد نصًا إبداعيًا. |
| mistralai/mistral-large | 4,096 tokens | ينشئ بيانات اصطناعية متنوعة تحاكي خصائص بيانات العالم الحقيقي. |
| mistralai/mixtral-8x22b-instruct-v0.1 | 8,192 tokens | ينشئ بيانات اصطناعية متنوعة تحاكي خصائص بيانات العالم الحقيقي. |
| mistralai/mistral-7b-instruct-v0.3 | 32k tokens | نموذج LLM يتبع التعليمات ويكمل الطلبات ويولد نصًا إبداعيًا. |
| nv-mistralai/mistral-nemo-12b-instruct | 128k tokens | أكثر نموذج لغة تقدمًا للاستدلال والبرمجة والمهام متعددة اللغات؛ يعمل على وحدة GPU واحدة. |
| mistralai/mamba-codestral-7b-v0.1 | 256k tokens | نموذج للكتابة والتفاعل مع الكود عبر مجموعة واسعة من لغات البرمجة والمهام. |
| microsoft/phi-3-mini-128k-instruct | 128K tokens | نموذج LLM مفتوح خفيف ومتطور مع مهارات قوية في الرياضيات والاستدلال المنطقي. |
| microsoft/phi-3-mini-4k-instruct | 4,096 tokens | نموذج LLM مفتوح خفيف ومتطور مع مهارات قوية في الرياضيات والاستدلال المنطقي. |
| microsoft/phi-3-small-8k-instruct | 8,192 tokens | نموذج LLM مفتوح خفيف ومتطور مع مهارات قوية في الرياضيات والاستدلال المنطقي. |
| microsoft/phi-3-small-128k-instruct | 128K tokens | نموذج LLM مفتوح خفيف ومتطور مع مهارات قوية في الرياضيات والاستدلال المنطقي. |
| microsoft/phi-3-medium-4k-instruct | 4,096 tokens | نموذج LLM مفتوح خفيف ومتطور مع مهارات قوية في الرياضيات والاستدلال المنطقي. |
| microsoft/phi-3-medium-128k-instruct | 128K tokens | نموذج LLM مفتوح خفيف ومتطور مع مهارات قوية في الرياضيات والاستدلال المنطقي. |
| microsoft/phi-3.5-mini-instruct | 128K tokens | نموذج LLM خفيف متعدد اللغات يدعم تطبيقات الذكاء الاصطناعي في البيئات المحدودة بالكمون والذاكرة والحوسبة |
| microsoft/phi-3.5-moe-instruct | 128K tokens | نموذج LLM متقدم يعتمد على معمارية خليط الخبراء لتوليد محتوى فعال حوسبيًا |
| microsoft/kosmos-2 | 1,024 tokens | نموذج متعدد الوسائط رائد مصمم لفهم العناصر المرئية في الصور والاستدلال عليها. |
| microsoft/phi-3-vision-128k-instruct | 128k tokens | نموذج متعدد الوسائط مفتوح متطور يتفوق في الاستدلال عالي الجودة من الصور. |
| microsoft/phi-3.5-vision-instruct | 128k tokens | نموذج متعدد الوسائط مفتوح متطور يتفوق في الاستدلال عالي الجودة من الصور. |
| databricks/dbrx-instruct | 12k tokens | نموذج LLM للأغراض العامة بأداء متطور في فهم اللغة والبرمجة وRAG. |
| snowflake/arctic | 1,024 tokens | يقدم استدلالًا عالي الكفاءة لتطبيقات المؤسسات مع التركيز على توليد SQL والبرمجة. |
| aisingapore/sea-lion-7b-instruct | 4,096 tokens | نموذج LLM لتمثيل وخدمة التنوع اللغوي والثقافي لجنوب شرق آسيا |
| ibm/granite-8b-code-instruct | 4,096 tokens | نموذج LLM لبرمجة البرمجيات لتوليد الكود وإكماله وشرحه والتحويل متعدد الأدوار. |
| ibm/granite-34b-code-instruct | 8,192 tokens | نموذج LLM لبرمجة البرمجيات لتوليد الكود وإكماله وشرحه والتحويل متعدد الأدوار. |
| ibm/granite-3.0-8b-instruct | 4,096 tokens | نموذج لغة صغير متقدم يدعم RAG والتلخيص والتصنيف والكود والذكاء الاصطناعي الوكيلي |
| ibm/granite-3.0-3b-a800m-instruct | 4,096 tokens | نموذج خليط خبراء عالي الكفاءة لـ RAG والتلخيص واستخراج الكيانات والتصنيف |
| mediatek/breeze-7b-instruct | 4,096 tokens | ينشئ بيانات اصطناعية متنوعة تحاكي خصائص بيانات العالم الحقيقي. |
| upstage/solar-10.7b-instruct | 4,096 tokens | يتفوق في مهام NLP، خاصة في اتباع التعليمات والاستدلال والرياضيات. |
| writer/palmyra-med-70b-32k | 32k tokens | نموذج LLM رائد للاستجابات الدقيقة والمناسبة للسياق في المجال الطبي. |
| writer/palmyra-med-70b | 32k tokens | نموذج LLM رائد للاستجابات الدقيقة والمناسبة للسياق في المجال الطبي. |
| writer/palmyra-fin-70b-32k | 32k tokens | نموذج LLM متخصص في التحليل المالي وإعداد التقارير ومعالجة البيانات |
| 01-ai/yi-large | 32k tokens | نموذج قوي مدرب على الإنجليزية والصينية لمهام متنوعة بما في ذلك روبوتات المحادثة والكتابة الإبداعية. |
| deepseek-ai/deepseek-coder-6.7b-instruct | 2k tokens | نموذج برمجة قوي يقدم قدرات متقدمة في توليد الكود وإكماله وملء الفراغات |
| rakuten/rakutenai-7b-instruct | 1,024 tokens | نموذج LLM متطور مع فهم اللغة واستدلال فائق وتوليد النص. |
| rakuten/rakutenai-7b-chat | 1,024 tokens | نموذج LLM متطور مع فهم اللغة واستدلال فائق وتوليد النص. |
| baichuan-inc/baichuan2-13b-chat | 4,096 tokens | يدعم المحادثة بالصينية والإنجليزية والبرمجة والرياضيات واتباع التعليمات وحل الألغاز |
**ملاحظة:** يستخدم هذا المزود LiteLLM. أضفه كتبعية لمشروعك:
```bash
@@ -943,15 +770,12 @@ mode: "wide"
مثال الاستخدام في مشروع CrewAI:
```python Code
llm = LLM(
model="groq/llama-3.2-90b-text-preview",
model="groq/qwen/qwen3.6-27b",
temperature=0.7
)
```
| النموذج | نافذة السياق | الأفضل لـ |
|-------------------|------------------|--------------------------------------------|
| Llama 3.1 70B/8B | 131,072 tokens | مهام عالية الأداء بسياق كبير |
| Llama 3.2 Series | 8,192 tokens | مهام ذات أغراض عامة |
| Mixtral 8x7B | 32,768 tokens | أداء متوازن وسياق جيد |
تميز Groq بين نماذج production وpreview وتسحب معرّفات النماذج بانتظام. تحقق من [كتالوج نماذج Groq](https://console.groq.com/docs/models) و[صفحة الإيقاف](https://console.groq.com/docs/deprecations) قبل اختيار نموذج للإنتاج.
**ملاحظة:** يستخدم هذا المزود LiteLLM. أضفه كتبعية لمشروعك:
```bash
@@ -1033,11 +857,12 @@ mode: "wide"
مثال الاستخدام في مشروع CrewAI:
```python Code
llm = LLM(
model="llama-3.1-sonar-large-128k-online",
base_url="https://api.perplexity.ai/"
model="perplexity/sonar-pro"
)
```
راجع [كتالوج نماذج Perplexity](https://docs.perplexity.ai/getting-started/models) و[changelog](https://docs.perplexity.ai/docs/resources/changelog) للحصول على معرّفات النماذج الحالية وإشعارات الإيقاف.
**ملاحظة:** يستخدم هذا المزود LiteLLM. أضفه كتبعية لمشروعك:
```bash
uv add 'crewai[litellm]'
@@ -1073,17 +898,12 @@ mode: "wide"
مثال الاستخدام في مشروع CrewAI:
```python Code
llm = LLM(
model="sambanova/Meta-Llama-3.1-8B-Instruct",
model="sambanova/Meta-Llama-3.3-70B-Instruct",
temperature=0.7
)
```
| النموذج | نافذة السياق | الأفضل لـ |
|--------------------|------------------------|----------------------------------------------|
| Llama 3.1 70B/8B | حتى 131,072 tokens | مهام عالية الأداء بسياق كبير |
| Llama 3.1 405B | 8,192 tokens | أداء عالٍ وجودة مخرجات |
| Llama 3.2 Series | 8,192 tokens | مهام عامة ومتعددة الوسائط |
| Llama 3.3 70B | حتى 131,072 tokens | أداء عالٍ وجودة مخرجات |
| Qwen2 familly | 8,192 tokens | أداء عالٍ وجودة مخرجات |
قد تتغير النماذج المستضافة في SambaNova Cloud بصورة مستقلة عن CrewAI. استعلم من [models endpoint](https://docs.sambanova.ai/docs/api-reference/models/get-environments-available-model-list-metadata) وراجع [دليل الإيقاف](https://docs.sambanova.ai/docs/en/models/deprecations) قبل النشر.
**ملاحظة:** يستخدم هذا المزود LiteLLM. أضفه كتبعية لمشروعك:
```bash
@@ -1101,7 +921,7 @@ mode: "wide"
مثال الاستخدام في مشروع CrewAI:
```python Code
llm = LLM(
model="cerebras/llama3.1-70b",
model="cerebras/gpt-oss-120b",
temperature=0.7,
max_tokens=8192
)
@@ -1115,6 +935,8 @@ mode: "wide"
- دعم نوافذ سياق طويلة
</Info>
راجع [كتالوج نماذج Cerebras](https://inference-docs.cerebras.ai/models/overview) و[إشعارات الإيقاف](https://inference-docs.cerebras.ai/support/deprecation) للحصول على معرّفات endpoints العامة الحالية.
**ملاحظة:** يستخدم هذا المزود LiteLLM. أضفه كتبعية لمشروعك:
```bash
uv add 'crewai[litellm]'
@@ -1189,7 +1011,7 @@ mode: "wide"
# Create an LLM with streaming enabled
llm = LLM(
model="openai/gpt-4o",
model="openai/gpt-5.6-terra",
stream=True # Enable streaming
)
```
@@ -1239,7 +1061,7 @@ mode: "wide"
my_listener = MyCustomListener()
llm = LLM(model="gpt-4o-mini", temperature=0, stream=True)
llm = LLM(model="openai/gpt-5.6-terra", stream=True)
researcher = Agent(
role="About User",
@@ -1319,6 +1141,8 @@ mode: "wide"
يدعم CrewAI الاستجابات المهيكلة من استدعاءات LLM من خلال السماح لك بتحديد `response_format` باستخدام نموذج Pydantic. يمكّن هذا الإطار من تحليل المخرجات والتحقق منها تلقائيًا، مما يسهّل دمج الاستجابة في تطبيقك دون معالجة لاحقة يدوية.
يختلف دعم المخرجات المهيكلة باختلاف المزوّد والنموذج. اختبر النموذج الذي اخترته قبل الاعتماد على الاستجابات المهيكلة في بيئة الإنتاج.
```python Code
from crewai import LLM
@@ -1328,7 +1152,7 @@ class Dog(BaseModel):
breed: str
llm = LLM(model="gpt-4o", response_format=Dog)
llm = LLM(model="openai/gpt-5.6-terra", response_format=Dog)
response = llm.call(
"Analyze the following messages and return the name, age, and breed. "
@@ -1357,8 +1181,8 @@ print(response)
# 3. Task splitting for large contexts
llm = LLM(
model="gpt-4",
max_tokens=4000, # Limit response length
model="openai/gpt-5.6-terra",
max_completion_tokens=4000, # Limit response length
)
```
@@ -1382,15 +1206,14 @@ print(response)
```python
# Configure model with appropriate settings
llm = LLM(
model="openai/gpt-4-turbo-preview",
temperature=0.7, # Adjust based on task
max_tokens=4096, # Set based on output needs
timeout=300 # Longer timeout for complex tasks
model="openai/gpt-5.6-terra",
reasoning_effort="medium",
max_completion_tokens=4096,
timeout=300
)
```
<Tip>
- درجة حرارة منخفضة (0.1 إلى 0.3) للاستجابات الواقعية
- درجة حرارة عالية (0.7 إلى 0.9) للمهام الإبداعية
استخدم عناصر التحكم التي يدعمها النموذج المحدد. حسب المزود، قد تكون `temperature` أو مستوى reasoning أو thinking، أو تعليمات prompt تحدد الأسلوب والتباين المطلوبين.
</Tip>
</Step>

View File

@@ -24,15 +24,23 @@ mode: "wide"
## البداية السريعة
### 1. إنشاء مجلد المهارة
### 1. إنشاء مهارة باستخدام سطر الأوامر (CLI)
واجهة سطر الأوامر هي الطريقة المدعومة لإنشاء مهارة — فهي تُنشئ لك هيكل المجلد وملف `SKILL.md` صالحًا:
```shell Terminal
crewai skill create code-review
```
داخل مشروع طاقم (حيث يوجد `pyproject.toml`) يُنشئ هذا الأمر `./skills/code-review/`؛ وخارج المشروع يُنشئ `./code-review/` في المجلد الحالي (يمكنك فرض هذا السلوك باستخدام `--no-project`):
```
skills/
└── code-review/
├── SKILL.md # مطلوب — التعليمات
├── references/ # اختياري — مستندات مرجعية
│ └── style-guide.md
└── scripts/ # اختياري — سكربتات قابلة للتنفيذ
├── SKILL.md # Required — instructions (pre-filled template)
├── references/ # Optional — reference docs
├── scripts/ # Optional — executable scripts
└── assets/ # Optional — static files
```
### 2. كتابة SKILL.md الخاص بك
@@ -164,6 +172,65 @@ agent = Agent(
---
## إنشاء المهارات ونشرها وتثبيتها
للمهارات دورة حياة كاملة تُدار عبر واجهة سطر الأوامر: **أنشئها باستخدام `crewai skill create`، وانشرها باستخدام `crewai skill publish`** — إنشاء المجلدات يدويًا يصلح للتجارب المحلية، لكن واجهة سطر الأوامر هي سير العمل المقصود، وهي تحافظ على صحة هيكل المهارة وبياناتها الوصفية.
### الإنشاء
```shell Terminal
crewai skill create my-skill
```
يُنشئ هذا الأمر المجلد (داخل `./skills/` في مشروع الطاقم) مع قالب `SKILL.md`، بالإضافة إلى مجلدات فارغة `scripts/` و `references/` و `assets/`. عدّل `SKILL.md` لتعريف التعليمات.
### النشر
نفّذ الأمر من داخل مجلد المهارة (حيث يوجد `SKILL.md`):
```shell Terminal
cd skills/my-skill
crewai skill publish
```
يقرأ النشر الحقول `name` و `description` و `metadata.version` من البيانات الوصفية في مقدمة `SKILL.md` ويدفع المهارة إلى سجل CrewAI. **المهارات المنشورة تكون دائمًا مقيّدة بنطاق مؤسستك** — مثل الأدوات، لا يستطيع رؤيتها وتثبيتها إلا أعضاء المؤسسة الناشرة؛ ولا توجد رؤية عامة. أعلام مفيدة:
| العلم | التأثير |
| :--- | :--- |
| `--org <slug>` | النشر تحت مؤسسة محددة (يتجاوز الإعدادات). |
| `--force` | تخطي التحقق من حالة git (تغييرات غير مُثبتة، إلخ). |
### التثبيت
ثبّت مهارة منشورة عبر مرجعها `@org/name`:
```shell Terminal
crewai skill install @acme/code-review
```
داخل مشروع الطاقم تُثبَّت المهارة في `./skills/{name}/`؛ وخارج المشروع تذهب إلى ذاكرة التخزين المؤقتة المشتركة في `~/.crewai/skills/{org}/{name}/`.
يمكن للوكلاء أيضًا الإشارة إلى مهارات السجل مباشرة — يتم حلّها من ذاكرة التخزين المؤقتة المحلية (أو من مجلد `skills/` في المشروع) وقت التشغيل:
```python
agent = Agent(
role="Senior Code Reviewer",
goal="Review pull requests for quality and security issues",
backstory="Staff engineer with expertise in secure coding practices.",
skills=["@acme/code-review"], # registry ref, resolved locally
)
```
### عرض القائمة
```shell Terminal
crewai skill list
```
يعرض المهارات المثبّتة من مجلد المشروع `./skills/` ومن ذاكرة التخزين المؤقتة العامة معًا، مع إصداراتها ومساراتها.
---
## المهارات على مستوى الطاقم
يمكن تعيين المهارات على الطاقم لتُطبّق على **جميع الوكلاء**:

View File

@@ -0,0 +1,123 @@
---
title: التدفقات في الاستوديو
description: "أنشئ سير عمل يعتمد على الأحداث يجمع بين التحكم الحتمي خطوة بخطوة والذكاء الوكيلي — دون كتابة أي كود."
icon: "diagram-project"
mode: "wide"
---
<Info>
**الطرح جارٍ حاليًا**: يجري طرح التدفقات في الاستوديو تدريجيًا خلال أسبوع 20 يوليو 2026. إذا لم يظهر لك خيار Flows في الاستوديو بعد، فهذا يعني أن الميزة لم تصل إلى مؤسستك بعد — عاود التحقق قريبًا.
</Info>
## نظرة عامة
يدعم الاستوديو الآن إنشاء **التدفقات (Flows)** إلى جانب فرق Crew. التدفقات هي سير عمل يعتمد على الأحداث تتحكم فيه بدقة في الخطوات التي تُنفَّذ وترتيبها وشروط تنفيذها — بينما تُفوِّض العمل الذكي داخل كل خطوة إلى وكلاء الذكاء الاصطناعي.
لإنشاء تدفق، افتح الاستوديو وصف الأتمتة التي تريدها، ثم اختر **Flows** من المحدد بجوار مربع الإدخال.
<Frame>
![محدد التدفقات في الاستوديو](/images/enterprise/studio-flows-selector.png)
</Frame>
## لماذا التدفقات؟
فرق Crew ممتازة عندما تريد أن يتعاون فريق من الوكلاء بشكل مستقل نحو هدف. لكن كثيرًا من الأتمتة الواقعية يحتاج إلى قدر أكبر من القابلية للتنبؤ: اجلب هذه البيانات أولًا، ثم لخصها، ثم انشر النتيجة — في كل مرة وبنفس الترتيب.
تمنحك التدفقات الأمرين معًا:
- **الحتمية حيث تهم**: تُنفَّذ الخطوات وفق تسلسل محدد وتفرعات صريحة، فتكون عمليات التشغيل قابلة للتنبؤ والتكرار وسهلة التصحيح.
- **الذكاء حيث تحتاجه**: كل خطوة يشغّلها وكيل (أو فريق Crew كامل)، لذا يستفيد العمل داخل الخطوة — التلخيص والتقييم والصياغة واتخاذ القرار — من قدرات الاستدلال الكاملة للنموذج اللغوي.
هذا المزيج هو ما يجعل التدفقات مناسبة للأتمتة في بيئات الإنتاج: البنية مضمونة، والاستقلالية محصورة في الخطوات التي تحتاجها.
## إنشاء تدفق
صف ما تريده بلغة طبيعية وسيصمم مساعد الاستوديو (Studio Assistant) التدفق لك — بإنشاء الخطوات وربطها ببعضها وتهيئة الوكلاء وتكاملات التطبيقات التي تحتاجها كل خطوة. تعرض اللوحة (Canvas) على اليمين سير العمل الناتج كعُقد متصلة، ويمكنك مواصلة التحسين عبر المحادثة أو تعديل أي عقدة مباشرة.
<Frame>
![لوحة التدفق مع مساعد الاستوديو](/images/enterprise/studio-flows-agent-node.png)
</Frame>
عندما تكون جاهزًا، استخدم **Run** لاختبار التدفق من البداية إلى النهاية، وافحص النتائج في تبويبي **Output** و**Traces**، ثم نفّذ **Deploy** عندما يستقر. يمكنك أيضًا مشاركة المشروع عبر **Share** أو تنزيل الكود المصدري عبر **Download**.
## أنواع العُقد
تتكون التدفقات من ثلاثة أنواع أساسية من العُقد. كل عقدة هي خطوة في سير العمل، ويمكنك المزج بينها بحرية.
### الوكيل المنفرد (Single Agent)
تُشغِّل عقدة Single Agent وكيلًا واحدًا لمهمة واحدة مركزة — وهي مثالية للخطوات محددة النطاق مثل جلب البيانات من تكامل، أو تحويل المحتوى، أو نشر رسالة.
عند النقر على عقدة الوكيل تُفتح تهيئتها الكاملة:
- **Task**: ما ينبغي أن تنجزه هذه الخطوة والمخرجات التي يجب أن تنتجها
- **Profile**: دور الوكيل وهدفه وخلفيته
- **Model**: النموذج اللغوي الذي يشغّل الوكيل
- **Apps**: التكاملات التي يمكن للوكيل استخدامها (مثل Linear وSlack وHubSpot)
- **Runtime Controls**: خيارات التخطيط قبل التنفيذ والتفويض والذاكرة
<Frame>
![تهيئة عقدة الوكيل المنفرد](/images/enterprise/studio-flows-agent-config.png)
</Frame>
### فرق Crew
تُضمِّن عقدة Crew فريقًا كاملًا — عدة وكلاء يتعاونون عبر عدة مهام — كخطوة واحدة في تدفقك. استخدمها عندما تكون الخطوة أكبر من أن يتولاها وكيل واحد، مثل تجميع البيانات وتلخيصها حسب الفريق ثم تنسيق النتيجة للتسليم.
<Frame>
![عقدة Crew داخل تدفق](/images/enterprise/studio-flows-crew-node.png)
</Frame>
يكشف فتح عقدة Crew عن بنيتها الداخلية: المهام التي تؤديها، والوكلاء المعيّنين لكل مهمة، والتطبيقات التي يستخدمونها. يعمل الفريق بشكل مستقل داخل الخطوة، ثم يسلّم مخرجاته إلى العقدة التالية في التدفق.
<Frame>
![داخل عقدة Crew](/images/enterprise/studio-flows-crew-detail.png)
</Frame>
هذا هو نمط الحتمية مع الذكاء الوكيلي عمليًا: يضمن التدفق *متى* يعمل الفريق، بينما يضيف الفريق ذكاءً تعاونيًا إلى *كيفية* إنجاز العمل.
### الموجِّه (Router)
تُفرِّع عقدة Router التدفق بناءً على شروط، بحيث تسلك النتائج المختلفة مسارات مختلفة. على سبيل المثال، يمكن لتدفق توجيه العملاء المحتملين تقييم العملاء الواردين ثم توجيه ذوي الجودة العالية إلى خطوة إسناد المبيعات، مع تسجيل البقية للمتابعة والرعاية لاحقًا.
<Frame>
![عقدة الموجّه مع تفرعات شرطية](/images/enterprise/studio-flows-router-node.png)
</Frame>
الموجِّهات هي ما يجعل التدفقات معتمدة على الأحداث فعليًا: يتعامل سير العمل نفسه مع كل الحالات، لكن كل عملية تشغيل تتبع فقط الفرع الذي تستدعيه بياناتها — بلا خطوات مهدرة ولا غموض حول ما سيحدث تاليًا.
## المزامنة مع مستودع الوكلاء
لا يلزم أن يبقى الوكلاء الذين تنشئهم في التدفقات حبيسي مشروع واحد. تتضمن كل عقدة وكيل زر **Publish to Agent Repository** الذي يحفظ الوكيل — بدوره وهدفه وخلفيته ونموذجه وتهيئته — في [مستودع الوكلاء](/ar/enterprise/features/agent-repositories) الخاص بمؤسستك.
يعمل هذا في الاتجاهين:
- **النشر**: رقِّ وكيلًا حسّنته داخل تدفق إلى المستودع ليتمكن باقي الفرق والمشاريع من إعادة استخدامه.
- **السحب**: أدخِل وكيلًا موجودًا من المستودع إلى تدفق جديد بدلًا من إعادة بنائه من الصفر.
ولأن وكلاء المستودع متزامنون عبر مؤسستك كلها، فإن أي تحسين على وكيل مشترك يعود بالنفع على كل تدفق يستخدمه — مما يحافظ على سلوك وكلاء متسق وخاضع للحوكمة وخالٍ من ازدواجية الجهد.
## أفضل الممارسات
- **اختر التدفق** عندما يكون للأتمتة تسلسل واضح أو منطق تفرّع؛ واختر Crew عندما يكون الطريق إلى الهدف مفتوحًا.
- **أبقِ مهام الوكلاء مركزة** — عقدة Single Agent بوصف مهمة محكم أكثر موثوقية من وكيل مطلوب منه ثلاثة أشياء.
- **استخدم الموجّهات لمعالجة كل حالة صراحةً**، بما في ذلك مسار "عدم فعل شيء" (مثل تسجيل العملاء المتجاوزين)، حتى تكون كل عمليات التشغيل محسوبة بالكامل.
- **انشر الوكلاء المستقرين في مستودع الوكلاء** لتبني مؤسستك مكتبة مشتركة بدلًا من نسخ متوازية لمرة واحدة.
- **اختبر عبر Run وافحص Traces** قبل النشر لاكتشاف مشكلات التكامل أو الموجِّهات النصية مبكرًا.
## ذات صلة
<CardGroup cols={4}>
<Card title="استوديو الطاقم" href="/ar/enterprise/features/crew-studio" icon="pencil">
أنشئ فرق Crew في الاستوديو.
</Card>
<Card title="مستودعات الوكلاء" href="/ar/enterprise/features/agent-repositories" icon="people-group">
شارك الوكلاء وأعد استخدامهم عبر مؤسستك.
</Card>
<Card title="مفاهيم التدفقات" href="/ar/concepts/flows" icon="diagram-project">
تعرّف على كيفية عمل التدفقات في إطار عمل CrewAI.
</Card>
<Card title="الأدوات والتكاملات" href="/ar/enterprise/features/tools-and-integrations" icon="plug">
اربط التطبيقات التي يستخدمها وكلاؤك.
</Card>
</CardGroup>

View File

@@ -11,7 +11,7 @@ mode: "wide"
لا نزال نعمل على تحسين الأدوات، لذا قد يحدث سلوك غير متوقع أو تغييرات في المستقبل.
</Note>
تمثل أداة FileReadTool مفهومياً مجموعة من الوظائف ضمن حزمة crewai_tools تهدف إلى تسهيل قراءة الملفات واسترجاع المحتوى. تتضمن هذه المجموعة أدوات لمعالجة ملفات نصية دفعية، وقراءة ملفات التكوين أثناء التشغيل، واستيراد البيانات للتحليلات. تدعم مجموعة متنوعة من صيغ الملفات النصية مثل `.txt` و `.csv` و `.json` وغيرها. اعتماداً على نوع الملف، توفر المجموعة وظائف متخصصة، مثل تحويل محتوى JSON إلى قاموس Python لسهولة الاستخدام.
تمثل أداة FileReadTool مفهوميًا مجموعة من الوظائف ضمن حزمة crewai_tools تهدف إلى تسهيل قراءة الملفات واسترجاع المحتوى. تتضمن هذه المجموعة أدوات لمعالجة ملفات نصية دفعية، وقراءة ملفات التكوين أثناء التشغيل، واستيراد البيانات للتحليلات. تدعم مجموعة متنوعة من صيغ الملفات النصية مثل `.txt` و `.csv` و `.json` وغيرها. يُعاد المحتوى دائمًا نصًا عاديًا.
## التثبيت

View File

@@ -30,7 +30,11 @@ from crewai_tools import FileWriterTool
file_writer_tool = FileWriterTool()
# Write content to a file in a specified directory
result = file_writer_tool._run('example.txt', 'This is a test content.', 'test_directory')
result = file_writer_tool.run(
filename='example.txt',
content='This is a test content.',
directory='test_directory',
)
print(result)
```

View File

@@ -4,6 +4,163 @@ description: "Product updates, improvements, and bug fixes for CrewAI"
icon: "clock"
mode: "wide"
---
<Update label="Jul 29, 2026">
## v1.15.9
[View release on GitHub](https://github.com/crewAIInc/crewAI/releases/tag/1.15.9)
## What's Changed
### Features
- Surface tool failures instead of reporting them as success
- Emit FlowFailedEvent when a flow execution fails
- Implement progressive disclosure for skills
### Documentation
- Update snapshot and changelog for v1.15.8
## Contributors
@github-actions[bot], @joaomdmoura, @lorenzejay, @lucasgomide
</Update>
<Update label="Jul 28, 2026">
## v1.15.8
[View release on GitHub](https://github.com/crewAIInc/crewAI/releases/tag/1.15.8)
## What's Changed
### Features
- Add WaitTool for pausing on long-running jobs.
### Bug Fixes
- Fix FileWriterTool writes and address rough edges in file tool.
- Mark E2B_API_KEY as a required env var for E2B tools.
### Documentation
- Refresh model availability guidance.
## Contributors
@github-actions[bot], @joaomdmoura, @lucasgomide, @oalami, @thiagomoretto
</Update>
<Update label="Jul 26, 2026">
## v1.15.7
[View release on GitHub](https://github.com/crewAIInc/crewAI/releases/tag/1.15.7)
## What's Changed
### Bug Fixes
- Resolve registry skills through the runtime's CrewAI+ client
- Recover from the GPT-5.6 tools + reasoning_effort 400
- Make tool calling work on the Responses API path
- Route responses-only models instead of failing with 404
- Bump bedrock-agentcore to patch CVE-2026-16796
### Observability
- Emit skill usage events at runtime for observability
### Documentation
- Add snapshot and changelog for v1.15.7a1
## Contributors
@alex-clawd, @joaomdmoura, @lorenzejay
</Update>
<Update label="Jul 26, 2026">
## v1.15.7a1
[View release on GitHub](https://github.com/crewAIInc/crewAI/releases/tag/1.15.7a1)
## What's Changed
### Bug Fixes
- Fix registry skills resolution through the runtime's CrewAI+ client.
- Recover from the GPT-5.6 tools and reasoning_effort 400 errors.
- Make tool calling work on the Responses API path.
- Route responses-only models to prevent 404 errors.
- Bump bedrock-agentcore dependency to patch CVE-2026-16796.
### Observability
- Emit skill usage events at runtime for improved observability.
### Documentation
- Snapshot and changelog updates for version 1.15.6.
## Contributors
@alex-clawd, @joaomdmoura, @lorenzejay
</Update>
<Update label="Jul 24, 2026">
## v1.15.6
[View release on GitHub](https://github.com/crewAIInc/crewAI/releases/tag/1.15.6)
## What's Changed
### Bug Fixes
- Fix detection of Anthropic preview tool-use blocks.
- Preserve strict tool schema property names.
- Dispatch execution_end hook on failed crew and flow executions.
- Handle async get_agent in load_agent_from_repository.
- Fix dependency resolution issues.
### Documentation
- Snapshot and changelog for v1.15.5.
## Contributors
@alex-clawd, @iris-clawd, @lorenzejay, @lucasgomide, @theCyberTech, @vinibrsl
</Update>
<Update label="Jul 20, 2026">
## v1.15.5
[View release on GitHub](https://github.com/crewAIInc/crewAI/releases/tag/1.15.5)
## What's Changed
### Features
- Authenticate skill registry downloads
### Documentation
- Update snapshot and changelog for v1.15.4
## Contributors
@vinibrsl
</Update>
<Update label="Jul 17, 2026">
## v1.15.4
[View release on GitHub](https://github.com/crewAIInc/crewAI/releases/tag/1.15.4)
## What's Changed
### Features
- Promote Skills Repository out of experimental status
### Documentation
- Add Flows in Studio documentation
## Contributors
@jessemiller, @joaomdmoura, @vinibrsl
</Update>
<Update label="Jul 16, 2026">
## v1.15.3

View File

@@ -256,6 +256,7 @@ CrewAI provides a wide range of events that you can listen for:
- **FlowCreatedEvent**: Emitted when a Flow is created
- **FlowStartedEvent**: Emitted when a Flow starts execution
- **FlowFinishedEvent**: Emitted when a Flow completes execution
- **FlowFailedEvent**: Emitted when a Flow execution fails. Contains the flow name and the exception that ended the execution.
- **FlowPausedEvent**: Emitted when a Flow is paused waiting for human feedback. Contains the flow name, flow ID, method name, current state, message shown when requesting feedback, and optional list of possible outcomes for routing.
- **FlowPlotEvent**: Emitted when a Flow is plotted
- **MethodExecutionStartedEvent**: Emitted when a Flow method starts execution

View File

@@ -22,7 +22,10 @@ Large Language Models (LLMs) are the core intelligence behind CrewAI agents. The
The context window determines how much text an LLM can process at once. Larger windows (e.g., 128K tokens) allow for more context but may be more expensive and slower.
</Card>
<Card title="Temperature" icon="temperature-three-quarters">
Temperature (0.0 to 1.0) controls response randomness. Lower values (e.g., 0.2) produce more focused, deterministic outputs, while higher values (e.g., 0.8) increase creativity and variability.
Temperature is a sampling control supported by some models. Lower values
generally make sampling more focused, while higher values increase
variability. Some newer reasoning models ignore, deprecate, or reject this
parameter, so check the selected model's documentation before setting it.
</Card>
<Card title="Provider Selection" icon="server">
Each LLM provider (e.g., OpenAI, Anthropic, Google) offers different models with varying capabilities, pricing, and features. Choose based on your needs for accuracy, speed, and cost.
@@ -38,7 +41,7 @@ There are different places in CrewAI code where you can specify the model to use
The simplest way to get started. Set the model in your environment directly, through an `.env` file or in your app code. If you used `crewai create` to bootstrap your project, it will be set already.
```bash .env
MODEL=model-id # e.g. gpt-4o, gemini-2.0-flash, claude-3-sonnet-...
MODEL=provider/model-id # e.g. openai/gpt-5.6-terra
# Be sure to set your API keys here too. See the Provider
# section below.
@@ -57,7 +60,7 @@ There are different places in CrewAI code where you can specify the model to use
goal: Conduct comprehensive research and analysis
backstory: A dedicated research professional with years of experience
verbose: true
llm: provider/model-id # e.g. openai/gpt-4o, google/gemini-2.0-flash, anthropic/claude...
llm: provider/model-id # e.g. anthropic/claude-sonnet-4-6
# (see provider configuration examples below for more)
```
@@ -76,32 +79,27 @@ There are different places in CrewAI code where you can specify the model to use
from crewai import LLM
# Basic configuration
llm = LLM(model="model-id-here") # gpt-4o, gemini-2.0-flash, anthropic/claude...
llm = LLM(model="provider/model-id") # e.g. gemini/gemini-3.6-flash
# Advanced configuration with detailed parameters
llm = LLM(
model="model-id-here", # gpt-4o, gemini-2.0-flash, anthropic/claude...
temperature=0.7, # Higher for more creative outputs
timeout=120, # Seconds to wait for response
max_tokens=4000, # Maximum length of response
top_p=0.9, # Nucleus sampling parameter
frequency_penalty=0.1 , # Reduce repetition
presence_penalty=0.1, # Encourage topic diversity
model="provider/model-id",
timeout=120,
max_tokens=4000,
response_format={"type": "json"}, # For structured outputs
seed=42 # For reproducible results
)
```
<Info>
Parameter explanations:
- `temperature`: Controls randomness (0.0-1.0)
- `timeout`: Maximum wait time for response
- `max_tokens`: Limits response length
- `top_p`: Alternative to temperature for sampling
- `frequency_penalty`: Reduces word repetition
- `presence_penalty`: Encourages new topics
- `response_format`: Specifies output structure
- `seed`: Ensures consistent outputs
Sampling controls such as `temperature` and `top_p`, penalty parameters,
token-limit names, and reasoning controls are model-specific. Add them
only when the selected provider and model support them. See the provider
examples below and the provider's model documentation.
</Info>
</Tab>
</Tabs>
@@ -120,6 +118,13 @@ There are different places in CrewAI code where you can specify the model to use
CrewAI supports a multitude of LLM providers, each offering unique features, authentication methods, and model capabilities.
In this section, you'll find detailed examples that help you select, configure, and optimize the LLM that best fits your project's needs.
<Warning>
Model availability changes frequently and can vary by account, region, and
cloud platform. The examples below use models that are current at the time of
writing, but they are not exhaustive support lists. Before deploying, verify
the model ID and lifecycle status in the provider's linked model catalog.
</Warning>
<AccordionGroup>
<Accordion title="OpenAI">
CrewAI provides native integration with OpenAI through the OpenAI Python SDK.
@@ -137,10 +142,10 @@ In this section, you'll find detailed examples that help you select, configure,
from crewai import LLM
llm = LLM(
model="openai/gpt-4o",
model="openai/gpt-5.6-terra",
api_key="your-api-key", # Or set OPENAI_API_KEY
temperature=0.7,
max_tokens=4000
reasoning_effort="medium",
max_completion_tokens=4000
)
```
@@ -161,25 +166,16 @@ In this section, you'll find detailed examples that help you select, configure,
from crewai import LLM
llm = LLM(
model="openai/gpt-4o",
model="openai/gpt-5.6-terra",
api_key="your-api-key",
base_url="https://api.openai.com/v1", # Optional custom endpoint
organization="org-...", # Optional organization ID
project="proj_...", # Optional project ID
temperature=0.7,
max_tokens=4000,
max_completion_tokens=4000, # For newer models
top_p=0.9,
frequency_penalty=0.1,
presence_penalty=0.1,
stop=["END"],
seed=42, # For reproducible outputs
max_completion_tokens=4000,
reasoning_effort="medium",
stream=True, # Enable streaming
timeout=60.0, # Request timeout in seconds
max_retries=3, # Maximum retry attempts
logprobs=True, # Return log probabilities
top_logprobs=5, # Number of most likely tokens
reasoning_effort="medium" # For o1 models: low, medium, high
max_retries=3 # Maximum retry attempts
)
```
@@ -194,7 +190,7 @@ In this section, you'll find detailed examples that help you select, configure,
summary: str
llm = LLM(
model="openai/gpt-4o",
model="openai/gpt-5.6-terra",
)
```
@@ -203,30 +199,18 @@ In this section, you'll find detailed examples that help you select, configure,
- `OPENAI_BASE_URL`: Custom base URL for OpenAI API (optional)
**Features:**
- Native function calling support (except o1 models)
- Native function calling support
- Structured outputs with JSON schema
- Streaming support for real-time responses
- Token usage tracking
- Stop sequences support (except o1 models)
- Provider-specific generation controls
- Log probabilities for token-level insights
- Reasoning effort control for o1 models
- Reasoning effort control for supported models
**Supported Models:**
| Model | Context Window | Best For |
|---------------------|------------------|-----------------------------------------------|
| gpt-4.1 | 1M tokens | Latest model with enhanced capabilities |
| gpt-4.1-mini | 1M tokens | Efficient version with large context |
| gpt-4.1-nano | 1M tokens | Ultra-efficient variant |
| gpt-4o | 128,000 tokens | Optimized for speed and intelligence |
| gpt-4o-mini | 200,000 tokens | Cost-effective with large context |
| gpt-4-turbo | 128,000 tokens | Long-form content, document analysis |
| gpt-4 | 8,192 tokens | High-accuracy tasks, complex reasoning |
| o1 | 200,000 tokens | Advanced reasoning, complex problem-solving |
| o1-preview | 128,000 tokens | Preview of reasoning capabilities |
| o1-mini | 128,000 tokens | Efficient reasoning model |
| o3-mini | 200,000 tokens | Lightweight reasoning model |
| o4-mini | 200,000 tokens | Next-gen efficient reasoning |
OpenAI regularly adds models and retires older snapshots. See the
[OpenAI model catalog](https://developers.openai.com/api/docs/models) for
current model IDs, context windows, endpoint compatibility, and lifecycle
information.
**Responses API:**
@@ -288,14 +272,8 @@ In this section, you'll find detailed examples that help you select, configure,
)
```
All models listed here https://llama.developer.meta.com/docs/models/ are supported.
| Model ID | Input context length | Output context length | Input Modalities | Output Modalities |
| --- | --- | --- | --- | --- |
| `meta_llama/Llama-4-Scout-17B-16E-Instruct-FP8` | 128k | 4028 | Text, Image | Text |
| `meta_llama/Llama-4-Maverick-17B-128E-Instruct-FP8` | 128k | 4028 | Text, Image | Text |
| `meta_llama/Llama-3.3-70B-Instruct` | 128k | 4028 | Text | Text |
| `meta_llama/Llama-3.3-8B-Instruct` | 128k | 4028 | Text | Text |
See the [Meta Llama model overview](https://ai.meta.com/llama/get-started/)
for current model families, modalities, and context guidance.
**Note:** This provider uses LiteLLM. Add it as a dependency to your project:
```bash
@@ -365,7 +343,7 @@ In this section, you'll find detailed examples that help you select, configure,
from crewai import LLM
llm = LLM(
model="anthropic/claude-3-5-sonnet-20241022",
model="anthropic/claude-sonnet-4-6",
api_key="your-api-key", # Or set ANTHROPIC_API_KEY
max_tokens=4096 # Required for Anthropic
)
@@ -376,12 +354,10 @@ In this section, you'll find detailed examples that help you select, configure,
from crewai import LLM
llm = LLM(
model="anthropic/claude-3-5-sonnet-20241022",
model="anthropic/claude-sonnet-4-6",
api_key="your-api-key",
base_url="https://api.anthropic.com", # Optional custom endpoint
temperature=0.7,
max_tokens=4096, # Required parameter
top_p=0.9,
stop_sequences=["END", "STOP"], # Anthropic uses stop_sequences
stream=True, # Enable streaming
timeout=60.0, # Request timeout in seconds
@@ -389,7 +365,7 @@ In this section, you'll find detailed examples that help you select, configure,
)
```
**Extended Thinking (Claude Sonnet 4 and Beyond):**
**Extended Thinking:**
CrewAI supports Anthropic's Extended Thinking feature, which allows Claude to think through problems in a more human-like way before responding. This is particularly useful for complex reasoning, analysis, and problem-solving tasks.
@@ -398,14 +374,14 @@ In this section, you'll find detailed examples that help you select, configure,
# Enable extended thinking with default settings
llm = LLM(
model="anthropic/claude-sonnet-4",
model="anthropic/claude-sonnet-4-6",
thinking={"type": "enabled"},
max_tokens=10000
)
# Configure thinking with budget control
llm = LLM(
model="anthropic/claude-sonnet-4",
model="anthropic/claude-sonnet-4-6",
thinking={
"type": "enabled",
"budget_tokens": 5000 # Limit thinking tokens
@@ -418,9 +394,8 @@ In this section, you'll find detailed examples that help you select, configure,
- `type`: Set to `"enabled"` to activate extended thinking mode
- `budget_tokens` (optional): Maximum tokens to use for thinking (helps control costs)
**Models Supporting Extended Thinking:**
- `claude-sonnet-4` and newer models
- `claude-3-7-sonnet` (with extended thinking capabilities)
Thinking modes and accepted parameters vary across Claude generations.
Check the selected model's capabilities before enabling `thinking`.
**When to Use Extended Thinking:**
- Complex reasoning and multi-step problem solving
@@ -436,7 +411,7 @@ In this section, you'll find detailed examples that help you select, configure,
**Features:**
- Native tool use support for Claude 3+ models
- Extended Thinking support for Claude Sonnet 4+
- Extended Thinking support for compatible Claude models
- Streaming support for real-time responses
- Automatic system message handling
- Stop sequences for controlled output
@@ -450,20 +425,10 @@ In this section, you'll find detailed examples that help you select, configure,
- First message must be from the user (automatically handled)
- Messages must alternate between user and assistant
**Supported Models:**
| Model | Context Window | Best For |
|------------------------------|----------------|-----------------------------------------------|
| claude-sonnet-4 | 200,000 tokens | Latest with extended thinking capabilities |
| claude-3-7-sonnet | 200,000 tokens | Advanced reasoning and agentic tasks |
| claude-3-5-sonnet-20241022 | 200,000 tokens | Latest Sonnet with best performance |
| claude-3-5-haiku | 200,000 tokens | Fast, compact model for quick responses |
| claude-3-opus | 200,000 tokens | Most capable for complex tasks |
| claude-3-sonnet | 200,000 tokens | Balanced intelligence and speed |
| claude-3-haiku | 200,000 tokens | Fastest for simple tasks |
| claude-2.1 | 200,000 tokens | Extended context, reduced hallucinations |
| claude-2 | 100,000 tokens | Versatile model for various tasks |
| claude-instant | 100,000 tokens | Fast, cost-effective for everyday tasks |
See Anthropic's [models overview](https://platform.claude.com/docs/en/about-claude/models/overview)
for current model IDs and capabilities, and review the
[model deprecation table](https://platform.claude.com/docs/en/about-claude/model-deprecations)
before pinning a model in production.
**Note:** To use Anthropic, install the required dependencies:
```bash
@@ -495,9 +460,8 @@ In this section, you'll find detailed examples that help you select, configure,
from crewai import LLM
llm = LLM(
model="gemini/gemini-2.0-flash",
model="gemini/gemini-3.6-flash",
api_key="your-api-key", # Or set GOOGLE_API_KEY/GEMINI_API_KEY
temperature=0.7
)
```
@@ -506,11 +470,8 @@ In this section, you'll find detailed examples that help you select, configure,
from crewai import LLM
llm = LLM(
model="gemini/gemini-2.5-flash",
model="gemini/gemini-3.6-flash",
api_key="your-api-key",
temperature=0.7,
top_p=0.9,
top_k=40, # Top-k sampling parameter
max_output_tokens=8192,
stop_sequences=["END", "STOP"],
stream=True, # Enable streaming
@@ -536,8 +497,7 @@ In this section, you'll find detailed examples that help you select, configure,
from crewai import LLM
llm = LLM(
model="gemini/gemini-2.0-flash",
temperature=0.7
model="gemini/gemini-3.6-flash"
)
```
@@ -554,7 +514,7 @@ In this section, you'll find detailed examples that help you select, configure,
from crewai import LLM
llm = LLM(
model="gemini/gemini-1.5-pro",
model="gemini/gemini-3.6-flash",
project="your-gcp-project-id",
location="us-central1" # GCP region
)
@@ -567,7 +527,7 @@ In this section, you'll find detailed examples that help you select, configure,
- `GOOGLE_CLOUD_LOCATION`: GCP location (defaults to `us-central1`)
**Features:**
- Native function calling support for Gemini 1.5+ and 2.x models
- Native function calling support for compatible Gemini models
- Streaming support for real-time responses
- Multimodal capabilities (text, images, video)
- Safety settings configuration
@@ -575,53 +535,24 @@ In this section, you'll find detailed examples that help you select, configure,
- Automatic system instruction handling
- Token usage tracking
**Gemini Models:**
Google offers a range of powerful models optimized for different use cases.
| Model | Context Window | Best For |
|--------------------------------|----------------|-------------------------------------------------------------------|
| gemini-2.5-flash | 1M tokens | Adaptive thinking, cost efficiency |
| gemini-2.5-pro | 1M tokens | Enhanced thinking and reasoning, multimodal understanding |
| gemini-2.0-flash | 1M tokens | Next generation features, speed, thinking |
| gemini-2.0-flash-thinking | 32,768 tokens | Advanced reasoning with thinking process |
| gemini-2.0-flash-lite | 1M tokens | Cost efficiency and low latency |
| gemini-1.5-pro | 2M tokens | Best performing, logical reasoning, coding |
| gemini-1.5-flash | 1M tokens | Balanced multimodal model, good for most tasks |
| gemini-1.5-flash-8b | 1M tokens | Fastest, most cost-efficient |
| gemini-1.0-pro | 32,768 tokens | Earlier generation model |
**Gemma Models:**
The Gemini API also supports [Gemma models](https://ai.google.dev/gemma/docs) hosted on Google infrastructure.
| Model | Context Window | Best For |
|----------------|----------------|------------------------------------|
| gemma-3-1b | 32,000 tokens | Ultra-lightweight tasks |
| gemma-3-4b | 128,000 tokens | Efficient general-purpose tasks |
| gemma-3-12b | 128,000 tokens | Balanced performance and efficiency|
| gemma-3-27b | 128,000 tokens | High-performance tasks |
Google publishes current Gemini IDs, capabilities, and lifecycle stages in
the [Gemini model catalog](https://ai.google.dev/gemini-api/docs/models).
Check the [deprecation schedule](https://ai.google.dev/gemini-api/docs/deprecations)
before choosing a stable or preview model. The Gemini API also hosts
[Gemma models](https://ai.google.dev/gemma/docs).
**Note:** To use Google Gemini, install the required dependencies:
```bash
uv add "crewai[google-genai]"
```
The full list of models is available in the [Gemini model docs](https://ai.google.dev/gemini-api/docs/models).
</Accordion>
<Accordion title="Google (Vertex AI)">
Get credentials from your Google Cloud Console and save it to a JSON file, then load it with the following code:
```python Code
import json
file_path = 'path/to/vertex_ai_service_account.json'
# Load the JSON file
with open(file_path, 'r') as file:
vertex_credentials = json.load(file)
# Convert the credentials to a JSON string
vertex_credentials_json = json.dumps(vertex_credentials)
Authenticate with [Application Default Credentials](https://cloud.google.com/docs/authentication/provide-credentials-adc), then configure the native Gemini provider for Vertex AI:
```toml .env
GOOGLE_GENAI_USE_VERTEXAI=true
GOOGLE_CLOUD_PROJECT=<your-project-id>
GOOGLE_CLOUD_LOCATION=<location>
```
Example usage in your CrewAI project:
@@ -629,27 +560,17 @@ In this section, you'll find detailed examples that help you select, configure,
from crewai import LLM
llm = LLM(
model="gemini-1.5-pro-latest", # or vertex_ai/gemini-1.5-pro-latest
temperature=0.7,
vertex_credentials=vertex_credentials_json
model="gemini/gemini-3.6-flash"
)
```
Google offers a range of powerful models optimized for different use cases:
Vertex AI availability varies by region. Use the
[Vertex AI model catalog](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models)
to verify the model ID and location before deployment.
| Model | Context Window | Best For |
|--------------------------------|----------------|-------------------------------------------------------------------|
| gemini-2.5-flash-preview-04-17 | 1M tokens | Adaptive thinking, cost efficiency |
| gemini-2.5-pro-preview-05-06 | 1M tokens | Enhanced thinking and reasoning, multimodal understanding, advanced coding, and more |
| gemini-2.0-flash | 1M tokens | Next generation features, speed, thinking, and realtime streaming |
| gemini-2.0-flash-lite | 1M tokens | Cost efficiency and low latency |
| gemini-1.5-flash | 1M tokens | Balanced multimodal model, good for most tasks |
| gemini-1.5-flash-8B | 1M tokens | Fastest, most cost-efficient, good for high-frequency tasks |
| gemini-1.5-pro | 2M tokens | Best performing, wide variety of reasoning tasks including logical reasoning, coding, and creative collaboration |
**Note:** This provider uses LiteLLM. Add it as a dependency to your project:
**Note:** This route uses CrewAI's native Gemini integration. Add it as a dependency to your project:
```bash
uv add 'crewai[litellm]'
uv add "crewai[google-genai]"
```
</Accordion>
@@ -740,7 +661,7 @@ In this section, you'll find detailed examples that help you select, configure,
from crewai import LLM
llm = LLM(
model="bedrock/anthropic.claude-3-5-sonnet-20241022-v2:0",
model="bedrock/us.anthropic.claude-sonnet-4-6",
region_name="us-east-1"
)
```
@@ -750,7 +671,7 @@ In this section, you'll find detailed examples that help you select, configure,
from crewai import LLM
llm = LLM(
model="bedrock/anthropic.claude-3-5-sonnet-20241022-v2:0",
model="bedrock/us.anthropic.claude-sonnet-4-6",
aws_access_key_id="your-access-key", # Or set AWS_ACCESS_KEY_ID
aws_secret_access_key="your-secret-key", # Or set AWS_SECRET_ACCESS_KEY
aws_session_token="your-session-token", # For temporary credentials
@@ -795,38 +716,9 @@ In this section, you'll find detailed examples that help you select, configure,
- First message must be from user (automatically handled)
- Some models (like Cohere) require conversation to end with user message
[Amazon Bedrock](https://docs.aws.amazon.com/bedrock/latest/userguide/models-regions.html) is a managed service that provides access to multiple foundation models from top AI companies through a unified API.
| Model | Context Window | Best For |
|-------------------------|----------------------|-------------------------------------------------------------------|
| Amazon Nova Pro | Up to 300k tokens | High-performance, model balancing accuracy, speed, and cost-effectiveness across diverse tasks. |
| Amazon Nova Micro | Up to 128k tokens | High-performance, cost-effective text-only model optimized for lowest latency responses. |
| Amazon Nova Lite | Up to 300k tokens | High-performance, affordable multimodal processing for images, video, and text with real-time capabilities. |
| Claude 3.7 Sonnet | Up to 128k tokens | High-performance, best for complex reasoning, coding & AI agents |
| Claude 3.5 Sonnet v2 | Up to 200k tokens | State-of-the-art model specialized in software engineering, agentic capabilities, and computer interaction at optimized cost. |
| Claude 3.5 Sonnet | Up to 200k tokens | High-performance model delivering superior intelligence and reasoning across diverse tasks with optimal speed-cost balance. |
| Claude 3.5 Haiku | Up to 200k tokens | Fast, compact multimodal model optimized for quick responses and seamless human-like interactions |
| Claude 3 Sonnet | Up to 200k tokens | Multimodal model balancing intelligence and speed for high-volume deployments. |
| Claude 3 Haiku | Up to 200k tokens | Compact, high-speed multimodal model optimized for quick responses and natural conversational interactions |
| Claude 3 Opus | Up to 200k tokens | Most advanced multimodal model exceling at complex tasks with human-like reasoning and superior contextual understanding. |
| Claude 2.1 | Up to 200k tokens | Enhanced version with expanded context window, improved reliability, and reduced hallucinations for long-form and RAG applications |
| Claude | Up to 100k tokens | Versatile model excelling in sophisticated dialogue, creative content, and precise instruction following. |
| Claude Instant | Up to 100k tokens | Fast, cost-effective model for everyday tasks like dialogue, analysis, summarization, and document Q&A |
| Llama 3.1 405B Instruct | Up to 128k tokens | Advanced LLM for synthetic data generation, distillation, and inference for chatbots, coding, and domain-specific tasks. |
| Llama 3.1 70B Instruct | Up to 128k tokens | Powers complex conversations with superior contextual understanding, reasoning and text generation. |
| Llama 3.1 8B Instruct | Up to 128k tokens | Advanced state-of-the-art model with language understanding, superior reasoning, and text generation. |
| Llama 3 70B Instruct | Up to 8k tokens | Powers complex conversations with superior contextual understanding, reasoning and text generation. |
| Llama 3 8B Instruct | Up to 8k tokens | Advanced state-of-the-art LLM with language understanding, superior reasoning, and text generation. |
| Titan Text G1 - Lite | Up to 4k tokens | Lightweight, cost-effective model optimized for English tasks and fine-tuning with focus on summarization and content generation. |
| Titan Text G1 - Express | Up to 8k tokens | Versatile model for general language tasks, chat, and RAG applications with support for English and 100+ languages. |
| Cohere Command | Up to 4k tokens | Model specialized in following user commands and delivering practical enterprise solutions. |
| Jurassic-2 Mid | Up to 8,191 tokens | Cost-effective model balancing quality and affordability for diverse language tasks like Q&A, summarization, and content generation. |
| Jurassic-2 Ultra | Up to 8,191 tokens | Model for advanced text generation and comprehension, excelling in complex tasks like analysis and content creation. |
| Jamba-Instruct | Up to 256k tokens | Model with extended context window optimized for cost-effective text generation, summarization, and Q&A. |
| Mistral 7B Instruct | Up to 32k tokens | This LLM follows instructions, completes requests, and generates creative text. |
| Mistral 8x7B Instruct | Up to 32k tokens | An MOE LLM that follows instructions, completes requests, and generates creative text. |
| DeepSeek R1 | 32,768 tokens | Advanced reasoning model |
Amazon Bedrock model access and IDs vary by region. Use AWS's
[supported models and regions](https://docs.aws.amazon.com/bedrock/latest/userguide/models-regions.html)
reference to select a model and verify Converse API support.
**Note:** To use AWS Bedrock, install the required dependencies:
```bash
uv add "crewai[bedrock]"
@@ -882,81 +774,14 @@ In this section, you'll find detailed examples that help you select, configure,
Example usage in your CrewAI project:
```python Code
llm = LLM(
model="nvidia_nim/meta/llama3-70b-instruct",
model="nvidia_nim/nvidia/nvidia-nemotron-3-ultra-550b-a55b",
temperature=0.7
)
```
Nvidia NIM provides a comprehensive suite of models for various use cases, from general-purpose tasks to specialized applications.
| Model | Context Window | Best For |
|-------------------------------------------------------------------------|----------------|-------------------------------------------------------------------|
| nvidia/mistral-nemo-minitron-8b-8k-instruct | 8,192 tokens | State-of-the-art small language model delivering superior accuracy for chatbot, virtual assistants, and content generation. |
| nvidia/nemotron-4-mini-hindi-4b-instruct | 4,096 tokens | A bilingual Hindi-English SLM for on-device inference, tailored specifically for Hindi Language. |
| nvidia/llama-3.1-nemotron-70b-instruct | 128k tokens | Customized for enhanced helpfulness in responses |
| nvidia/llama3-chatqa-1.5-8b | 128k tokens | Advanced LLM to generate high-quality, context-aware responses for chatbots and search engines. |
| nvidia/llama3-chatqa-1.5-70b | 128k tokens | Advanced LLM to generate high-quality, context-aware responses for chatbots and search engines. |
| nvidia/vila | 128k tokens | Multi-modal vision-language model that understands text/img/video and creates informative responses |
| nvidia/neva-22 | 4,096 tokens | Multi-modal vision-language model that understands text/images and generates informative responses |
| nvidia/nemotron-mini-4b-instruct | 8,192 tokens | General-purpose tasks |
| nvidia/usdcode-llama3-70b-instruct | 128k tokens | State-of-the-art LLM that answers OpenUSD knowledge queries and generates USD-Python code. |
| nvidia/nemotron-4-340b-instruct | 4,096 tokens | Creates diverse synthetic data that mimics the characteristics of real-world data. |
| meta/codellama-70b | 100k tokens | LLM capable of generating code from natural language and vice versa. |
| meta/llama2-70b | 4,096 tokens | Cutting-edge large language AI model capable of generating text and code in response to prompts. |
| meta/llama3-8b-instruct | 8,192 tokens | Advanced state-of-the-art LLM with language understanding, superior reasoning, and text generation. |
| meta/llama3-70b-instruct | 8,192 tokens | Powers complex conversations with superior contextual understanding, reasoning and text generation. |
| meta/llama-3.1-8b-instruct | 128k tokens | Advanced state-of-the-art model with language understanding, superior reasoning, and text generation. |
| meta/llama-3.1-70b-instruct | 128k tokens | Powers complex conversations with superior contextual understanding, reasoning and text generation. |
| meta/llama-3.1-405b-instruct | 128k tokens | Advanced LLM for synthetic data generation, distillation, and inference for chatbots, coding, and domain-specific tasks. |
| meta/llama-3.2-1b-instruct | 128k tokens | Advanced state-of-the-art small language model with language understanding, superior reasoning, and text generation. |
| meta/llama-3.2-3b-instruct | 128k tokens | Advanced state-of-the-art small language model with language understanding, superior reasoning, and text generation. |
| meta/llama-3.2-11b-vision-instruct | 128k tokens | Advanced state-of-the-art small language model with language understanding, superior reasoning, and text generation. |
| meta/llama-3.2-90b-vision-instruct | 128k tokens | Advanced state-of-the-art small language model with language understanding, superior reasoning, and text generation. |
| google/gemma-7b | 8,192 tokens | Cutting-edge text generation model text understanding, transformation, and code generation. |
| google/gemma-2b | 8,192 tokens | Cutting-edge text generation model text understanding, transformation, and code generation. |
| google/codegemma-7b | 8,192 tokens | Cutting-edge model built on Google's Gemma-7B specialized for code generation and code completion. |
| google/codegemma-1.1-7b | 8,192 tokens | Advanced programming model for code generation, completion, reasoning, and instruction following. |
| google/recurrentgemma-2b | 8,192 tokens | Novel recurrent architecture based language model for faster inference when generating long sequences. |
| google/gemma-2-9b-it | 8,192 tokens | Cutting-edge text generation model text understanding, transformation, and code generation. |
| google/gemma-2-27b-it | 8,192 tokens | Cutting-edge text generation model text understanding, transformation, and code generation. |
| google/gemma-2-2b-it | 8,192 tokens | Cutting-edge text generation model text understanding, transformation, and code generation. |
| google/deplot | 512 tokens | One-shot visual language understanding model that translates images of plots into tables. |
| google/paligemma | 8,192 tokens | Vision language model adept at comprehending text and visual inputs to produce informative responses. |
| mistralai/mistral-7b-instruct-v0.2 | 32k tokens | This LLM follows instructions, completes requests, and generates creative text. |
| mistralai/mixtral-8x7b-instruct-v0.1 | 8,192 tokens | An MOE LLM that follows instructions, completes requests, and generates creative text. |
| mistralai/mistral-large | 4,096 tokens | Creates diverse synthetic data that mimics the characteristics of real-world data. |
| mistralai/mixtral-8x22b-instruct-v0.1 | 8,192 tokens | Creates diverse synthetic data that mimics the characteristics of real-world data. |
| mistralai/mistral-7b-instruct-v0.3 | 32k tokens | This LLM follows instructions, completes requests, and generates creative text. |
| nv-mistralai/mistral-nemo-12b-instruct | 128k tokens | Most advanced language model for reasoning, code, multilingual tasks; runs on a single GPU. |
| mistralai/mamba-codestral-7b-v0.1 | 256k tokens | Model for writing and interacting with code across a wide range of programming languages and tasks. |
| microsoft/phi-3-mini-128k-instruct | 128K tokens | Lightweight, state-of-the-art open LLM with strong math and logical reasoning skills. |
| microsoft/phi-3-mini-4k-instruct | 4,096 tokens | Lightweight, state-of-the-art open LLM with strong math and logical reasoning skills. |
| microsoft/phi-3-small-8k-instruct | 8,192 tokens | Lightweight, state-of-the-art open LLM with strong math and logical reasoning skills. |
| microsoft/phi-3-small-128k-instruct | 128K tokens | Lightweight, state-of-the-art open LLM with strong math and logical reasoning skills. |
| microsoft/phi-3-medium-4k-instruct | 4,096 tokens | Lightweight, state-of-the-art open LLM with strong math and logical reasoning skills. |
| microsoft/phi-3-medium-128k-instruct | 128K tokens | Lightweight, state-of-the-art open LLM with strong math and logical reasoning skills. |
| microsoft/phi-3.5-mini-instruct | 128K tokens | Lightweight multilingual LLM powering AI applications in latency bound, memory/compute constrained environments |
| microsoft/phi-3.5-moe-instruct | 128K tokens | Advanced LLM based on Mixture of Experts architecture to deliver compute efficient content generation |
| microsoft/kosmos-2 | 1,024 tokens | Groundbreaking multimodal model designed to understand and reason about visual elements in images. |
| microsoft/phi-3-vision-128k-instruct | 128k tokens | Cutting-edge open multimodal model exceling in high-quality reasoning from images. |
| microsoft/phi-3.5-vision-instruct | 128k tokens | Cutting-edge open multimodal model exceling in high-quality reasoning from images. |
| databricks/dbrx-instruct | 12k tokens | A general-purpose LLM with state-of-the-art performance in language understanding, coding, and RAG. |
| snowflake/arctic | 1,024 tokens | Delivers high efficiency inference for enterprise applications focused on SQL generation and coding. |
| aisingapore/sea-lion-7b-instruct | 4,096 tokens | LLM to represent and serve the linguistic and cultural diversity of Southeast Asia |
| ibm/granite-8b-code-instruct | 4,096 tokens | Software programming LLM for code generation, completion, explanation, and multi-turn conversion. |
| ibm/granite-34b-code-instruct | 8,192 tokens | Software programming LLM for code generation, completion, explanation, and multi-turn conversion. |
| ibm/granite-3.0-8b-instruct | 4,096 tokens | Advanced Small Language Model supporting RAG, summarization, classification, code, and agentic AI |
| ibm/granite-3.0-3b-a800m-instruct | 4,096 tokens | Highly efficient Mixture of Experts model for RAG, summarization, entity extraction, and classification |
| mediatek/breeze-7b-instruct | 4,096 tokens | Creates diverse synthetic data that mimics the characteristics of real-world data. |
| upstage/solar-10.7b-instruct | 4,096 tokens | Excels in NLP tasks, particularly in instruction-following, reasoning, and mathematics. |
| writer/palmyra-med-70b-32k | 32k tokens | Leading LLM for accurate, contextually relevant responses in the medical domain. |
| writer/palmyra-med-70b | 32k tokens | Leading LLM for accurate, contextually relevant responses in the medical domain. |
| writer/palmyra-fin-70b-32k | 32k tokens | Specialized LLM for financial analysis, reporting, and data processing |
| 01-ai/yi-large | 32k tokens | Powerful model trained on English and Chinese for diverse tasks including chatbot and creative writing. |
| deepseek-ai/deepseek-coder-6.7b-instruct | 2k tokens | Powerful coding model offering advanced capabilities in code generation, completion, and infilling |
| rakuten/rakutenai-7b-instruct | 1,024 tokens | Advanced state-of-the-art LLM with language understanding, superior reasoning, and text generation. |
| rakuten/rakutenai-7b-chat | 1,024 tokens | Advanced state-of-the-art LLM with language understanding, superior reasoning, and text generation. |
| baichuan-inc/baichuan2-13b-chat | 4,096 tokens | Support Chinese and English chat, coding, math, instruction following, solving quizzes |
NVIDIA NIM's hosted catalog changes frequently. Use the
[NVIDIA NIM model catalog](https://build.nvidia.com/models) to select a
current endpoint and verify its model ID, modalities, and context limits.
**Note:** This provider uses LiteLLM. Add it as a dependency to your project:
```bash
@@ -1074,15 +899,15 @@ In this section, you'll find detailed examples that help you select, configure,
Example usage in your CrewAI project:
```python Code
llm = LLM(
model="groq/llama-3.2-90b-text-preview",
model="groq/qwen/qwen3.6-27b",
temperature=0.7
)
```
| Model | Context Window | Best For |
|-------------------|------------------|--------------------------------------------|
| Llama 3.1 70B/8B | 131,072 tokens | High-performance, large context tasks |
| Llama 3.2 Series | 8,192 tokens | General-purpose tasks |
| Mixtral 8x7B | 32,768 tokens | Balanced performance and context |
Groq distinguishes production and preview models and retires model IDs
regularly. Check the [Groq model catalog](https://console.groq.com/docs/models)
and [deprecation page](https://console.groq.com/docs/deprecations) before
selecting a model for production.
**Note:** This provider uses LiteLLM. Add it as a dependency to your project:
```bash
@@ -1164,11 +989,14 @@ In this section, you'll find detailed examples that help you select, configure,
Example usage in your CrewAI project:
```python Code
llm = LLM(
model="llama-3.1-sonar-large-128k-online",
base_url="https://api.perplexity.ai/"
model="perplexity/sonar-pro"
)
```
See the [Perplexity model catalog](https://docs.perplexity.ai/getting-started/models)
and [changelog](https://docs.perplexity.ai/docs/resources/changelog) for
current model IDs and deprecation notices.
**Note:** This provider uses LiteLLM. Add it as a dependency to your project:
```bash
uv add 'crewai[litellm]'
@@ -1204,17 +1032,14 @@ In this section, you'll find detailed examples that help you select, configure,
Example usage in your CrewAI project:
```python Code
llm = LLM(
model="sambanova/Meta-Llama-3.1-8B-Instruct",
model="sambanova/Meta-Llama-3.3-70B-Instruct",
temperature=0.7
)
```
| Model | Context Window | Best For |
|--------------------|------------------------|----------------------------------------------|
| Llama 3.1 70B/8B | Up to 131,072 tokens | High-performance, large context tasks |
| Llama 3.1 405B | 8,192 tokens | High-performance and output quality |
| Llama 3.2 Series | 8,192 tokens | General-purpose, multimodal tasks |
| Llama 3.3 70B | Up to 131,072 tokens | High-performance and output quality |
| Qwen2 familly | 8,192 tokens | High-performance and output quality |
SambaNova Cloud's hosted models can change independently of CrewAI. Query
the [models endpoint](https://docs.sambanova.ai/docs/api-reference/models/get-environments-available-model-list-metadata)
and check the [deprecation guide](https://docs.sambanova.ai/docs/en/models/deprecations)
before deployment.
**Note:** This provider uses LiteLLM. Add it as a dependency to your project:
```bash
@@ -1232,7 +1057,7 @@ In this section, you'll find detailed examples that help you select, configure,
Example usage in your CrewAI project:
```python Code
llm = LLM(
model="cerebras/llama3.1-70b",
model="cerebras/gpt-oss-120b",
temperature=0.7,
max_tokens=8192
)
@@ -1246,6 +1071,10 @@ In this section, you'll find detailed examples that help you select, configure,
- Support for long context windows
</Info>
See the [Cerebras model catalog](https://inference-docs.cerebras.ai/models/overview)
and [deprecation notices](https://inference-docs.cerebras.ai/support/deprecation)
for current public endpoint IDs.
**Note:** This provider uses LiteLLM. Add it as a dependency to your project:
```bash
uv add 'crewai[litellm]'
@@ -1320,7 +1149,7 @@ CrewAI supports streaming responses from LLMs, allowing your application to rece
# Create an LLM with streaming enabled
llm = LLM(
model="openai/gpt-4o",
model="openai/gpt-5.6-terra",
stream=True # Enable streaming
)
```
@@ -1370,7 +1199,7 @@ CrewAI supports streaming responses from LLMs, allowing your application to rece
my_listener = MyCustomListener()
llm = LLM(model="gpt-4o-mini", temperature=0, stream=True)
llm = LLM(model="openai/gpt-5.6-terra", stream=True)
researcher = Agent(
role="About User",
@@ -1450,6 +1279,8 @@ CrewAI supports asynchronous LLM calls for improved performance and concurrency
CrewAI supports structured responses from LLM calls by allowing you to define a `response_format` using a Pydantic model. This enables the framework to automatically parse and validate the output, making it easier to integrate the response into your application without manual post-processing.
Structured output support varies by provider and model. Test your chosen model before relying on structured responses in production.
For example, you can define a Pydantic model to represent the expected response structure and pass it as the `response_format` when instantiating the LLM. The model will then be used to convert the LLM output into a structured Python object.
```python Code
@@ -1461,7 +1292,7 @@ class Dog(BaseModel):
breed: str
llm = LLM(model="gpt-4o", response_format=Dog)
llm = LLM(model="openai/gpt-5.6-terra", response_format=Dog)
response = llm.call(
"Analyze the following messages and return the name, age, and breed. "
@@ -1490,8 +1321,8 @@ Learn how to get the most out of your LLM configuration:
# 3. Task splitting for large contexts
llm = LLM(
model="gpt-4",
max_tokens=4000, # Limit response length
model="openai/gpt-5.6-terra",
max_completion_tokens=4000, # Limit response length
)
```
@@ -1515,15 +1346,16 @@ Learn how to get the most out of your LLM configuration:
```python
# Configure model with appropriate settings
llm = LLM(
model="openai/gpt-4-turbo-preview",
temperature=0.7, # Adjust based on task
max_tokens=4096, # Set based on output needs
timeout=300 # Longer timeout for complex tasks
model="openai/gpt-5.6-terra",
reasoning_effort="medium",
max_completion_tokens=4096,
timeout=300
)
```
<Tip>
- Lower temperature (0.1 to 0.3) for factual responses
- Higher temperature (0.7 to 0.9) for creative tasks
Use the controls supported by your selected model. Depending on the
provider, this may be `temperature`, a reasoning or thinking level,
or prompt instructions that define the desired style and variability.
</Tip>
</Step>

View File

@@ -9,7 +9,10 @@ mode: "wide"
Skills are self-contained directories that provide agents with **domain-specific instructions, guidelines, and reference material**. Each skill is defined by a `SKILL.md` file with YAML frontmatter and a markdown body.
When activated, a skill's instructions are injected directly into the agent's task prompt — giving the agent expertise without requiring any code changes.
Agents first receive each configured skill's name and description. When a
description applies to the current request, the agent loads that skill's full
instructions for that execution. This keeps unrelated instructions out of the
context while giving the agent the relevant expertise without code changes.
<Note type="info" title="Skills vs Tools — The Key Distinction">
**Skills are NOT tools.** This is the most common point of confusion.
@@ -24,15 +27,23 @@ You often need **both**: skills for expertise, tools for action. They are config
## Quick Start
### 1. Create a Skill Directory
### 1. Create a Skill with the CLI
The CLI is the supported way to create a skill — it scaffolds the directory layout and a valid `SKILL.md` for you:
```shell Terminal
crewai skill create code-review
```
Inside a crew project (where `pyproject.toml` lives) this creates `./skills/code-review/`; outside a project it creates `./code-review/` in the current directory (you can force that behavior with `--no-project`):
```
skills/
└── code-review/
├── SKILL.md # Required — instructions
├── SKILL.md # Required — instructions (pre-filled template)
├── references/ # Optional — reference docs
│ └── style-guide.md
└── scripts/ # Optional — executable scripts
├── scripts/ # Optional — executable scripts
└── assets/ # Optional — static files
```
### 2. Write Your SKILL.md
@@ -71,12 +82,13 @@ reviewer = Agent(
role="Senior Code Reviewer",
goal="Review pull requests for quality and security issues",
backstory="Staff engineer with expertise in secure coding practices.",
skills=["./skills"], # Injects review guidelines
skills=["./skills"], # Discovers review skills
tools=[GithubSearchTool(), FileReadTool()], # Lets agent read code
)
```
The agent now has both **expertise** (from the skill) and **capabilities** (from the tools).
The agent now has both **expertise** (loaded from the relevant skill when
needed) and **capabilities** (from the tools).
---
@@ -164,6 +176,93 @@ agent = Agent(
---
## Creating, Publishing, and Installing Skills
Skills have a full lifecycle managed by the CLI: **create them with `crewai skill create`, publish them with `crewai skill publish`** — hand-rolling directories works for local experiments, but the CLI is the intended workflow and keeps your skill layout and frontmatter valid.
### Create
```shell Terminal
crewai skill create my-skill
```
Scaffolds the directory (into `./skills/` inside a crew project) with a template `SKILL.md`, plus empty `scripts/`, `references/`, and `assets/` directories. Edit `SKILL.md` to define the instructions.
### Publish
Run from inside the skill directory (where `SKILL.md` is):
```shell Terminal
cd skills/my-skill
crewai skill publish
```
Publishing reads `name`, `description`, and `metadata.version` from the `SKILL.md` frontmatter and pushes the skill to the CrewAI registry. **Published skills are always scoped to your organization** — like tools, only members of the publishing org can see and install them; there is no public visibility. Useful flags:
| Flag | Effect |
| :--- | :--- |
| `--org <slug>` | Publish under a specific organization (overrides settings). |
| `--force` | Skip git-state validation (uncommitted changes, etc.). |
### Install
Install a published skill by its `@org/name` reference:
```shell Terminal
crewai skill install @acme/code-review
```
Inside a crew project the skill lands in `./skills/{name}/`; outside a project it goes to the shared cache at `~/.crewai/skills/{org}/{name}/`.
Agents can also reference registry skills directly — they resolve from the local cache (or project `skills/` directory) at runtime:
```python
agent = Agent(
role="Senior Code Reviewer",
goal="Review pull requests for quality and security issues",
backstory="Staff engineer with expertise in secure coding practices.",
skills=["@acme/code-review"], # registry ref, resolved locally
)
```
### Pin a Version
An unpinned reference resolves to the newest published version, so publishing a
new version changes every agent that references it. Append `@<version>` to pin
one instead:
```python
agent = Agent(
role="Senior Code Reviewer",
goal="Review pull requests for quality and security issues",
backstory="Staff engineer with expertise in secure coding practices.",
skills=["@acme/code-review@1.2.0"], # pinned; a leading "v" also works
)
```
A pinned reference re-downloads unless the copy it finds is that exact version —
a pin asks for a specific version rather than hinting at one. A cached skill is
matched on the version recorded when it was installed, so it needs nothing in
its frontmatter; a project-local copy under `skills/` has no such record, so it
is matched on `metadata.version` in its `SKILL.md` frontmatter. Pinning an
unpublished version fails rather than falling back to the latest.
<Note>
Agents from the **Agent Repository** are pinned automatically: the repository
records a version alongside each skill it assigns, and the runtime applies those
pins when it loads the agent.
</Note>
### List
```shell Terminal
crewai skill list
```
Shows installed skills from both the project `./skills/` directory and the global cache, with their versions and paths.
---
## Crew-Level Skills
Skills can be set on a crew to apply to **all agents**:
@@ -229,7 +328,8 @@ The directory name must match the `name` field in `SKILL.md`. The `scripts/`, `r
## Pre-loading Skills
For more control, you can discover and activate skills programmatically:
For more control, you can discover and activate skills programmatically.
Passing an activated skill makes its instructions always-on:
```python
from pathlib import Path
@@ -256,12 +356,21 @@ agent = Agent(
Skills use **progressive disclosure** — only loading what's needed at each stage:
| Stage | What's loaded | When |
| :--------- | :------------------------------------ | :------------------ |
| Discovery | Name, description, frontmatter fields | `discover_skills()` |
| Activation | Full SKILL.md body text | `activate_skill()` |
| Stage | What's loaded | When |
| :--------- | :------------------------------------ | :---------------------------------------- |
| Discovery | Name, description, frontmatter fields | Agent setup or `discover_skills()` |
| Activation | Full SKILL.md body text | Relevant runtime request or `activate_skill()` |
| Resources | Resource directory catalog | Explicit `load_resources()` call |
During normal agent execution (passing directory paths via `skills=["./skills"]`), skills are automatically discovered and activated. The progressive loading only matters when using the programmatic API.
With `skills=["./skills"]`, the directory is discovered at setup but the full
instructions are not placed in every prompt. The agent reviews the metadata on
each execution and loads only a skill that applies. The loaded instructions are
scoped to that execution, so skills selected for earlier calls do not accumulate
on the agent.
Inline skill strings and `Skill` objects already activated with
`activate_skill()` remain always-on. This provides an explicit opt-in when the
instructions should apply to every request.
---

View File

@@ -334,6 +334,126 @@ writer1 = Agent(
#...
```
## Reporting Tool Failures
A tool can finish without raising and still fail to do what it was asked. Slack
answers `HTTP 200` with `{"ok": false, "error": "channel_not_found"}`; an MCP
server sets `isError`; a platform action returns an error payload. The tool call
"worked", so the error text reaches the agent as an ordinary result — the agent
narrates the problem in its final answer and the run is recorded as a success.
Return a `ToolFailure` instead of an error string and the framework can tell the
difference:
```python Code
from typing import Any
from crewai.tools import BaseTool
from crewai.tools.tool_failure import ToolFailure
class SendSlackMessage(BaseTool):
name: str = "send_slack_message"
description: str = "Post a message to a Slack channel."
def _run(self, channel: str, text: str) -> Any:
payload = slack.post(channel=channel, text=text)
if not payload["ok"]:
return ToolFailure(
message=f"Slack rejected the message: {payload['error']}",
code=payload["error"],
retryable=payload["error"] == "rate_limited",
)
return payload
```
The agent still reads plain prose — `ToolFailure.as_agent_message()` renders the
message — so model behavior is unchanged. What changes is that the failure is now
visible to everything downstream.
Detection is strictly declarative. CrewAI never guesses whether a string "looks
like" an error, so a tool that legitimately returns text about an error is never
misread as having failed. Failures are recorded when a tool returns a
`ToolFailure`, when a tool raises, when an MCP server sets `isError`, when a
tool's `max_usage_count` is spent, or when the agent calls a tool that does not exist.
### Choosing a Failure Policy
`tool_failure_policy` controls what happens next:
| Policy | Behavior |
| :-- | :-- |
| `ignore` | Nothing is recorded, emitted, or acted on. |
| `warn` *(default)* | Records the failure, emits `ToolFailureDetectedEvent`, and continues. |
| `raise` | Records and emits, then aborts with `ToolExecutionFailedError`. |
```python Code
from crewai import Agent, Crew, Task
from crewai.tools.tool_failure import ToolFailurePolicy
agent = Agent(
role="Slack Messenger",
goal="Post the report to Slack",
backstory="...",
tools=[SendSlackMessage()],
tool_failure_policy=ToolFailurePolicy.WARN,
)
# Tighten a single high-stakes task without changing the agent.
task = Task(
description="Post the final report to #engineering",
expected_output="Confirmation the message was posted",
agent=agent,
tool_failure_policy=ToolFailurePolicy.RAISE,
)
# Or set a baseline once for every agent in the crew.
crew = Crew(
agents=[agent],
tasks=[task],
tool_failure_policy=ToolFailurePolicy.WARN,
)
```
The most specific setting wins: **tool → task → agent → crew → `warn`**. Every
level defaults to `None`, meaning "inherit from the next one out", so the
effective default with nothing configured anywhere is `warn`.
### Inspecting Failures
Recorded failures are structured, so nothing downstream has to parse a string:
```python Code
result = crew.kickoff()
if result.has_tool_failures:
for record in result.tool_failures:
print(record.tool_name) # "send_slack_message"
print(record.failure.code) # "channel_not_found"
print(record.failure.reason) # ToolFailureReason.TOOL_REPORTED
print(record.summary())
```
`tool_failures` is available on `TaskOutput`, `CrewOutput`, and
`LiteAgentOutput`. A crew can finish successfully with a non-empty list — check
it before treating `raw` as complete.
To react as failures happen, subscribe to the event:
```python Code
from crewai.events import ToolFailureDetectedEvent
from crewai.events.event_bus import crewai_event_bus
@crewai_event_bus.on(ToolFailureDetectedEvent)
def on_tool_failure(source, event):
print(f"{event.tool_name} failed: {event.failure.message} ({event.policy})")
```
The event is emitted before the `raise` policy aborts, so subscribers always
observe the failure. `ToolUsageFinishedEvent` also carries a `failure` field, letting
a trace UI mark the call as failed without correlating two events.
## Conclusion
Tools are pivotal in extending the capabilities of CrewAI agents, enabling them to undertake a broad spectrum of tasks and collaborate effectively.

View File

@@ -0,0 +1,123 @@
---
title: Flows in Studio
description: "Build event-driven workflows that combine deterministic, step-by-step control with agentic intelligence — no code required."
icon: "diagram-project"
mode: "wide"
---
<Info>
**Rolling out now**: Flows in Studio is being rolled out gradually during the week of July 20th, 2026. If you don't see the Flows option in Studio yet, it hasn't reached your organization — check back soon.
</Info>
## Overview
Studio now supports building **Flows** in addition to Crews. Flows are event-driven workflows where you control exactly which steps run, in what order, and under what conditions — while still delegating the intelligent work within each step to AI agents.
To build a Flow, open Studio, describe your automation, and select **Flows** from the selector next to the prompt box.
<Frame>
![Flows selector in Studio](/images/enterprise/studio-flows-selector.png)
</Frame>
## Why Flows?
Crews are great when you want a team of agents to collaborate autonomously toward a goal. But many real-world automations need more predictability: fetch this data first, then summarize it, then post the result — every time, in that order.
Flows give you both:
- **Determinism where it matters**: steps execute in a defined sequence with explicit branching, so runs are predictable, repeatable, and easy to debug.
- **Intelligence where you need it**: each step is powered by an agent (or an entire crew), so the work inside a step — summarizing, scoring, drafting, deciding — benefits from full LLM reasoning.
This mix is what makes Flows well suited for production automations: the structure is guaranteed, and the agency is scoped to the steps that need it.
## Building a Flow
Describe what you want in natural language and the Studio Assistant designs the Flow for you — creating the steps, wiring them together, and configuring the agents and app integrations each step needs. The canvas on the right shows the resulting workflow as connected nodes, and you can keep iterating conversationally or edit any node directly.
<Frame>
![Flow canvas with the Studio Assistant](/images/enterprise/studio-flows-agent-node.png)
</Frame>
When you're ready, use **Run** to test the Flow end-to-end, inspect results in the **Output** and **Traces** tabs, and **Deploy** when it's stable. You can also **Share** the project or **Download** the source code.
## Node Types
Flows are composed from three core node types. Each node is a step in the workflow, and you can mix them freely.
### Single Agent
A Single Agent node runs one agent against one focused task — ideal for well-scoped steps like fetching data from an integration, transforming content, or posting a message.
Clicking into an agent node opens its full configuration:
- **Task**: what this step should accomplish and what output it should produce
- **Profile**: the agent's role, goal, and backstory
- **Model**: which LLM powers the agent
- **Apps**: the integrations the agent can use (e.g. Linear, Slack, HubSpot)
- **Runtime Controls**: toggles for planning before executing, delegation, and memory
<Frame>
![Single Agent node configuration](/images/enterprise/studio-flows-agent-config.png)
</Frame>
### Crews
A Crew node embeds an entire crew — multiple agents collaborating across multiple tasks — as a single step in your Flow. Use it when a step is too rich for one agent, like grouping and summarizing data by team and then formatting the result for delivery.
<Frame>
![Crew node in a Flow](/images/enterprise/studio-flows-crew-node.png)
</Frame>
Opening a Crew node reveals its internal structure: the tasks it performs, the agents assigned to each, and the apps they use. The crew runs autonomously within the step, then hands its output to the next node in the Flow.
<Frame>
![Inside a Crew node](/images/enterprise/studio-flows-crew-detail.png)
</Frame>
This is the deterministic-plus-agentic pattern in action: the Flow guarantees *when* the crew runs, and the crew brings collaborative intelligence to *how* the work gets done.
### Router
A Router node branches the Flow based on conditions, so different outcomes take different paths. For example, a lead-routing Flow can score incoming leads and then route high-quality leads to a sales-assignment step while logging the rest for future nurturing.
<Frame>
![Router node with conditional branches](/images/enterprise/studio-flows-router-node.png)
</Frame>
Routers are what make Flows genuinely event-driven: the same workflow handles every case, but each run follows only the branch its data warrants — no wasted steps, no ambiguity about what happens next.
## Agent Repository Sync
Agents you build in Flows don't have to stay locked inside a single project. Every agent node includes a **Publish to Agent Repository** button that saves the agent — its role, goal, backstory, model, and configuration — to your organization's [Agent Repository](/en/enterprise/features/agent-repositories).
This works in both directions:
- **Publish**: promote an agent you've refined in a Flow to the repository so other teams and projects can reuse it.
- **Pull**: bring an existing repository agent into a new Flow instead of rebuilding it from scratch.
Because repository agents are synced across your organization, an improvement made to a shared agent benefits every Flow that uses it — keeping agent behavior consistent, governed, and free of duplicated effort.
## Best Practices
- **Reach for a Flow** when the automation has a clear sequence or branching logic; reach for a Crew when the path to the goal is open-ended.
- **Keep agent tasks focused** — a Single Agent node with a tight task description is more reliable than one asked to do three things.
- **Use Routers to handle every case explicitly**, including the "do nothing" path (e.g. logging skipped leads), so runs are fully accounted for.
- **Publish stable agents to the Agent Repository** so your organization builds a shared library instead of parallel one-offs.
- **Test with Run and inspect Traces** before deploying to catch integration or prompt issues early.
## Related
<CardGroup cols={4}>
<Card title="Crew Studio" href="/en/enterprise/features/crew-studio" icon="pencil">
Build Crews in Studio.
</Card>
<Card title="Agent Repositories" href="/en/enterprise/features/agent-repositories" icon="people-group">
Share and reuse agents across your organization.
</Card>
<Card title="Flows Concepts" href="/en/concepts/flows" icon="diagram-project">
Learn how Flows work in the CrewAI framework.
</Card>
<Card title="Tools & Integrations" href="/en/enterprise/features/tools-and-integrations" icon="plug">
Connect the apps your agents use.
</Card>
</CardGroup>

View File

@@ -18,7 +18,7 @@ Four interception points cover the boundaries:
| `EXECUTION_START` | A crew or flow is about to begin | inputs `dict` |
| `INPUT` | Resolved inputs for the execution | inputs `dict` |
| `OUTPUT` | The final result is ready | the output object |
| `EXECUTION_END` | The execution has finished | the output object |
| `EXECUTION_END` | The execution has finished (success or failure) | the output object, or `None` on failure |
For a crew, the output payload is a `CrewOutput`. For a flow, it is the final
flow-method result.
@@ -68,7 +68,9 @@ class OutputContext(InterceptionContext):
output: Any # The output object
class ExecutionEndContext(InterceptionContext):
output: Any # The output object
output: Any # The output object (None when status == "failed")
status: str # "completed" or "failed"
error: BaseException | None # The exception when status == "failed"
```
<Note>
@@ -136,6 +138,28 @@ def redact_emails(ctx):
payload from earlier hooks; the final rewritten value is what `kickoff()`
returns.
### Observing Failures
`EXECUTION_END` fires exactly once per execution, on success and on failure
alike. When the run raises — a task error, a flow-method exception, or a
`HookAborted` from an earlier point — the hook receives `status="failed"` with
the exception in `ctx.error`, and the original exception still propagates out
of `kickoff()` unchanged:
```python
@on(InterceptionPoint.EXECUTION_END)
def report_outcome(ctx):
if ctx.status == "failed":
notify_policy_engine(status="failed", error=repr(ctx.error))
else:
notify_policy_engine(status="completed")
```
Two caveats: `EXECUTION_END` does not fire when `EXECUTION_START` never
dispatched (an abort at start counts as the execution never beginning), and
raising `HookAborted` from a failure-path `EXECUTION_END` dispatch is ignored —
there is nothing left to abort, and the original error wins.
## Ordering
For a crew run the boundary order is:

View File

@@ -22,6 +22,10 @@ These tools enable your agents to automate workflows, integrate with external pl
Automate browser interactions and web-based workflows.
</Card>
<Card title="Wait Tool" icon="hourglass-half" href="/edge/en/tools/automation/waittool">
Pause before re-checking a long-running job such as a build or deployment.
</Card>
<Card title="Zapier Actions Adapter" icon="bolt" href="/en/tools/automation/zapieractionstool">
Expose Zapier Actions as CrewAI tools for automation across thousands of apps.
</Card>

View File

@@ -0,0 +1,124 @@
---
title: Wait Tool
description: The `WaitTool` lets an agent pause before checking a long-running job again.
icon: hourglass-half
mode: "wide"
---
## Overview
The `WaitTool` pauses execution for a given number of seconds. It exists because agents that
kick off long-running work — a sandbox build, a deployment, a batch import, an async API job —
otherwise have no way to let time pass. Without it, an agent either polls in a tight loop or
gives up before the work finishes.
The tool takes no API key and has no dependencies beyond the standard library.
## When to Use It
The tool's description tells the model to reach for it when out-of-band work needs real time
to progress:
- A sandbox build, test run, or script that is still executing
- A deployment or provisioning step that is still rolling out
- A batch import, export, or training job
- An async API that returned a job id to poll later
- A rate limit or backoff that has to cool down before retrying
The pattern the model is steered toward is: start the job, wait, check status, wait again if it
is still running. The description also tells it *not* to wait to pace a conversation or when the
information it needs is already available — waiting only lets clock time pass, it does not
advance or check the job.
## Installation
The tool ships with `crewai-tools`:
```shell
uv add crewai-tools
```
## Example
```python Code
from crewai import Agent, Crew, Task
from crewai.tools import tool
from crewai_tools import WaitTool
wait_tool = WaitTool()
@tool("Check build status")
def check_build_status_tool(build_id: str) -> str:
"""Return the current status of a build: queued, running, passed, or failed."""
# Replace this with a call to your own build system.
return my_ci_client.get_build(build_id).status
build_agent = Agent(
role="Build Monitor",
goal="Start the build and report its final status",
backstory="An engineer who knows that builds take time.",
tools=[wait_tool, check_build_status_tool],
verbose=True,
)
monitor_task = Task(
description=(
"Start the build, then wait and re-check its status until it finishes."
),
expected_output="The final build status.",
agent=build_agent,
)
crew = Crew(agents=[build_agent], tasks=[monitor_task])
result = crew.kickoff()
```
## Arguments
| Argument | Type | Required | Description |
| :-------- | :------ | :------- | :----------------------------------------------------------------------------- |
| `seconds` | `float` | ✅ | How many seconds to wait. Must be zero or greater. |
| `reason` | `str` | ❌ | Optional note on what is being waited for. Echoed back in the tool's result. |
## Initialization Parameters
| Parameter | Type | Default | Description |
| :------------ | :------ | :------ | :----------------------------------------------------------------------------------- |
| `max_seconds` | `float` | `300` | Upper bound for a single wait. Longer requests are capped to this value, not rejected. |
## Capping Long Waits
A single call waits at most `max_seconds`. If an agent asks for more, the tool waits the
maximum and says so in its result, so the agent can call it again rather than fail:
```python Code
wait_tool = WaitTool()
wait_tool.run(seconds=3600)
# 'Waited 300 seconds. Requested 3600 seconds, capped at 300 seconds per call -
# call this tool again if more waiting is needed.'
```
Raise the cap when a workflow genuinely needs longer single pauses:
```python Code
wait_tool = WaitTool(max_seconds=1800)
```
## Async Support
The tool implements both sync and async execution, so it does not block the event loop when
awaited:
```python Code
import asyncio
async def main():
result = await wait_tool.arun(seconds=30, reason="waiting for the sandbox build")
print(result)
asyncio.run(main())
```

View File

@@ -11,10 +11,12 @@ mode: "wide"
We are still working on improving tools, so there might be unexpected behavior or changes in the future.
</Note>
The FileReadTool conceptually represents a suite of functionalities within the crewai_tools package aimed at facilitating file reading and content retrieval.
This suite includes tools for processing batch text files, reading runtime configuration files, and importing data for analytics.
It supports a variety of text-based file formats such as `.txt`, `.csv`, `.json`, and more. Depending on the file type, the suite offers specialized functionality,
such as converting JSON content into a Python dictionary for ease of use.
The `FileReadTool` reads the contents of a file from the local file system and returns it as text.
It is useful for batch text file processing, reading runtime configuration files, and importing data for analytics.
It supports any text-based file format, such as `.txt`, `.csv`, `.json`, and `.md`.
Content is always returned as plain text — parsing it (for example, `json.loads` on a `.json` file) is up to the agent or your own code.
For large files, `start_line` and `line_count` read just a window of lines instead of loading the whole file.
## Installation
@@ -31,15 +33,48 @@ To get started with the FileReadTool:
```python Code
from crewai_tools import FileReadTool
# Initialize the tool to read any files the agents knows or lean the path for
# Initialize the tool to read any file the agent knows or learns the path for
file_read_tool = FileReadTool()
# OR
# Initialize the tool with a specific file path, so the agent can only read the content of the specified file
# Initialize with a specific file path, so the agent reads that file by default
file_read_tool = FileReadTool(file_path='path/to/your/file.txt')
# Read a window of lines (lines 100-149) instead of the whole file
partial_content = file_read_tool.run(
file_path='path/to/your/file.txt',
start_line=100,
line_count=50,
)
```
## Arguments
- `file_path`: The path to the file you want to read. It accepts both absolute and relative paths. Ensure the file exists and you have the necessary permissions to access it.
The agent supplies these at runtime:
- `file_path`: (Optional) The path to the file you want to read. Accepts absolute and relative paths. Ensure the file exists and you have the necessary permissions to access it. Omit it to read the default file configured at construction; if there is no default, the tool reports that no path was provided.
- `start_line`: (Optional) The line number to start reading from (1-indexed). Defaults to `1`.
- `line_count`: (Optional) The number of lines to read. If omitted, reads from `start_line` to the end of the file.
You set these when constructing the tool:
- `file_path`: (Optional) A default file to read when the agent calls the tool with no arguments.
- `base_dir`: (Optional) The directory that runtime paths must stay inside. Defaults to the current working directory.
- `encoding`: (Optional) Text encoding used to decode the file. Defaults to `utf-8`.
## Allowed paths
Because the file path is usually chosen by an LLM at runtime, reads are confined to a sandbox:
- Paths supplied at runtime must resolve inside `base_dir`, which defaults to the current working directory. `..` segments and symlinks are resolved before the check, so they cannot be used to escape.
- A `file_path` passed to the constructor is developer-declared intent, so it is always allowed past the containment check — even outside `base_dir`. The read itself can still fail if the file is missing, is a directory, or is not permitted. It is pinned when the tool is built, so a later change of working directory cannot repoint it, and the agent can address it either by omitting `file_path` or by using the name shown in the tool's description. Declaring one file does not expose its siblings.
To let an agent read a directory tree outside the working directory, point `base_dir` at it:
```python Code
# The agent may read anything under /data, and nothing outside it
file_read_tool = FileReadTool(base_dir='/data')
```
As a last resort, setting `CREWAI_TOOLS_ALLOW_UNSAFE_PATHS=true` disables path validation. This applies process-wide to every crewai-tools tool, including the SSRF protections on URL-fetching tools, so prefer `base_dir`.

View File

@@ -11,7 +11,7 @@ mode: "wide"
The `FileWriterTool` is a component of the crewai_tools package, designed to simplify the process of writing content to files with cross-platform compatibility (Windows, Linux, macOS).
It is particularly useful in scenarios such as generating reports, saving logs, creating configuration files, and more.
This tool handles path differences across operating systems, supports UTF-8 encoding, and automatically creates directories if they don't exist, making it easier to organize your output reliably across different platforms.
This tool handles path differences across operating systems, writes UTF-8 by default rather than the platform's locale encoding, and automatically creates directories if they don't exist, making it easier to organize your output reliably across different platforms.
## Installation
@@ -32,15 +32,45 @@ from crewai_tools import FileWriterTool
file_writer_tool = FileWriterTool()
# Write content to a file in a specified directory
result = file_writer_tool._run('example.txt', 'This is a test content.', 'test_directory')
result = file_writer_tool.run(
filename='example.txt',
content='This is a test content.',
directory='test_directory',
)
print(result)
```
## Arguments
- `filename`: The name of the file you want to create or overwrite.
- `content`: The content to write into the file.
- `directory` (optional): The path to the directory where the file will be created. Defaults to the current directory (`.`). If the directory does not exist, it will be created.
The agent supplies these at runtime:
- `filename`: The name of the file to write, relative to `directory`. May include subdirectories, which are created if they don't exist.
- `content`: The text content to write into the file.
- `directory` (optional): The path to the directory where the file will be created. A relative path resolves inside the tool's allowed directory — `base_dir` when set, the current working directory otherwise — and defaults to its root. If the directory does not exist, it will be created.
- `overwrite` (optional): Whether to replace the file when it already exists. Accepts `true`/`false` (also `yes`/`no`, `on`/`off`, `1`/`0`). Defaults to `false`, which reports an error instead of replacing existing content.
You set these when constructing the tool:
- `base_dir` (optional): The directory that writes must stay inside. Defaults to the current working directory.
- `encoding` (optional): Text encoding used to write the file. Defaults to `utf-8`.
## Allowed paths
Because both the directory and the filename are usually chosen by an LLM at runtime, writes are confined to a sandbox:
- The resolved `directory` must be inside `base_dir`, which defaults to the current working directory.
- The resolved file must then be inside that `directory`. `..` segments, absolute paths, and symlinks are resolved before both checks, so they cannot be used to escape.
To let an agent write outside the working directory, point `base_dir` at the target tree:
```python Code
# The agent may write anywhere under /var/output, and nowhere outside it
file_writer_tool = FileWriterTool(base_dir='/var/output')
```
<Note>
Previously an absolute `directory` could write anywhere the process had permission to. If you relied on that, set `base_dir` to the tree you want to allow. Setting `CREWAI_TOOLS_ALLOW_UNSAFE_PATHS=true` restores the old behavior, but it applies process-wide to every crewai-tools tool, including the SSRF protections on URL-fetching tools, so prefer `base_dir`.
</Note>
## Conclusion

View File

@@ -4,6 +4,163 @@ description: "CrewAI의 제품 업데이트, 개선 사항 및 버그 수정"
icon: "clock"
mode: "wide"
---
<Update label="2026년 7월 29일">
## v1.15.9
[GitHub 릴리스 보기](https://github.com/crewAIInc/crewAI/releases/tag/1.15.9)
## 변경 사항
### 기능
- 성공으로 보고하는 대신 도구 실패를 표면화
- 흐름 실행이 실패할 때 FlowFailedEvent 발생
- 기술에 대한 점진적 공개 구현
### 문서
- v1.15.8에 대한 스냅샷 및 변경 로그 업데이트
## 기여자
@github-actions[bot], @joaomdmoura, @lorenzejay, @lucasgomide
</Update>
<Update label="2026년 7월 28일">
## v1.15.8
[GitHub 릴리스 보기](https://github.com/crewAIInc/crewAI/releases/tag/1.15.8)
## 변경 사항
### 기능
- 장시간 실행되는 작업에서 일시 중지를 위한 WaitTool 추가.
### 버그 수정
- FileWriterTool의 쓰기 기능 수정 및 파일 도구의 거친 부분 해결.
- E2B 도구에 대해 E2B_API_KEY를 필수 환경 변수로 표시.
### 문서
- 모델 가용성 안내 새로 고침.
## 기여자
@github-actions[bot], @joaomdmoura, @lucasgomide, @oalami, @thiagomoretto
</Update>
<Update label="2026년 7월 26일">
## v1.15.7
[GitHub 릴리스 보기](https://github.com/crewAIInc/crewAI/releases/tag/1.15.7)
## 변경 사항
### 버그 수정
- 런타임의 CrewAI+ 클라이언트를 통해 레지스트리 기술 해결
- GPT-5.6 도구 + reasoning_effort 400에서 복구
- Responses API 경로에서 도구 호출 작동
- 404 오류 대신 응답 전용 모델 라우팅
- CVE-2026-16796 패치를 위해 bedrock-agentcore 버전 업그레이드
### 관찰 가능성
- 관찰 가능성을 위해 런타임에서 기술 사용 이벤트 발행
### 문서
- v1.15.7a1에 대한 스냅샷 및 변경 로그 추가
## 기여자
@alex-clawd, @joaomdmoura, @lorenzejay
</Update>
<Update label="2026년 7월 26일">
## v1.15.7a1
[GitHub 릴리스 보기](https://github.com/crewAIInc/crewAI/releases/tag/1.15.7a1)
## 변경 사항
### 버그 수정
- 런타임의 CrewAI+ 클라이언트를 통한 레지스트리 기술 해결 문제 수정.
- GPT-5.6 도구 및 reasoning_effort 400 오류에서 복구.
- Responses API 경로에서 도구 호출이 작동하도록 수정.
- 404 오류를 방지하기 위해 응답 전용 모델을 라우팅.
- CVE-2026-16796 패치를 위해 bedrock-agentcore 의존성 버전 증가.
### 관찰 가능성
- 향상된 관찰 가능성을 위해 런타임에서 기술 사용 이벤트 방출.
### 문서
- 버전 1.15.6에 대한 스냅샷 및 변경 로그 업데이트.
## 기여자
@alex-clawd, @joaomdmoura, @lorenzejay
</Update>
<Update label="2026년 7월 24일">
## v1.15.6
[GitHub 릴리스 보기](https://github.com/crewAIInc/crewAI/releases/tag/1.15.6)
## 변경 사항
### 버그 수정
- Anthropic 미리보기 도구 사용 차단 감지 수정.
- 엄격한 도구 스키마 속성 이름 유지.
- 실패한 크루 및 흐름 실행에서 execution_end 후크 전송.
- load_agent_from_repository에서 비동기 get_agent 처리.
- 의존성 해결 문제 수정.
### 문서
- v1.15.5에 대한 스냅샷 및 변경 로그.
## 기여자
@alex-clawd, @iris-clawd, @lorenzejay, @lucasgomide, @theCyberTech, @vinibrsl
</Update>
<Update label="2026년 7월 20일">
## v1.15.5
[GitHub 릴리스 보기](https://github.com/crewAIInc/crewAI/releases/tag/1.15.5)
## 변경 사항
### 기능
- 기술 레지스트리 다운로드 인증
### 문서
- v1.15.4에 대한 스냅샷 및 변경 로그 업데이트
## 기여자
@vinibrsl
</Update>
<Update label="2026년 7월 17일">
## v1.15.4
[GitHub 릴리스 보기](https://github.com/crewAIInc/crewAI/releases/tag/1.15.4)
## 변경 사항
### 기능
- 기술 저장소를 실험적 상태에서 벗어나도록 승격
### 문서
- Studio 문서에 흐름 추가
## 기여자
@jessemiller, @joaomdmoura, @vinibrsl
</Update>
<Update label="2026년 7월 16일">
## v1.15.3

View File

@@ -255,6 +255,7 @@ CrewAI는 여러분이 청취할 수 있는 다양한 이벤트를 제공합니
- **FlowCreatedEvent**: Flow가 생성될 때 발생
- **FlowStartedEvent**: Flow가 실행을 시작할 때 발생
- **FlowFinishedEvent**: Flow가 실행을 완료할 때 발생
- **FlowFailedEvent**: Flow 실행이 실패할 때 발생합니다. Flow 이름과 실행을 종료시킨 예외를 포함합니다.
- **FlowPausedEvent**: 사람의 피드백을 기다리며 Flow가 일시 중지될 때 발생합니다. Flow 이름, Flow ID, 메서드 이름, 현재 상태, 피드백 요청 시 표시되는 메시지, 라우팅을 위한 선택적 결과 목록을 포함합니다.
- **FlowPlotEvent**: Flow가 플롯될 때 발생
- **MethodExecutionStartedEvent**: Flow 메서드가 실행을 시작할 때 발생

View File

@@ -21,7 +21,7 @@ Large Language Models(LLM)는 CrewAI 에이전트의 핵심 지능입니다. 에
컨텍스트 윈도우는 LLM이 한 번에 처리할 수 있는 텍스트 양을 결정합니다. 더 큰 윈도우(예: 128K 토큰)는 더 많은 문맥을 다룰 수 있지만, 비용과 속도 면에서 더 부담이 될 수 있습니다.
</Card>
<Card title="Temperature" icon="temperature-three-quarters">
Temperature(0.0에서 1.0)는 응답의 무작위성을 조절합니다. 낮은 값(예: 0.2)은 더 집중적이고 결정적인 결과를, 높은 값(예: 0.8)은 창의성과 다양성을 높입니다.
Temperature는 일부 모델이 지원하는 샘플링 제어 옵션입니다. 값이 낮을수록 일반적으로 샘플링이 더 집중되고, 값이 높을수록 변동성이 커집니다. 일부 최신 추론 모델은 이 파라미터를 무시하거나 더 이상 권장하지 않거나 거부하므로, 설정하기 전에 선택한 모델의 문서를 확인하세요.
</Card>
<Card title="제공자 선택" icon="server">
각 LLM 제공자(예: OpenAI, Anthropic, Google)는 다양한 기능, 가격, 특성을 가진 모델을 제공합니다. 정확성, 속도, 비용 등 요구 사항에 따라 선택하세요.
@@ -37,7 +37,7 @@ CrewAI 코드 내에는 사용할 모델을 지정할 수 있는 여러 위치
가장 간단하게 시작할 수 있는 방법입니다. `.env` 파일이나 앱 코드에서 환경 변수로 직접 모델을 설정할 수 있습니다. `crewai create`를 사용해 프로젝트를 부트스트랩했다면 이미 설정되어 있을 수 있습니다.
```bash .env
MODEL=model-id # e.g. gpt-4o, gemini-2.0-flash, claude-3-sonnet-...
MODEL=provider/model-id # e.g. openai/gpt-5.6-terra
# 반드시 여기에서 API 키도 설정하세요. 아래 제공자
# 섹션을 참고하세요.
@@ -56,7 +56,7 @@ CrewAI 코드 내에는 사용할 모델을 지정할 수 있는 여러 위치
goal: Conduct comprehensive research and analysis
backstory: A dedicated research professional with years of experience
verbose: true
llm: provider/model-id # e.g. openai/gpt-4o, google/gemini-2.0-flash, anthropic/claude...
llm: provider/model-id # e.g. anthropic/claude-sonnet-4-6
# (아래 제공자 구성 예제 참고)
```
@@ -75,32 +75,24 @@ CrewAI 코드 내에는 사용할 모델을 지정할 수 있는 여러 위치
from crewai import LLM
# 기본 설정
llm = LLM(model="model-id-here") # gpt-4o, gemini-2.0-flash, anthropic/claude...
llm = LLM(model="provider/model-id") # e.g. gemini/gemini-3.6-flash
# 자세한 파라미터로 고급 설정
llm = LLM(
model="model-id-here", # gpt-4o, gemini-2.0-flash, anthropic/claude...
temperature=0.7, # 더욱 창의적인 결과를 원할 때 높게 설정
timeout=120, # 응답을 기다릴 최대 초
max_tokens=4000, # 응답의 최대 길이
top_p=0.9, # 누클리어스 샘플링 파라미터
frequency_penalty=0.1 , # 반복 줄이기
presence_penalty=0.1, # 주제 다양성 높이기
model="provider/model-id",
timeout=120,
max_tokens=4000,
response_format={"type": "json"}, # 구조화된 출력용
seed=42 # 결과 재현성 확보용
)
```
<Info>
파라미터 설명:
- `temperature`: 랜덤성 제어 (0.0-1.0)
- `timeout`: 응답 대기 최대 시간
- `max_tokens`: 응답 길이 제한
- `top_p`: 샘플링 시 temperature의 대체값
- `frequency_penalty`: 단어 반복 감소
- `presence_penalty`: 새로운 주제 생성 유도
- `response_format`: 출력 구조 지정
- `seed`: 일관된 출력 보장
`temperature`, `top_p` 같은 샘플링 제어, 페널티 파라미터, 토큰 제한 파라미터 이름, 추론 제어는 모델별로 다릅니다. 선택한 제공자와 모델이 지원하는 경우에만 추가하세요. 아래 제공자 예시와 해당 제공자의 모델 문서를 참고하세요.
</Info>
</Tab>
</Tabs>
@@ -119,6 +111,10 @@ CrewAI 코드 내에는 사용할 모델을 지정할 수 있는 여러 위치
CrewAI는 고유한 기능, 인증 방법, 모델 역량을 제공하는 다양한 LLM 공급자를 지원합니다.
이 섹션에서는 프로젝트의 요구에 가장 적합한 LLM을 선택, 구성, 최적화하는 데 도움이 되는 자세한 예시를 제공합니다.
<Warning>
모델 가용성은 자주 변경되며 계정, 리전, 클라우드 플랫폼에 따라 달라질 수 있습니다. 아래 예시는 작성 시점에 제공되는 모델을 사용하지만 전체 지원 목록은 아닙니다. 배포하기 전에 연결된 제공자 모델 카탈로그에서 모델 ID와 수명 주기 상태를 확인하세요.
</Warning>
<AccordionGroup>
<Accordion title="OpenAI">
`.env` 파일에 다음 환경 변수를 설정하십시오:
@@ -137,28 +133,13 @@ CrewAI는 고유한 기능, 인증 방법, 모델 역량을 제공하는 다양
from crewai import LLM
llm = LLM(
model="openai/gpt-4", # call model by provider/model_name
temperature=0.8,
max_tokens=150,
top_p=0.9,
frequency_penalty=0.1,
presence_penalty=0.1,
stop=["END"],
seed=42
model="openai/gpt-5.6-terra",
reasoning_effort="medium",
max_completion_tokens=4000
)
```
OpenAI는 다양한 모델과 기능을 제공하는 대표적인 LLM 공급자 중 하나입니다.
| 모델 | 컨텍스트 윈도우 | 최적 용도 |
|-------------------|-------------------|-----------------------------------------------|
| GPT-4 | 8,192 토큰 | 고정확도 작업, 복잡한 추론 |
| GPT-4 Turbo | 128,000 토큰 | 장문 콘텐츠, 문서 분석 |
| GPT-4o & GPT-4o-mini | 128,000 토큰 | 비용 효율적인 대용량 컨텍스트 처리 |
| o3-mini | 200,000 토큰 | 빠른 추론, 복잡한 추론 |
| o1-mini | 128,000 토큰 | 빠른 추론, 복잡한 추론 |
| o1-preview | 128,000 토큰 | 빠른 추론, 복잡한 추론 |
| o1 | 200,000 토큰 | 빠른 추론, 복잡한 추론 |
OpenAI는 정기적으로 모델을 추가하고 이전 스냅샷을 폐기합니다. 현재 모델 ID, 컨텍스트 윈도우, 엔드포인트 호환성, 수명 주기 정보는 [OpenAI 모델 카탈로그](https://developers.openai.com/api/docs/models)를 확인하세요.
**Responses API:**
@@ -215,14 +196,7 @@ CrewAI는 고유한 기능, 인증 방법, 모델 역량을 제공하는 다양
)
```
https://llama.developer.meta.com/docs/models/ 에 기재된 모든 모델이 지원됩니다.
| 모델 ID | 입력 컨텍스트 길이 | 출력 컨텍스트 길이 | 입력 모달리티 | 출력 모달리티 |
| ------- | ------------------ | ------------------ | ---------------- | ---------------- |
| `meta_llama/Llama-4-Scout-17B-16E-Instruct-FP8` | 128k | 4028 | 텍스트, 이미지 | 텍스트 |
| `meta_llama/Llama-4-Maverick-17B-128E-Instruct-FP8` | 128k | 4028 | 텍스트, 이미지 | 텍스트 |
| `meta_llama/Llama-3.3-70B-Instruct` | 128k | 4028 | 텍스트 | 텍스트 |
| `meta_llama/Llama-3.3-8B-Instruct` | 128k | 4028 | 텍스트 | 텍스트 |
현재 모델 제품군, 모달리티, 컨텍스트 지침은 [Meta Llama 모델 개요](https://ai.meta.com/llama/get-started/)를 확인하세요.
**참고:** 이 제공자는 LiteLLM을 사용합니다. 프로젝트에 의존성으로 추가하세요:
```bash
@@ -291,10 +265,12 @@ CrewAI는 고유한 기능, 인증 방법, 모델 역량을 제공하는 다양
CrewAI 프로젝트에서의 예시 사용법:
```python Code
llm = LLM(
model="anthropic/claude-3-sonnet-20240229-v1:0",
temperature=0.7
model="anthropic/claude-sonnet-4-6",
max_tokens=4096
)
```
현재 모델 ID와 기능은 Anthropic의 [모델 개요](https://platform.claude.com/docs/en/about-claude/models/overview)를 확인하고, 프로덕션에서 모델을 고정하기 전에 [모델 지원 중단 표](https://platform.claude.com/docs/en/about-claude/model-deprecations)를 검토하세요.
</Accordion>
<Accordion title="Google (Gemini API)">
@@ -319,8 +295,7 @@ CrewAI는 고유한 기능, 인증 방법, 모델 역량을 제공하는 다양
from crewai import LLM
llm = LLM(
model="gemini/gemini-2.0-flash",
temperature=0.7,
model="gemini/gemini-3.6-flash",
)
```
@@ -339,8 +314,7 @@ CrewAI는 고유한 기능, 인증 방법, 모델 역량을 제공하는 다양
from crewai import LLM
llm = LLM(
model="gemini/gemini-2.0-flash",
temperature=0.7
model="gemini/gemini-3.6-flash"
)
```
@@ -352,47 +326,15 @@ CrewAI는 고유한 기능, 인증 방법, 모델 역량을 제공하는 다양
자세한 내용은 [Vertex AI Express 모드 문서](https://docs.cloud.google.com/vertex-ai/generative-ai/docs/start/quickstart?usertype=apikey)를 참조하세요.
</Info>
### Gemini 모델
Google은 다양한 용도에 최적화된 강력한 모델을 제공합니다.
| 모델 | 컨텍스트 윈도우 | 최적 용도 |
|----------------------------------|-----------------|------------------------------------------------------------------------|
| gemini-2.5-flash-preview-04-17 | 1M 토큰 | 적응형 사고, 비용 효율성 |
| gemini-2.5-pro-preview-05-06 | 1M 토큰 | 향상된 사고 및 추론, 멀티모달 이해, 고급 코딩 등 |
| gemini-2.0-flash | 1M 토큰 | 차세대 기능, 속도, 사고, 실시간 스트리밍 |
| gemini-2.0-flash-lite | 1M 토큰 | 비용 효율성과 낮은 대기 시간 |
| gemini-1.5-flash | 1M 토큰 | 밸런스 잡힌 멀티모달 모델, 대부분의 작업에 적합 |
| gemini-1.5-flash-8B | 1M 토큰 | 가장 빠르고, 비용 효율적, 고빈도 작업에 적합 |
| gemini-1.5-pro | 2M 토큰 | 최고의 성능, 논리적 추론, 코딩, 창의적 협업 등 다양한 추론 작업에 적합 |
전체 모델 목록은 [Gemini 모델 문서](https://ai.google.dev/gemini-api/docs/models)에서 확인할 수 있습니다.
### Gemma
Gemini API를 통해 Google 인프라에서 호스팅되는 [Gemma 모델](https://ai.google.dev/gemma/docs)도 API 키를 이용해 사용할 수 있습니다.
| 모델 | 컨텍스트 윈도우 |
|----------------|----------------|
| gemma-3-1b-it | 32k 토큰 |
| gemma-3-4b-it | 32k 토큰 |
| gemma-3-12b-it | 32k 토큰 |
| gemma-3-27b-it | 128k 토큰 |
Google은 현재 Gemini ID, 기능, 수명 주기 단계를 [Gemini 모델 카탈로그](https://ai.google.dev/gemini-api/docs/models)에 게시합니다. 안정 또는 preview 모델을 선택하기 전에 [지원 중단 일정](https://ai.google.dev/gemini-api/docs/deprecations)을 확인하세요. Gemini API는 [Gemma 모델](https://ai.google.dev/gemma/docs)도 호스팅합니다.
</Accordion>
<Accordion title="Google (Vertex AI)">
Google Cloud Console에서 자격증명을 받아 JSON 파일로 저장한 후, 다음 코드로 로드하세요:
```python Code
import json
file_path = 'path/to/vertex_ai_service_account.json'
# Load the JSON file
with open(file_path, 'r') as file:
vertex_credentials = json.load(file)
# Convert the credentials to a JSON string
vertex_credentials_json = json.dumps(vertex_credentials)
[애플리케이션 기본 사용자 인증 정보](https://cloud.google.com/docs/authentication/provide-credentials-adc)로 인증한 다음, Vertex AI를 사용하도록 네이티브 Gemini 제공업체를 구성하세요:
```toml .env
GOOGLE_GENAI_USE_VERTEXAI=true
GOOGLE_CLOUD_PROJECT=<your-project-id>
GOOGLE_CLOUD_LOCATION=<location>
```
CrewAI 프로젝트에서의 예시 사용법:
@@ -400,27 +342,15 @@ CrewAI는 고유한 기능, 인증 방법, 모델 역량을 제공하는 다양
from crewai import LLM
llm = LLM(
model="gemini-1.5-pro-latest", # or vertex_ai/gemini-1.5-pro-latest
temperature=0.7,
vertex_credentials=vertex_credentials_json
model="gemini/gemini-3.6-flash"
)
```
Google은 다양한 용도에 최적화된 강력한 모델들을 제공합니다:
사용 가능한 Vertex AI 모델과 리전은 [Vertex AI 모델 정보](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models)를 확인하세요.
| 모델 | 컨텍스트 윈도우 | 최적 용도 |
|----------------------------------|-----------------|------------------------------------------------------------------------|
| gemini-2.5-flash-preview-04-17 | 1M 토큰 | 적응형 사고, 비용 효율성 |
| gemini-2.5-pro-preview-05-06 | 1M 토큰 | 향상된 사고 및 추론, 멀티모달 이해, 고급 코딩 등 |
| gemini-2.0-flash | 1M 토큰 | 차세대 기능, 속도, 사고, 실시간 스트리밍 |
| gemini-2.0-flash-lite | 1M 토큰 | 비용 효율성과 낮은 대기 시간 |
| gemini-1.5-flash | 1M 토큰 | 밸런스 잡힌 멀티모달 모델, 대부분의 작업에 적합 |
| gemini-1.5-flash-8B | 1M 토큰 | 가장 빠르고, 비용 효율적, 고빈도 작업에 적합 |
| gemini-1.5-pro | 2M 토큰 | 최고의 성능, 논리적 추론, 코딩, 창의적 협업 등 다양한 추론 작업에 적합 |
**참고:** 이 제공자는 LiteLLM을 사용합니다. 프로젝트에 의존성으로 추가하세요:
**참고:** 이 경로는 CrewAI의 네이티브 Gemini 통합을 사용합니다. 프로젝트에 의존성으로 추가하세요:
```bash
uv add 'crewai[litellm]'
uv add "crewai[google-genai]"
```
</Accordion>
@@ -455,7 +385,7 @@ CrewAI는 고유한 기능, 인증 방법, 모델 역량을 제공하는 다양
CrewAI 프로젝트에서의 예시 사용법:
```python Code
llm = LLM(
model="bedrock/anthropic.claude-3-sonnet-20240229-v1:0"
model="bedrock/us.anthropic.claude-sonnet-4-6"
)
```
@@ -463,34 +393,6 @@ CrewAI는 고유한 기능, 인증 방법, 모델 역량을 제공하는 다양
[Amazon Bedrock](https://docs.aws.amazon.com/bedrock/latest/userguide/models-regions.html)은 대표적인 AI 회사들의 여러 파운데이션 모델에 통합 API를 통해 접근할 수 있는 매니지드 서비스로, 안전하고 책임감 있는 AI 응용프로그램 개발을 가능하게 해줍니다.
| 모델 | 컨텍스트 윈도우 | 최적 용도 |
|-----------------------------|--------------------|------------------------------------------------------------------------|
| Amazon Nova Pro | 최대 300k 토큰 | 다양한 작업에서 정확성, 속도, 비용을 균형 있게 제공하는 고성능 모델 |
| Amazon Nova Micro | 최대 128k 토큰 | 텍스트 전용, 최소 레이턴시 응답에 최적화된 비용 효율적 고성능 모델 |
| Amazon Nova Lite | 최대 300k 토큰 | 이미지, 비디오, 텍스트를 아우르는 실시간 멀티모달 처리 |
| Claude 3.7 Sonnet | 최대 128k 토큰 | 복잡한 추론, 코딩 및 AI 에이전트에 적합한 고성능 모델 |
| Claude 3.5 Sonnet v2 | 최대 200k 토큰 | 소프트웨어 공학, 에이전트 기능, 컴퓨터 상호작용에 특화된 최신 모델 |
| Claude 3.5 Sonnet | 최대 200k 토큰 | 다양한 작업에 탁월한 지능 및 추론 제공, 최적의 속도·비용 모델 |
| Claude 3.5 Haiku | 최대 200k 토큰 | 빠르고 컴팩트한 멀티모달 모델, 신속하고 자연스러운 대화에 최적 |
| Claude 3 Sonnet | 최대 200k 토큰 | 지능과 속도의 균형 잡힌 멀티모달 모델, 대규모 배포에 적합 |
| Claude 3 Haiku | 최대 200k 토큰 | 컴팩트한 고속 멀티모달 모델, 신속한 응답과 자연스러운 대화형 상호작용 |
| Claude 3 Opus | 최대 200k 토큰 | 인간 같은 추론과 우수한 문맥 이해로 복잡한 작업 수행 |
| Claude 2.1 | 최대 200k 토큰 | 확장된 컨텍스트, 신뢰도 개선, 로봇화 감소, 장문 및 RAG 적용에 적합 |
| Claude | 최대 100k 토큰 | 복잡한 대화, 창의적 콘텐츠 생성, 정교한 지시 수행에 탁월 |
| Claude Instant | 최대 100k 토큰 | 일상 대화, 분석, 요약, 문서 Q&A 등 빠르고 비용 효율적인 모델 |
| Llama 3.1 405B Instruct | 최대 128k 토큰 | 챗봇, 코딩, 도메인 특화 작업을 위한 합성 데이터 생성 및 추론용 첨단 LLM |
| Llama 3.1 70B Instruct | 최대 128k 토큰 | 복잡한 대화, 우수한 문맥 및 추론, 텍스트 생성 능력 강화 |
| Llama 3.1 8B Instruct | 최대 128k 토큰 | 우수한 언어 이해, 추론, 텍스트 생성 기능의 최첨단 모델 |
| Llama 3 70B Instruct | 최대 8k 토큰 | 복잡한 대화, 우수한 문맥 및 추론, 텍스트 생성 기능 강화 |
| Llama 3 8B Instruct | 최대 8k 토큰 | 첨단 언어 이해력, 추론, 텍스트 생성이 가능한 최첨단 LLM |
| Titan Text G1 - Lite | 최대 4k 토큰 | 영어 과제 및 요약, 콘텐츠 생성에 최적화된 경량 비용 효율적 모델 |
| Titan Text G1 - Express | 최대 8k 토큰 | 일반 언어, 대화, RAG 지원, 영어 및 100여 개 언어 지원 |
| Cohere Command | 최대 4k 토큰 | 사용자의 명령 수행, 실질적 기업 솔루션 제공에 특화된 모델 |
| Jurassic-2 Mid | 최대 8,191 토큰 | 다양한 언어 과제(Q&A, 요약, 생성 등)에 적합한 품질-비용 균형 모델 |
| Jurassic-2 Ultra | 최대 8,191 토큰 | 고급 텍스트 생성과 이해, 분석 및 콘텐츠 제작 등 복잡한 작업 수행 |
| Jamba-Instruct | 최대 256k 토큰 | 비용 효율적인 대용량 문맥 창작, 요약, Q&A에 최적화된 모델 |
| Mistral 7B Instruct | 최대 32k 토큰 | 명령을 따르고, 요청을 완성하며, 창의적 텍스트를 생성하는 LLM |
| Mistral 8x7B Instruct | 최대 32k 토큰 | 명령 및 요청 완성, 창의적 텍스트 생성이 가능한 MOE LLM |
</Accordion>
@@ -543,81 +445,13 @@ CrewAI는 고유한 기능, 인증 방법, 모델 역량을 제공하는 다양
CrewAI 프로젝트에서의 예시 사용법:
```python Code
llm = LLM(
model="nvidia_nim/meta/llama3-70b-instruct",
model="nvidia_nim/nvidia/nvidia-nemotron-3-ultra-550b-a55b",
temperature=0.7
)
```
Nvidia NIM은 일반 목적 작업부터 특수 목적 응용까지 다양한 용도를 위한 모델 제품군을 제공합니다.
NVIDIA NIM의 호스팅 카탈로그는 자주 변경됩니다. 현재 endpoint를 선택하고 모델 ID, 모달리티, 컨텍스트 제한을 확인하려면 [NVIDIA NIM 모델 카탈로그](https://build.nvidia.com/models)를 사용하세요.
| 모델 | 컨텍스트 윈도우 | 최적 용도 |
|------------------------------------------------------------------------|----------------|---------------------------------------------------------------------|
| nvidia/mistral-nemo-minitron-8b-8k-instruct | 8,192 토큰 | 챗봇, 가상 비서, 콘텐츠 생성을 위한 최신형 소형 언어 모델 |
| nvidia/nemotron-4-mini-hindi-4b-instruct | 4,096 토큰 | 힌디-영어 SLM, 힌디 언어 전용 온디바이스 추론 |
| nvidia/llama-3.1-nemotron-70b-instruct | 128k 토큰 | 더욱 도움이 되는 답변을 위해 커스터마이즈됨 |
| nvidia/llama3-chatqa-1.5-8b | 128k 토큰 | 챗봇, 검색엔진용 맥락 인식 응답 생성에 탁월한 고급 LLM |
| nvidia/llama3-chatqa-1.5-70b | 128k 토큰 | 챗봇, 검색엔진용 맥락 인식 응답 생성에 탁월한 고급 LLM |
| nvidia/vila | 128k 토큰 | 텍스트/이미지/비디오 이해 및 정보성 응답 생성을 지원하는 멀티모달 모델 |
| nvidia/neva-22 | 4,096 토큰 | 텍스트/이미지 이해 및 정보성 응답 생성을 지원하는 멀티모달 모델 |
| nvidia/nemotron-mini-4b-instruct | 8,192 토큰 | 일반 목적 작업 |
| nvidia/usdcode-llama3-70b-instruct | 128k 토큰 | OpenUSD 지식 질의 응답, USD-Python 코드 생성이 가능한 최신 LLM |
| nvidia/nemotron-4-340b-instruct | 4,096 토큰 | 실제 데이터를 모사하는 다양한 합성 데이터 생성 |
| meta/codellama-70b | 100k 토큰 | 자연어 → 코드 및 코드 → 자연어 전환 가능한 LLM |
| meta/llama2-70b | 4,096 토큰 | 텍스트, 코드 생성에 최적화된 최첨단 대형 언어 모델 |
| meta/llama3-8b-instruct | 8,192 토큰 | 최첨단 언어 이해 및 추론, 텍스트 생성 기능 모델 |
| meta/llama3-70b-instruct | 8,192 토큰 | 복잡한 대화, 우수한 문맥 및 추론, 텍스트 생성 |
| meta/llama-3.1-8b-instruct | 128k 토큰 | 최첨단 언어 이해 및 추론, 텍스트 생성 기능의 첨단 모델 |
| meta/llama-3.1-70b-instruct | 128k 토큰 | 복잡한 대화, 우수한 문맥 및 추론, 텍스트 생성 |
| meta/llama-3.1-405b-instruct | 128k 토큰 | 챗봇, 코딩, 도메인 특화 작업 합성 데이터 생성 및 추론 |
| meta/llama-3.2-1b-instruct | 128k 토큰 | 최첨단 소형 언어 이해, 추론, 텍스트 생성 모델 |
| meta/llama-3.2-3b-instruct | 128k 토큰 | 최첨단 소형 언어 이해, 추론, 텍스트 생성 |
| meta/llama-3.2-11b-vision-instruct | 128k 토큰 | 최첨단 소형 언어 이해, 추론, 텍스트 생성 |
| meta/llama-3.2-90b-vision-instruct | 128k 토큰 | 최첨단 소형 언어 이해, 추론, 텍스트 생성 |
| google/gemma-7b | 8,192 토큰 | 문자열의 이해, 변환, 코드 생성을 지원하는 최첨단 텍스트 생성 모델 |
| google/gemma-2b | 8,192 토큰 | 문자열의 이해, 변환, 코드 생성을 지원하는 최첨단 텍스트 생성 모델 |
| google/codegemma-7b | 8,192 토큰 | 코드 생성 및 보완에 특화된 Google Gemma-7B 기반 모델 |
| google/codegemma-1.1-7b | 8,192 토큰 | 코드 생성, 보완, 추론, 명령 수행에 강점을 가진 고급 프로그래밍 모델 |
| google/recurrentgemma-2b | 8,192 토큰 | 긴 시퀀스 생성 시 빠른 추론을 가능케 하는 순환 아키텍처 LLM |
| google/gemma-2-9b-it | 8,192 토큰 | 문자열의 이해, 변환, 코드 생성을 지원하는 최첨단 텍스트 생성 모델 |
| google/gemma-2-27b-it | 8,192 토큰 | 문자열의 이해, 변환, 코드 생성을 지원하는 최첨단 텍스트 생성 모델 |
| google/gemma-2-2b-it | 8,192 토큰 | 문자열의 이해, 변환, 코드 생성을 지원하는 최첨단 텍스트 생성 모델 |
| google/deplot | 512 토큰 | 플롯 이미지를 표로 변환하는 원샷 비주얼 언어 이해 모델 |
| google/paligemma | 8,192 토큰 | 텍스트, 이미지 입력 이해 및 정보성 응답 생성에 능한 비전 언어 모델 |
| mistralai/mistral-7b-instruct-v0.2 | 32k 토큰 | 명령을 따르고, 요청을 완성하며, 창의적 텍스트 생성이 가능한 LLM |
| mistralai/mixtral-8x7b-instruct-v0.1 | 8,192 토큰 | 명령 및 요청 완성, 창의 텍스트 생성이 가능한 MOE LLM |
| mistralai/mistral-large | 4,096 토큰 | 실제 데이터 특성을 모방하는 다양한 합성 데이터 생성 |
| mistralai/mixtral-8x22b-instruct-v0.1 | 8,192 토큰 | 실제 데이터 특성을 모방하는 다양한 합성 데이터 생성 |
| mistralai/mistral-7b-instruct-v0.3 | 32k 토큰 | 명령을 따르고, 요청을 완성하며, 창의적 텍스트 생성이 가능한 LLM |
| nv-mistralai/mistral-nemo-12b-instruct | 128k 토큰 | 추론, 코드, 다국어 작업에 적합한 최첨단 언어 모델; 단일 GPU에서 구동 |
| mistralai/mamba-codestral-7b-v0.1 | 256k 토큰 | 광범위한 프로그래밍 언어 및 작업에서 코드 작성 및 상호작용 전용 모델 |
| microsoft/phi-3-mini-128k-instruct | 128K 토큰 | 수학·논리 추론에 강한 경량 최신 공개 LLM |
| microsoft/phi-3-mini-4k-instruct | 4,096 토큰 | 수학·논리 추론에 강한 경량 최신 공개 LLM |
| microsoft/phi-3-small-8k-instruct | 8,192 토큰 | 수학·논리 추론에 강한 경량 최신 공개 LLM |
| microsoft/phi-3-small-128k-instruct | 128K 토큰 | 수학·논리 추론에 강한 경량 최신 공개 LLM |
| microsoft/phi-3-medium-4k-instruct | 4,096 토큰 | 수학·논리 추론에 강한 경량 최신 공개 LLM |
| microsoft/phi-3-medium-128k-instruct | 128K 토큰 | 수학·논리 추론에 강한 경량 최신 공개 LLM |
| microsoft/phi-3.5-mini-instruct | 128K 토큰 | 지연, 메모리/컴퓨트 한계 환경에서 AI 응용프로그램 구동 가능한 다국어 LLM |
| microsoft/phi-3.5-moe-instruct | 128K 토큰 | 연산 효율적 콘텐츠 생성을 위한 Mixture of Experts 기반 첨단 LLM |
| microsoft/kosmos-2 | 1,024 토큰 | 이미지의 시각적 요소 이해 및 추론을 위한 획기적 멀티모달 모델 |
| microsoft/phi-3-vision-128k-instruct | 128k 토큰 | 이미지에서 고품질 추론이 가능한 최첨단 공개 멀티모달 모델 |
| microsoft/phi-3.5-vision-instruct | 128k 토큰 | 이미지에서 고품질 추론이 가능한 최첨단 공개 멀티모달 모델 |
| databricks/dbrx-instruct | 12k 토큰 | 언어 이해, 코딩, RAG에 최신 성능을 제공하는 범용 LLM |
| snowflake/arctic | 1,024 토큰 | SQL 생성 및 코딩에 집중한 기업용 고효율 추론 모델 |
| aisingapore/sea-lion-7b-instruct | 4,096 토큰 | 동남아 언어 및 문화 다양성을 반영하는 LLM |
| ibm/granite-8b-code-instruct | 4,096 토큰 | 소프트웨어 프로그래밍 LLM, 코드 생성, 완성, 설명, 멀티턴 전환 |
| ibm/granite-34b-code-instruct | 8,192 토큰 | 소프트웨어 프로그래밍 LLM, 코드 생성, 완성, 설명, 멀티턴 전환 |
| ibm/granite-3.0-8b-instruct | 4,096 토큰 | RAG, 요약, 분류, 코드, 에이전틱AI 지원 첨단 소형 언어 모델 |
| ibm/granite-3.0-3b-a800m-instruct | 4,096 토큰 | RAG, 요약, 엔터티 추출, 분류에 최적화된 고효율 Mixture of Experts 모델 |
| mediatek/breeze-7b-instruct | 4,096 토큰 | 실제 데이터 특성을 모방하는 다양한 합성 데이터 생성 |
| upstage/solar-10.7b-instruct | 4,096 토큰 | 지시 따르기, 추론, 수학 등에서 뛰어난 NLP 작업 수행 |
| writer/palmyra-med-70b-32k | 32k 토큰 | 의료 분야에서 정확하고 문맥에 맞는 응답 생성에 선도적인 LLM |
| writer/palmyra-med-70b | 32k 토큰 | 의료 분야에서 정확하고 문맥에 맞는 응답 생성에 선도적인 LLM |
| writer/palmyra-fin-70b-32k | 32k 토큰 | 금융 분석, 보고, 데이터 처리에 특화된 LLM |
| 01-ai/yi-large | 32k 토큰 | 영어, 중국어로 훈련, 챗봇 및 창의적 글쓰기 등 다양한 작업에 사용 |
| deepseek-ai/deepseek-coder-6.7b-instruct | 2k 토큰 | 고급 코드 생성, 완성, 인필링 등의 기능을 제공하는 강력한 코딩 모델 |
| rakuten/rakutenai-7b-instruct | 1,024 토큰 | 언어 이해, 추론, 텍스트 생성이 탁월한 최첨단 LLM |
| rakuten/rakutenai-7b-chat | 1,024 토큰 | 언어 이해, 추론, 텍스트 생성이 탁월한 최첨단 LLM |
| baichuan-inc/baichuan2-13b-chat | 4,096 토큰 | 중국어 및 영어 대화, 코딩, 수학, 지시 따르기, 퀴즈 풀이 지원 |
**참고:** 이 제공자는 LiteLLM을 사용합니다. 프로젝트에 의존성으로 추가하세요:
```bash
@@ -680,15 +514,12 @@ CrewAI는 고유한 기능, 인증 방법, 모델 역량을 제공하는 다양
CrewAI 프로젝트에서의 예시 사용법:
```python Code
llm = LLM(
model="groq/llama-3.2-90b-text-preview",
model="groq/qwen/qwen3.6-27b",
temperature=0.7
)
```
| 모델 | 컨텍스트 윈도우 | 최적 용도 |
|-----------------|-------------------|----------------------------------|
| Llama 3.1 70B/8B| 131,072 토큰 | 고성능, 대용량 문맥 작업 |
| Llama 3.2 Series| 8,192 토큰 | 범용 작업 |
| Mixtral 8x7B | 32,768 토큰 | 성능과 문맥의 균형 |
Groq는 production 모델과 preview 모델을 구분하며 모델 ID를 정기적으로 폐기합니다. 프로덕션 모델을 선택하기 전에 [Groq 모델 카탈로그](https://console.groq.com/docs/models)와 [지원 중단 페이지](https://console.groq.com/docs/deprecations)를 확인하세요.
**참고:** 이 제공자는 LiteLLM을 사용합니다. 프로젝트에 의존성으로 추가하세요:
```bash
@@ -770,11 +601,12 @@ CrewAI는 고유한 기능, 인증 방법, 모델 역량을 제공하는 다양
CrewAI 프로젝트에서의 예시 사용법:
```python Code
llm = LLM(
model="llama-3.1-sonar-large-128k-online",
base_url="https://api.perplexity.ai/"
model="perplexity/sonar-pro"
)
```
현재 모델 ID와 지원 중단 공지는 [Perplexity 모델 카탈로그](https://docs.perplexity.ai/getting-started/models)와 [changelog](https://docs.perplexity.ai/docs/resources/changelog)를 확인하세요.
**참고:** 이 제공자는 LiteLLM을 사용합니다. 프로젝트에 의존성으로 추가하세요:
```bash
uv add 'crewai[litellm]'
@@ -810,17 +642,12 @@ CrewAI는 고유한 기능, 인증 방법, 모델 역량을 제공하는 다양
CrewAI 프로젝트에서의 예시 사용법:
```python Code
llm = LLM(
model="sambanova/Meta-Llama-3.1-8B-Instruct",
model="sambanova/Meta-Llama-3.3-70B-Instruct",
temperature=0.7
)
```
| 모델 | 컨텍스트 윈도우 | 최적 용도 |
|-----------------|---------------------|--------------------------------------|
| Llama 3.1 70B/8B| 최대 131,072 토큰 | 고성능, 대용량 문맥 작업 |
| Llama 3.1 405B | 8,192 토큰 | 고성능, 높은 출력 품질 |
| Llama 3.2 Series| 8,192 토큰 | 범용, 멀티모달 작업 |
| Llama 3.3 70B | 최대 131,072 토큰 | 고성능, 높은 출력 품질 |
| Qwen2 familly | 8,192 토큰 | 고성능, 높은 출력 품질 |
SambaNova Cloud의 호스팅 모델은 CrewAI와 별도로 변경될 수 있습니다. 배포 전에 [models endpoint](https://docs.sambanova.ai/docs/api-reference/models/get-environments-available-model-list-metadata)를 조회하고 [지원 중단 가이드](https://docs.sambanova.ai/docs/en/models/deprecations)를 확인하세요.
**참고:** 이 제공자는 LiteLLM을 사용합니다. 프로젝트에 의존성으로 추가하세요:
```bash
@@ -838,7 +665,7 @@ CrewAI는 고유한 기능, 인증 방법, 모델 역량을 제공하는 다양
CrewAI 프로젝트에서의 예시 사용법:
```python Code
llm = LLM(
model="cerebras/llama3.1-70b",
model="cerebras/gpt-oss-120b",
temperature=0.7,
max_tokens=8192
)
@@ -852,6 +679,8 @@ CrewAI는 고유한 기능, 인증 방법, 모델 역량을 제공하는 다양
- 긴 컨텍스트 윈도우 지원
</Info>
현재 공개 endpoint ID는 [Cerebras 모델 카탈로그](https://inference-docs.cerebras.ai/models/overview)와 [지원 중단 공지](https://inference-docs.cerebras.ai/support/deprecation)를 확인하세요.
**참고:** 이 제공자는 LiteLLM을 사용합니다. 프로젝트에 의존성으로 추가하세요:
```bash
uv add 'crewai[litellm]'
@@ -926,7 +755,7 @@ CrewAI는 LLM의 스트리밍 응답을 지원하여, 애플리케이션이 출
# 스트리밍이 활성화된 LLM 생성
llm = LLM(
model="openai/gpt-4o",
model="openai/gpt-5.6-terra",
stream=True # 스트리밍 활성화
)
```
@@ -976,7 +805,7 @@ CrewAI는 LLM의 스트리밍 응답을 지원하여, 애플리케이션이 출
my_listener = MyCustomListener()
llm = LLM(model="gpt-4o-mini", temperature=0, stream=True)
llm = LLM(model="openai/gpt-5.6-terra", stream=True)
researcher = Agent(
role="About User",
@@ -1012,6 +841,8 @@ CrewAI는 LLM의 스트리밍 응답을 지원하여, 애플리케이션이 출
CrewAI는 Pydantic 모델을 사용하여 `response_format`을 정의함으로써 LLM 호출에서 구조화된 응답을 지원합니다. 이를 통해 프레임워크가 출력을 자동으로 파싱하고 검증할 수 있어, 수동 후처리 없이도 응답을 애플리케이션에 쉽게 통합할 수 있습니다.
구조화된 출력 지원은 제공업체와 모델에 따라 다릅니다. 프로덕션에서 구조화된 응답에 의존하기 전에 선택한 모델을 테스트하세요.
예를 들어, 예상되는 응답 구조를 나타내는 Pydantic 모델을 정의하고 LLM을 인스턴스화할 때 `response_format`으로 전달할 수 있습니다. 이 모델은 LLM 출력을 구조화된 Python 객체로 변환하는 데 사용됩니다.
```python Code
@@ -1023,7 +854,7 @@ class Dog(BaseModel):
breed: str
llm = LLM(model="gpt-4o", response_format=Dog)
llm = LLM(model="openai/gpt-5.6-terra", response_format=Dog)
response = llm.call(
"Analyze the following messages and return the name, age, and breed. "
@@ -1052,8 +883,8 @@ LLM 설정을 최대한 활용하는 방법을 알아보세요:
# 3. 큰 컨텍스트에 대한 작업 분할
llm = LLM(
model="gpt-4",
max_tokens=4000, # 응답 길이 제한
model="openai/gpt-5.6-terra",
max_completion_tokens=4000, # 응답 길이 제한
)
```
@@ -1077,15 +908,14 @@ LLM 설정을 최대한 활용하는 방법을 알아보세요:
```python
# 모델을 적절한 설정으로 구성
llm = LLM(
model="openai/gpt-4-turbo-preview",
temperature=0.7, # 작업에 따라 조정
max_tokens=4096, # 출력 요구 사항에 맞게 설정
timeout=300 # 복잡한 작업을 위한 더 긴 타임아웃
model="openai/gpt-5.6-terra",
reasoning_effort="medium",
max_completion_tokens=4096,
timeout=300
)
```
<Tip>
- 사실 기반 응답에는 낮은 temperature(0.1~0.3)
- 창의적인 작업에는 높은 temperature(0.7~0.9)
선택한 모델이 지원하는 제어 옵션을 사용하세요. 제공자에 따라 `temperature`, reasoning 또는 thinking 수준, 혹은 원하는 스타일과 변동성을 정의하는 프롬프트 지침을 사용할 수 있습니다.
</Tip>
</Step>

View File

@@ -24,15 +24,23 @@ mode: "wide"
## 빠른 시작
### 1. 스킬 디렉터리 생성
### 1. CLI로 스킬 생성
CLI는 스킬을 생성하는 공식 지원 방식입니다 — 디렉터리 레이아웃과 유효한 `SKILL.md`를 자동으로 스캐폴딩해 줍니다:
```shell Terminal
crewai skill create code-review
```
크루 프로젝트 내부(`pyproject.toml`이 있는 곳)에서는 `./skills/code-review/`가 생성되고, 프로젝트 외부에서는 현재 디렉터리에 `./code-review/`가 생성됩니다 (`--no-project`로 이 동작을 강제할 수 있습니다):
```
skills/
└── code-review/
├── SKILL.md # 필수 — 지침
├── SKILL.md # 필수 — 지침 (미리 채워진 템플릿)
├── references/ # 선택 — 참조 문서
│ └── style-guide.md
└── scripts/ # 선택 — 실행 가능한 스크립트
├── scripts/ # 선택 — 실행 가능한 스크립트
└── assets/ # 선택 — 정적 파일
```
### 2. SKILL.md 작성
@@ -164,6 +172,65 @@ agent = Agent(
---
## 스킬 생성, 게시 및 설치
스킬은 CLI로 관리되는 전체 라이프사이클을 갖습니다: **`crewai skill create`로 생성하고, `crewai skill publish`로 게시하세요** — 디렉터리를 직접 만드는 방식도 로컬 실험에는 사용할 수 있지만, CLI가 의도된 워크플로우이며 스킬 레이아웃과 프론트매터를 유효하게 유지해 줍니다.
### 생성
```shell Terminal
crewai skill create my-skill
```
디렉터리를 스캐폴딩하고 (크루 프로젝트 내부에서는 `./skills/`에 생성) 템플릿 `SKILL.md`와 함께 빈 `scripts/`, `references/`, `assets/` 디렉터리를 만듭니다. `SKILL.md`를 편집하여 지침을 정의하세요.
### 게시
스킬 디렉터리 내부(`SKILL.md`가 있는 곳)에서 실행하세요:
```shell Terminal
cd skills/my-skill
crewai skill publish
```
게시 시 `SKILL.md` 프론트매터에서 `name`, `description`, `metadata.version`을 읽어 스킬을 CrewAI 레지스트리로 푸시합니다. **게시된 스킬은 항상 조직 범위로 제한됩니다** — 도구와 마찬가지로 게시한 조직의 멤버만 스킬을 보고 설치할 수 있으며, 공개 가시성은 없습니다. 유용한 플래그:
| 플래그 | 효과 |
| :--- | :--- |
| `--org <slug>` | 특정 조직으로 게시합니다 (설정을 재정의). |
| `--force` | git 상태 검증을 건너뜁니다 (커밋되지 않은 변경 사항 등). |
### 설치
게시된 스킬을 `@org/name` 참조로 설치합니다:
```shell Terminal
crewai skill install @acme/code-review
```
크루 프로젝트 내부에서는 스킬이 `./skills/{name}/`에 설치되고, 프로젝트 외부에서는 공유 캐시인 `~/.crewai/skills/{org}/{name}/`에 저장됩니다.
에이전트는 레지스트리 스킬을 직접 참조할 수도 있습니다 — 런타임에 로컬 캐시(또는 프로젝트 `skills/` 디렉터리)에서 해석됩니다:
```python
agent = Agent(
role="Senior Code Reviewer",
goal="Review pull requests for quality and security issues",
backstory="Staff engineer with expertise in secure coding practices.",
skills=["@acme/code-review"], # registry ref, resolved locally
)
```
### 목록 조회
```shell Terminal
crewai skill list
```
프로젝트 `./skills/` 디렉터리와 전역 캐시 양쪽에 설치된 스킬을 버전 및 경로와 함께 보여줍니다.
---
## 크루 레벨 스킬
스킬을 크루에 설정하여 **모든 에이전트**에 적용할 수 있습니다:

View File

@@ -0,0 +1,123 @@
---
title: "Studio의 Flows"
description: "결정론적인 단계별 제어와 에이전트 지능을 결합한 이벤트 기반 워크플로우를 코드 없이 구축하세요."
icon: "diagram-project"
mode: "wide"
---
<Info>
**점진적 출시 중**: Studio의 Flows는 2026년 7월 20일 주간에 걸쳐 순차적으로 출시됩니다. Studio에서 아직 Flows 옵션이 보이지 않는다면 소속 조직에 아직 배포되지 않은 것이니 곧 다시 확인해 주세요.
</Info>
## 개요
이제 Studio에서 Crew뿐 아니라 **Flows**도 구축할 수 있습니다. Flows는 어떤 단계가 어떤 순서로, 어떤 조건에서 실행될지를 직접 제어하는 이벤트 기반 워크플로우이며, 각 단계 내부의 지능적인 작업은 AI 에이전트에게 맡길 수 있습니다.
Flow를 만들려면 Studio를 열고 자동화를 설명한 뒤, 프롬프트 입력창 옆의 선택기에서 **Flows**를 선택하세요.
<Frame>
![Studio의 Flows 선택기](/images/enterprise/studio-flows-selector.png)
</Frame>
## 왜 Flows인가?
Crew는 에이전트 팀이 목표를 향해 자율적으로 협업하도록 할 때 매우 유용합니다. 하지만 실제 자동화 중 상당수는 더 높은 예측 가능성이 필요합니다. 먼저 이 데이터를 가져오고, 그다음 요약하고, 마지막으로 결과를 게시하는 식으로 — 매번 같은 순서로요.
Flows는 두 가지를 모두 제공합니다:
- **필요한 곳의 결정론**: 단계가 정의된 순서와 명시적인 분기에 따라 실행되므로, 실행 결과가 예측 가능하고 반복 가능하며 디버깅하기 쉽습니다.
- **필요한 곳의 지능**: 각 단계는 에이전트(또는 전체 crew)가 수행하므로, 요약·평가·작성·판단 같은 단계 내부의 작업은 LLM의 추론 능력을 온전히 활용합니다.
이 조합 덕분에 Flows는 프로덕션 자동화에 적합합니다. 구조는 보장되고, 에이전트의 자율성은 그것이 필요한 단계로만 한정됩니다.
## Flow 구축하기
원하는 것을 자연어로 설명하면 Studio Assistant가 Flow를 설계해 줍니다. 단계를 만들고, 서로 연결하고, 각 단계에 필요한 에이전트와 앱 연동을 구성합니다. 오른쪽 캔버스에는 완성된 워크플로우가 연결된 노드로 표시되며, 대화를 이어가며 반복 수정하거나 노드를 직접 편집할 수 있습니다.
<Frame>
![Studio Assistant와 Flow 캔버스](/images/enterprise/studio-flows-agent-node.png)
</Frame>
준비가 되면 **Run**으로 Flow를 처음부터 끝까지 테스트하고, **Output** 및 **Traces** 탭에서 결과를 확인한 뒤, 안정화되면 **Deploy**하세요. 프로젝트를 **Share**하거나 소스 코드를 **Download**할 수도 있습니다.
## 노드 유형
Flows는 세 가지 핵심 노드 유형으로 구성됩니다. 각 노드는 워크플로우의 한 단계이며 자유롭게 조합할 수 있습니다.
### Single Agent
Single Agent 노드는 하나의 에이전트가 하나의 집중된 작업을 수행합니다. 연동 서비스에서 데이터 가져오기, 콘텐츠 변환, 메시지 게시처럼 범위가 명확한 단계에 적합합니다.
에이전트 노드를 클릭하면 전체 구성이 열립니다:
- **Task**: 이 단계가 달성해야 할 목표와 생성해야 할 출력
- **Profile**: 에이전트의 role, goal, backstory
- **Model**: 에이전트를 구동하는 LLM
- **Apps**: 에이전트가 사용할 수 있는 연동 서비스(예: Linear, Slack, HubSpot)
- **Runtime Controls**: 실행 전 계획 수립, 위임, 메모리에 대한 토글
<Frame>
![Single Agent 노드 구성](/images/enterprise/studio-flows-agent-config.png)
</Frame>
### Crews
Crew 노드는 여러 에이전트가 여러 작업을 협업으로 수행하는 전체 crew를 Flow의 단일 단계로 포함합니다. 데이터를 팀별로 그룹화·요약한 뒤 전달용으로 포맷을 정리하는 것처럼, 하나의 에이전트로 감당하기 어려운 단계에 사용하세요.
<Frame>
![Flow 안의 Crew 노드](/images/enterprise/studio-flows-crew-node.png)
</Frame>
Crew 노드를 열면 내부 구조가 표시됩니다. 수행하는 작업, 각 작업에 배정된 에이전트, 사용하는 앱을 확인할 수 있습니다. crew는 해당 단계 내에서 자율적으로 실행된 뒤 결과를 Flow의 다음 노드로 전달합니다.
<Frame>
![Crew 노드 내부](/images/enterprise/studio-flows-crew-detail.png)
</Frame>
이것이 결정론과 에이전트 지능이 결합된 패턴입니다. Flow는 crew가 *언제* 실행될지를 보장하고, crew는 작업을 *어떻게* 수행할지에 협업 지능을 더합니다.
### Router
Router 노드는 조건에 따라 Flow를 분기시켜 결과에 따라 서로 다른 경로를 따르게 합니다. 예를 들어 리드 라우팅 Flow는 유입 리드를 평가한 뒤, 고품질 리드는 영업 배정 단계로 보내고 나머지는 향후 육성을 위해 기록만 남길 수 있습니다.
<Frame>
![조건 분기가 있는 Router 노드](/images/enterprise/studio-flows-router-node.png)
</Frame>
Router가 있기에 Flows는 진정한 이벤트 기반 워크플로우가 됩니다. 하나의 워크플로우가 모든 경우를 처리하되, 각 실행은 데이터에 해당하는 분기만 따라갑니다 — 불필요한 단계도, 다음에 무슨 일이 일어날지에 대한 모호함도 없습니다.
## Agent Repository 동기화
Flows에서 만든 에이전트를 하나의 프로젝트에 가둘 필요가 없습니다. 모든 에이전트 노드에는 **Publish to Agent Repository** 버튼이 있어, 에이전트의 role, goal, backstory, 모델, 구성을 조직의 [Agent Repository](/ko/enterprise/features/agent-repositories)에 저장할 수 있습니다.
양방향으로 동작합니다:
- **게시(Publish)**: Flow에서 다듬은 에이전트를 리포지토리로 승격하여 다른 팀과 프로젝트에서 재사용할 수 있게 합니다.
- **가져오기(Pull)**: 처음부터 다시 만드는 대신 리포지토리의 기존 에이전트를 새 Flow로 가져옵니다.
리포지토리 에이전트는 조직 전체에 동기화되므로, 공유 에이전트를 한 번 개선하면 이를 사용하는 모든 Flow가 혜택을 받습니다. 에이전트 동작을 일관되고 관리 가능하게 유지하며 중복 작업을 없앨 수 있습니다.
## 모범 사례
- 자동화에 명확한 순서나 분기 로직이 있다면 **Flow를 선택**하고, 목표까지의 경로가 열려 있다면 Crew를 선택하세요.
- **에이전트 작업은 집중적으로 유지하세요** — 작업 설명이 명확한 Single Agent 노드가 세 가지 일을 한꺼번에 맡은 에이전트보다 안정적입니다.
- **Router로 모든 경우를 명시적으로 처리하세요.** "아무것도 하지 않는" 경로(예: 건너뛴 리드 기록)까지 포함해 모든 실행이 빠짐없이 처리되도록 합니다.
- **안정화된 에이전트는 Agent Repository에 게시**하여 조직이 일회성 복사본 대신 공유 라이브러리를 구축하도록 하세요.
- **배포 전에 Run으로 테스트하고 Traces를 확인**하여 연동이나 프롬프트 문제를 조기에 발견하세요.
## 관련 문서
<CardGroup cols={4}>
<Card title="Crew Studio" href="/ko/enterprise/features/crew-studio" icon="pencil">
Studio에서 Crew를 구축하세요.
</Card>
<Card title="Agent Repositories" href="/ko/enterprise/features/agent-repositories" icon="people-group">
조직 전체에서 에이전트를 공유하고 재사용하세요.
</Card>
<Card title="Flows 개념" href="/ko/concepts/flows" icon="diagram-project">
CrewAI 프레임워크에서 Flows가 동작하는 방식을 알아보세요.
</Card>
<Card title="Tools & Integrations" href="/ko/enterprise/features/tools-and-integrations" icon="plug">
에이전트가 사용할 앱을 연결하세요.
</Card>
</CardGroup>

View File

@@ -13,8 +13,7 @@ mode: "wide"
FileReadTool은 crewai_tools 패키지 내에서 파일 읽기와 콘텐츠 검색을 용이하게 하는 기능 모음입니다.
이 모음에는 배치 텍스트 파일 처리, 런타임 구성 파일 읽기, 분석을 위한 데이터 가져오기 등 다양한 도구가 포함되어 있습니다.
`.txt`, `.csv`, `.json` 등 다양한 텍스트 기반 파일 형식을 지원합니다. 파일 유형에 따라 이 모음은
JSON 콘텐츠를 Python 딕셔너리로 변환하여 사용을 쉽게 하는 등 특화된 기능을 제공합니다.
`.txt`, `.csv`, `.json` 등 다양한 텍스트 기반 파일 형식을 지원합니다. 콘텐츠는 항상 일반 텍스트로 반환됩니다.
## 설치

View File

@@ -32,7 +32,11 @@ from crewai_tools import FileWriterTool
file_writer_tool = FileWriterTool()
# Write content to a file in a specified directory
result = file_writer_tool._run('example.txt', 'This is a test content.', 'test_directory')
result = file_writer_tool.run(
filename='example.txt',
content='This is a test content.',
directory='test_directory',
)
print(result)
```

View File

@@ -4,6 +4,163 @@ description: "Atualizações de produto, melhorias e correções do CrewAI"
icon: "clock"
mode: "wide"
---
<Update label="29 jul 2026">
## v1.15.9
[Ver release no GitHub](https://github.com/crewAIInc/crewAI/releases/tag/1.15.9)
## O que mudou
### Recursos
- Exibir falhas de ferramentas em vez de relatá-las como sucesso
- Emitir FlowFailedEvent quando uma execução de fluxo falha
- Implementar divulgação progressiva para habilidades
### Documentação
- Atualizar snapshot e changelog para v1.15.8
## Contributors
@github-actions[bot], @joaomdmoura, @lorenzejay, @lucasgomide
</Update>
<Update label="28 jul 2026">
## v1.15.8
[Ver release no GitHub](https://github.com/crewAIInc/crewAI/releases/tag/1.15.8)
## O que Mudou
### Funcionalidades
- Adicionar WaitTool para pausar em trabalhos de longa duração.
### Correções de Bugs
- Corrigir FileWriterTool para gravações e abordar problemas no arquivo ferramenta.
- Marcar E2B_API_KEY como uma variável de ambiente obrigatória para ferramentas E2B.
### Documentação
- Atualizar orientações sobre a disponibilidade do modelo.
## Contribuidores
@github-actions[bot], @joaomdmoura, @lucasgomide, @oalami, @thiagomoretto
</Update>
<Update label="26 jul 2026">
## v1.15.7
[Ver release no GitHub](https://github.com/crewAIInc/crewAI/releases/tag/1.15.7)
## O que Mudou
### Correções de Bugs
- Resolver habilidades de registro através do cliente CrewAI+ do runtime
- Recuperar das ferramentas GPT-5.6 + reasoning_effort 400
- Fazer chamadas de ferramentas funcionarem no caminho da API de Respostas
- Roteirizar modelos apenas de respostas em vez de falhar com 404
- Atualizar bedrock-agentcore para corrigir CVE-2026-16796
### Observabilidade
- Emitir eventos de uso de habilidades em tempo de execução para observabilidade
### Documentação
- Adicionar snapshot e changelog para v1.15.7a1
## Contributors
@alex-clawd, @joaomdmoura, @lorenzejay
</Update>
<Update label="26 jul 2026">
## v1.15.7a1
[Ver release no GitHub](https://github.com/crewAIInc/crewAI/releases/tag/1.15.7a1)
## O Que Mudou
### Correções de Bugs
- Corrigir a resolução de habilidades do registro através do cliente CrewAI+ do runtime.
- Recuperar dos erros 400 de tools e reasoning_effort do GPT-5.6.
- Fazer a chamada de ferramentas funcionar no caminho da API de Respostas.
- Roteirizar modelos apenas de respostas para evitar erros 404.
- Atualizar a dependência bedrock-agentcore para corrigir o CVE-2026-16796.
### Observabilidade
- Emitir eventos de uso de habilidades em tempo de execução para melhorar a observabilidade.
### Documentação
- Atualizações de snapshot e changelog para a versão 1.15.6.
## Contributors
@alex-clawd, @joaomdmoura, @lorenzejay
</Update>
<Update label="24 jul 2026">
## v1.15.6
[Ver release no GitHub](https://github.com/crewAIInc/crewAI/releases/tag/1.15.6)
## O que mudou
### Correções de Bugs
- Corrigir a detecção de blocos de uso da ferramenta de pré-visualização da Anthropic.
- Preservar os nomes das propriedades do esquema de ferramenta estrito.
- Disparar o hook execution_end em execuções de equipe e fluxo com falha.
- Lidar com get_agent assíncrono em load_agent_from_repository.
- Corrigir problemas de resolução de dependências.
### Documentação
- Snapshot e changelog para v1.15.5.
## Contributors
@alex-clawd, @iris-clawd, @lorenzejay, @lucasgomide, @theCyberTech, @vinibrsl
</Update>
<Update label="20 jul 2026">
## v1.15.5
[Ver release no GitHub](https://github.com/crewAIInc/crewAI/releases/tag/1.15.5)
## O Que Mudou
### Funcionalidades
- Autenticar downloads do registro de habilidades
### Documentação
- Atualizar snapshot e changelog para v1.15.4
## Contribuidores
@vinibrsl
</Update>
<Update label="17 jul 2026">
## v1.15.4
[Ver release no GitHub](https://github.com/crewAIInc/crewAI/releases/tag/1.15.4)
## O que Mudou
### Funcionalidades
- Promover o Repositório de Habilidades para fora do status experimental
### Documentação
- Adicionar Fluxos na documentação do Studio
## Contribuidores
@jessemiller, @joaomdmoura, @vinibrsl
</Update>
<Update label="16 jul 2026">
## v1.15.3

View File

@@ -256,6 +256,7 @@ O CrewAI fornece uma ampla variedade de eventos para escuta:
- **FlowCreatedEvent**: Emitido ao criar um Flow
- **FlowStartedEvent**: Emitido ao iniciar a execução de um Flow
- **FlowFinishedEvent**: Emitido ao concluir a execução de um Flow
- **FlowFailedEvent**: Emitido quando a execução de um Flow falha. Contém o nome do flow e a exceção que encerrou a execução.
- **FlowPausedEvent**: Emitido quando um Flow é pausado aguardando feedback humano. Contém o nome do flow, ID do flow, nome do método, estado atual, mensagem exibida ao solicitar feedback e lista opcional de resultados possíveis para roteamento.
- **FlowPlotEvent**: Emitido ao plotar um Flow
- **MethodExecutionStartedEvent**: Emitido ao iniciar a execução de um método do Flow

View File

@@ -21,7 +21,7 @@ Modelos de Linguagem de Grande Escala (LLMs) são a inteligência central por tr
A janela de contexto determina quanto texto um LLM pode processar de uma só vez. Janelas maiores (por exemplo, 128K tokens) permitem mais contexto, porém podem ser mais caras e lentas.
</Card>
<Card title="Temperatura" icon="temperature-three-quarters">
A temperatura (0.0 a 1.0) controla a aleatoriedade das respostas. Valores mais baixos (ex.: 0.2) produzem respostas mais focadas e determinísticas, enquanto valores mais altos (ex.: 0.8) aumentam criatividade e variabilidade.
A temperatura é um controle de amostragem compatível com alguns modelos. Valores mais baixos geralmente tornam a amostragem mais focada, enquanto valores mais altos aumentam a variabilidade. Alguns modelos de raciocínio mais recentes ignoram, desaconselham ou rejeitam esse parâmetro; consulte a documentação do modelo escolhido antes de defini-lo.
</Card>
<Card title="Seleção de Provedor" icon="server">
Cada provedor de LLM (ex.: OpenAI, Anthropic, Google) oferece modelos diferentes, com capacidades, preços e recursos variados. Escolha conforme suas necessidades de precisão, velocidade e custo.
@@ -37,7 +37,7 @@ Existem diferentes locais no código do CrewAI onde você pode especificar o mod
A maneira mais simples de começar. Defina o modelo diretamente em seu ambiente, usando um arquivo `.env` ou no código do seu aplicativo. Se você utilizou `crewai create` para iniciar seu projeto, já estará configurado.
```bash .env
MODEL=model-id # e.g. gpt-4o, gemini-2.0-flash, claude-3-sonnet-...
MODEL=provider/model-id # e.g. openai/gpt-5.6-terra
# Lembre-se de definir suas chaves de API aqui também. Veja a seção
# do Provedor abaixo.
@@ -56,7 +56,7 @@ Existem diferentes locais no código do CrewAI onde você pode especificar o mod
goal: Conduct comprehensive research and analysis
backstory: A dedicated research professional with years of experience
verbose: true
llm: provider/model-id # e.g. openai/gpt-4o, google/gemini-2.0-flash, anthropic/claude...
llm: provider/model-id # e.g. anthropic/claude-sonnet-4-6
# (veja exemplos de configuração de provedores abaixo para mais)
```
@@ -75,32 +75,24 @@ Existem diferentes locais no código do CrewAI onde você pode especificar o mod
from crewai import LLM
# Configuração básica
llm = LLM(model="model-id-here") # gpt-4o, gemini-2.0-flash, anthropic/claude...
llm = LLM(model="provider/model-id") # e.g. gemini/gemini-3.6-flash
# Configuração avançada com parâmetros detalhados
llm = LLM(
model="openai/gpt-4",
temperature=0.8,
max_tokens=150,
top_p=0.9,
frequency_penalty=0.1,
presence_penalty=0.1,
response_format={"type":"json"},
stop=["FIM"],
seed=42
model="provider/model-id",
timeout=120,
max_tokens=4000,
response_format={"type": "json"}, # Para saídas estruturadas
)
```
<Info>
Explicações dos parâmetros:
- `temperature`: Controla a aleatoriedade (0.0-1.0)
- `timeout`: Tempo máximo de espera pela resposta
- `max_tokens`: Limita o comprimento da resposta
- `top_p`: Alternativa à temperatura para amostragem
- `frequency_penalty`: Reduz repetição de palavras
- `presence_penalty`: Incentiva novos tópicos
- `response_format`: Especifica formato de saída
- `seed`: Garante resultados consistentes
Controles de amostragem como `temperature` e `top_p`, parâmetros de penalidade, nomes de limites de tokens e controles de raciocínio são específicos de cada modelo. Adicione-os somente quando o provedor e o modelo escolhidos oferecerem suporte. Consulte os exemplos de provedores abaixo e a documentação do modelo do provedor.
</Info>
</Tab>
</Tabs>
@@ -119,6 +111,10 @@ Existem diferentes locais no código do CrewAI onde você pode especificar o mod
O CrewAI suporta uma grande variedade de provedores de LLM, cada um com recursos, métodos de autenticação e capacidades de modelo únicos.
Nesta seção, você encontrará exemplos detalhados que ajudam a selecionar, configurar e otimizar o LLM que melhor atende às necessidades do seu projeto.
<Warning>
A disponibilidade dos modelos muda com frequência e pode variar por conta, região e plataforma de nuvem. Os exemplos abaixo usam modelos atuais no momento da redação, mas não são listas completas de suporte. Antes de implantar, confirme o ID e o estado do ciclo de vida do modelo no catálogo vinculado do provedor.
</Warning>
<AccordionGroup>
<Accordion title="OpenAI">
Defina as seguintes variáveis de ambiente no seu arquivo `.env`:
@@ -137,28 +133,13 @@ Nesta seção, você encontrará exemplos detalhados que ajudam a selecionar, co
from crewai import LLM
llm = LLM(
model="openai/gpt-4",
temperature=0.8,
max_tokens=150,
top_p=0.9,
frequency_penalty=0.1,
presence_penalty=0.1,
stop=["FIM"],
seed=42
model="openai/gpt-5.6-terra",
reasoning_effort="medium",
max_completion_tokens=4000
)
```
OpenAI é um dos líderes em modelos LLM com uma ampla gama de modelos e recursos.
| Modelo | Janela de Contexto | Melhor Para |
|----------------------|---------------------|------------------------------------------|
| GPT-4 | 8.192 tokens | Tarefas de alta precisão, raciocínio complexo |
| GPT-4 Turbo | 128.000 tokens | Conteúdo longo, análise de documentos |
| GPT-4o & GPT-4o-mini | 128.000 tokens | Processamento de contexto amplo com bom custo-benefício |
| o3-mini | 200.000 tokens | Raciocínio rápido, tarefas complexas |
| o1-mini | 128.000 tokens | Raciocínio rápido, tarefas complexas |
| o1-preview | 128.000 tokens | Raciocínio rápido, tarefas complexas |
| o1 | 200.000 tokens | Raciocínio rápido, tarefas complexas |
A OpenAI adiciona modelos e desativa snapshots antigos regularmente. Consulte o [catálogo de modelos da OpenAI](https://developers.openai.com/api/docs/models) para obter IDs atuais, janelas de contexto, compatibilidade com endpoints e informações de ciclo de vida.
**Responses API:**
@@ -215,14 +196,7 @@ Nesta seção, você encontrará exemplos detalhados que ajudam a selecionar, co
)
```
Todos os modelos listados em https://llama.developer.meta.com/docs/models/ são suportados.
| ID do Modelo | Comprimento contexto entrada | Comprimento contexto saída | Modalidades de entrada | Modalidades de saída |
| --- | --- | --- | --- | --- |
| `meta_llama/Llama-4-Scout-17B-16E-Instruct-FP8` | 128k | 4028 | Texto, Imagem | Texto |
| `meta_llama/Llama-4-Maverick-17B-128E-Instruct-FP8` | 128k | 4028 | Texto, Imagem | Texto |
| `meta_llama/Llama-3.3-70B-Instruct` | 128k | 4028 | Texto | Texto |
| `meta_llama/Llama-3.3-8B-Instruct` | 128k | 4028 | Texto | Texto |
Consulte a [visão geral dos modelos Meta Llama](https://ai.meta.com/llama/get-started/) para conhecer as famílias de modelos, modalidades e orientações de contexto atuais.
**Nota:** Este provedor usa o LiteLLM. Adicione-o como dependência ao seu projeto:
```bash
@@ -291,10 +265,12 @@ Nesta seção, você encontrará exemplos detalhados que ajudam a selecionar, co
Exemplo de uso em seu projeto CrewAI:
```python Code
llm = LLM(
model="anthropic/claude-3-sonnet-20240229-v1:0",
temperature=0.7
model="anthropic/claude-sonnet-4-6",
max_tokens=4096
)
```
Consulte a [visão geral dos modelos](https://platform.claude.com/docs/en/about-claude/models/overview) da Anthropic para obter IDs e capacidades atuais e revise a [tabela de descontinuação](https://platform.claude.com/docs/en/about-claude/model-deprecations) antes de fixar um modelo em produção.
</Accordion>
<Accordion title="Google (Gemini API)">
@@ -319,8 +295,7 @@ Nesta seção, você encontrará exemplos detalhados que ajudam a selecionar, co
from crewai import LLM
llm = LLM(
model="gemini/gemini-2.0-flash",
temperature=0.7,
model="gemini/gemini-3.6-flash",
)
```
@@ -339,8 +314,7 @@ Nesta seção, você encontrará exemplos detalhados que ajudam a selecionar, co
from crewai import LLM
llm = LLM(
model="gemini/gemini-2.0-flash",
temperature=0.7
model="gemini/gemini-3.6-flash"
)
```
@@ -352,47 +326,15 @@ Nesta seção, você encontrará exemplos detalhados que ajudam a selecionar, co
Para mais detalhes, consulte a [documentação do Vertex AI Express mode](https://docs.cloud.google.com/vertex-ai/generative-ai/docs/start/quickstart?usertype=apikey).
</Info>
### Modelos Gemini
O Google oferece uma variedade de modelos poderosos otimizados para diferentes casos de uso.
| Modelo | Janela de Contexto | Melhor Para |
|----------------------------------|--------------------|---------------------------------------------------------------------|
| gemini-2.5-flash-preview-04-17 | 1M tokens | Pensamento adaptativo, eficiência de custo |
| gemini-2.5-pro-preview-05-06 | 1M tokens | Pensamento e raciocínio avançados, compreensão multimodal, codificação avançada, etc. |
| gemini-2.0-flash | 1M tokens | Próxima geração de recursos, velocidade, raciocínio e streaming em tempo real |
| gemini-2.0-flash-lite | 1M tokens | Eficiência de custo e baixa latência |
| gemini-1.5-flash | 1M tokens | Modelo multimodal equilibrado, bom para maioria das tarefas |
| gemini-1.5-flash-8B | 1M tokens | Mais rápido, mais eficiente em custo, adequado para tarefas de alta frequência |
| gemini-1.5-pro | 2M tokens | Melhor desempenho para uma ampla variedade de tarefas de raciocínio, incluindo lógica, codificação e colaboração criativa |
A lista completa de modelos está disponível na [documentação dos modelos Gemini](https://ai.google.dev/gemini-api/docs/models).
### Gemma
A API Gemini também permite uso de sua chave de API para acessar [modelos Gemma](https://ai.google.dev/gemma/docs) hospedados na infraestrutura Google.
| Modelo | Janela de Contexto |
|----------------|-------------------|
| gemma-3-1b-it | 32k tokens |
| gemma-3-4b-it | 32k tokens |
| gemma-3-12b-it | 32k tokens |
| gemma-3-27b-it | 128k tokens |
O Google publica IDs atuais, capacidades e estágios do ciclo de vida no [catálogo de modelos Gemini](https://ai.google.dev/gemini-api/docs/models). Consulte o [cronograma de descontinuação](https://ai.google.dev/gemini-api/docs/deprecations) antes de escolher um modelo estável ou preview. A API Gemini também hospeda [modelos Gemma](https://ai.google.dev/gemma/docs).
</Accordion>
<Accordion title="Google (Vertex AI)">
Obtenha as credenciais pelo Google Cloud Console, salve em um arquivo JSON e carregue com o código a seguir:
```python Code
import json
file_path = 'path/to/vertex_ai_service_account.json'
# Carregar o arquivo JSON
with open(file_path, 'r') as file:
vertex_credentials = json.load(file)
# Converter credenciais em string JSON
vertex_credentials_json = json.dumps(vertex_credentials)
Autentique-se com as [Credenciais Padrão do Aplicativo](https://cloud.google.com/docs/authentication/provide-credentials-adc) e configure o provedor Gemini nativo para usar o Vertex AI:
```toml .env
GOOGLE_GENAI_USE_VERTEXAI=true
GOOGLE_CLOUD_PROJECT=<your-project-id>
GOOGLE_CLOUD_LOCATION=<location>
```
Exemplo de uso em seu projeto CrewAI:
@@ -400,27 +342,15 @@ Nesta seção, você encontrará exemplos detalhados que ajudam a selecionar, co
from crewai import LLM
llm = LLM(
model="gemini-1.5-pro-latest", # or vertex_ai/gemini-1.5-pro-latest
temperature=0.7,
vertex_credentials=vertex_credentials_json
model="gemini/gemini-3.6-flash"
)
```
O Google oferece uma variedade de modelos poderosos otimizados para diferentes casos de uso:
Consulte as [informações de modelos do Vertex AI](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models) para verificar modelos e regiões disponíveis.
| Modelo | Janela de Contexto | Melhor Para |
|----------------------------------|--------------------|---------------------------------------------------------------------|
| gemini-2.5-flash-preview-04-17 | 1M tokens | Pensamento adaptativo, eficiência de custo |
| gemini-2.5-pro-preview-05-06 | 1M tokens | Pensamento e raciocínio avançados, compreensão multimodal, codificação avançada, etc. |
| gemini-2.0-flash | 1M tokens | Próxima geração de recursos, velocidade, raciocínio e streaming em tempo real |
| gemini-2.0-flash-lite | 1M tokens | Eficiência de custo e baixa latência |
| gemini-1.5-flash | 1M tokens | Modelo multimodal equilibrado, bom para maioria das tarefas |
| gemini-1.5-flash-8B | 1M tokens | Mais rápido, mais eficiente em custo, adequado para tarefas de alta frequência |
| gemini-1.5-pro | 2M tokens | Melhor desempenho para uma ampla variedade de tarefas de raciocínio, incluindo lógica, codificação e colaboração criativa |
**Nota:** Este provedor usa o LiteLLM. Adicione-o como dependência ao seu projeto:
**Nota:** Esta configuração usa a integração Gemini nativa do CrewAI. Adicione-a como dependência ao seu projeto:
```bash
uv add 'crewai[litellm]'
uv add "crewai[google-genai]"
```
</Accordion>
@@ -455,7 +385,7 @@ Nesta seção, você encontrará exemplos detalhados que ajudam a selecionar, co
Exemplo de uso em seu projeto CrewAI:
```python Code
llm = LLM(
model="bedrock/anthropic.claude-3-sonnet-20240229-v1:0"
model="bedrock/us.anthropic.claude-sonnet-4-6"
)
```
@@ -463,34 +393,6 @@ Nesta seção, você encontrará exemplos detalhados que ajudam a selecionar, co
[Amazon Bedrock](https://docs.aws.amazon.com/bedrock/latest/userguide/models-regions.html) é um serviço gerenciado que fornece acesso a múltiplos modelos fundamentais dos principais provedores de IA através de uma API unificada, permitindo o desenvolvimento seguro e responsável de aplicações de IA.
| Modelo | Janela de Contexto | Melhor Para |
|--------------------------|------------------------|---------------------------------------------------------------------|
| Amazon Nova Pro | Até 300k tokens | Alto desempenho, equilíbrio entre precisão, velocidade e custo em tarefas diversas. |
| Amazon Nova Micro | Até 128k tokens | Modelo texto-only de alta performance, custo-benefício, otimizado para baixa latência. |
| Amazon Nova Lite | Até 300k tokens | Alto desempenho, processamento multimodal acessível para texto, imagem, vídeo em tempo real. |
| Claude 3.7 Sonnet | Até 128k tokens | Alto desempenho para raciocínio complexo, programação & agentes de IA|
| Claude 3.5 Sonnet v2 | Até 200k tokens | Modelo avançado especializado em engenharia de software, capacidades agenticas e interação computacional com custo otimizado. |
| Claude 3.5 Sonnet | Até 200k tokens | Alto desempenho com inteligência e raciocínio excepcionais, equilíbrio entre velocidade-custo. |
| Claude 3.5 Haiku | Até 200k tokens | Modelo multimodal rápido e compacto, otimizado para respostas rápidas e interações humanas naturais |
| Claude 3 Sonnet | Até 200k tokens | Modelo multimodal equilibrando inteligência e velocidade para grandes volumes de uso. |
| Claude 3 Haiku | Até 200k tokens | Compacto, multimodal, otimizado para respostas rápidas e diálogo natural |
| Claude 3 Opus | Até 200k tokens | Modelo multimodal mais avançado para tarefas complexas com raciocínio humano e entendimento contextual superior. |
| Claude 2.1 | Até 200k tokens | Versão aprimorada com janela de contexto aumentada, maior confiabilidade, menos alucinações para aplicações longas e RAG |
| Claude | Até 100k tokens | Modelo versátil para diálogos sofisticados, conteúdo criativo e instruções precisas. |
| Claude Instant | Até 100k tokens | Modelo rápido e de baixo custo para tarefas diárias, como diálogos, análise, sumarização e Q&A em documentos |
| Llama 3.1 405B Instruct | Até 128k tokens | LLM avançado para geração de dados sintéticos, distilação e inferência para chatbots, programação, tarefas de domínio específico. |
| Llama 3.1 70B Instruct | Até 128k tokens | Potencializa conversas complexas com entendimento contextual superior, raciocínio e geração de texto. |
| Llama 3.1 8B Instruct | Até 128k tokens | Modelo de última geração, entendimento de linguagem, raciocínio e geração de texto. |
| Llama 3 70B Instruct | Até 8k tokens | Potencializa conversas complexas com entendimento contextual superior, raciocínio e geração de texto. |
| Llama 3 8B Instruct | Até 8k tokens | LLM de última geração com excelente desempenho em linguagem e geração de texto. |
| Titan Text G1 - Lite | Até 4k tokens | Modelo leve e econômico para tarefas em inglês e ajuste fino, focado em sumarização e geração de conteúdo. |
| Titan Text G1 - Express | Até 8k tokens | Modelo versátil para tarefas gerais de linguagem, chat e aplicações RAG com suporte a inglês e 100+ línguas. |
| Cohere Command | Até 4k tokens | Modelo especializado em seguir comandos do usuário e entregar soluções empresariais práticas. |
| Jurassic-2 Mid | Até 8.191 tokens | Modelo econômico equilibrando qualidade e custo para tarefas como Q&A, sumarização e geração de conteúdo. |
| Jurassic-2 Ultra | Até 8.191 tokens | Geração avançada de texto e compreensão, excelente em análise e criação de conteúdo complexo. |
| Jamba-Instruct | Até 256k tokens | Modelo com janela de contexto extendida para geração de texto, sumarização e Q&A de baixo custo. |
| Mistral 7B Instruct | Até 32k tokens | LLM atende instruções, solicitações e gera texto criativo. |
| Mistral 8x7B Instruct | Até 32k tokens | MOE LLM que atende instruções, solicitações e gera texto criativo. |
</Accordion>
<Accordion title="Amazon SageMaker">
@@ -542,81 +444,13 @@ Nesta seção, você encontrará exemplos detalhados que ajudam a selecionar, co
Exemplo de uso em seu projeto CrewAI:
```python Code
llm = LLM(
model="nvidia_nim/meta/llama3-70b-instruct",
model="nvidia_nim/nvidia/nvidia-nemotron-3-ultra-550b-a55b",
temperature=0.7
)
```
O Nvidia NIM oferece uma suíte abrangente de modelos para diversos usos, desde tarefas gerais até aplicações especializadas.
O catálogo hospedado do NVIDIA NIM muda com frequência. Use o [catálogo de modelos NVIDIA NIM](https://build.nvidia.com/models) para escolher um endpoint atual e confirmar o ID, as modalidades e os limites de contexto.
| Modelo | Janela de Contexto | Melhor Para |
|--------------------------------------------------------------------------|--------------------|---------------------------------------------------------------------|
| nvidia/mistral-nemo-minitron-8b-8k-instruct | 8.192 tokens | Modelo pequeno de linguagem topo de linha para chatbots, assistentes virtuais e geração de conteúdo. |
| nvidia/nemotron-4-mini-hindi-4b-instruct | 4.096 tokens | SLM bilíngue Hindi-Inglês para inferência no dispositivo, específico para língua hindi. |
| nvidia/llama-3.1-nemotron-70b-instruct | 128k tokens | Personalizado para respostas mais úteis |
| nvidia/llama3-chatqa-1.5-8b | 128k tokens | LLM avançado para respostas contextuais de alta qualidade em chatbots e mecanismos de busca. |
| nvidia/llama3-chatqa-1.5-70b | 128k tokens | LLM avançado para respostas contextuais de alta qualidade para chatbots e mecanismos de busca. |
| nvidia/vila | 128k tokens | Modelo multmodal visão-linguagem para compreensão de texto/img/vídeo com respostas informativas |
| nvidia/neva-22 | 4.096 tokens | Modelo de visão-linguagem multimodal para compreensão textos/imagens e respostas informativas |
| nvidia/nemotron-mini-4b-instruct | 8.192 tokens | Tarefas gerais |
| nvidia/usdcode-llama3-70b-instruct | 128k tokens | LLM de ponta para queries OpenUSD e geração de código USD-Python. |
| nvidia/nemotron-4-340b-instruct | 4.096 tokens | Gera dados sintéticos diversos simulando características reais. |
| meta/codellama-70b | 100k tokens | LLM capaz de gerar código a partir de linguagem natural e vice-versa.|
| meta/llama2-70b | 4.096 tokens | Modelo de IA avançado para geração de textos e códigos. |
| meta/llama3-8b-instruct | 8.192 tokens | LLM de última geração, entendimento de linguagem, raciocínio e geração de texto. |
| meta/llama3-70b-instruct | 8.192 tokens | Potencializa conversas complexas com entendimento contextual superior, raciocínio e geração de texto.|
| meta/llama-3.1-8b-instruct | 128k tokens | Modelo compacto de última geração, com compreensão, raciocínio e geração de texto superior. |
| meta/llama-3.1-70b-instruct | 128k tokens | Potencializa conversas complexas com entendimento contextual superior, raciocínio e geração de texto. |
| meta/llama-3.1-405b-instruct | 128k tokens | LLM avançado para geração sintética de dados, destilação e inferência para chatbots, código, tarefas de domínio específico. |
| meta/llama-3.2-1b-instruct | 128k tokens | Pequeno modelo de linguagem de última geração, entendimento, raciocínio e geração textual.|
| meta/llama-3.2-3b-instruct | 128k tokens | Pequeno modelo de linguagem de última geração, entendimento, raciocínio e geração textual.|
| meta/llama-3.2-11b-vision-instruct | 128k tokens | Pequeno modelo de linguagem de última geração, entendimento, raciocínio e geração textual multimodal.|
| meta/llama-3.2-90b-vision-instruct | 128k tokens | Pequeno modelo de linguagem de última geração, entendimento, raciocínio e geração textual multimodal.|
| google/gemma-7b | 8.192 tokens | Modelo avançado de geração de texto, compreensão, transformação e programação.|
| google/gemma-2b | 8.192 tokens | Modelo avançado de geração de texto, compreensão, transformação e programação.|
| google/codegemma-7b | 8.192 tokens | Modelo avançado baseado no Gemma-7B do Google, especializado em geração de códigos e autocomplete.|
| google/codegemma-1.1-7b | 8.192 tokens | Modelo avançado para geração, complemento, raciocínio e instrução em código.|
| google/recurrentgemma-2b | 8.192 tokens | Modelo baseado em arquitetura recorrente para inferência mais rápida em sequências longas.|
| google/gemma-2-9b-it | 8.192 tokens | Modelo avançado de geração de texto, compreensão, transformação e programação.|
| google/gemma-2-27b-it | 8.192 tokens | Modelo avançado de geração de texto, compreensão, transformação e programação.|
| google/gemma-2-2b-it | 8.192 tokens | Modelo avançado de geração de texto, compreensão, transformação e programação.|
| google/deplot | 512 tokens | Modelo visual por linguagem para entender gráficos e converter em tabelas.|
| google/paligemma | 8.192 tokens | Modelo visão-linguagem experto em compreender texto e visual, gerando respostas informativas.|
| mistralai/mistral-7b-instruct-v0.2 | 32k tokens | LLM que segue instruções, completa pedidos e gera texto criativo. |
| mistralai/mixtral-8x7b-instruct-v0.1 | 8.192 tokens | MOE LLM para seguir instruções e gerar versões criativas de texto. |
| mistralai/mistral-large | 4.096 tokens | Geração de dados sintéticos. |
| mistralai/mixtral-8x22b-instruct-v0.1 | 8.192 tokens | Geração de dados sintéticos. |
| mistralai/mistral-7b-instruct-v0.3 | 32k tokens | LLM que segue instruções, completa pedidos e gera texto criativo. |
| nv-mistralai/mistral-nemo-12b-instruct | 128k tokens | Modelo de linguagem avançado para raciocínio, código, tarefas multilíngues; roda em uma única GPU.|
| mistralai/mamba-codestral-7b-v0.1 | 256k tokens | Modelo para escrita e interação com código em múltiplas linguagens e tarefas.|
| microsoft/phi-3-mini-128k-instruct | 128K tokens | LLM leve, de última geração, com habilidades de lógica e matemática.|
| microsoft/phi-3-mini-4k-instruct | 4.096 tokens | LLM leve, de última geração, com habilidades de lógica e matemática.|
| microsoft/phi-3-small-8k-instruct | 8.192 tokens | LLM leve, de última geração, com habilidades de lógica e matemática.|
| microsoft/phi-3-small-128k-instruct | 128K tokens | LLM leve, de última geração, com habilidades de lógica e matemática.|
| microsoft/phi-3-medium-4k-instruct | 4.096 tokens | LLM leve, de última geração, com habilidades de lógica e matemática.|
| microsoft/phi-3-medium-128k-instruct | 128K tokens | LLM leve, de última geração, com habilidades de lógica e matemática.|
| microsoft/phi-3.5-mini-instruct | 128K tokens | LLM multilíngue leve para aplicações de IA restritas em memória e tempo.|
| microsoft/phi-3.5-moe-instruct | 128K tokens | LLM avançada baseada em Mixture of Experts para geração eficiente de conteúdo.|
| microsoft/kosmos-2 | 1.024 tokens | Modelo multimodal revolucionário para compreender e raciocinar elementos visuais em imagens.|
| microsoft/phi-3-vision-128k-instruct | 128k tokens | Modelo multimodal aberto de ponta para raciocínio de alta qualidade a partir de imagens.|
| microsoft/phi-3.5-vision-instruct | 128k tokens | Modelo multimodal aberto de ponta para raciocínio de alta qualidade a partir de imagens.|
| databricks/dbrx-instruct | 12k tokens | LLM de uso geral com desempenho no estado da arte para linguagem, programação e RAG.|
| snowflake/arctic | 1.024 tokens | Inferência eficiente para aplicações empresariais focadas em SQL e programação.|
| aisingapore/sea-lion-7b-instruct | 4.096 tokens | LLM para representação e diversidade linguística e cultural do sudeste asiático.|
| ibm/granite-8b-code-instruct | 4.096 tokens | LLM para programação: geração, explicação e diálogo multi-turn de código.|
| ibm/granite-34b-code-instruct | 8.192 tokens | LLM para programação: geração, explicação e diálogo multi-turn de código.|
| ibm/granite-3.0-8b-instruct | 4.096 tokens | Pequeno modelo avançado, com suporte a RAG, sumário, classificação, código e IA agentica.|
| ibm/granite-3.0-3b-a800m-instruct | 4.096 tokens | Modelo Mixture of Experts eficiente para RAG, sumário, extração de entidades, classificação.|
| mediatek/breeze-7b-instruct | 4.096 tokens | Gera dados sintéticos diversos.|
| upstage/solar-10.7b-instruct | 4.096 tokens | Excelente em tarefas de PLN, especialmente seguir instruções, raciocínio e matemática.|
| writer/palmyra-med-70b-32k | 32k tokens | LLM líder para respostas médicas precisas e contextuais.|
| writer/palmyra-med-70b | 32k tokens | LLM líder para respostas médicas precisas e contextuais.|
| writer/palmyra-fin-70b-32k | 32k tokens | LLM especializada em análise financeira, relatórios e processamento de dados.|
| 01-ai/yi-large | 32k tokens | Poderoso para inglês e chinês, incluindo chatbot e escrita criativa.|
| deepseek-ai/deepseek-coder-6.7b-instruct | 2k tokens | Modelo avançado para geração de código, autocomplete, infilling.|
| rakuten/rakutenai-7b-instruct | 1.024 tokens | LLM topo de linha, compreensão, raciocínio e geração textual.|
| rakuten/rakutenai-7b-chat | 1.024 tokens | LLM topo de linha, compreensão, raciocínio e geração textual.|
| baichuan-inc/baichuan2-13b-chat | 4.096 tokens | Suporte a chat em chinês/inglês, programação, matemática, seguir instruções, resolver quizzes.|
**Nota:** Este provedor usa o LiteLLM. Adicione-o como dependência ao seu projeto:
```bash
@@ -679,15 +513,12 @@ Nesta seção, você encontrará exemplos detalhados que ajudam a selecionar, co
Exemplo de uso em seu projeto CrewAI:
```python Code
llm = LLM(
model="groq/llama-3.2-90b-text-preview",
model="groq/qwen/qwen3.6-27b",
temperature=0.7
)
```
| Modelo | Janela de Contexto | Melhor Para |
|-------------------|---------------------|------------------------------------------|
| Llama 3.1 70B/8B | 131.072 tokens | Alta performance e tarefas de contexto grande|
| Llama 3.2 Série | 8.192 tokens | Tarefas gerais |
| Mixtral 8x7B | 32.768 tokens | Equilíbrio entre performance e contexto |
A Groq diferencia modelos production e preview e desativa IDs regularmente. Consulte o [catálogo de modelos da Groq](https://console.groq.com/docs/models) e a [página de descontinuações](https://console.groq.com/docs/deprecations) antes de escolher um modelo para produção.
**Nota:** Este provedor usa o LiteLLM. Adicione-o como dependência ao seu projeto:
```bash
@@ -769,11 +600,12 @@ Nesta seção, você encontrará exemplos detalhados que ajudam a selecionar, co
Exemplo de uso em seu projeto CrewAI:
```python Code
llm = LLM(
model="llama-3.1-sonar-large-128k-online",
base_url="https://api.perplexity.ai/"
model="perplexity/sonar-pro"
)
```
Consulte o [catálogo de modelos da Perplexity](https://docs.perplexity.ai/getting-started/models) e o [changelog](https://docs.perplexity.ai/docs/resources/changelog) para obter IDs atuais e avisos de descontinuação.
**Nota:** Este provedor usa o LiteLLM. Adicione-o como dependência ao seu projeto:
```bash
uv add 'crewai[litellm]'
@@ -809,17 +641,12 @@ Nesta seção, você encontrará exemplos detalhados que ajudam a selecionar, co
Exemplo de uso em seu projeto CrewAI:
```python Code
llm = LLM(
model="sambanova/Meta-Llama-3.1-8B-Instruct",
model="sambanova/Meta-Llama-3.3-70B-Instruct",
temperature=0.7
)
```
| Modelo | Janela de Contexto | Melhor Para |
|-------------------|---------------------------|----------------------------------------------|
| Llama 3.1 70B/8B | Até 131.072 tokens | Alto desempenho, tarefas com grande contexto |
| Llama 3.1 405B | 8.192 tokens | Desempenho e qualidade de saída elevada |
| Llama 3.2 Série | 8.192 tokens | Tarefas gerais e multimodais |
| Llama 3.3 70B | Até 131.072 tokens | Desempenho e qualidade de saída elevada |
| Família Qwen2 | 8.192 tokens | Desempenho e qualidade de saída elevada |
Os modelos hospedados no SambaNova Cloud podem mudar independentemente do CrewAI. Consulte o [endpoint de modelos](https://docs.sambanova.ai/docs/api-reference/models/get-environments-available-model-list-metadata) e o [guia de descontinuação](https://docs.sambanova.ai/docs/en/models/deprecations) antes de implantar.
**Nota:** Este provedor usa o LiteLLM. Adicione-o como dependência ao seu projeto:
```bash
@@ -837,7 +664,7 @@ Nesta seção, você encontrará exemplos detalhados que ajudam a selecionar, co
Exemplo de uso em seu projeto CrewAI:
```python Code
llm = LLM(
model="cerebras/llama3.1-70b",
model="cerebras/gpt-oss-120b",
temperature=0.7,
max_tokens=8192
)
@@ -851,6 +678,8 @@ Nesta seção, você encontrará exemplos detalhados que ajudam a selecionar, co
- Suporte a longas janelas de contexto
</Info>
Consulte o [catálogo de modelos Cerebras](https://inference-docs.cerebras.ai/models/overview) e os [avisos de descontinuação](https://inference-docs.cerebras.ai/support/deprecation) para obter os IDs atuais dos endpoints públicos.
**Nota:** Este provedor usa o LiteLLM. Adicione-o como dependência ao seu projeto:
```bash
uv add 'crewai[litellm]'
@@ -898,7 +727,7 @@ O CrewAI suporta respostas em streaming de LLMs, permitindo que sua aplicação
# Crie um LLM com streaming ativado
llm = LLM(
model="openai/gpt-4o",
model="openai/gpt-5.6-terra",
stream=True # Ativar streaming
)
```
@@ -935,6 +764,8 @@ O CrewAI suporta respostas em streaming de LLMs, permitindo que sua aplicação
O CrewAI suporta respostas estruturadas de LLMs permitindo que você defina um `response_format` usando um modelo Pydantic. Isso permite que o framework automaticamente faça o parsing e valide a saída, facilitando a integração da resposta em sua aplicação sem pós-processamento manual.
O suporte a saídas estruturadas varia de acordo com o provedor e o modelo. Teste o modelo escolhido antes de depender de respostas estruturadas em produção.
Por exemplo, é possível definir um modelo Pydantic para representar a resposta esperada e passá-lo como `response_format` ao instanciar o LLM. O modelo será utilizado para converter a resposta do LLM em um objeto Python estruturado.
```python Code
@@ -946,7 +777,7 @@ class Dog(BaseModel):
breed: str
llm = LLM(model="gpt-4o", response_format=Dog)
llm = LLM(model="openai/gpt-5.6-terra", response_format=Dog)
response = llm.call(
"Analyze the following messages and return the name, age, and breed. "
@@ -975,8 +806,8 @@ Saiba como obter o máximo da configuração do seu LLM:
# 3. Divisão de tarefas para grandes contextos
llm = LLM(
model="gpt-4",
max_tokens=4000, # Limitar tamanho da resposta
model="openai/gpt-5.6-terra",
max_completion_tokens=4000, # Limitar tamanho da resposta
)
```
@@ -1000,15 +831,14 @@ Saiba como obter o máximo da configuração do seu LLM:
```python
# Configure o modelo com as opções certas
llm = LLM(
model="openai/gpt-4-turbo-preview",
temperature=0.7, # Ajuste conforme a tarefa
max_tokens=4096, # Defina conforme a necessidade da saída
timeout=300 # Timeout maior para tarefas complexas
model="openai/gpt-5.6-terra",
reasoning_effort="medium",
max_completion_tokens=4096,
timeout=300
)
```
<Tip>
- Temperaturas baixas (0.1 a 0.3) para respostas factuais
- Temperaturas altas (0.7 a 0.9) para tarefas criativas
Use os controles compatíveis com o modelo escolhido. Dependendo do provedor, isso pode ser `temperature`, um nível de reasoning ou thinking, ou instruções no prompt que definam o estilo e a variabilidade desejados.
</Tip>
</Step>

View File

@@ -24,15 +24,23 @@ Frequentemente você precisa de **ambos**: skills para expertise, ferramentas pa
## Início Rápido
### 1. Crie um Diretório de Skill
### 1. Crie uma Skill com a CLI
A CLI é a forma suportada de criar uma skill — ela gera a estrutura de diretórios e um `SKILL.md` válido para você:
```shell Terminal
crewai skill create code-review
```
Dentro de um projeto de crew (onde o `pyproject.toml` está) isso cria `./skills/code-review/`; fora de um projeto, cria `./code-review/` no diretório atual (você pode forçar esse comportamento com `--no-project`):
```
skills/
└── code-review/
├── SKILL.md # Obrigatório — instruções
├── SKILL.md # Obrigatório — instruções (template pré-preenchido)
├── references/ # Opcional — documentos de referência
│ └── style-guide.md
└── scripts/ # Opcional — scripts executáveis
├── scripts/ # Opcional — scripts executáveis
└── assets/ # Opcional — arquivos estáticos
```
### 2. Escreva seu SKILL.md
@@ -164,6 +172,65 @@ agent = Agent(
---
## Criando, Publicando e Instalando Skills
Skills têm um ciclo de vida completo gerenciado pela CLI: **crie-as com `crewai skill create`, publique-as com `crewai skill publish`** — criar diretórios à mão funciona para experimentos locais, mas a CLI é o fluxo de trabalho pretendido e mantém a estrutura e o frontmatter da sua skill válidos.
### Criar
```shell Terminal
crewai skill create my-skill
```
Gera o diretório (em `./skills/` dentro de um projeto de crew) com um `SKILL.md` de template, além dos diretórios vazios `scripts/`, `references/` e `assets/`. Edite o `SKILL.md` para definir as instruções.
### Publicar
Execute de dentro do diretório da skill (onde o `SKILL.md` está):
```shell Terminal
cd skills/my-skill
crewai skill publish
```
A publicação lê `name`, `description` e `metadata.version` do frontmatter do `SKILL.md` e envia a skill para o registro da CrewAI. **Skills publicadas são sempre escopadas à sua organização** — assim como ferramentas, apenas membros da organização que publicou podem vê-las e instalá-las; não há visibilidade pública. Flags úteis:
| Flag | Efeito |
| :--- | :--- |
| `--org <slug>` | Publica sob uma organização específica (sobrepõe as configurações). |
| `--force` | Pula a validação de estado do git (alterações não commitadas, etc.). |
### Instalar
Instale uma skill publicada pela sua referência `@org/name`:
```shell Terminal
crewai skill install @acme/code-review
```
Dentro de um projeto de crew, a skill é colocada em `./skills/{name}/`; fora de um projeto, vai para o cache compartilhado em `~/.crewai/skills/{org}/{name}/`.
Agentes também podem referenciar skills do registro diretamente — elas são resolvidas a partir do cache local (ou do diretório `skills/` do projeto) em tempo de execução:
```python
agent = Agent(
role="Senior Code Reviewer",
goal="Review pull requests for quality and security issues",
backstory="Staff engineer with expertise in secure coding practices.",
skills=["@acme/code-review"], # registry ref, resolved locally
)
```
### Listar
```shell Terminal
crewai skill list
```
Mostra as skills instaladas tanto do diretório `./skills/` do projeto quanto do cache global, com suas versões e caminhos.
---
## Skills no Nível do Crew
Skills podem ser definidas no crew para aplicar a **todos os agentes**:

View File

@@ -0,0 +1,123 @@
---
title: Flows no Studio
description: "Crie fluxos de trabalho orientados a eventos que combinam controle determinístico passo a passo com inteligência agêntica — sem escrever código."
icon: "diagram-project"
mode: "wide"
---
<Info>
**Lançamento em andamento**: Flows no Studio está sendo liberado gradualmente durante a semana de 20 de julho de 2026. Se você ainda não vê a opção Flows no Studio, o recurso ainda não chegou à sua organização — volte em breve.
</Info>
## Visão geral
O Studio agora permite criar **Flows** além de Crews. Flows são fluxos de trabalho orientados a eventos em que você controla exatamente quais etapas são executadas, em que ordem e sob quais condições — enquanto delega o trabalho inteligente dentro de cada etapa a agentes de IA.
Para criar um Flow, abra o Studio, descreva sua automação e selecione **Flows** no seletor ao lado da caixa de prompt.
<Frame>
![Seletor de Flows no Studio](/images/enterprise/studio-flows-selector.png)
</Frame>
## Por que Flows?
Crews são ótimos quando você quer que uma equipe de agentes colabore de forma autônoma em direção a um objetivo. Mas muitas automações do mundo real precisam de mais previsibilidade: buscar estes dados primeiro, depois resumi-los, depois publicar o resultado — sempre, nessa ordem.
Flows oferecem os dois:
- **Determinismo onde importa**: as etapas são executadas em uma sequência definida com ramificações explícitas, tornando as execuções previsíveis, repetíveis e fáceis de depurar.
- **Inteligência onde você precisa**: cada etapa é executada por um agente (ou por um crew inteiro), então o trabalho dentro da etapa — resumir, pontuar, redigir, decidir — se beneficia de todo o raciocínio do LLM.
Essa combinação é o que torna os Flows adequados para automações em produção: a estrutura é garantida e a agência fica restrita às etapas que precisam dela.
## Criando um Flow
Descreva o que você quer em linguagem natural e o Studio Assistant projeta o Flow para você — criando as etapas, conectando-as e configurando os agentes e as integrações de apps de que cada etapa precisa. O canvas à direita mostra o fluxo resultante como nós conectados, e você pode continuar iterando por conversa ou editar qualquer nó diretamente.
<Frame>
![Canvas do Flow com o Studio Assistant](/images/enterprise/studio-flows-agent-node.png)
</Frame>
Quando estiver pronto, use **Run** para testar o Flow de ponta a ponta, inspecione os resultados nas abas **Output** e **Traces** e faça o **Deploy** quando estiver estável. Você também pode compartilhar o projeto (**Share**) ou baixar o código-fonte (**Download**).
## Tipos de nós
Flows são compostos por três tipos principais de nós. Cada nó é uma etapa do fluxo de trabalho, e você pode combiná-los livremente.
### Single Agent
Um nó Single Agent executa um agente em uma única tarefa focada — ideal para etapas bem delimitadas, como buscar dados de uma integração, transformar conteúdo ou publicar uma mensagem.
Ao clicar em um nó de agente, você abre sua configuração completa:
- **Task**: o que essa etapa deve realizar e qual saída deve produzir
- **Profile**: o papel (role), o objetivo (goal) e a história (backstory) do agente
- **Model**: qual LLM alimenta o agente
- **Apps**: as integrações que o agente pode usar (ex.: Linear, Slack, HubSpot)
- **Runtime Controls**: opções para planejar antes de executar, delegação e memória
<Frame>
![Configuração do nó Single Agent](/images/enterprise/studio-flows-agent-config.png)
</Frame>
### Crews
Um nó Crew incorpora um crew inteiro — múltiplos agentes colaborando em múltiplas tarefas — como uma única etapa do seu Flow. Use-o quando uma etapa for rica demais para um único agente, como agrupar e resumir dados por equipe e depois formatar o resultado para entrega.
<Frame>
![Nó Crew em um Flow](/images/enterprise/studio-flows-crew-node.png)
</Frame>
Ao abrir um nó Crew, você vê sua estrutura interna: as tarefas que ele executa, os agentes atribuídos a cada uma e os apps que eles usam. O crew é executado de forma autônoma dentro da etapa e entrega sua saída ao próximo nó do Flow.
<Frame>
![Dentro de um nó Crew](/images/enterprise/studio-flows-crew-detail.png)
</Frame>
Esse é o padrão determinístico-mais-agêntico em ação: o Flow garante *quando* o crew é executado, e o crew traz inteligência colaborativa para *como* o trabalho é feito.
### Router
Um nó Router ramifica o Flow com base em condições, para que resultados diferentes sigam caminhos diferentes. Por exemplo, um Flow de roteamento de leads pode pontuar os leads recebidos e encaminhar os de alta qualidade para uma etapa de atribuição de vendas, enquanto registra os demais para nutrição futura.
<Frame>
![Nó Router com ramificações condicionais](/images/enterprise/studio-flows-router-node.png)
</Frame>
Os Routers são o que torna os Flows verdadeiramente orientados a eventos: o mesmo fluxo de trabalho lida com todos os casos, mas cada execução segue apenas o ramo que seus dados justificam — sem etapas desperdiçadas, sem ambiguidade sobre o que acontece a seguir.
## Sincronização com o Agent Repository
Os agentes que você cria em Flows não precisam ficar presos a um único projeto. Todo nó de agente inclui um botão **Publish to Agent Repository**, que salva o agente — papel, objetivo, história, modelo e configuração — no [Agent Repository](/pt-BR/enterprise/features/agent-repositories) da sua organização.
Isso funciona nos dois sentidos:
- **Publicar**: promova um agente refinado em um Flow para o repositório, para que outras equipes e projetos possam reutilizá-lo.
- **Importar**: traga um agente existente do repositório para um novo Flow em vez de recriá-lo do zero.
Como os agentes do repositório são sincronizados em toda a organização, uma melhoria feita em um agente compartilhado beneficia todos os Flows que o utilizam — mantendo o comportamento dos agentes consistente, governado e sem duplicação de esforço.
## Boas práticas
- **Escolha um Flow** quando a automação tiver uma sequência clara ou lógica de ramificação; escolha um Crew quando o caminho até o objetivo for aberto.
- **Mantenha as tarefas dos agentes focadas** — um nó Single Agent com uma descrição de tarefa enxuta é mais confiável do que um agente encarregado de três coisas.
- **Use Routers para tratar todos os casos explicitamente**, inclusive o caminho "não fazer nada" (ex.: registrar leads ignorados), para que as execuções fiquem totalmente contabilizadas.
- **Publique agentes estáveis no Agent Repository** para que sua organização construa uma biblioteca compartilhada em vez de cópias paralelas.
- **Teste com Run e inspecione os Traces** antes do deploy para detectar problemas de integração ou de prompt com antecedência.
## Relacionados
<CardGroup cols={4}>
<Card title="Crew Studio" href="/pt-BR/enterprise/features/crew-studio" icon="pencil">
Crie Crews no Studio.
</Card>
<Card title="Agent Repositories" href="/pt-BR/enterprise/features/agent-repositories" icon="people-group">
Compartilhe e reutilize agentes em toda a sua organização.
</Card>
<Card title="Conceitos de Flows" href="/pt-BR/concepts/flows" icon="diagram-project">
Saiba como os Flows funcionam no framework CrewAI.
</Card>
<Card title="Tools & Integrations" href="/pt-BR/enterprise/features/tools-and-integrations" icon="plug">
Conecte os apps que seus agentes usam.
</Card>
</CardGroup>

View File

@@ -13,8 +13,7 @@ mode: "wide"
O FileReadTool representa conceitualmente um conjunto de funcionalidades dentro do pacote crewai_tools voltadas para facilitar a leitura e a recuperação de conteúdo de arquivos.
Esse conjunto inclui ferramentas para processar arquivos de texto em lote, ler arquivos de configuração em tempo de execução e importar dados para análise.
Ele suporta uma variedade de formatos de arquivo baseados em texto, como `.txt`, `.csv`, `.json` e outros. Dependendo do tipo de arquivo, o conjunto oferece funcionalidades especializadas,
como converter conteúdo JSON em um dicionário Python para facilitar o uso.
Ele suporta uma variedade de formatos de arquivo baseados em texto, como `.txt`, `.csv`, `.json` e outros. O conteúdo é sempre retornado como texto simples.
## Instalação

View File

@@ -32,7 +32,11 @@ from crewai_tools import FileWriterTool
file_writer_tool = FileWriterTool()
# Escreva conteúdo em um arquivo em um diretório especificado
result = file_writer_tool._run('example.txt', 'This is a test content.', 'test_directory')
result = file_writer_tool.run(
filename='example.txt',
content='This is a test content.',
directory='test_directory',
)
print(result)
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

View File

@@ -0,0 +1,8 @@
---
title: "GET /inputs"
description: "الحصول على المدخلات المطلوبة لطاقمك"
openapi: "/v1.15.4/enterprise-api.en.yaml GET /inputs"
mode: "wide"
---

View File

@@ -0,0 +1,135 @@
---
title: "مقدمة"
description: "المرجع الكامل لواجهة برمجة تطبيقات CrewAI AMP REST"
icon: "code"
mode: "wide"
---
# واجهة برمجة تطبيقات CrewAI AMP
مرحبًا بك في مرجع واجهة برمجة تطبيقات CrewAI AMP. تتيح لك هذه الواجهة التفاعل برمجيًا مع الأطقم المنشورة، مما يمكّنك من دمجها مع تطبيقاتك وسير عملك وخدماتك.
## البدء السريع
<Steps>
<Step title="الحصول على بيانات اعتماد API">
انتقل إلى صفحة تفاصيل طاقمك في لوحة تحكم CrewAI AMP وانسخ رمز Bearer من علامة تبويب الحالة.
</Step>
<Step title="اكتشاف المدخلات المطلوبة">
استخدم نقطة النهاية `GET /inputs` لمعرفة المعاملات التي يتوقعها طاقمك.
</Step>
<Step title="بدء تنفيذ الطاقم">
استدعِ `POST /kickoff` مع مدخلاتك لبدء تنفيذ الطاقم واستلام
`kickoff_id`.
</Step>
<Step title="مراقبة التقدم">
استخدم `GET /status/{kickoff_id}` للتحقق من حالة التنفيذ واسترجاع النتائج.
</Step>
</Steps>
## المصادقة
تتطلب جميع طلبات API المصادقة باستخدام رمز Bearer. أدرج رمزك في ترويسة `Authorization`:
```bash
curl -H "Authorization: Bearer YOUR_CREW_TOKEN" \
https://your-crew-url.crewai.com/inputs
```
### أنواع الرموز
| نوع الرمز | النطاق | حالة الاستخدام |
| :-------------------- | :------------------------ | :----------------------------------------------------------- |
| **Bearer Token** | وصول على مستوى المؤسسة | عمليات الطاقم الكاملة، مثالي للتكامل بين الخوادم |
| **User Bearer Token** | وصول محدد بالمستخدم | صلاحيات محدودة، مناسب للعمليات الخاصة بالمستخدم |
<Tip>
يمكنك العثور على كلا نوعي الرموز في علامة تبويب الحالة من صفحة تفاصيل طاقمك في
لوحة تحكم CrewAI AMP.
</Tip>
## عنوان URL الأساسي
لكل طاقم منشور نقطة نهاية API فريدة خاصة به:
```
https://your-crew-name.crewai.com
```
استبدل `your-crew-name` بعنوان URL الفعلي لطاقمك من لوحة التحكم.
## سير العمل النموذجي
1. **الاكتشاف**: استدعِ `GET /inputs` لفهم ما يحتاجه طاقمك
2. **التنفيذ**: أرسل المدخلات عبر `POST /kickoff` لبدء المعالجة
3. **المراقبة**: استعلم عن `GET /status/{kickoff_id}` حتى الاكتمال
4. **النتائج**: استخرج المخرجات النهائية من الاستجابة المكتملة
## معالجة الأخطاء
تستخدم الواجهة أكواد حالة HTTP القياسية:
| الكود | المعنى |
| ----- | :----------------------------------------- |
| `200` | نجاح |
| `400` | طلب غير صالح - تنسيق مدخلات غير صحيح |
| `401` | غير مصرّح - رمز bearer غير صالح |
| `404` | غير موجود - المورد غير موجود |
| `422` | خطأ في التحقق - مدخلات مطلوبة مفقودة |
| `500` | خطأ في الخادم - تواصل مع الدعم |
## الاختبار التفاعلي
<Info>
**لماذا لا يوجد زر "إرسال"؟** نظرًا لأن كل مستخدم CrewAI AMP لديه عنوان URL
فريد للطاقم، نستخدم **وضع المرجع** بدلاً من بيئة تفاعلية لتجنب
الالتباس. يوضح لك هذا بالضبط كيف يجب أن تبدو الطلبات بدون
أزرار إرسال غير فعالة.
</Info>
تعرض لك كل صفحة نقطة نهاية:
- **تنسيق الطلب الدقيق** مع جميع المعاملات
- **أمثلة الاستجابة** لحالات النجاح والخطأ
- **عينات الكود** بلغات متعددة (cURL، Python، JavaScript، إلخ)
- **أمثلة المصادقة** بتنسيق رمز Bearer الصحيح
### **لاختبار واجهتك الفعلية:**
<CardGroup cols={2}>
<Card title="نسخ أمثلة cURL" icon="terminal">
انسخ أمثلة cURL واستبدل العنوان URL + الرمز بقيمك الحقيقية
</Card>
<Card title="استخدام Postman/Insomnia" icon="play">
استورد الأمثلة في أداة اختبار API المفضلة لديك
</Card>
</CardGroup>
**مثال على سير العمل:**
1. **انسخ مثال cURL هذا** من أي صفحة نقطة نهاية
2. **استبدل `your-actual-crew-name.crewai.com`** بعنوان URL الحقيقي لطاقمك
3. **استبدل رمز Bearer** برمزك الحقيقي من لوحة التحكم
4. **نفّذ الطلب** في طرفيتك أو عميل API
## هل تحتاج مساعدة؟
<CardGroup cols={2}>
<Card
title="دعم المؤسسات"
icon="headset"
href="mailto:support@crewai.com"
>
احصل على مساعدة في تكامل API واستكشاف الأخطاء وإصلاحها
</Card>
<Card
title="لوحة تحكم المؤسسات"
icon="chart-line"
href="https://app.crewai.com"
>
إدارة أطقمك وعرض سجلات التنفيذ
</Card>
</CardGroup>

View File

@@ -0,0 +1,8 @@
---
title: "POST /kickoff"
description: "بدء تنفيذ الطاقم"
openapi: "/v1.15.4/enterprise-api.en.yaml POST /kickoff"
mode: "wide"
---

View File

@@ -0,0 +1,6 @@
---
title: "POST /resume"
description: "استئناف تنفيذ الطاقم مع التغذية الراجعة البشرية"
openapi: "/v1.15.4/enterprise-api.en.yaml POST /resume"
mode: "wide"
---

View File

@@ -0,0 +1,6 @@
---
title: "GET /status/{kickoff_id}"
description: "الحصول على حالة التنفيذ"
openapi: "/v1.15.4/enterprise-api.en.yaml GET /status/{kickoff_id}"
mode: "wide"
---

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,147 @@
---
title: "قدرات الوكيل"
description: "فهم الطرق الخمس لتوسيع وكلاء CrewAI: الأدوات، MCP، التطبيقات، المهارات، والمعرفة."
icon: puzzle-piece
mode: "wide"
---
## نظرة عامة
يمكن توسيع وكلاء CrewAI بـ **خمسة أنواع مميزة من القدرات**، كل منها يخدم غرضًا مختلفًا. فهم متى تستخدم كل نوع — وكيف يعملون معًا — هو المفتاح لبناء وكلاء فعّالين.
<CardGroup cols={2}>
<Card title="الأدوات" icon="wrench" href="/ar/concepts/tools" color="#3B82F6">
**دوال قابلة للاستدعاء** — تمنح الوكلاء القدرة على اتخاذ إجراءات. البحث على الويب، عمليات الملفات، استدعاءات API، تنفيذ الكود.
</Card>
<Card title="خوادم MCP" icon="plug" href="/ar/mcp/overview" color="#8B5CF6">
**خوادم أدوات عن بُعد** — تربط الوكلاء بخوادم أدوات خارجية عبر Model Context Protocol. نفس تأثير الأدوات، لكن مستضافة خارجيًا.
</Card>
<Card title="التطبيقات" icon="grid-2" color="#EC4899">
**تكاملات المنصة** — تربط الوكلاء بتطبيقات SaaS (Gmail، Slack، Jira، Salesforce) عبر منصة CrewAI. تعمل محليًا مع رمز تكامل المنصة.
</Card>
<Card title="المهارات" icon="bolt" href="/ar/concepts/skills" color="#F59E0B">
**خبرة المجال** — تحقن التعليمات والإرشادات والمواد المرجعية في إرشادات الوكلاء. المهارات تخبر الوكلاء *كيف يفكرون*.
</Card>
<Card title="المعرفة" icon="book" href="/ar/concepts/knowledge" color="#10B981">
**حقائق مُسترجعة** — توفر للوكلاء بيانات من المستندات والملفات وعناوين URL عبر البحث الدلالي (RAG). المعرفة تعطي الوكلاء *ما يحتاجون معرفته*.
</Card>
</CardGroup>
---
## التمييز الأساسي
أهم شيء يجب فهمه: **هذه القدرات تنقسم إلى فئتين**.
### قدرات الإجراء (الأدوات، MCP، التطبيقات)
تمنح الوكلاء القدرة على **فعل أشياء** — استدعاء APIs، قراءة الملفات، البحث على الويب، إرسال رسائل البريد الإلكتروني. عند التنفيذ، تتحول الأنواع الثلاثة إلى نفس التنسيق الداخلي (مثيلات `BaseTool`) وتظهر في قائمة أدوات موحدة يمكن للوكيل استدعاؤها.
```python
from crewai import Agent
from crewai_tools import SerperDevTool, FileReadTool
agent = Agent(
role="Researcher",
goal="Find and compile market data",
backstory="Expert market analyst",
tools=[SerperDevTool(), FileReadTool()], # أدوات محلية
mcps=["https://mcp.example.com/sse"], # أدوات خادم MCP عن بُعد
apps=["gmail", "google_sheets"], # تكاملات المنصة
)
```
### قدرات السياق (المهارات، المعرفة)
تُعدّل **إرشادات** الوكيل — بحقن الخبرة أو التعليمات أو البيانات المُسترجعة قبل أن يبدأ الوكيل في التفكير. لا تمنح الوكلاء إجراءات جديدة؛ بل تُشكّل كيف يفكر الوكلاء وما هي المعلومات التي يمكنهم الوصول إليها.
```python
from crewai import Agent
agent = Agent(
role="Security Auditor",
goal="Audit cloud infrastructure for vulnerabilities",
backstory="Expert in cloud security with 10 years of experience",
skills=["./skills/security-audit"], # تعليمات المجال
knowledge_sources=[pdf_source, url_source], # حقائق مُسترجعة
)
```
---
## متى تستخدم ماذا
| تحتاج إلى... | استخدم | مثال |
| :------------------------------------------------------- | :---------------- | :--------------------------------------- |
| الوكيل يبحث على الويب | **الأدوات** | `tools=[SerperDevTool()]` |
| الوكيل يستدعي API عن بُعد عبر MCP | **MCP** | `mcps=["https://api.example.com/sse"]` |
| الوكيل يرسل بريد إلكتروني عبر Gmail | **التطبيقات** | `apps=["gmail"]` |
| الوكيل يتبع إجراءات محددة | **المهارات** | `skills=["./skills/code-review"]` |
| الوكيل يرجع لمستندات الشركة | **المعرفة** | `knowledge_sources=[pdf_source]` |
| الوكيل يبحث على الويب ويتبع إرشادات المراجعة | **الأدوات + المهارات** | استخدم كليهما معًا |
---
## دمج القدرات
في الممارسة العملية، غالبًا ما يستخدم الوكلاء **أنواعًا متعددة من القدرات معًا**. إليك مثال واقعي:
```python
from crewai import Agent
from crewai_tools import SerperDevTool, FileReadTool, CodeInterpreterTool
# وكيل بحث مجهز بالكامل
researcher = Agent(
role="Senior Research Analyst",
goal="Produce comprehensive market analysis reports",
backstory="Expert analyst with deep industry knowledge",
# الإجراء: ما يمكن للوكيل فعله
tools=[
SerperDevTool(), # البحث على الويب
FileReadTool(), # قراءة الملفات المحلية
CodeInterpreterTool(), # تشغيل كود Python للتحليل
],
mcps=["https://data-api.example.com/sse"], # الوصول لـ API بيانات عن بُعد
apps=["google_sheets"], # الكتابة في Google Sheets
# السياق: ما يعرفه الوكيل
skills=["./skills/research-methodology"], # كيفية إجراء البحث
knowledge_sources=[company_docs], # بيانات خاصة بالشركة
)
```
---
## جدول المقارنة
| الميزة | الأدوات | MCP | التطبيقات | المهارات | المعرفة |
| :--- | :---: | :---: | :---: | :---: | :---: |
| **يمنح الوكيل إجراءات** | ✅ | ✅ | ✅ | ❌ | ❌ |
| **يُعدّل الإرشادات** | ❌ | ❌ | ❌ | ✅ | ✅ |
| **يتطلب كود** | نعم | إعداد فقط | إعداد فقط | Markdown فقط | إعداد فقط |
| **يعمل محليًا** | نعم | يعتمد | نعم (مع متغير بيئة) | غير متاح | نعم |
| **يحتاج مفاتيح API** | لكل أداة | لكل خادم | رمز التكامل | لا | المُضمّن فقط |
| **يُعيَّن على Agent** | `tools=[]` | `mcps=[]` | `apps=[]` | `skills=[]` | `knowledge_sources=[]` |
| **يُعيَّن على Crew** | ❌ | ❌ | ❌ | `skills=[]` | `knowledge_sources=[]` |
---
## تعمّق أكثر
هل أنت مستعد لمعرفة المزيد عن كل نوع من أنواع القدرات؟
<CardGroup cols={2}>
<Card title="الأدوات" icon="wrench" href="/ar/concepts/tools">
إنشاء أدوات مخصصة، استخدام كتالوج OSS مع أكثر من 75 خيارًا، تكوين التخزين المؤقت والتنفيذ غير المتزامن.
</Card>
<Card title="تكامل MCP" icon="plug" href="/ar/mcp/overview">
الاتصال بخوادم MCP عبر stdio أو SSE أو HTTP. تصفية الأدوات، تكوين المصادقة.
</Card>
<Card title="المهارات" icon="bolt" href="/ar/concepts/skills">
بناء حزم المهارات مع SKILL.md، حقن خبرة المجال، استخدام الكشف التدريجي.
</Card>
<Card title="المعرفة" icon="book" href="/ar/concepts/knowledge">
إضافة المعرفة من ملفات PDF وCSV وعناوين URL والمزيد. تكوين المُضمّنات والاسترجاع.
</Card>
</CardGroup>

View File

@@ -0,0 +1,383 @@
---
title: الوكلاء
description: دليل تفصيلي حول إنشاء وإدارة الوكلاء ضمن إطار عمل CrewAI.
icon: robot
mode: "wide"
---
## نظرة عامة على الوكيل
في إطار عمل CrewAI، الـ `Agent` هو وحدة مستقلة يمكنها:
- أداء مهام محددة
- اتخاذ قرارات بناءً على دوره وهدفه
- استخدام الأدوات لتحقيق الأهداف
- التواصل والتعاون مع وكلاء آخرين
- الاحتفاظ بذاكرة التفاعلات
- تفويض المهام عند السماح بذلك
<Tip>
فكّر في الوكيل كعضو فريق متخصص بمهارات وخبرات ومسؤوليات محددة.
على سبيل المثال، قد يتفوق وكيل `Researcher` في جمع وتحليل المعلومات،
بينما قد يكون وكيل `Writer` أفضل في إنشاء المحتوى.
</Tip>
<Note type="info" title="تحسين المؤسسات: منشئ الوكلاء المرئي">
يتضمن CrewAI AMP منشئ وكلاء مرئي يبسّط إنشاء وتهيئة الوكلاء بدون كتابة كود. صمم وكلاءك بصريًا واختبرهم في الوقت الفعلي.
![Visual Agent Builder Screenshot](/images/enterprise/crew-studio-interface.png)
يُمكّن منشئ الوكلاء المرئي من:
- تهيئة وكلاء بديهية بواجهات نماذج
- اختبار والتحقق في الوقت الفعلي
- مكتبة قوالب مع أنواع وكلاء مهيأة مسبقًا
- تخصيص سهل لخصائص وسلوكيات الوكيل
</Note>
## خصائص الوكيل
| الخاصية | المعامل | النوع | الوصف |
| :-------------------------------------- | :----------------------- | :------------------------------------ | :------------------------------------------------------------------------------------------------------- |
| **الدور** | `role` | `str` | يحدد وظيفة الوكيل وخبرته ضمن الطاقم. |
| **الهدف** | `goal` | `str` | الهدف الفردي الذي يوجه عملية اتخاذ القرار لدى الوكيل. |
| **الخلفية** | `backstory` | `str` | يوفر سياقًا وشخصية للوكيل، مما يثري التفاعلات. |
| **LLM** _(اختياري)_ | `llm` | `Union[str, LLM, Any]` | نموذج اللغة الذي يشغّل الوكيل. افتراضيًا النموذج المحدد في `OPENAI_MODEL_NAME` أو "gpt-4". |
| **الأدوات** _(اختياري)_ | `tools` | `List[BaseTool]` | القدرات أو الوظائف المتاحة للوكيل. افتراضيًا قائمة فارغة. |
| **LLM استدعاء الدوال** _(اختياري)_ | `function_calling_llm` | `Optional[Any]` | نموذج لغة لاستدعاء الأدوات، يتجاوز LLM الطاقم إذا حُدد. |
| **الحد الأقصى للتكرارات** _(اختياري)_ | `max_iter` | `int` | الحد الأقصى للتكرارات قبل أن يقدم الوكيل أفضل إجابته. الافتراضي 20. |
| **الحد الأقصى لـ RPM** _(اختياري)_ | `max_rpm` | `Optional[int]` | الحد الأقصى للطلبات في الدقيقة لتجنب حدود المعدل. |
| **الحد الأقصى لوقت التنفيذ** _(اختياري)_ | `max_execution_time` | `Optional[int]` | الحد الأقصى للوقت (بالثواني) لتنفيذ المهمة. |
| **الوضع المفصل** _(اختياري)_ | `verbose` | `bool` | تفعيل سجلات التنفيذ المفصلة للتصحيح. الافتراضي False. |
| **السماح بالتفويض** _(اختياري)_ | `allow_delegation` | `bool` | السماح للوكيل بتفويض المهام لوكلاء آخرين. الافتراضي False. |
| **دالة الخطوة** _(اختياري)_ | `step_callback` | `Optional[Any]` | دالة تُستدعى بعد كل خطوة للوكيل، تتجاوز دالة الطاقم. |
| **التخزين المؤقت** _(اختياري)_ | `cache` | `bool` | تفعيل التخزين المؤقت لاستخدام الأدوات. الافتراضي True. |
| **قالب النظام** _(اختياري)_ | `system_template` | `Optional[str]` | قالب أمر نظام مخصص للوكيل. |
| **قالب الأمر** _(اختياري)_ | `prompt_template` | `Optional[str]` | قالب أمر مخصص للوكيل. |
| **قالب الاستجابة** _(اختياري)_ | `response_template` | `Optional[str]` | قالب استجابة مخصص للوكيل. |
| **السماح بتنفيذ الكود** _(اختياري)_ | `allow_code_execution` | `Optional[bool]` | تفعيل تنفيذ الكود للوكيل. الافتراضي False. |
| **الحد الأقصى لإعادة المحاولة** _(اختياري)_ | `max_retry_limit` | `int` | الحد الأقصى لإعادات المحاولة عند حدوث خطأ. الافتراضي 2. |
| **احترام نافذة السياق** _(اختياري)_ | `respect_context_window` | `bool` | إبقاء الرسائل تحت حجم نافذة السياق عبر التلخيص. الافتراضي True. |
| **وضع تنفيذ الكود** _(اختياري)_ | `code_execution_mode` | `Literal["safe", "unsafe"]` | وضع تنفيذ الكود: 'safe' (باستخدام Docker) أو 'unsafe' (مباشر). الافتراضي 'safe'. |
| **متعدد الوسائط** _(اختياري)_ | `multimodal` | `bool` | ما إذا كان الوكيل يدعم القدرات متعددة الوسائط. الافتراضي False. |
| **حقن التاريخ** _(اختياري)_ | `inject_date` | `bool` | ما إذا كان يتم حقن التاريخ الحالي تلقائيًا في المهام. الافتراضي False. |
| **تنسيق التاريخ** _(اختياري)_ | `date_format` | `str` | سلسلة تنسيق التاريخ عند تفعيل inject_date. الافتراضي "%Y-%m-%d" (تنسيق ISO). |
| **الاستدلال** _(اختياري)_ | `reasoning` | `bool` | ما إذا كان يجب على الوكيل التأمل وإنشاء خطة قبل تنفيذ المهمة. الافتراضي False. |
| **الحد الأقصى لمحاولات الاستدلال** _(اختياري)_ | `max_reasoning_attempts` | `Optional[int]` | الحد الأقصى لمحاولات الاستدلال قبل تنفيذ المهمة. إذا None، سيحاول حتى الاستعداد. |
| **المُضمّن** _(اختياري)_ | `embedder` | `Optional[Dict[str, Any]]` | تهيئة المُضمّن المستخدم من قبل الوكيل. |
| **مصادر المعرفة** _(اختياري)_ | `knowledge_sources` | `Optional[List[BaseKnowledgeSource]]` | مصادر المعرفة المتاحة للوكيل. |
| **استخدام أمر النظام** _(اختياري)_ | `use_system_prompt` | `Optional[bool]` | ما إذا كان يُستخدم أمر النظام (لدعم نموذج o1). الافتراضي True. |
## إنشاء الوكلاء
هناك طريقتان شائعتان لإنشاء الوكلاء في CrewAI: باستخدام **تهيئة JSONC (الموصى بها للـ crews الجديدة)** أو تعريفهم **مباشرة في الكود**.
### تهيئة JSONC (موصى بها)
المشاريع الجديدة التي تُنشأ عبر `crewai create crew <name>` تستخدم تهيئة JSON-first. يُعرّف كل Agent في `agents/<agent_name>.jsonc`، ويحدد `crew.jsonc` أي Agents تدخل في الـ crew.
```jsonc agents/researcher.jsonc
{
"role": "{topic} Senior Data Researcher",
"goal": "Uncover cutting-edge developments in {topic}",
"backstory": "You find the most relevant information and present it clearly.",
"llm": "openai/gpt-4o",
"tools": ["SerperDevTool"],
"settings": {
"verbose": true,
"allow_delegation": false
}
}
```
استخدم `{placeholder}` داخل `role` أو `goal` أو `backstory`. ضع القيم الافتراضية في `inputs` داخل `crew.jsonc`؛ وسيطلب `crewai run` أي قيم ناقصة. يمكن وضع حقول السلوك مثل `verbose` و `allow_delegation` و `max_iter` و `memory` و `cache` و `planning_config` في المستوى الأعلى أو داخل `settings`.
<Note>
يدعم JSONC التعليقات والفواصل النهائية. إذا وُجد `agents/<name>.jsonc` و `agents/<name>.json` معًا، يستخدم CrewAI ملف JSONC.
</Note>
### تهيئة YAML الكلاسيكية
المشاريع الكلاسيكية التي تُنشأ عبر `crewai create crew <name> --classic` تستخدم `config/agents.yaml` وفئة `@CrewBase` في `crew.py`.
تظل تهيئة YAML مدعومة للمشاريع الحالية المبنية بـ Python/YAML وللفِرق التي تفضل تعريف الوكلاء من خلال فئة `@CrewBase`.
بعد إنشاء مشروع كلاسيكي، انتقل إلى ملف `src/<project_name>/config/agents.yaml` وعدّل القالب ليتوافق مع متطلباتك.
<Note>
ستُستبدل المتغيرات في ملفات YAML (مثل `{topic}`) بقيم من مدخلاتك عند تشغيل الطاقم:
```python Code
crew.kickoff(inputs={'topic': 'AI Agents'})
```
</Note>
إليك مثالًا على كيفية تهيئة الوكلاء باستخدام YAML:
```yaml agents.yaml
# src/<project_name>/config/agents.yaml
researcher:
role: >
{topic} Senior Data Researcher
goal: >
Uncover cutting-edge developments in {topic}
backstory: >
You're a seasoned researcher with a knack for uncovering the latest
developments in {topic}. Known for your ability to find the most relevant
information and present it in a clear and concise manner.
reporting_analyst:
role: >
{topic} Reporting Analyst
goal: >
Create detailed reports based on {topic} data analysis and research findings
backstory: >
You're a meticulous analyst with a keen eye for detail. You're known for
your ability to turn complex data into clear and concise reports, making
it easy for others to understand and act on the information you provide.
```
لاستخدام تهيئة YAML في الكود، أنشئ فئة طاقم ترث من `CrewBase`:
```python Code
# src/<project_name>/crew.py
from crewai import Agent, Crew, Process
from crewai.project import CrewBase, agent, crew
from crewai_tools import SerperDevTool
@CrewBase
class LatestAiDevelopmentCrew():
"""LatestAiDevelopment crew"""
agents_config = "config/agents.yaml"
@agent
def researcher(self) -> Agent:
return Agent(
config=self.agents_config['researcher'], # type: ignore[index]
verbose=True,
tools=[SerperDevTool()]
)
@agent
def reporting_analyst(self) -> Agent:
return Agent(
config=self.agents_config['reporting_analyst'], # type: ignore[index]
verbose=True
)
```
<Note>
يجب أن تتطابق الأسماء المستخدمة في ملفات YAML (`agents.yaml`) مع أسماء
الطرق في كود Python.
</Note>
### تعريف مباشر في الكود
يمكنك إنشاء الوكلاء مباشرة في الكود بإنشاء فئة `Agent`. إليك مثالًا شاملًا يوضح جميع المعاملات المتاحة:
```python Code
from crewai import Agent
from crewai_tools import SerperDevTool
# إنشاء وكيل بجميع المعاملات المتاحة
agent = Agent(
role="Senior Data Scientist",
goal="Analyze and interpret complex datasets to provide actionable insights",
backstory="With over 10 years of experience in data science and machine learning, "
"you excel at finding patterns in complex datasets.",
llm="gpt-4",
function_calling_llm=None,
verbose=False,
allow_delegation=False,
max_iter=20,
max_rpm=None,
max_execution_time=None,
max_retry_limit=2,
allow_code_execution=False,
code_execution_mode="safe",
respect_context_window=True,
use_system_prompt=True,
multimodal=False,
inject_date=False,
date_format="%Y-%m-%d",
reasoning=False,
max_reasoning_attempts=None,
tools=[SerperDevTool()],
knowledge_sources=None,
embedder=None,
system_template=None,
prompt_template=None,
response_template=None,
step_callback=None,
)
```
دعنا نستعرض بعض تركيبات المعاملات الرئيسية لحالات الاستخدام الشائعة:
#### وكيل بحث أساسي
```python Code
research_agent = Agent(
role="Research Analyst",
goal="Find and summarize information about specific topics",
backstory="You are an experienced researcher with attention to detail",
tools=[SerperDevTool()],
verbose=True
)
```
#### وكيل تطوير الكود
```python Code
dev_agent = Agent(
role="Senior Python Developer",
goal="Write and debug Python code",
backstory="Expert Python developer with 10 years of experience",
allow_code_execution=True,
code_execution_mode="safe",
max_execution_time=300,
max_retry_limit=3
)
```
#### وكيل تحليل طويل المدى
```python Code
analysis_agent = Agent(
role="Data Analyst",
goal="Perform deep analysis of large datasets",
backstory="Specialized in big data analysis and pattern recognition",
memory=True,
respect_context_window=True,
max_rpm=10,
function_calling_llm="gpt-4o-mini"
)
```
### تفاصيل المعاملات
#### المعاملات الحرجة
- `role` و `goal` و `backstory` مطلوبة وتشكّل سلوك الوكيل
- `llm` يحدد نموذج اللغة المستخدم (افتراضي: GPT-4 من OpenAI)
#### الذاكرة والسياق
- `memory`: تفعيل للحفاظ على سجل المحادثة
- `respect_context_window`: يمنع مشاكل حد الرموز
- `knowledge_sources`: إضافة قواعد معرفة خاصة بالمجال
#### التحكم في التنفيذ
- `max_iter`: الحد الأقصى للمحاولات قبل تقديم أفضل إجابة
- `max_execution_time`: المهلة بالثواني
- `max_rpm`: تحديد معدل استدعاءات API
- `max_retry_limit`: إعادات المحاولة عند الخطأ
#### تنفيذ الكود
<Warning>
`allow_code_execution` و`code_execution_mode` مهجوران. تمت إزالة `CodeInterpreterTool` من `crewai-tools`. استخدم خدمة بيئة معزولة مخصصة مثل [E2B](https://e2b.dev) أو [Modal](https://modal.com) لتنفيذ الكود بأمان.
</Warning>
- `allow_code_execution` _(مهجور)_: كان يُمكّن تنفيذ الكود المدمج عبر `CodeInterpreterTool`.
- `code_execution_mode` _(مهجور)_: كان يتحكم في وضع التنفيذ (`"safe"` لـ Docker، `"unsafe"` للتنفيذ المباشر).
#### الميزات المتقدمة
- `multimodal`: تفعيل القدرات متعددة الوسائط لمعالجة النص والمحتوى المرئي
- `reasoning`: تمكين الوكيل من التأمل وإنشاء خطط قبل تنفيذ المهام
- `inject_date`: حقن التاريخ الحالي تلقائيًا في أوصاف المهام
#### القوالب
- `system_template`: يحدد السلوك الأساسي للوكيل
- `prompt_template`: ينظم تنسيق الإدخال
- `response_template`: ينسّق استجابات الوكيل
<Note>
عند استخدام القوالب المخصصة، تأكد من تعريف كل من `system_template` و
`prompt_template`. `response_template` اختياري لكن يُوصى به
لتنسيق مخرجات متسق.
</Note>
## أدوات الوكيل
يمكن تجهيز الوكلاء بأدوات متنوعة لتعزيز قدراتهم. يدعم CrewAI أدوات من:
- [مجموعة أدوات CrewAI](https://github.com/joaomdmoura/crewai-tools)
- [أدوات LangChain](https://python.langchain.com/docs/integrations/tools)
إليك كيفية إضافة أدوات لوكيل:
```python Code
from crewai import Agent
from crewai_tools import SerperDevTool, WikipediaTools
# إنشاء الأدوات
search_tool = SerperDevTool()
wiki_tool = WikipediaTools()
# إضافة أدوات للوكيل
researcher = Agent(
role="AI Technology Researcher",
goal="Research the latest AI developments",
tools=[search_tool, wiki_tool],
verbose=True
)
```
## التفاعل المباشر مع الوكيل عبر `kickoff()`
يمكن استخدام الوكلاء مباشرة بدون المرور بمهمة أو سير عمل طاقم باستخدام طريقة `kickoff()`. يوفر هذا طريقة أبسط للتفاعل مع وكيل عندما لا تحتاج إلى إمكانيات تنسيق الطاقم الكاملة.
```python Code
from crewai import Agent
from crewai_tools import SerperDevTool
# إنشاء وكيل
researcher = Agent(
role="AI Technology Researcher",
goal="Research the latest AI developments",
tools=[SerperDevTool()],
verbose=True
)
# استخدام kickoff() للتفاعل مباشرة مع الوكيل
result = researcher.kickoff("What are the latest developments in language models?")
# الوصول إلى الاستجابة الخام
print(result.raw)
```
## اعتبارات مهمة وأفضل الممارسات
### الأمان وتنفيذ الكود
<Warning>
`allow_code_execution` و`code_execution_mode` مهجوران وتمت إزالة `CodeInterpreterTool`. استخدم خدمة بيئة معزولة مخصصة مثل [E2B](https://e2b.dev) أو [Modal](https://modal.com) لتنفيذ الكود بأمان.
</Warning>
### تحسين الأداء
- استخدم `respect_context_window: true` لمنع مشاكل حد الرموز
- عيّن `max_rpm` مناسبًا لتجنب تحديد المعدل
- فعّل `cache: true` لتحسين الأداء للمهام المتكررة
- اضبط `max_iter` و `max_retry_limit` بناءً على تعقيد المهمة
### إدارة الذاكرة والسياق
- استفد من `knowledge_sources` للمعلومات الخاصة بالمجال
- هيّئ `embedder` عند استخدام نماذج تضمين مخصصة
- استخدم القوالب المخصصة للتحكم الدقيق في سلوك الوكيل
### التعاون بين الوكلاء
- فعّل `allow_delegation: true` عندما يحتاج الوكلاء للعمل معًا
- استخدم `step_callback` لمراقبة وتسجيل تفاعلات الوكلاء
- فكّر في استخدام نماذج LLM مختلفة لأغراض مختلفة
### توافق النموذج
- عيّن `use_system_prompt: false` للنماذج القديمة التي لا تدعم رسائل النظام
- تأكد من أن `llm` المختار يدعم الميزات التي تحتاجها

View File

@@ -0,0 +1,423 @@
---
title: Checkpointing
description: حفظ حالة التنفيذ تلقائيا حتى تتمكن الطواقم والتدفقات والوكلاء من الاستئناف بعد الفشل.
icon: floppy-disk
mode: "wide"
---
الـ Checkpointing يحفظ لقطة من حالة التنفيذ أثناء التشغيل بحيث يمكن لطاقم أو تدفق أو وكيل الاستئناف بعد الفشل أو التفرع إلى فرع بديل.
<CardGroup cols={2}>
<Card title="الشرح" icon="lightbulb" href="#الشرح">
كيف يعمل الـ Checkpointing: الأحداث والتخزين والوراثة.
</Card>
<Card title="درس تطبيقي" icon="graduation-cap" href="#درس-تطبيقي-استئناف-طاقم-فاشل">
دليل 5 دقائق: تشغيل، إيقاف، استئناف.
</Card>
<Card title="ادلة عملية" icon="screwdriver-wrench" href="#ادلة-عملية">
وصفات مركزة على المهام لسير العمل الشائع.
</Card>
<Card title="المرجع" icon="book" href="#المرجع">
`CheckpointConfig` والأحداث والمزودات وسطر الأوامر.
</Card>
</CardGroup>
## الشرح
### ما هي نقطة الحفظ
تلتقط نقطة الحفظ كل ما يحتاجه CrewAI لإعادة إنشاء تشغيل أثناء سيره: الحالة الكاملة للطاقم أو التدفق أو الوكيل — التكوين، وذاكرة الوكلاء ومصادر المعرفة، وتقدم المهام، والمخرجات الوسيطة، والحالة الداخلية والسمات — إلى جانب مدخلات الـ kickoff، وسجل الأحداث حتى تلك النقطة، ومعرف نسب يربط نقطة الحفظ بالتشغيل الذي جاءت منه.
الاستعادة تعيد بناء تلك الحالة وتستمر. تتخطى المهام المكتملة، وتعاد ترطيب الذاكرة والمعرفة، ويعمل العمل التابع على نفس المخرجات التي أنتجها التشغيل الأصلي. التفرع يجري نفس الاستعادة تحت نسب جديد، بحيث يكتب الفرع الجديد والتشغيل الأصلي نقاط الحفظ جنبا إلى جنب دون أن يطمس أحدهما الآخر.
### متى تكتب نقاط الحفظ
الـ Checkpointing مدفوع بالأحداث. يشترك وقت التشغيل في الأحداث التي تحددها عبر `on_events` ويكتب نقطة حفظ عند إطلاق أحدها. الافتراضي `task_completed` ينتج نقطة حفظ لكل مهمة منتهية — توازن معقول بين الدقة واستخدام القرص. الأحداث عالية التردد مثل `llm_call_completed` متاحة للاستعادة الدقيقة لكنها تكتب ملفات أكثر بكثير.
### التخزين
يتضمن CrewAI مزودين:
- `JsonProvider` يكتب ملفا لكل نقطة حفظ. قابل للقراءة وسهل التفقد.
- `SqliteProvider` يكتب إلى قاعدة بيانات SQLite واحدة. أفضل لنقاط الحفظ عالية التردد.
كلاهما يحذف أقدم نقاط الحفظ عند تحديد `max_checkpoints`.
<Note>
كتابة نقاط الحفظ بأفضل جهد. فشل نقطة حفظ يسجل لكنه لا يقاطع التشغيل.
</Note>
### نموذج الوراثة
`Crew` و`Flow` و`Agent` كلها تقبل وسيط `checkpoint`. يرث الأبناء من الأب ما لم يحددوا قيمتهم الخاصة أو يمرروا `False` للانسحاب. فعل الـ Checkpointing مرة واحدة على الطاقم وتشارك كل الوكلاء، أو استبعد وكيلا واحدا بشكل انتقائي.
## درس تطبيقي: استئناف طاقم فاشل
هذا الدليل يستغرق حوالي 5 دقائق. ستشغل طاقما بمهمتين، توقفه في المنتصف، ثم تستأنف من نقطة الحفظ المحفوظة.
<Steps>
<Step title="أنشئ الطاقم مع تفعيل الـ Checkpointing">
```python
from crewai import Agent, Crew, Task
researcher = Agent(role="Researcher", goal="Research", backstory="Expert")
writer = Agent(role="Writer", goal="Write", backstory="Expert")
crew = Crew(
agents=[researcher, writer],
tasks=[
Task(description="Research AI trends", agent=researcher, expected_output="bullets"),
Task(description="Write a summary", agent=writer, expected_output="paragraph"),
],
checkpoint=True,
)
```
</Step>
<Step title="شغله وأوقفه بعد المهمة الأولى">
```python
result = crew.kickoff()
```
اضغط `Ctrl+C` بعد انتهاء المهمة الأولى. في `./.checkpoints/`، الملف بصيغة `<timestamp>_<uuid>.json` هو نقطة الحفظ.
</Step>
<Step title="استأنف من نقطة الحفظ">
```python
from crewai import CheckpointConfig
result = crew.kickoff(
from_checkpoint=CheckpointConfig(
restore_from="./.checkpoints/<timestamp>_<uuid>.json",
),
)
```
يتم تخطي مهمة البحث، ويعمل الكاتب على مخرجات البحث المحفوظة، وينتهي الطاقم.
</Step>
</Steps>
## ادلة عملية
<AccordionGroup>
<Accordion title="تفعيل الـ Checkpointing بالإعدادات الافتراضية" icon="play">
```python
crew = Crew(agents=[...], tasks=[...], checkpoint=True)
```
يكتب إلى `./.checkpoints/` عند كل `task_completed`.
</Accordion>
<Accordion title="تخصيص التخزين والتردد" icon="sliders">
```python
from crewai import Crew, CheckpointConfig
crew = Crew(
agents=[...],
tasks=[...],
checkpoint=CheckpointConfig(
location="./my_checkpoints",
on_events=["task_completed", "crew_kickoff_completed"],
max_checkpoints=5,
),
)
```
</Accordion>
<Accordion title="اختيار مزود التخزين" icon="database">
<CodeGroup>
```python JsonProvider
from crewai import Crew, CheckpointConfig
from crewai.state import JsonProvider
crew = Crew(
agents=[...],
tasks=[...],
checkpoint=CheckpointConfig(
location="./my_checkpoints",
provider=JsonProvider(),
max_checkpoints=5,
),
)
```
```python SqliteProvider
from crewai import Crew, CheckpointConfig
from crewai.state import SqliteProvider
crew = Crew(
agents=[...],
tasks=[...],
checkpoint=CheckpointConfig(
location="./.checkpoints.db",
provider=SqliteProvider(),
max_checkpoints=50,
),
)
```
</CodeGroup>
<Tip>
SQLite يفعل وضع journal WAL للقراءات المتزامنة. يفضل لنقاط الحفظ عالية التردد.
</Tip>
</Accordion>
<Accordion title="استبعاد وكيل واحد" icon="user-slash">
```python
crew = Crew(
agents=[
Agent(role="Researcher", ...),
Agent(role="Writer", ..., checkpoint=False),
],
tasks=[...],
checkpoint=True,
)
```
</Accordion>
<Accordion title="التفرع إلى فرع جديد" icon="code-branch">
`fork()` يستعيد نقطة حفظ تحت نسب جديد بحيث لا يتصادم التشغيل الجديد مع الأصلي.
```python
config = CheckpointConfig(restore_from="./my_checkpoints/<file>.json")
crew = Crew.fork(config, branch="experiment-a")
result = crew.kickoff(inputs={"strategy": "aggressive"})
```
تسمية `branch` اختيارية؛ يتم إنشاء واحدة إذا أغفلت.
</Accordion>
<Accordion title="Checkpointing لـ Crew أو Flow أو Agent" icon="cubes">
<Tabs>
<Tab title="Crew">
```python
crew = Crew(
agents=[researcher, writer],
tasks=[research_task, write_task, review_task],
checkpoint=CheckpointConfig(location="./crew_cp"),
)
```
المشغل الافتراضي: `task_completed`.
</Tab>
<Tab title="Flow">
```python
from crewai.flow.flow import Flow, start, listen
from crewai import CheckpointConfig
class MyFlow(Flow):
@start()
def step_one(self):
return "data"
@listen(step_one)
def step_two(self, data):
return process(data)
flow = MyFlow(
checkpoint=CheckpointConfig(
location="./flow_cp",
on_events=["method_execution_finished"],
),
)
result = flow.kickoff()
```
</Tab>
<Tab title="Agent">
```python
agent = Agent(
role="Researcher",
goal="Research topics",
backstory="Expert researcher",
checkpoint=CheckpointConfig(
location="./agent_cp",
on_events=["lite_agent_execution_completed"],
),
)
result = agent.kickoff(messages=[{"role": "user", "content": "Research AI trends"}])
```
</Tab>
</Tabs>
</Accordion>
<Accordion title="كتابة نقطة حفظ يدويا" icon="code">
سجل معالجا على أي حدث واستدع `state.checkpoint()`.
<CodeGroup>
```python Sync
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from crewai.events.event_bus import crewai_event_bus
from crewai.events.types.llm_events import LLMCallCompletedEvent
if TYPE_CHECKING:
from crewai.state.runtime import RuntimeState
@crewai_event_bus.on(LLMCallCompletedEvent)
def on_llm_done(source: Any, event: LLMCallCompletedEvent, state: RuntimeState) -> None:
path = state.checkpoint("./my_checkpoints")
print(f"تم حفظ نقطة الحفظ: {path}")
```
```python Async
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from crewai.events.event_bus import crewai_event_bus
from crewai.events.types.llm_events import LLMCallCompletedEvent
if TYPE_CHECKING:
from crewai.state.runtime import RuntimeState
@crewai_event_bus.on(LLMCallCompletedEvent)
async def on_llm_done_async(source: Any, event: LLMCallCompletedEvent, state: RuntimeState) -> None:
path = await state.acheckpoint("./my_checkpoints")
print(f"تم حفظ نقطة الحفظ: {path}")
```
</CodeGroup>
يتم تمرير وسيط `state` تلقائيا عندما يقبل المعالج ثلاثة معاملات. راجع [Event Listeners](/ar/concepts/event-listener) لقائمة الأحداث الكاملة.
</Accordion>
<Accordion title="التصفح والاستئناف والتفرع من سطر الأوامر" icon="terminal">
```bash
crewai checkpoint
crewai checkpoint --location ./my_checkpoints
crewai checkpoint --location ./.checkpoints.db
```
<Frame caption="شجرة نقاط الحفظ — الفروع والتفرعات تتداخل تحت أبيها.">
<img src="/images/checkpoint-tui-tree.png" alt="Checkpoint TUI tree view" />
</Frame>
اللوحة اليسرى تجمع نقاط الحفظ حسب الفرع؛ التفرعات تتداخل تحت أبيها. اختيار نقطة حفظ يفتح لوحة التفاصيل مع بياناتها الوصفية وحالة الكيان وتقدم المهام. **Resume** يكمل التشغيل؛ **Fork** يبدأ فرعا جديدا.
<Frame caption="تبويب النظرة العامة — البيانات الوصفية وحالة الكيان وملخص التشغيل.">
<img src="/images/checkpoint-tui-detail-overview.png" alt="Checkpoint detail overview tab" />
</Frame>
لوحة التفاصيل تعرض منطقتين قابلتين للتحرير:
- **Inputs** — مدخلات الـ kickoff الأصلية، معبأة مسبقا وقابلة للتحرير.
<Frame>
<img src="/images/checkpoint-tui-detail-inputs.png" alt="Editable kickoff inputs" />
</Frame>
- **مخرجات المهام** — مخرجات المهام المكتملة. تحرير مخرج والضغط على **Fork** يبطل المهام التابعة لتعاد بالسياق المعدل.
<Frame>
<img src="/images/checkpoint-tui-detail-tasks.png" alt="Editable task outputs" />
</Frame>
<Frame caption="عرض التفرع — تأكيد فرع جديد من نقطة الحفظ المختارة.">
<img src="/images/checkpoint-tui-details-fork.png" alt="Fork confirmation panel" />
</Frame>
<Tip>
مفيد لاستكشاف "ماذا لو": تفرع، عدل، راقب.
</Tip>
</Accordion>
<Accordion title="تفقد نقاط الحفظ بدون TUI" icon="magnifying-glass">
```bash
crewai checkpoint list ./my_checkpoints
crewai checkpoint info ./my_checkpoints/<file>.json
crewai checkpoint info ./.checkpoints.db
```
</Accordion>
</AccordionGroup>
## المرجع
### `CheckpointConfig`
<ParamField path="location" type="str" default='"./.checkpoints"'>
وجهة التخزين. مجلد لـ `JsonProvider`، مسار ملف قاعدة بيانات لـ `SqliteProvider`.
</ParamField>
<ParamField path="on_events" type='list[CheckpointEventType | Literal["*"]]' default='["task_completed"]'>
أنواع الأحداث التي تطلق نقطة حفظ. `CheckpointEventType` هو `Literal` — مدقق الأنواع يكمل تلقائيا ويرفض القيم غير المدعومة. راجع [أنواع الأحداث](#أنواع-الأحداث) للقائمة الكاملة.
</ParamField>
<ParamField path="provider" type="BaseProvider" default="JsonProvider()">
واجهة التخزين. `JsonProvider` أو `SqliteProvider`.
</ParamField>
<ParamField path="max_checkpoints" type="int | None" default="None">
الحد الاقصى لنقاط الحفظ المحتفظ بها. الأقدم تحذف بعد كل كتابة.
</ParamField>
<ParamField path="restore_from" type="Path | str | None" default="None">
نقطة الحفظ المراد استعادتها عند تمريرها عبر `from_checkpoint`.
</ParamField>
### قيم حقل `checkpoint`
مقبولة في `Crew` و`Flow` و`Agent`.
<ParamField path="None" type="افتراضي">
يرث من الأب.
</ParamField>
<ParamField path="True" type="bool">
تفعيل بالإعدادات الافتراضية.
</ParamField>
<ParamField path="False" type="bool">
انسحاب صريح. يوقف الوراثة.
</ParamField>
<ParamField path="CheckpointConfig(...)" type="CheckpointConfig">
إعدادات مخصصة.
</ParamField>
### أنواع الأحداث
يقبل `on_events` أي مجموعة من قيم `CheckpointEventType`. الافتراضي `["task_completed"]` يكتب نقطة حفظ لكل مهمة منتهية، و`["*"]` يطابق جميع الأحداث.
<Warning>
`["*"]` والأحداث عالية التردد مثل `llm_call_completed` تكتب نقاط حفظ كثيرة وقد تضر بالاداء. استخدمها مع `max_checkpoints`.
</Warning>
<Expandable title="جميع الأحداث المدعومة">
- **Task** — `task_started`, `task_completed`, `task_failed`, `task_evaluation`
- **Crew** — `crew_kickoff_started`, `crew_kickoff_completed`, `crew_kickoff_failed`, `crew_train_started`, `crew_train_completed`, `crew_train_failed`, `crew_test_started`, `crew_test_completed`, `crew_test_failed`, `crew_test_result`
- **Agent** — `agent_execution_started`, `agent_execution_completed`, `agent_execution_error`, `lite_agent_execution_started`, `lite_agent_execution_completed`, `lite_agent_execution_error`, `agent_evaluation_started`, `agent_evaluation_completed`, `agent_evaluation_failed`
- **Flow** — `flow_created`, `flow_started`, `flow_finished`, `flow_paused`, `method_execution_started`, `method_execution_finished`, `method_execution_failed`, `method_execution_paused`, `human_feedback_requested`, `human_feedback_received`, `flow_input_requested`, `flow_input_received`
- **LLM** — `llm_call_started`, `llm_call_completed`, `llm_call_failed`, `llm_stream_chunk`, `llm_thinking_chunk`
- **LLM Guardrail** — `llm_guardrail_started`, `llm_guardrail_completed`, `llm_guardrail_failed`
- **Tool** — `tool_usage_started`, `tool_usage_finished`, `tool_usage_error`, `tool_validate_input_error`, `tool_selection_error`, `tool_execution_error`
- **Memory** — `memory_save_started`, `memory_save_completed`, `memory_save_failed`, `memory_query_started`, `memory_query_completed`, `memory_query_failed`, `memory_retrieval_started`, `memory_retrieval_completed`, `memory_retrieval_failed`
- **Knowledge** — `knowledge_search_query_started`, `knowledge_search_query_completed`, `knowledge_query_started`, `knowledge_query_completed`, `knowledge_query_failed`, `knowledge_search_query_failed`
- **Reasoning** — `agent_reasoning_started`, `agent_reasoning_completed`, `agent_reasoning_failed`
- **MCP** — `mcp_connection_started`, `mcp_connection_completed`, `mcp_connection_failed`, `mcp_tool_execution_started`, `mcp_tool_execution_completed`, `mcp_tool_execution_failed`, `mcp_config_fetch_failed`
- **Observation** — `step_observation_started`, `step_observation_completed`, `step_observation_failed`, `plan_refinement`, `plan_replan_triggered`, `goal_achieved_early`
- **Skill** — `skill_discovery_started`, `skill_discovery_completed`, `skill_loaded`, `skill_activated`, `skill_load_failed`
- **Logging** — `agent_logs_started`, `agent_logs_execution`
- **A2A** — `a2a_delegation_started`, `a2a_delegation_completed`, `a2a_conversation_started`, `a2a_conversation_completed`, `a2a_message_sent`, `a2a_response_received`, `a2a_polling_started`, `a2a_polling_status`, `a2a_push_notification_registered`, `a2a_push_notification_received`, `a2a_push_notification_sent`, `a2a_push_notification_timeout`, `a2a_streaming_started`, `a2a_streaming_chunk`, `a2a_agent_card_fetched`, `a2a_authentication_failed`, `a2a_artifact_received`, `a2a_connection_error`, `a2a_server_task_started`, `a2a_server_task_completed`, `a2a_server_task_canceled`, `a2a_server_task_failed`, `a2a_parallel_delegation_started`, `a2a_parallel_delegation_completed`, `a2a_transport_negotiated`, `a2a_content_type_negotiated`, `a2a_context_created`, `a2a_context_expired`, `a2a_context_idle`, `a2a_context_completed`, `a2a_context_pruned`
- **إشارات النظام** — `SIGTERM`, `SIGINT`, `SIGHUP`, `SIGTSTP`, `SIGCONT`
- **حرف بدل** — `"*"` يطابق جميع الأحداث.
</Expandable>
### مزودات التخزين
<ParamField path="JsonProvider" type="provider">
ملف واحد لكل نقطة حفظ بصيغة `<timestamp>_<uuid>.json` داخل `location`.
</ParamField>
<ParamField path="SqliteProvider" type="provider">
ملف قاعدة بيانات واحد في `location` مع journaling WAL.
</ParamField>
### سطر الأوامر
| الامر | الغرض |
|:------|:------|
| `crewai checkpoint` | تشغيل TUI؛ كشف التخزين تلقائيا. |
| `crewai checkpoint --location <path>` | تشغيل TUI على موقع محدد. |
| `crewai checkpoint list <path>` | سرد نقاط الحفظ. |
| `crewai checkpoint info <path>` | تفقد ملف نقطة حفظ أو آخر مدخل في قاعدة بيانات SQLite. |

View File

@@ -0,0 +1,302 @@
---
title: واجهة سطر الأوامر
description: تعرّف على كيفية استخدام واجهة سطر أوامر CrewAI للتفاعل مع CrewAI.
icon: terminal
mode: "wide"
---
<Warning>
منذ الإصدار 0.140.0، بدأ CrewAI AMP عملية نقل مزود تسجيل الدخول.
لذلك، تم تحديث تدفق المصادقة عبر CLI. المستخدمون الذين يسجلون الدخول
باستخدام Google، أو الذين أنشأوا حساباتهم بعد 3 يوليو 2025 لن يتمكنوا
من تسجيل الدخول مع الإصدارات القديمة من مكتبة `crewai`.
</Warning>
## نظرة عامة
توفر واجهة سطر أوامر CrewAI مجموعة من الأوامر للتفاعل مع CrewAI، مما يتيح لك إنشاء وتدريب وتشغيل وإدارة الأطقم والتدفقات.
## التثبيت
لاستخدام واجهة سطر أوامر CrewAI، تأكد من تثبيت CrewAI:
```shell Terminal
pip install crewai
```
## الاستخدام الأساسي
الهيكل الأساسي لأمر CrewAI CLI هو:
```shell Terminal
crewai [COMMAND] [OPTIONS] [ARGUMENTS]
```
## الأوامر المتاحة
### 1. إنشاء
إنشاء طاقم أو تدفق جديد.
```shell Terminal
crewai create [OPTIONS] TYPE NAME
```
- `TYPE`: اختر بين "crew" أو "flow"
- `NAME`: اسم الطاقم أو التدفق
مثال:
```shell Terminal
crewai create crew my_new_crew
crewai create flow my_new_flow
```
افتراضيًا، ينشئ `crewai create crew` مشروعًا JSON-first يحتوي على `crew.jsonc` و `agents/*.jsonc`. استخدم `crewai create crew my_new_crew --classic` فقط إذا أردت البنية القديمة Python/YAML مع `crew.py` و `config/agents.yaml` و `config/tasks.yaml`.
### 2. الإصدار
عرض الإصدار المثبت من CrewAI.
```shell Terminal
crewai version [OPTIONS]
```
- `--tools`: (اختياري) عرض الإصدار المثبت من أدوات CrewAI
### 3. التدريب
تدريب الطاقم لعدد محدد من التكرارات.
```shell Terminal
crewai train [OPTIONS]
```
- `-n, --n_iterations INTEGER`: عدد تكرارات التدريب (افتراضي: 5)
- `-f, --filename TEXT`: مسار ملف مخصص للتدريب (افتراضي: "trained_agents_data.pkl")
### 4. الإعادة
إعادة تنفيذ الطاقم من مهمة محددة.
```shell Terminal
crewai replay [OPTIONS]
```
- `-t, --task_id TEXT`: إعادة تنفيذ الطاقم من معرّف المهمة هذا، بما في ذلك جميع المهام اللاحقة
### 5. سجل مخرجات المهام
استرجاع أحدث مخرجات مهام crew.kickoff().
```shell Terminal
crewai log-tasks-outputs
```
### 6. إعادة تعيين الذاكرة
إعادة تعيين ذاكرة الطاقم (طويلة، قصيرة، الكيانات، أحدث مخرجات التشغيل).
```shell Terminal
crewai reset-memories [OPTIONS]
```
- `-l, --long`: إعادة تعيين الذاكرة طويلة المدى
- `-s, --short`: إعادة تعيين الذاكرة قصيرة المدى
- `-e, --entities`: إعادة تعيين ذاكرة الكيانات
- `-k, --kickoff-outputs`: إعادة تعيين أحدث مخرجات التشغيل
- `-kn, --knowledge`: إعادة تعيين تخزين المعرفة
- `-akn, --agent-knowledge`: إعادة تعيين تخزين معرفة الوكيل
- `-a, --all`: إعادة تعيين جميع الذاكرات
### 7. الاختبار
اختبار الطاقم وتقييم النتائج.
```shell Terminal
crewai test [OPTIONS]
```
- `-n, --n_iterations INTEGER`: عدد تكرارات الاختبار (افتراضي: 3)
- `-m, --model TEXT`: نموذج LLM لتشغيل الاختبارات (افتراضي: "gpt-4o-mini")
### 8. التشغيل
تشغيل الطاقم أو التدفق.
```shell Terminal
crewai run
```
<Note>
بدءًا من الإصدار 0.103.0، يمكن استخدام أمر `crewai run` لتشغيل
كل من الأطقم القياسية والتدفقات. للتدفقات، يكتشف تلقائيًا النوع
من pyproject.toml ويشغّل الأمر المناسب. هذه هي الطريقة الموصى بها
لتشغيل كل من الأطقم والتدفقات.
</Note>
### 9. الدردشة
بدءًا من الإصدار `0.98.0`، عند تشغيل أمر `crewai chat`، تبدأ جلسة تفاعلية مع طاقمك. سيرشدك المساعد الذكي بطلب المدخلات اللازمة لتنفيذ الطاقم. بمجرد توفير جميع المدخلات، سينفذ الطاقم مهامه.
```shell Terminal
crewai chat
```
<Note>
مهم: عيّن خاصية `chat_llm` في تعريف الـ crew لتفعيل هذا الأمر.
للـ crews بنمط JSON-first، أضفها إلى `crew.jsonc`:
```jsonc
{
"name": "My Crew",
"agents": ["researcher"],
"tasks": [],
"chat_llm": "openai/gpt-4o"
}
```
للـ crews الكلاسيكية Python/YAML، عيّنها في `crew.py`:
```python
@crew
def crew(self) -> Crew:
return Crew(
agents=self.agents,
tasks=self.tasks,
process=Process.sequential,
verbose=True,
chat_llm="gpt-4o",
)
```
</Note>
### 10. النشر
نشر الطاقم أو التدفق إلى [CrewAI AMP](https://app.crewai.com).
- **المصادقة**: تحتاج لتكون مصادقًا للنشر إلى CrewAI AMP.
```shell Terminal
crewai login
```
- **إنشاء نشر**:
```shell Terminal
crewai deploy create
```
- **نشر الطاقم**:
```shell Terminal
crewai deploy push
```
- **حالة النشر**:
```shell Terminal
crewai deploy status
```
- **سجلات النشر**:
```shell Terminal
crewai deploy logs
```
- **عرض النشرات**:
```shell Terminal
crewai deploy list
```
- **حذف النشر**:
```shell Terminal
crewai deploy remove
```
### 11. إدارة المؤسسة
إدارة مؤسسات CrewAI AMP.
```shell Terminal
crewai org [COMMAND] [OPTIONS]
```
- `list`: عرض جميع المؤسسات
- `current`: عرض المؤسسة النشطة حاليًا
- `switch`: التبديل إلى مؤسسة محددة
### 12. تسجيل الدخول
المصادقة مع CrewAI AMP باستخدام تدفق رمز الجهاز الآمن.
```shell Terminal
crewai login
```
### 13. إدارة التهيئة
إدارة إعدادات تهيئة CLI لـ CrewAI.
```shell Terminal
crewai config [COMMAND] [OPTIONS]
```
- `list`: عرض جميع معاملات التهيئة
- `set`: تعيين معامل تهيئة
- `reset`: إعادة تعيين جميع المعاملات إلى القيم الافتراضية
### 14. إدارة التتبع
إدارة تفضيلات جمع التتبع لعمليات الطاقم والتدفق.
```shell Terminal
crewai traces [COMMAND]
```
- `enable`: تفعيل جمع التتبع
- `disable`: تعطيل جمع التتبع
- `status`: عرض حالة جمع التتبع الحالية
#### كيف يعمل التتبع
يتم التحكم في جمع التتبع بفحص ثلاثة إعدادات بترتيب الأولوية:
1. **علامة صريحة في الكود** (الأولوية الأعلى):
```python
crew = Crew(agents=[...], tasks=[...], tracing=True) # تفعيل دائمًا
crew = Crew(agents=[...], tasks=[...], tracing=False) # تعطيل دائمًا
crew = Crew(agents=[...], tasks=[...]) # فحص الأولويات الأدنى
```
2. **متغير البيئة** (الأولوية الثانية):
```env
CREWAI_TRACING_ENABLED=true
```
3. **تفضيل المستخدم** (الأولوية الأدنى):
```shell Terminal
crewai traces enable
```
<Note>
**لتفعيل التتبع**، استخدم أيًا من هذه الطرق:
- عيّن `tracing=True` في كود الطاقم/التدفق، أو
- أضف `CREWAI_TRACING_ENABLED=true` إلى ملف `.env`، أو
- شغّل `crewai traces enable`
**لتعطيل التتبع**، استخدم أيًا من هذه الطرق:
- عيّن `tracing=False` في كود الطاقم/التدفق، أو
- أزل أو عيّن `false` لمتغير `CREWAI_TRACING_ENABLED`، أو
- شغّل `crewai traces disable`
</Note>
<Tip>
يتعامل CrewAI CLI مع المصادقة لمستودع الأدوات تلقائيًا عند
إضافة حزم إلى مشروعك. فقط أضف `crewai` قبل أي أمر `uv`
لاستخدامه. مثلًا `crewai uv add requests`.
</Tip>
<Note>
تُخزن إعدادات التهيئة في `~/.config/crewai/settings.json`. بعض
الإعدادات مثل اسم المؤسسة ومعرّفها للقراءة فقط وتُدار من خلال
أوامر المصادقة والمؤسسة.
</Note>

View File

@@ -0,0 +1,363 @@
---
title: التعاون
description: كيفية تمكين الوكلاء من العمل معًا وتفويض المهام والتواصل بفعالية داخل فرق CrewAI.
icon: screen-users
mode: "wide"
---
## نظرة عامة
يُمكّن التعاون في CrewAI الوكلاء من العمل معًا كفريق عن طريق تفويض المهام وطرح الأسئلة للاستفادة من خبرات بعضهم البعض. عندما يكون `allow_delegation=True`، يحصل الوكلاء تلقائيًا على أدوات تعاون قوية.
## البدء السريع: تفعيل التعاون
```python
from crewai import Agent, Crew, Task
# تفعيل التعاون للوكلاء
researcher = Agent(
role="Research Specialist",
goal="Conduct thorough research on any topic",
backstory="Expert researcher with access to various sources",
allow_delegation=True, # الإعداد الرئيسي للتعاون
verbose=True
)
writer = Agent(
role="Content Writer",
goal="Create engaging content based on research",
backstory="Skilled writer who transforms research into compelling content",
allow_delegation=True, # يُمكّن طرح الأسئلة على الوكلاء الآخرين
verbose=True
)
# يمكن للوكلاء الآن التعاون تلقائيًا
crew = Crew(
agents=[researcher, writer],
tasks=[...],
verbose=True
)
```
## كيف يعمل تعاون الوكلاء
عندما يكون `allow_delegation=True`، يوفر CrewAI تلقائيًا للوكلاء أداتين قويتين:
### 1. **أداة تفويض العمل**
تسمح للوكلاء بتعيين مهام لزملاء الفريق ذوي الخبرة المحددة.
```python
# يحصل الوكيل تلقائيًا على هذه الأداة:
# Delegate work to coworker(task: str, context: str, coworker: str)
```
### 2. **أداة طرح الأسئلة**
تُمكّن الوكلاء من طرح أسئلة محددة لجمع المعلومات من الزملاء.
```python
# يحصل الوكيل تلقائيًا على هذه الأداة:
# Ask question to coworker(question: str, context: str, coworker: str)
```
## التعاون في الممارسة
إليك مثالًا كاملًا يوضح تعاون الوكلاء في مهمة إنشاء المحتوى:
```python
from crewai import Agent, Crew, Task, Process
# إنشاء وكلاء تعاونيين
researcher = Agent(
role="Research Specialist",
goal="Find accurate, up-to-date information on any topic",
backstory="""You're a meticulous researcher with expertise in finding
reliable sources and fact-checking information across various domains.""",
allow_delegation=True,
verbose=True
)
writer = Agent(
role="Content Writer",
goal="Create engaging, well-structured content",
backstory="""You're a skilled content writer who excels at transforming
research into compelling, readable content for different audiences.""",
allow_delegation=True,
verbose=True
)
editor = Agent(
role="Content Editor",
goal="Ensure content quality and consistency",
backstory="""You're an experienced editor with an eye for detail,
ensuring content meets high standards for clarity and accuracy.""",
allow_delegation=True,
verbose=True
)
# إنشاء مهمة تشجع التعاون
article_task = Task(
description="""Write a comprehensive 1000-word article about 'The Future of AI in Healthcare'.
The article should include:
- Current AI applications in healthcare
- Emerging trends and technologies
- Potential challenges and ethical considerations
- Expert predictions for the next 5 years
Collaborate with your teammates to ensure accuracy and quality.""",
expected_output="A well-researched, engaging 1000-word article with proper structure and citations",
agent=writer # الكاتب يقود، لكن يمكنه تفويض البحث إلى الباحث
)
# إنشاء طاقم تعاوني
crew = Crew(
agents=[researcher, writer, editor],
tasks=[article_task],
process=Process.sequential,
verbose=True
)
result = crew.kickoff()
```
## أنماط التعاون
### النمط 1: بحث ← كتابة ← تحرير
```python
research_task = Task(
description="Research the latest developments in quantum computing",
expected_output="Comprehensive research summary with key findings and sources",
agent=researcher
)
writing_task = Task(
description="Write an article based on the research findings",
expected_output="Engaging 800-word article about quantum computing",
agent=writer,
context=[research_task] # يحصل على مخرجات البحث كسياق
)
editing_task = Task(
description="Edit and polish the article for publication",
expected_output="Publication-ready article with improved clarity and flow",
agent=editor,
context=[writing_task] # يحصل على مسودة المقال كسياق
)
```
### النمط 2: مهمة واحدة تعاونية
```python
collaborative_task = Task(
description="""Create a marketing strategy for a new AI product.
Writer: Focus on messaging and content strategy
Researcher: Provide market analysis and competitor insights
Work together to create a comprehensive strategy.""",
expected_output="Complete marketing strategy with research backing",
agent=writer # الوكيل القائد، لكن يمكنه التفويض إلى الباحث
)
```
## التعاون الهرمي
للمشاريع المعقدة، استخدم عملية هرمية مع وكيل مدير:
```python
from crewai import Agent, Crew, Task, Process
# وكيل المدير ينسق الفريق
manager = Agent(
role="Project Manager",
goal="Coordinate team efforts and ensure project success",
backstory="Experienced project manager skilled at delegation and quality control",
allow_delegation=True,
verbose=True
)
# وكلاء متخصصون
researcher = Agent(
role="Researcher",
goal="Provide accurate research and analysis",
backstory="Expert researcher with deep analytical skills",
allow_delegation=False, # المتخصصون يركزون على خبرتهم
verbose=True
)
writer = Agent(
role="Writer",
goal="Create compelling content",
backstory="Skilled writer who creates engaging content",
allow_delegation=False,
verbose=True
)
# مهمة يقودها المدير
project_task = Task(
description="Create a comprehensive market analysis report with recommendations",
expected_output="Executive summary, detailed analysis, and strategic recommendations",
agent=manager # المدير سيفوّض إلى المتخصصين
)
# طاقم هرمي
crew = Crew(
agents=[manager, researcher, writer],
tasks=[project_task],
process=Process.hierarchical, # المدير ينسق كل شيء
manager_llm="gpt-4o", # تحديد LLM للمدير
verbose=True
)
```
## أفضل ممارسات التعاون
### 1. **تحديد الأدوار بوضوح**
```python
# جيد: أدوار محددة ومتكاملة
researcher = Agent(role="Market Research Analyst", ...)
writer = Agent(role="Technical Content Writer", ...)
# تجنب: أدوار متداخلة أو غامضة
agent1 = Agent(role="General Assistant", ...)
agent2 = Agent(role="Helper", ...)
```
### 2. **تفعيل التفويض الاستراتيجي**
```python
# فعّل التفويض للمنسقين والعامين
lead_agent = Agent(
role="Content Lead",
allow_delegation=True, # يمكنه التفويض إلى المتخصصين
...
)
# عطّل للمتخصصين المركّزين (اختياري)
specialist_agent = Agent(
role="Data Analyst",
allow_delegation=False, # يركز على الخبرة الأساسية
...
)
```
### 3. **مشاركة السياق**
```python
# استخدم معامل context لاعتماديات المهام
writing_task = Task(
description="Write article based on research",
agent=writer,
context=[research_task], # يشارك نتائج البحث
...
)
```
### 4. **أوصاف المهام الواضحة**
```python
# أوصاف محددة وقابلة للتنفيذ
Task(
description="""Research competitors in the AI chatbot space.
Focus on: pricing models, key features, target markets.
Provide data in a structured format.""",
...
)
# تجنب: أوصاف غامضة لا توجه التعاون
Task(description="Do some research about chatbots", ...)
```
## استكشاف أخطاء التعاون وإصلاحها
### المشكلة: الوكلاء لا يتعاونون
**الأعراض:** يعمل الوكلاء بمعزل، لا يحدث تفويض
```python
# الحل: تأكد من تفعيل التفويض
agent = Agent(
role="...",
allow_delegation=True, # هذا مطلوب!
...
)
```
### المشكلة: كثرة الذهاب والإياب
**الأعراض:** يطرح الوكلاء أسئلة مفرطة، تقدم بطيء
```python
# الحل: وفّر سياقًا أفضل وأدوارًا محددة
Task(
description="""Write a technical blog post about machine learning.
Context: Target audience is software developers with basic ML knowledge.
Length: 1200 words
Include: code examples, practical applications, best practices
If you need specific technical details, delegate research to the researcher.""",
...
)
```
### المشكلة: حلقات التفويض
**الأعراض:** يفوّض الوكلاء ذهابًا وإيابًا بلا نهاية
```python
# الحل: تسلسل هرمي واضح ومسؤوليات
manager = Agent(role="Manager", allow_delegation=True)
specialist1 = Agent(role="Specialist A", allow_delegation=False) # لا إعادة تفويض
specialist2 = Agent(role="Specialist B", allow_delegation=False)
```
## ميزات التعاون المتقدمة
### قواعد التعاون المخصصة
```python
# تعيين إرشادات تعاون محددة في خلفية الوكيل
agent = Agent(
role="Senior Developer",
backstory="""You lead development projects and coordinate with team members.
Collaboration guidelines:
- Delegate research tasks to the Research Analyst
- Ask the Designer for UI/UX guidance
- Consult the QA Engineer for testing strategies
- Only escalate blocking issues to the Project Manager""",
allow_delegation=True
)
```
### مراقبة التعاون
```python
def track_collaboration(output):
"""تتبع أنماط التعاون"""
if "Delegate work to coworker" in output.raw:
print("Delegation occurred")
if "Ask question to coworker" in output.raw:
print("Question asked")
crew = Crew(
agents=[...],
tasks=[...],
step_callback=track_collaboration, # مراقبة التعاون
verbose=True
)
```
## الذاكرة والتعلم
تمكين الوكلاء من تذكر التعاونات السابقة:
```python
agent = Agent(
role="Content Lead",
memory=True, # يتذكر التفاعلات السابقة
allow_delegation=True,
verbose=True
)
```
مع تفعيل الذاكرة، يتعلم الوكلاء من التعاونات السابقة ويحسّنون قرارات التفويض بمرور الوقت.
## الخطوات التالية
- **جرّب الأمثلة**: ابدأ بمثال التعاون الأساسي
- **جرّب أدوارًا مختلفة**: اختبر تركيبات أدوار وكلاء مختلفة
- **راقب التفاعلات**: استخدم `verbose=True` لرؤية التعاون في العمل
- **حسّن أوصاف المهام**: المهام الواضحة تؤدي إلى تعاون أفضل
- **وسّع النطاق**: جرّب العمليات الهرمية للمشاريع المعقدة
يحوّل التعاون وكلاء الذكاء الاصطناعي الفرديين إلى فرق قوية يمكنها معالجة التحديات المعقدة ومتعددة الأوجه معًا.

View File

@@ -0,0 +1,245 @@
---
title: الأطقم
description: فهم واستخدام الأطقم في إطار عمل CrewAI مع خصائص ووظائف شاملة.
icon: people-group
mode: "wide"
---
## نظرة عامة
يمثل الطاقم في CrewAI مجموعة تعاونية من الوكلاء يعملون معًا لتحقيق مجموعة من المهام. يحدد كل طاقم استراتيجية تنفيذ المهام وتعاون الوكلاء وسير العمل العام.
## خصائص الطاقم
| الخاصية | المعامل | الوصف |
| :------------------------------------ | :--------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **المهام** | `tasks` | قائمة المهام المعيّنة للطاقم. |
| **الوكلاء** | `agents` | قائمة الوكلاء الذين يشكلون جزءًا من الطاقم. |
| **العملية** _(اختياري)_ | `process` | تدفق العملية (مثل تسلسلي، هرمي) الذي يتبعه الطاقم. الافتراضي `sequential`. |
| **الوضع المفصل** _(اختياري)_ | `verbose` | مستوى التفصيل في التسجيل أثناء التنفيذ. الافتراضي `False`. |
| **LLM المدير** _(اختياري)_ | `manager_llm` | نموذج اللغة المستخدم بواسطة وكيل المدير في العملية الهرمية. **مطلوب عند استخدام العملية الهرمية.** |
| **LLM استدعاء الدوال** _(اختياري)_ | `function_calling_llm` | إذا مُرر، سيستخدم الطاقم هذا LLM لاستدعاء دوال الأدوات لجميع الوكلاء. يمكن لكل وكيل أن يكون له LLM خاص يتجاوز LLM الطاقم. |
| **التهيئة** _(اختياري)_ | `config` | إعدادات تهيئة اختيارية للطاقم، بتنسيق `Json` أو `Dict[str, Any]`. |
| **الحد الأقصى لـ RPM** _(اختياري)_ | `max_rpm` | الحد الأقصى للطلبات في الدقيقة. الافتراضي `None`. |
| **الذاكرة** _(اختياري)_ | `memory` | تُستخدم لتخزين ذاكرات التنفيذ (قصيرة المدى، طويلة المدى، ذاكرة الكيانات). |
| **التخزين المؤقت** _(اختياري)_ | `cache` | يحدد ما إذا كان يُستخدم تخزين مؤقت لنتائج تنفيذ الأدوات. الافتراضي `True`. |
| **المُضمّن** _(اختياري)_ | `embedder` | تهيئة المُضمّن المستخدم من قبل الطاقم. الافتراضي `{"provider": "openai"}`. |
| **دالة الخطوة** _(اختياري)_ | `step_callback` | دالة تُستدعى بعد كل خطوة لكل وكيل. |
| **دالة المهمة** _(اختياري)_ | `task_callback` | دالة تُستدعى بعد اكتمال كل مهمة. |
| **مشاركة الطاقم** _(اختياري)_ | `share_crew` | ما إذا كنت تريد مشاركة معلومات الطاقم الكاملة وتنفيذه مع فريق CrewAI. |
| **ملف سجل المخرجات** _(اختياري)_ | `output_log_file` | عيّن True لحفظ السجلات كـ logs.txt أو وفّر مسار ملف. الافتراضي `None`. |
| **وكيل المدير** _(اختياري)_ | `manager_agent` | يعيّن وكيلًا مخصصًا سيُستخدم كمدير. |
| **التخطيط** *(اختياري)* | `planning` | يضيف قدرة التخطيط للطاقم. |
| **LLM التخطيط** *(اختياري)* | `planning_llm` | نموذج اللغة المستخدم بواسطة AgentPlanner في عملية التخطيط. |
| **مصادر المعرفة** _(اختياري)_ | `knowledge_sources` | مصادر المعرفة المتاحة على مستوى الطاقم، يمكن لجميع الوكلاء الوصول إليها. |
| **البث** _(اختياري)_ | `stream` | تفعيل مخرجات البث لتلقي تحديثات في الوقت الفعلي. الافتراضي `False`. |
<Tip>
**الحد الأقصى لـ RPM للطاقم**: تعيّن خاصية `max_rpm` الحد الأقصى للطلبات في الدقيقة التي يمكن للطاقم تنفيذها لتجنب حدود المعدل وستتجاوز إعدادات `max_rpm` الفردية للوكلاء إذا عيّنتها.
</Tip>
## إنشاء الأطقم
هناك طريقتان رئيسيتان لإنشاء الأطقم في CrewAI: باستخدام **تهيئة JSONC (الموصى بها للـ crews الجديدة)** أو تعريفها **مباشرة في الكود** للمشاريع الكلاسيكية والحالات المتقدمة.
### تهيئة JSONC (موصى بها)
المشاريع الجديدة التي تُنشأ عبر `crewai create crew <name>` تستخدم `crew.jsonc` لإعدادات الـ crew والمهام، وملفًا منفصلًا لكل Agent داخل `agents/`. يكتشف `crewai run` ملف `crew.jsonc` أو `crew.json`، ويحمّل الـ Agents المشار إليها، ويطلب قيم placeholders الناقصة، ثم يبدأ الـ crew.
```jsonc crew.jsonc
{
"name": "Market Research Crew",
"agents": ["researcher", "analyst"],
"tasks": [
{
"name": "research",
"description": "Research {topic} and collect the most relevant facts.",
"expected_output": "Structured research notes about {topic}.",
"agent": "researcher"
},
{
"name": "analysis",
"description": "Analyze the research and write a concise report.",
"expected_output": "A markdown report with findings and recommendations.",
"agent": "analyst",
"context": ["research"],
"output_file": "output/report.md"
}
],
"process": "sequential",
"verbose": true,
"memory": true,
"inputs": {
"topic": "AI Agents"
}
}
```
كل عنصر في `agents` يُحل أولًا إلى `agents/<name>.jsonc` ثم إلى `agents/<name>.json`. للـ crews الهرمية، استخدم `"process": "hierarchical"` مع `manager_llm` أو `manager_agent`.
<Warning>
شغّل مشاريع JSON crew من مصادر تثق بها فقط. أدوات `custom:<name>` ومراجع `{"python": "module.attribute"}` تنفذ كود Python محليًا عند تحميل الـ crew.
</Warning>
### تهيئة YAML الكلاسيكية
المشاريع الكلاسيكية التي تُنشأ عبر `crewai create crew <name> --classic` تستخدم `crew.py` و `config/agents.yaml` و `config/tasks.yaml` والمزيّنات `@CrewBase` و `@agent` و `@task` و `@crew`.
تظل هذه الطريقة مدعومة للمشاريع الحالية المبنية بـ Python/YAML وللفِرق التي تحتاج تحكمًا صريحًا عبر decorators.
```python code
from crewai import Agent, Crew, Task, Process
from crewai.project import CrewBase, agent, task, crew, before_kickoff, after_kickoff
from crewai.agents.agent_builder.base_agent import BaseAgent
from typing import List
@CrewBase
class YourCrewName:
"""Description of your crew"""
agents: List[BaseAgent]
tasks: List[Task]
agents_config = 'config/agents.yaml'
tasks_config = 'config/tasks.yaml'
@before_kickoff
def prepare_inputs(self, inputs):
inputs['additional_data'] = "Some extra information"
return inputs
@after_kickoff
def process_output(self, output):
output.raw += "\nProcessed after kickoff."
return output
@agent
def agent_one(self) -> Agent:
return Agent(
config=self.agents_config['agent_one'], # type: ignore[index]
verbose=True
)
@task
def task_one(self) -> Task:
return Task(
config=self.tasks_config['task_one'] # type: ignore[index]
)
@crew
def crew(self) -> Crew:
return Crew(
agents=self.agents,
tasks=self.tasks,
process=Process.sequential,
verbose=True,
)
```
<Note>
سيتم تنفيذ المهام بالترتيب الذي عُرّفت به.
</Note>
فئة `CrewBase`، مع هذه المزيّنات، تؤتمت جمع الوكلاء والمهام، مما يقلل الحاجة للإدارة اليدوية.
### تعريف مباشر في الكود (بديل)
بدلاً من ذلك، يمكنك تعريف الطاقم مباشرة في الكود بدون ملفات تهيئة YAML.
## مخرجات الطاقم
تُغلّف مخرجات الطاقم في فئة `CrewOutput`. توفر هذه الفئة طريقة منظمة للوصول إلى نتائج تنفيذ الطاقم، بما في ذلك تنسيقات متنوعة مثل السلاسل النصية الخام وJSON ونماذج Pydantic.
### خصائص مخرجات الطاقم
| الخاصية | المعامل | النوع | الوصف |
| :--------------- | :------------- | :------------------------- | :--------------------------------------------------------------------------------------------------- |
| **Raw** | `raw` | `str` | المخرجات الخام للطاقم. هذا هو التنسيق الافتراضي. |
| **Pydantic** | `pydantic` | `Optional[BaseModel]` | كائن نموذج Pydantic يمثل المخرجات المنظمة. |
| **JSON Dict** | `json_dict` | `Optional[Dict[str, Any]]` | قاموس يمثل مخرجات JSON. |
| **Tasks Output** | `tasks_output` | `List[TaskOutput]` | قائمة كائنات `TaskOutput`، كل منها يمثل مخرجات مهمة. |
| **Token Usage** | `token_usage` | `Dict[str, Any]` | ملخص استخدام الرموز. |
## استخدام الذاكرة
يمكن للأطقم استخدام الذاكرة (قصيرة المدى، طويلة المدى، وذاكرة الكيانات) لتحسين تنفيذها وتعلمها بمرور الوقت.
## استخدام التخزين المؤقت
يمكن استخدام التخزين المؤقت لتخزين نتائج تنفيذ الأدوات، مما يجعل العملية أكثر كفاءة.
## مقاييس استخدام الطاقم
بعد تنفيذ الطاقم، يمكنك الوصول إلى خاصية `usage_metrics` لعرض مقاييس استخدام نموذج اللغة (LLM) لجميع المهام المنفذة.
```python Code
crew = Crew(agents=[agent1, agent2], tasks=[task1, task2])
crew.kickoff()
print(crew.usage_metrics)
```
## عملية تنفيذ الطاقم
- **العملية التسلسلية**: تُنفذ المهام واحدة تلو الأخرى، مما يسمح بتدفق عمل خطي.
- **العملية الهرمية**: ينسق وكيل مدير الطاقم، ويفوّض المهام ويتحقق من النتائج.
### تشغيل الطاقم
بمجرد تجميع طاقمك، ابدأ سير العمل بطريقة `kickoff()`.
```python Code
result = my_crew.kickoff()
print(result)
```
### طرق مختلفة لتشغيل الطاقم
#### الطرق المتزامنة
- `kickoff()`: يبدأ عملية التنفيذ وفقًا لتدفق العملية المحدد.
- `kickoff_for_each()`: ينفذ المهام بالتتابع لكل مدخل.
#### الطرق غير المتزامنة
| الطريقة | النوع | الوصف |
|--------|------|-------------|
| `akickoff()` | غير متزامن أصلي | async/await أصلي عبر سلسلة التنفيذ بأكملها |
| `akickoff_for_each()` | غير متزامن أصلي | تنفيذ غير متزامن أصلي لكل مدخل في قائمة |
| `kickoff_async()` | مبني على الخيوط | يغلّف التنفيذ المتزامن في `asyncio.to_thread` |
| `kickoff_for_each_async()` | مبني على الخيوط | غير متزامن مبني على الخيوط لكل مدخل في قائمة |
<Note>
لأحمال العمل عالية التزامن، يُوصى بـ `akickoff()` و `akickoff_for_each()` لأنها تستخدم async أصلي.
</Note>
### بث تنفيذ الطاقم
للرؤية في الوقت الفعلي لتنفيذ الطاقم، يمكنك تفعيل البث:
```python Code
crew = Crew(
agents=[researcher],
tasks=[task],
stream=True
)
streaming = crew.kickoff(inputs={"topic": "AI"})
for chunk in streaming:
print(chunk.content, end="", flush=True)
result = streaming.result
```
### الإعادة من مهمة محددة
يمكنك الآن الإعادة من مهمة محددة باستخدام أمر CLI `replay`.
```shell
crewai log-tasks-outputs
```
ثم للإعادة من مهمة محددة:
```shell
crewai replay -t <task_id>
```

View File

@@ -0,0 +1,236 @@
---
title: "مستمعو الأحداث"
description: "الاستفادة من أحداث CrewAI لبناء تكاملات مخصصة ومراقبة"
icon: spinner
mode: "wide"
---
## نظرة عامة
يوفر CrewAI نظام أحداث قوي يتيح لك الاستماع والتفاعل مع الأحداث المختلفة التي تحدث أثناء تنفيذ طاقمك. تُمكّنك هذه الميزة من بناء تكاملات مخصصة وحلول مراقبة وأنظمة تسجيل أو أي وظائف أخرى تحتاج للتشغيل بناءً على أحداث CrewAI الداخلية.
## كيف يعمل
يستخدم CrewAI بنية ناقل أحداث لإرسال الأحداث طوال دورة حياة التنفيذ. يُبنى نظام الأحداث على المكونات التالية:
1. **CrewAIEventsBus**: ناقل أحداث فريد يدير تسجيل الأحداث وإرسالها
2. **BaseEvent**: الفئة الأساسية لجميع الأحداث في النظام
3. **BaseEventListener**: فئة أساسية مجردة لإنشاء مستمعي أحداث مخصصين
عندما تحدث إجراءات محددة في CrewAI (مثل بدء تنفيذ طاقم، أو إكمال وكيل لمهمة، أو استخدام أداة)، يرسل النظام أحداثًا مقابلة. يمكنك تسجيل معالجات لهذه الأحداث لتنفيذ كود مخصص عند حدوثها.
<Note type="info" title="تحسين المؤسسات: تتبع الأوامر">
يوفر CrewAI AMP ميزة تتبع أوامر مدمجة تستفيد من نظام الأحداث لتتبع وتخزين وتصور جميع الأوامر والاستكمالات والبيانات الوصفية المرتبطة.
![Prompt Tracing Dashboard](/images/enterprise/traces-overview.png)
مع تتبع الأوامر يمكنك:
- عرض السجل الكامل لجميع الأوامر المرسلة إلى LLM
- تتبع استخدام الرموز والتكاليف
- تصحيح إخفاقات استدلال الوكيل
- مشاركة تسلسلات الأوامر مع فريقك
- مقارنة استراتيجيات الأوامر المختلفة
- تصدير التتبعات للامتثال والتدقيق
</Note>
## إنشاء مستمع أحداث مخصص
لإنشاء مستمع أحداث مخصص، تحتاج إلى:
1. إنشاء فئة ترث من `BaseEventListener`
2. تنفيذ طريقة `setup_listeners`
3. تسجيل معالجات للأحداث التي تهمك
4. إنشاء مثيل من مستمعك في الملف المناسب
إليك مثالًا بسيطًا:
```python
from crewai.events import (
CrewKickoffStartedEvent,
CrewKickoffCompletedEvent,
AgentExecutionCompletedEvent,
)
from crewai.events import BaseEventListener
class MyCustomListener(BaseEventListener):
def __init__(self):
super().__init__()
def setup_listeners(self, crewai_event_bus):
@crewai_event_bus.on(CrewKickoffStartedEvent)
def on_crew_started(source, event):
print(f"Crew '{event.crew_name}' has started execution!")
@crewai_event_bus.on(CrewKickoffCompletedEvent)
def on_crew_completed(source, event):
print(f"Crew '{event.crew_name}' has completed execution!")
print(f"Output: {event.output}")
@crewai_event_bus.on(AgentExecutionCompletedEvent)
def on_agent_execution_completed(source, event):
print(f"Agent '{event.agent.role}' completed task")
print(f"Output: {event.output}")
```
## تسجيل المستمع بشكل صحيح
مجرد تعريف فئة المستمع ليس كافيًا. تحتاج لإنشاء مثيل منه والتأكد من استيراده في تطبيقك.
```python
# في ملف crew.py
from crewai import Agent, Crew, Task
from my_listeners import MyCustomListener
# إنشاء مثيل من المستمع
my_listener = MyCustomListener()
class MyCustomCrew:
def crew(self):
return Crew(
agents=[...],
tasks=[...],
)
```
## أنواع الأحداث المتاحة
يوفر CrewAI مجموعة واسعة من الأحداث يمكنك الاستماع إليها:
### أحداث الطاقم
- **CrewKickoffStartedEvent**: يُرسل عند بدء تنفيذ الطاقم
- **CrewKickoffCompletedEvent**: يُرسل عند اكتمال تنفيذ الطاقم
- **CrewKickoffFailedEvent**: يُرسل عند فشل تنفيذ الطاقم
- **CrewTestStartedEvent**: يُرسل عند بدء اختبار الطاقم
- **CrewTestCompletedEvent**: يُرسل عند اكتمال اختبار الطاقم
- **CrewTestFailedEvent**: يُرسل عند فشل اختبار الطاقم
- **CrewTrainStartedEvent**: يُرسل عند بدء تدريب الطاقم
- **CrewTrainCompletedEvent**: يُرسل عند اكتمال تدريب الطاقم
- **CrewTrainFailedEvent**: يُرسل عند فشل تدريب الطاقم
### أحداث الوكيل
- **AgentExecutionStartedEvent**: يُرسل عند بدء تنفيذ وكيل لمهمة
- **AgentExecutionCompletedEvent**: يُرسل عند اكتمال تنفيذ وكيل لمهمة
- **AgentExecutionErrorEvent**: يُرسل عند مواجهة وكيل لخطأ أثناء التنفيذ
- **LiteAgentExecutionStartedEvent**: يُرسل عند بدء تنفيذ LiteAgent
- **LiteAgentExecutionCompletedEvent**: يُرسل عند اكتمال تنفيذ LiteAgent
### أحداث المهام
- **TaskStartedEvent**: يُرسل عند بدء تنفيذ مهمة
- **TaskCompletedEvent**: يُرسل عند اكتمال تنفيذ مهمة
- **TaskFailedEvent**: يُرسل عند فشل تنفيذ مهمة
### أحداث استخدام الأدوات
- **ToolUsageStartedEvent**: يُرسل عند بدء تنفيذ أداة
- **ToolUsageFinishedEvent**: يُرسل عند اكتمال تنفيذ أداة
- **ToolUsageErrorEvent**: يُرسل عند مواجهة خطأ في تنفيذ أداة
### أحداث MCP
- **MCPConnectionStartedEvent**: يُرسل عند بدء الاتصال بخادم MCP
- **MCPConnectionCompletedEvent**: يُرسل عند اكتمال الاتصال بخادم MCP
- **MCPConnectionFailedEvent**: يُرسل عند فشل الاتصال بخادم MCP
- **MCPToolExecutionStartedEvent**: يُرسل عند بدء تنفيذ أداة MCP
- **MCPToolExecutionCompletedEvent**: يُرسل عند اكتمال تنفيذ أداة MCP
- **MCPToolExecutionFailedEvent**: يُرسل عند فشل تنفيذ أداة MCP
### أحداث المعرفة
- **KnowledgeRetrievalStartedEvent**: يُرسل عند بدء استرجاع المعرفة
- **KnowledgeRetrievalCompletedEvent**: يُرسل عند اكتمال استرجاع المعرفة
- **KnowledgeQueryStartedEvent**: يُرسل عند بدء استعلام المعرفة
- **KnowledgeQueryCompletedEvent**: يُرسل عند اكتمال استعلام المعرفة
- **KnowledgeQueryFailedEvent**: يُرسل عند فشل استعلام المعرفة
### أحداث حواجز LLM
- **LLMGuardrailStartedEvent**: يُرسل عند بدء التحقق من الحاجز
- **LLMGuardrailCompletedEvent**: يُرسل عند اكتمال التحقق من الحاجز
- **LLMGuardrailFailedEvent**: يُرسل عند فشل التحقق من الحاجز
### أحداث التدفق
- **FlowCreatedEvent**: يُرسل عند إنشاء تدفق
- **FlowStartedEvent**: يُرسل عند بدء تنفيذ تدفق
- **FlowFinishedEvent**: يُرسل عند اكتمال تنفيذ تدفق
- **FlowPausedEvent**: يُرسل عند إيقاف تدفق مؤقتًا بانتظار ملاحظات بشرية
### أحداث LLM
- **LLMCallStartedEvent**: يُرسل عند بدء استدعاء LLM
- **LLMCallCompletedEvent**: يُرسل عند اكتمال استدعاء LLM
- **LLMCallFailedEvent**: يُرسل عند فشل استدعاء LLM
- **LLMStreamChunkEvent**: يُرسل لكل جزء مستلم أثناء بث استجابات LLM
### أحداث الذاكرة
- **MemoryQueryStartedEvent**: يُرسل عند بدء استعلام الذاكرة
- **MemoryQueryCompletedEvent**: يُرسل عند اكتمال استعلام الذاكرة
- **MemorySaveStartedEvent**: يُرسل عند بدء حفظ الذاكرة
- **MemorySaveCompletedEvent**: يُرسل عند اكتمال حفظ الذاكرة
### أحداث الاستدلال
- **AgentReasoningStartedEvent**: يُرسل عند بدء وكيل الاستدلال حول مهمة
- **AgentReasoningCompletedEvent**: يُرسل عند انتهاء عملية الاستدلال
- **AgentReasoningFailedEvent**: يُرسل عند فشل عملية الاستدلال
### أحداث A2A (وكيل إلى وكيل)
- **A2ADelegationStartedEvent**: يُرسل عند بدء تفويض A2A
- **A2ADelegationCompletedEvent**: يُرسل عند اكتمال تفويض A2A
- **A2AConversationStartedEvent**: يُرسل عند بدء محادثة A2A متعددة الأدوار
- **A2AConversationCompletedEvent**: يُرسل عند انتهاء محادثة A2A
## هيكل معالج الأحداث
يستقبل كل معالج حدث معاملين:
1. **source**: الكائن الذي أرسل الحدث
2. **event**: مثيل الحدث، يحتوي على بيانات خاصة بالحدث
هيكل كائن الحدث يعتمد على نوع الحدث، لكن جميع الأحداث ترث من `BaseEvent` وتتضمن:
- **timestamp**: الوقت الذي أُرسل فيه الحدث
- **type**: معرّف نصي لنوع الحدث
## الاستخدام المتقدم: المعالجات المحددة النطاق
لمعالجة الأحداث المؤقتة، يمكنك استخدام مدير سياق `scoped_handlers`:
```python
from crewai.events import crewai_event_bus, CrewKickoffStartedEvent
with crewai_event_bus.scoped_handlers():
@crewai_event_bus.on(CrewKickoffStartedEvent)
def temp_handler(source, event):
print("This handler only exists within this context")
# قم بشيء يرسل أحداثًا
# خارج السياق، يتم إزالة المعالج المؤقت
```
## حالات الاستخدام
يمكن استخدام مستمعي الأحداث لأغراض متنوعة:
1. **التسجيل والمراقبة**: تتبع تنفيذ طاقمك وتسجيل الأحداث المهمة
2. **التحليلات**: جمع بيانات عن أداء وسلوك طاقمك
3. **التصحيح**: إعداد مستمعين مؤقتين لتصحيح مشاكل محددة
4. **التكامل**: ربط CrewAI بأنظمة خارجية مثل منصات المراقبة وقواعد البيانات أو خدمات الإشعارات
5. **السلوك المخصص**: تشغيل إجراءات مخصصة بناءً على أحداث محددة
## أفضل الممارسات
1. **اجعل المعالجات خفيفة**: يجب أن تكون معالجات الأحداث خفيفة وتتجنب العمليات الحاجبة
2. **معالجة الأخطاء**: أدرج معالجة أخطاء مناسبة في معالجات الأحداث لمنع الاستثناءات من التأثير على التنفيذ الرئيسي
3. **التنظيف**: إذا خصص مستمعك موارد، تأكد من تنظيفها بشكل صحيح
4. **الاستماع الانتقائي**: استمع فقط للأحداث التي تحتاج فعلاً لمعالجتها
5. **الاختبار**: اختبر مستمعي الأحداث بمعزل لضمان سلوكهم كما هو متوقع
بالاستفادة من نظام أحداث CrewAI، يمكنك توسيع وظائفه ودمجه بسلاسة مع بنيتك التحتية الحالية.

View File

@@ -0,0 +1,267 @@
---
title: الملفات
description: تمرير الصور وملفات PDF والصوت والفيديو والنصوص إلى وكلائك للمعالجة متعددة الوسائط.
icon: file-image
---
## نظرة عامة
يدعم CrewAI مدخلات الملفات متعددة الوسائط الأصلية، مما يتيح لك تمرير الصور وملفات PDF والصوت والفيديو والنصوص مباشرة إلى وكلائك. يتم تنسيق الملفات تلقائيًا وفقًا لمتطلبات API لكل مزود LLM.
<Note type="info" title="اعتمادية اختيارية">
يتطلب دعم الملفات حزمة `crewai-files` الاختيارية. ثبّتها بـ:
```bash
uv add 'crewai[file-processing]'
```
</Note>
<Note type="warning" title="وصول مبكر">
واجهة معالجة الملفات حاليًا في مرحلة الوصول المبكر.
</Note>
## أنواع الملفات
يدعم CrewAI خمسة أنواع ملفات محددة بالإضافة إلى فئة `File` العامة التي تكتشف النوع تلقائيًا:
| النوع | الفئة | حالات الاستخدام |
|:-----|:------|:----------|
| **صورة** | `ImageFile` | صور، لقطات شاشة، مخططات، رسوم بيانية |
| **PDF** | `PDFFile` | مستندات، تقارير، أوراق بحثية |
| **صوت** | `AudioFile` | تسجيلات صوتية، بودكاست، اجتماعات |
| **فيديو** | `VideoFile` | تسجيلات شاشة، عروض تقديمية |
| **نص** | `TextFile` | ملفات كود، سجلات، ملفات بيانات |
| **عام** | `File` | اكتشاف تلقائي للنوع من المحتوى |
```python
from crewai_files import File, ImageFile, PDFFile, AudioFile, VideoFile, TextFile
image = ImageFile(source="screenshot.png")
pdf = PDFFile(source="report.pdf")
audio = AudioFile(source="meeting.mp3")
video = VideoFile(source="demo.mp4")
text = TextFile(source="data.csv")
file = File(source="document.pdf")
```
## مصادر الملفات
يقبل معامل `source` أنواع إدخال متعددة ويكتشف تلقائيًا المعالج المناسب:
### من مسار
```python
from crewai_files import ImageFile
image = ImageFile(source="./images/chart.png")
```
### من عنوان URL
```python
from crewai_files import ImageFile
image = ImageFile(source="https://example.com/image.png")
```
### من بايتات
```python
from crewai_files import ImageFile, FileBytes
image_bytes = download_image_from_api()
image = ImageFile(source=FileBytes(data=image_bytes, filename="downloaded.png"))
image = ImageFile(source=image_bytes)
```
## استخدام الملفات
يمكن تمرير الملفات على مستويات متعددة، حيث تأخذ المستويات الأكثر تحديدًا الأولوية.
### مع الأطقم
مرر الملفات عند تشغيل طاقم:
```python
from crewai import Crew
from crewai_files import ImageFile
crew = Crew(agents=[analyst], tasks=[analysis_task])
result = crew.kickoff(
inputs={"topic": "Q4 Sales"},
input_files={
"chart": ImageFile(source="sales_chart.png"),
"report": PDFFile(source="quarterly_report.pdf"),
}
)
```
### مع المهام
أرفق الملفات بمهام محددة:
```python
from crewai import Task
from crewai_files import ImageFile
task = Task(
description="Analyze the sales chart and identify trends in {chart}",
expected_output="A summary of key trends",
input_files={
"chart": ImageFile(source="sales_chart.png"),
}
)
```
### مع التدفقات
مرر الملفات إلى التدفقات، والتي تنتقل تلقائيًا إلى الأطقم:
```python
from crewai.flow.flow import Flow, start
from crewai_files import ImageFile
class AnalysisFlow(Flow):
@start()
def analyze(self):
return self.analysis_crew.kickoff()
flow = AnalysisFlow()
result = flow.kickoff(
input_files={"image": ImageFile(source="data.png")}
)
```
### مع الوكلاء المستقلين
مرر الملفات مباشرة إلى تشغيل الوكيل:
```python
from crewai import Agent
from crewai_files import ImageFile
agent = Agent(
role="Image Analyst",
goal="Analyze images",
backstory="Expert at visual analysis",
llm="gpt-4o",
)
result = agent.kickoff(
messages="What's in this image?",
input_files={"photo": ImageFile(source="photo.jpg")},
)
```
## أولوية الملفات
عند تمرير الملفات على مستويات متعددة، تتجاوز المستويات الأكثر تحديدًا المستويات الأوسع:
```
Flow input_files < Crew input_files < Task input_files
```
على سبيل المثال، إذا عرّف كل من التدفق والمهمة ملفًا باسم `"chart"`، تُستخدم نسخة المهمة.
## دعم المزودين
تدعم المزودات المختلفة أنواع ملفات مختلفة. يقوم CrewAI تلقائيًا بتنسيق الملفات وفقًا لواجهة كل مزود.
| المزود | صورة | PDF | صوت | فيديو | نص |
|:---------|:-----:|:---:|:-----:|:-----:|:----:|
| **OpenAI** (completions API) | ✓ | | | | |
| **OpenAI** (responses API) | ✓ | ✓ | ✓ | | |
| **Anthropic** (claude-3.x) | ✓ | ✓ | | | |
| **Google Gemini** (gemini-1.5, 2.0, 2.5) | ✓ | ✓ | ✓ | ✓ | ✓ |
| **AWS Bedrock** (claude-3) | ✓ | ✓ | | | |
| **Azure OpenAI** (gpt-4o) | ✓ | | ✓ | | |
<Note type="info" title="Gemini لأقصى دعم للملفات">
تدعم نماذج Google Gemini جميع أنواع الملفات بما في ذلك الفيديو (حتى ساعة واحدة، 2 جيجابايت). استخدم Gemini عندما تحتاج لمعالجة محتوى الفيديو.
</Note>
<Note type="warning" title="أنواع الملفات غير المدعومة">
إذا مررت نوع ملف لا يدعمه المزود (مثل الفيديو إلى OpenAI)، ستتلقى خطأ `UnsupportedFileTypeError`. اختر مزودك بناءً على أنواع الملفات التي تحتاج لمعالجتها.
</Note>
## كيف تُرسل الملفات
يختار CrewAI تلقائيًا الطريقة المثلى لإرسال الملفات إلى كل مزود:
| الطريقة | الوصف | متى تُستخدم |
|:-------|:------------|:----------|
| **Inline Base64** | الملف مضمّن مباشرة في الطلب | ملفات صغيرة (< 5 ميجابايت عادة) |
| **File Upload API** | الملف يُرفع بشكل منفصل، يُشار إليه بمعرّف | ملفات كبيرة تتجاوز العتبة |
| **URL Reference** | عنوان URL مباشر يُمرر إلى النموذج | مصدر الملف هو عنوان URL بالفعل |
### طرق الإرسال حسب المزود
| المزود | Inline Base64 | File Upload API | URL References |
|:---------|:-------------:|:---------------:|:--------------:|
| **OpenAI** | ✓ | ✓ (> 5 MB) | ✓ |
| **Anthropic** | ✓ | ✓ (> 5 MB) | ✓ |
| **Google Gemini** | ✓ | ✓ (> 20 MB) | ✓ |
| **AWS Bedrock** | ✓ | | ✓ (S3 URIs) |
| **Azure OpenAI** | ✓ | | ✓ |
<Note type="info" title="تحسين تلقائي">
لا تحتاج لإدارة هذا بنفسك. يستخدم CrewAI تلقائيًا الطريقة الأكثر كفاءة بناءً على حجم الملف وقدرات المزود. المزودات بدون واجهات رفع الملفات تستخدم inline base64 لجميع الملفات.
</Note>
## أوضاع معالجة الملفات
تحكم في كيفية معالجة الملفات عندما تتجاوز حدود المزود:
```python
from crewai_files import ImageFile, PDFFile
image = ImageFile(source="large.png", mode="strict")
image = ImageFile(source="large.png", mode="auto")
image = ImageFile(source="large.png", mode="warn")
pdf = PDFFile(source="large.pdf", mode="chunk")
```
## قيود المزودين
لكل مزود حدود محددة لأحجام الملفات والأبعاد:
### OpenAI
- **الصور**: حد أقصى 20 ميجابايت، حتى 10 صور لكل طلب
- **PDF**: حد أقصى 32 ميجابايت، حتى 100 صفحة
- **الصوت**: حد أقصى 25 ميجابايت، حتى 25 دقيقة
### Anthropic
- **الصور**: حد أقصى 5 ميجابايت، أقصى 8000x8000 بكسل، حتى 100 صورة
- **PDF**: حد أقصى 32 ميجابايت، حتى 100 صفحة
### Google Gemini
- **الصور**: حد أقصى 100 ميجابايت
- **PDF**: حد أقصى 50 ميجابايت
- **الصوت**: حد أقصى 100 ميجابايت، حتى 9.5 ساعة
- **الفيديو**: حد أقصى 2 جيجابايت، حتى ساعة واحدة
### AWS Bedrock
- **الصور**: حد أقصى 4.5 ميجابايت، أقصى 8000x8000 بكسل
- **PDF**: حد أقصى 3.75 ميجابايت، حتى 100 صفحة
## الإشارة إلى الملفات في الأوامر
استخدم اسم مفتاح الملف في أوصاف المهام للإشارة إلى الملفات:
```python
task = Task(
description="""
Analyze the provided materials:
1. Review the chart in {sales_chart}
2. Cross-reference with data in {quarterly_report}
3. Summarize key findings
""",
expected_output="Analysis summary with key insights",
input_files={
"sales_chart": ImageFile(source="chart.png"),
"quarterly_report": PDFFile(source="report.pdf"),
}
)
```

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,878 @@
---
title: الذاكرة
description: الاستفادة من نظام الذاكرة الموحد في CrewAI لتعزيز قدرات الوكلاء.
icon: database
mode: "wide"
---
## نظرة عامة
يوفر CrewAI **نظام ذاكرة موحد** -- فئة `Memory` واحدة تستبدل أنواع الذاكرة المنفصلة (قصيرة المدى، طويلة المدى، ذاكرة الكيانات، والخارجية) بواجهة برمجة تطبيقات ذكية واحدة. تستخدم الذاكرة LLM لتحليل المحتوى عند الحفظ (استنتاج النطاق والفئات والأهمية) وتدعم الاسترجاع متعدد العمق مع تسجيل مركب يمزج بين التشابه الدلالي والحداثة والأهمية.
يمكنك استخدام الذاكرة بأربع طرق: **مستقلة** (سكربتات، دفاتر ملاحظات)، **مع فرق Crew**، **مع Agents**، أو **داخل التدفقات**.
## البدء السريع
```python
from crewai import Memory
memory = Memory()
# Store -- the LLM infers scope, categories, and importance
memory.remember("We decided to use PostgreSQL for the user database.")
# Retrieve -- results ranked by composite score (semantic + recency + importance)
matches = memory.recall("What database did we choose?")
for m in matches:
print(f"[{m.score:.2f}] {m.record.content}")
# Tune scoring for a fast-moving project
memory = Memory(recency_weight=0.5, recency_half_life_days=7)
# Forget
memory.forget(scope="/project/old")
# Explore the self-organized scope tree
print(memory.tree())
print(memory.info("/"))
```
## أربع طرق لاستخدام الذاكرة
### مستقلة
استخدم الذاكرة في السكربتات ودفاتر الملاحظات وأدوات سطر الأوامر أو كقاعدة معرفة مستقلة -- لا حاجة لوكلاء أو فرق Crew.
```python
from crewai import Memory
memory = Memory()
# Build up knowledge
memory.remember("The API rate limit is 1000 requests per minute.")
memory.remember("Our staging environment uses port 8080.")
memory.remember("The team agreed to use feature flags for all new releases.")
# Later, recall what you need
matches = memory.recall("What are our API limits?", limit=5)
for m in matches:
print(f"[{m.score:.2f}] {m.record.content}")
# Extract atomic facts from a longer text
raw = """Meeting notes: We decided to migrate from MySQL to PostgreSQL
next quarter. The budget is $50k. Sarah will lead the migration."""
facts = memory.extract_memories(raw)
# ["Migration from MySQL to PostgreSQL planned for next quarter",
# "Database migration budget is $50k",
# "Sarah will lead the database migration"]
for fact in facts:
memory.remember(fact)
```
### مع فرق Crew
مرّر `memory=True` للإعدادات الافتراضية، أو مرّر مثيل `Memory` مُعدّ للسلوك المخصص.
```python
from crewai import Crew, Agent, Task, Process, Memory
# Option 1: Default memory
crew = Crew(
agents=[researcher, writer],
tasks=[research_task, writing_task],
process=Process.sequential,
memory=True,
verbose=True,
)
# Option 2: Custom memory with tuned scoring
memory = Memory(
recency_weight=0.4,
semantic_weight=0.4,
importance_weight=0.2,
recency_half_life_days=14,
)
crew = Crew(
agents=[researcher, writer],
tasks=[research_task, writing_task],
memory=memory,
)
```
عند استخدام `memory=True`، ينشئ الفريق مثيل `Memory()` افتراضيًا ويمرر إعداد `embedder` الخاص بالفريق تلقائيًا. يشترك جميع الوكلاء في الفريق في ذاكرة الفريق ما لم يكن لدى الوكيل ذاكرته الخاصة.
بعد كل مهمة، يستخرج الفريق تلقائيًا حقائق منفصلة من مخرجات المهمة ويخزّنها. قبل كل مهمة، يسترجع الوكيل السياق ذا الصلة من الذاكرة ويحقنه في موجّه المهمة.
### مع Agents
يمكن للوكلاء استخدام ذاكرة الفريق المشتركة (افتراضيًا) أو تلقي عرض محدد النطاق للسياق الخاص.
```python
from crewai import Agent, Memory
memory = Memory()
# Researcher gets a private scope -- only sees /agent/researcher
researcher = Agent(
role="Researcher",
goal="Find and analyze information",
backstory="Expert researcher with attention to detail",
memory=memory.scope("/agent/researcher"),
)
# Writer uses crew shared memory (no agent-level memory set)
writer = Agent(
role="Writer",
goal="Produce clear, well-structured content",
backstory="Experienced technical writer",
# memory not set -- uses crew._memory when crew has memory enabled
)
```
يمنح هذا النمط الباحث نتائج خاصة بينما يقرأ الكاتب من ذاكرة الفريق المشتركة.
### مع التدفقات
كل تدفق يحتوي على ذاكرة مدمجة. استخدم `self.remember()` و `self.recall()` و `self.extract_memories()` داخل أي دالة تدفق.
```python
from crewai.flow.flow import Flow, listen, start
class ResearchFlow(Flow):
@start()
def gather_data(self):
findings = "PostgreSQL handles 10k concurrent connections. MySQL caps at 5k."
self.remember(findings, scope="/research/databases")
return findings
@listen(gather_data)
def write_report(self, findings):
# Recall past research to provide context
past = self.recall("database performance benchmarks")
context = "\n".join(f"- {m.record.content}" for m in past)
return f"Report:\nNew findings: {findings}\nPrevious context:\n{context}"
```
انظر [وثائق التدفقات](/concepts/flows) لمزيد من المعلومات حول الذاكرة في التدفقات.
## النطاقات الهرمية
### ما هي النطاقات
يتم تنظيم الذكريات في شجرة هرمية من النطاقات، مشابهة لنظام الملفات. كل نطاق هو مسار مثل `/` أو `/project/alpha` أو `/agent/researcher/findings`.
```
/
/company
/company/engineering
/company/product
/project
/project/alpha
/project/beta
/agent
/agent/researcher
/agent/writer
```
توفر النطاقات **ذاكرة تعتمد على السياق** -- عند الاسترجاع ضمن نطاق، تبحث فقط في ذلك الفرع من الشجرة، مما يحسّن كلًا من الدقة والأداء.
### كيف يعمل استنتاج النطاق
عند استدعاء `remember()` دون تحديد نطاق، يحلل LLM المحتوى وشجرة النطاقات الحالية، ثم يقترح أفضل موضع. إذا لم يكن هناك نطاق حالي مناسب، ينشئ واحدًا جديدًا. بمرور الوقت، تنمو شجرة النطاقات عضويًا من المحتوى نفسه -- لا تحتاج إلى تصميم مخطط مسبقًا.
```python
memory = Memory()
# LLM infers scope from content
memory.remember("We chose PostgreSQL for the user database.")
# -> might be placed under /project/decisions or /engineering/database
# You can also specify scope explicitly
memory.remember("Sprint velocity is 42 points", scope="/team/metrics")
```
### تصوير شجرة النطاقات
```python
print(memory.tree())
# / (15 records)
# /project (8 records)
# /project/alpha (5 records)
# /project/beta (3 records)
# /agent (7 records)
# /agent/researcher (4 records)
# /agent/writer (3 records)
print(memory.info("/project/alpha"))
# ScopeInfo(path='/project/alpha', record_count=5,
# categories=['architecture', 'database'],
# oldest_record=datetime(...), newest_record=datetime(...),
# child_scopes=[])
```
### MemoryScope: عروض الأشجار الفرعية
يقيّد `MemoryScope` جميع العمليات على فرع من الشجرة. يمكن للوكيل أو الكود الذي يستخدمه الرؤية والكتابة فقط ضمن تلك الشجرة الفرعية.
```python
memory = Memory()
# Create a scope for a specific agent
agent_memory = memory.scope("/agent/researcher")
# Everything is relative to /agent/researcher
agent_memory.remember("Found three relevant papers on LLM memory.")
# -> stored under /agent/researcher
agent_memory.recall("relevant papers")
# -> searches only under /agent/researcher
# Narrow further with subscope
project_memory = agent_memory.subscope("project-alpha")
# -> /agent/researcher/project-alpha
```
### أفضل الممارسات لتصميم النطاقات
- **ابدأ بشكل مسطح، ودع LLM ينظّم.** لا تبالغ في هندسة تسلسل النطاقات مسبقًا. ابدأ بـ `memory.remember(content)` ودع استنتاج النطاق في LLM ينشئ الهيكل مع تراكم المحتوى.
- **استخدم أنماط `/{entity_type}/{identifier}`.** تنشأ التسلسلات الطبيعية من أنماط مثل `/project/alpha` و `/agent/researcher` و `/company/engineering` و `/customer/acme-corp`.
- **حدد النطاق حسب الاهتمام، وليس حسب نوع البيانات.** استخدم `/project/alpha/decisions` بدلاً من `/decisions/project/alpha`. هذا يبقي المحتوى ذا الصلة معًا.
- **حافظ على العمق ضحلًا (2-3 مستويات).** النطاقات المتداخلة بعمق تصبح متفرقة جدًا. `/project/alpha/architecture` جيد؛ `/project/alpha/architecture/decisions/databases/postgresql` عميق جدًا.
- **استخدم النطاقات الصريحة عندما تعرف، ودع LLM يستنتج عندما لا تعرف.** إذا كنت تخزّن قرار مشروع معروف، مرّر `scope="/project/alpha/decisions"`. إذا كنت تخزّن مخرجات وكيل حرة الشكل، اترك النطاق ودع LLM يحدده.
### أمثلة حالات الاستخدام
**فريق متعدد المشاريع:**
```python
memory = Memory()
# Each project gets its own branch
memory.remember("Using microservices architecture", scope="/project/alpha/architecture")
memory.remember("GraphQL API for client apps", scope="/project/beta/api")
# Recall across all projects
memory.recall("API design decisions")
# Or within a specific project
memory.recall("API design", scope="/project/beta")
```
**سياق خاص لكل وكيل مع معرفة مشتركة:**
```python
memory = Memory()
# Researcher has private findings
researcher_memory = memory.scope("/agent/researcher")
# Writer can read from both its own scope and shared company knowledge
writer_view = memory.slice(
scopes=["/agent/writer", "/company/knowledge"],
read_only=True,
)
```
**دعم العملاء (سياق لكل عميل):**
```python
memory = Memory()
# Each customer gets isolated context
memory.remember("Prefers email communication", scope="/customer/acme-corp")
memory.remember("On enterprise plan, 50 seats", scope="/customer/acme-corp")
# Shared product docs are accessible to all agents
memory.remember("Rate limit is 1000 req/min on enterprise plan", scope="/product/docs")
```
## شرائح الذاكرة
### ما هي الشرائح
`MemorySlice` هو عرض عبر نطاقات متعددة، ربما متباعدة. على عكس النطاق (الذي يقيّد على شجرة فرعية واحدة)، تتيح لك الشريحة الاسترجاع من عدة فروع في وقت واحد.
### متى تستخدم الشرائح مقابل النطاقات
- **النطاق**: استخدمه عندما يجب تقييد وكيل أو كتلة كود على شجرة فرعية واحدة. مثال: وكيل يرى فقط `/agent/researcher`.
- **الشريحة**: استخدمها عندما تحتاج إلى دمج السياق من عدة فروع. مثال: وكيل يقرأ من نطاقه الخاص بالإضافة إلى معرفة الشركة المشتركة.
### شرائح القراءة فقط
النمط الأكثر شيوعًا: منح وكيل إمكانية القراءة من فروع متعددة دون السماح له بالكتابة في المناطق المشتركة.
```python
memory = Memory()
# Agent can recall from its own scope AND company knowledge,
# but cannot write to company knowledge
agent_view = memory.slice(
scopes=["/agent/researcher", "/company/knowledge"],
read_only=True,
)
matches = agent_view.recall("company security policies", limit=5)
# Searches both /agent/researcher and /company/knowledge, merges and ranks results
agent_view.remember("new finding") # Raises PermissionError (read-only)
```
### شرائح القراءة والكتابة
عند تعطيل القراءة فقط، يمكنك الكتابة في أي من النطاقات المضمّنة، لكن يجب تحديد النطاق صراحة.
```python
view = memory.slice(scopes=["/team/alpha", "/team/beta"], read_only=False)
# Must specify scope when writing
view.remember("Cross-team decision", scope="/team/alpha", categories=["decisions"])
```
## التسجيل المركب
يتم ترتيب نتائج الاسترجاع بواسطة مزيج مرجّح من ثلاث إشارات:
```
composite = semantic_weight * similarity + recency_weight * decay + importance_weight * importance
```
حيث:
- **similarity** = `1 / (1 + distance)` من فهرس المتجهات (0 إلى 1)
- **decay** = `0.5^(age_days / half_life_days)` -- اضمحلال أُسي (1.0 لليوم، 0.5 عند نصف العمر)
- **importance** = درجة أهمية السجل (0 إلى 1)، يتم تعيينها وقت الترميز
قم بإعدادها مباشرة على منشئ `Memory`:
```python
# Sprint retrospective: favor recent memories, short half-life
memory = Memory(
recency_weight=0.5,
semantic_weight=0.3,
importance_weight=0.2,
recency_half_life_days=7,
)
# Architecture knowledge base: favor important memories, long half-life
memory = Memory(
recency_weight=0.1,
semantic_weight=0.5,
importance_weight=0.4,
recency_half_life_days=180,
)
```
يتضمن كل `MemoryMatch` قائمة `match_reasons` حتى تتمكن من رؤية سبب ترتيب نتيجة معينة في موضعها (مثل `["semantic", "recency", "importance"]`).
## طبقة تحليل LLM
تستخدم الذاكرة LLM بثلاث طرق:
1. **عند الحفظ** -- عندما تحذف النطاق أو الفئات أو الأهمية، يحلل LLM المحتوى ويقترح النطاق والفئات والأهمية والبيانات الوصفية (الكيانات والتواريخ والموضوعات).
2. **عند الاسترجاع** -- للاسترجاع العميق/التلقائي، يحلل LLM الاستعلام (الكلمات المفتاحية، تلميحات الوقت، النطاقات المقترحة، التعقيد) لتوجيه الاسترجاع.
3. **استخراج الذكريات** -- `extract_memories(content)` يقسم النص الخام (مثل مخرجات المهمة) إلى عبارات ذاكرة منفصلة. يستخدم الوكلاء هذا قبل استدعاء `remember()` على كل عبارة حتى يتم تخزين حقائق ذرية بدلاً من كتلة كبيرة واحدة.
جميع التحليلات تتدهور بسلاسة عند فشل LLM -- انظر [سلوك الفشل](#سلوك-الفشل).
## توحيد الذاكرة
عند حفظ محتوى جديد، يتحقق خط أنابيب الترميز تلقائيًا من وجود سجلات مماثلة في التخزين. إذا كان التشابه أعلى من `consolidation_threshold` (الافتراضي 0.85)، يقرر LLM ما يجب فعله:
- **keep** -- السجل الحالي لا يزال دقيقًا وغير مكرر.
- **update** -- يجب تحديث السجل الحالي بمعلومات جديدة (يوفر LLM المحتوى المدمج).
- **delete** -- السجل الحالي قديم أو تم استبداله أو تناقضه.
- **insert_new** -- ما إذا كان يجب إدراج المحتوى الجديد أيضًا كسجل منفصل.
هذا يمنع تراكم النسخ المكررة. على سبيل المثال، إذا حفظت "CrewAI ensures reliable operation" ثلاث مرات، يتعرف التوحيد على النسخ المكررة ويحتفظ بسجل واحد فقط.
### إزالة التكرار داخل الدفعة
عند استخدام `remember_many()`، تتم مقارنة العناصر داخل نفس الدفعة مع بعضها البعض قبل الوصول إلى التخزين. إذا كان تشابه جيب التمام >= `batch_dedup_threshold` (الافتراضي 0.98)، يتم إسقاط العنصر الأحدث بصمت. هذا يلتقط النسخ المكررة الدقيقة أو شبه الدقيقة داخل دفعة واحدة دون أي استدعاءات LLM (رياضيات متجهات خالصة).
```python
# Only 2 records are stored (the third is a near-duplicate of the first)
memory.remember_many([
"CrewAI supports complex workflows.",
"Python is a great language.",
"CrewAI supports complex workflows.", # dropped by intra-batch dedup
])
```
## الحفظ غير الحاجب
`remember_many()` **غير حاجب** -- يقدم خط أنابيب الترميز إلى خيط خلفي ويعود فورًا. هذا يعني أن الوكيل يمكنه المتابعة إلى المهمة التالية بينما يتم حفظ الذكريات.
```python
# Returns immediately -- save happens in background
memory.remember_many(["Fact A.", "Fact B.", "Fact C."])
# recall() automatically waits for pending saves before searching
matches = memory.recall("facts") # sees all 3 records
```
### حاجز القراءة
كل استدعاء `recall()` يستدعي تلقائيًا `drain_writes()` قبل البحث، مما يضمن أن الاستعلام يرى دائمًا أحدث السجلات المستمرة. هذا شفاف -- لا تحتاج أبدًا إلى التفكير فيه.
### إيقاف الفريق
عند انتهاء الفريق، يستنزف `kickoff()` جميع عمليات حفظ الذاكرة المعلقة في كتلة `finally` الخاصة به، لذا لا تُفقد أي عمليات حفظ حتى لو اكتمل الفريق بينما عمليات الحفظ الخلفية قيد التنفيذ.
### الاستخدام المستقل
للسكربتات أو دفاتر الملاحظات حيث لا توجد دورة حياة فريق، استدعِ `drain_writes()` أو `close()` صراحة:
```python
memory = Memory()
memory.remember_many(["Fact A.", "Fact B."])
# Option 1: Wait for pending saves
memory.drain_writes()
# Option 2: Drain and shut down the background pool
memory.close()
```
## المصدر والخصوصية
يمكن لكل سجل ذاكرة أن يحمل علامة `source` لتتبع المصدر وعلامة `private` للتحكم في الوصول.
### تتبع المصدر
يحدد معامل `source` من أين جاءت الذاكرة:
```python
# Tag memories with their origin
memory.remember("User prefers dark mode", source="user:alice")
memory.remember("System config updated", source="admin")
memory.remember("Agent found a bug", source="agent:debugger")
# Recall only memories from a specific source
matches = memory.recall("user preferences", source="user:alice")
```
### الذكريات الخاصة
الذكريات الخاصة مرئية فقط للاسترجاع عندما يتطابق `source`:
```python
# Store a private memory
memory.remember("Alice's API key is sk-...", source="user:alice", private=True)
# This recall sees the private memory (source matches)
matches = memory.recall("API key", source="user:alice")
# This recall does NOT see it (different source)
matches = memory.recall("API key", source="user:bob")
# Admin access: see all private records regardless of source
matches = memory.recall("API key", include_private=True)
```
هذا مفيد بشكل خاص في النشرات متعددة المستخدمين أو المؤسسية حيث يجب عزل ذكريات المستخدمين المختلفين.
## RecallFlow (الاسترجاع العميق)
يدعم `recall()` عمقين:
- **`depth="shallow"`** -- بحث متجهي مباشر مع تسجيل مركب. سريع (~200 مللي ثانية)، بدون استدعاءات LLM.
- **`depth="deep"` (افتراضي)** -- يشغل RecallFlow متعدد الخطوات: تحليل الاستعلام، اختيار النطاق، بحث متجهي متوازٍ، توجيه قائم على الثقة، واستكشاف متكرر اختياري عندما تكون الثقة منخفضة.
**تخطي LLM الذكي**: الاستعلامات الأقصر من `query_analysis_threshold` (الافتراضي 200 حرف) تتخطى تحليل LLM للاستعلام بالكامل، حتى في الوضع العميق. الاستعلامات القصيرة مثل "ما قاعدة البيانات التي نستخدمها؟" هي بالفعل عبارات بحث جيدة -- تحليل LLM يضيف قيمة قليلة. هذا يوفر ~1-3 ثوانٍ لكل استرجاع للاستعلامات القصيرة النموذجية. فقط الاستعلامات الأطول (مثل أوصاف المهام الكاملة) تمر عبر تقطير LLM إلى استعلامات فرعية مستهدفة.
```python
# Shallow: pure vector search, no LLM
matches = memory.recall("What did we decide?", limit=10, depth="shallow")
# Deep (default): intelligent retrieval with LLM analysis for long queries
matches = memory.recall(
"Summarize all architecture decisions from this quarter",
limit=10,
depth="deep",
)
```
عتبات الثقة التي تتحكم في موجّه RecallFlow قابلة للإعداد:
```python
memory = Memory(
confidence_threshold_high=0.9, # Only synthesize when very confident
confidence_threshold_low=0.4, # Explore deeper more aggressively
exploration_budget=2, # Allow up to 2 exploration rounds
query_analysis_threshold=200, # Skip LLM for queries shorter than this
)
```
## إعداد المُضمِّن
تحتاج الذاكرة إلى نموذج تضمين لتحويل النص إلى متجهات للبحث الدلالي. يمكنك إعداده بثلاث طرق.
### التمرير إلى Memory مباشرة
```python
from crewai import Memory
# As a config dict
memory = Memory(embedder={"provider": "openai", "config": {"model_name": "text-embedding-3-small"}})
# As a pre-built callable
from crewai.rag.embeddings.factory import build_embedder
embedder = build_embedder({"provider": "ollama", "config": {"model_name": "mxbai-embed-large"}})
memory = Memory(embedder=embedder)
```
### عبر إعداد مُضمِّن Crew
عند استخدام `memory=True`، يتم تمرير إعداد `embedder` الخاص بالفريق:
```python
from crewai import Crew
crew = Crew(
agents=[...],
tasks=[...],
memory=True,
embedder={"provider": "openai", "config": {"model_name": "text-embedding-3-small"}},
)
```
### أمثلة المزودين
<AccordionGroup>
<Accordion title="OpenAI (افتراضي)">
```python
memory = Memory(embedder={
"provider": "openai",
"config": {
"model_name": "text-embedding-3-small",
# "api_key": "sk-...", # or set OPENAI_API_KEY env var
},
})
```
</Accordion>
<Accordion title="Ollama (محلي، خاص)">
```python
memory = Memory(embedder={
"provider": "ollama",
"config": {
"model_name": "mxbai-embed-large",
"url": "http://localhost:11434/api/embeddings",
},
})
```
</Accordion>
<Accordion title="Azure OpenAI">
```python
memory = Memory(embedder={
"provider": "azure",
"config": {
"deployment_id": "your-embedding-deployment",
"api_key": "your-azure-api-key",
"api_base": "https://your-resource.openai.azure.com",
"api_version": "2024-02-01",
},
})
```
</Accordion>
<Accordion title="Google AI">
```python
memory = Memory(embedder={
"provider": "google-generativeai",
"config": {
"model_name": "gemini-embedding-001",
# "api_key": "...", # or set GOOGLE_API_KEY env var
},
})
```
</Accordion>
<Accordion title="Google Vertex AI">
```python
memory = Memory(embedder={
"provider": "google-vertex",
"config": {
"model_name": "gemini-embedding-001",
"project_id": "your-gcp-project-id",
"location": "us-central1",
},
})
```
</Accordion>
<Accordion title="Cohere">
```python
memory = Memory(embedder={
"provider": "cohere",
"config": {
"model_name": "embed-english-v3.0",
# "api_key": "...", # or set COHERE_API_KEY env var
},
})
```
</Accordion>
<Accordion title="VoyageAI">
```python
memory = Memory(embedder={
"provider": "voyageai",
"config": {
"model": "voyage-3",
# "api_key": "...", # or set VOYAGE_API_KEY env var
},
})
```
</Accordion>
<Accordion title="AWS Bedrock">
```python
memory = Memory(embedder={
"provider": "amazon-bedrock",
"config": {
"model_name": "amazon.titan-embed-text-v1",
# Uses default AWS credentials (boto3 session)
},
})
```
</Accordion>
<Accordion title="Hugging Face">
```python
memory = Memory(embedder={
"provider": "huggingface",
"config": {
"model_name": "sentence-transformers/all-MiniLM-L6-v2",
},
})
```
</Accordion>
<Accordion title="Jina">
```python
memory = Memory(embedder={
"provider": "jina",
"config": {
"model_name": "jina-embeddings-v2-base-en",
# "api_key": "...", # or set JINA_API_KEY env var
},
})
```
</Accordion>
<Accordion title="IBM WatsonX">
```python
memory = Memory(embedder={
"provider": "watsonx",
"config": {
"model_id": "ibm/slate-30m-english-rtrvr",
"api_key": "your-watsonx-api-key",
"project_id": "your-project-id",
"url": "https://us-south.ml.cloud.ibm.com",
},
})
```
</Accordion>
<Accordion title="مُضمِّن مخصص">
```python
# Pass any callable that takes a list of strings and returns a list of vectors
def my_embedder(texts: list[str]) -> list[list[float]]:
# Your embedding logic here
return [[0.1, 0.2, ...] for _ in texts]
memory = Memory(embedder=my_embedder)
```
</Accordion>
</AccordionGroup>
### مرجع المزودين
| المزود | المفتاح | النموذج النموذجي | ملاحظات |
| :--- | :--- | :--- | :--- |
| OpenAI | `openai` | `text-embedding-3-small` | افتراضي. عيّن `OPENAI_API_KEY`. |
| Ollama | `ollama` | `mxbai-embed-large` | محلي، لا حاجة لمفتاح API. |
| Azure OpenAI | `azure` | `text-embedding-ada-002` | يتطلب `deployment_id`. |
| Google AI | `google-generativeai` | `gemini-embedding-001` | عيّن `GOOGLE_API_KEY`. |
| Google Vertex | `google-vertex` | `gemini-embedding-001` | يتطلب `project_id`. |
| Cohere | `cohere` | `embed-english-v3.0` | دعم قوي متعدد اللغات. |
| VoyageAI | `voyageai` | `voyage-3` | محسّن للاسترجاع. |
| AWS Bedrock | `amazon-bedrock` | `amazon.titan-embed-text-v1` | يستخدم بيانات اعتماد boto3. |
| Hugging Face | `huggingface` | `all-MiniLM-L6-v2` | sentence-transformers محلي. |
| Jina | `jina` | `jina-embeddings-v2-base-en` | عيّن `JINA_API_KEY`. |
| IBM WatsonX | `watsonx` | `ibm/slate-30m-english-rtrvr` | يتطلب `project_id`. |
| Sentence Transformer | `sentence-transformer` | `all-MiniLM-L6-v2` | محلي، لا حاجة لمفتاح API. |
| مخصص | `custom` | -- | يتطلب `embedding_callable`. |
## إعداد LLM
تستخدم الذاكرة LLM لتحليل الحفظ (استنتاج النطاق والفئات والأهمية)، وقرارات التوحيد، وتحليل استعلام الاسترجاع العميق. يمكنك إعداد النموذج المُستخدم.
```python
from crewai import Memory, LLM
# Default: gpt-4o-mini
memory = Memory()
# Use a different OpenAI model
memory = Memory(llm="gpt-4o")
# Use Anthropic
memory = Memory(llm="anthropic/claude-3-haiku-20240307")
# Use Ollama for fully local/private analysis
memory = Memory(llm="ollama/llama3.2")
# Use Google Gemini
memory = Memory(llm="gemini/gemini-2.0-flash")
# Pass a pre-configured LLM instance with custom settings
llm = LLM(model="gpt-4o", temperature=0)
memory = Memory(llm=llm)
```
يتم تهيئة LLM **بشكل كسول** -- يتم إنشاؤه فقط عند الحاجة لأول مرة. هذا يعني أن `Memory()` لا يفشل أبدًا في وقت الإنشاء، حتى لو لم تكن مفاتيح API مُعيّنة. تظهر الأخطاء فقط عند استدعاء LLM فعليًا (مثلاً عند الحفظ بدون نطاق/فئات صريحة، أو أثناء الاسترجاع العميق).
للتشغيل المحلي/الخاص بالكامل، استخدم نموذجًا محليًا لكل من LLM والمُضمِّن:
```python
memory = Memory(
llm="ollama/llama3.2",
embedder={"provider": "ollama", "config": {"model_name": "mxbai-embed-large"}},
)
```
## واجهة التخزين
- **الافتراضي**: LanceDB، مخزّن تحت `./.crewai/memory` (أو `$CREWAI_STORAGE_DIR/memory` إذا تم تعيين متغير البيئة، أو المسار الذي تمرره كـ `storage="path/to/dir"`).
- **واجهة مخصصة**: نفّذ بروتوكول `StorageBackend` (انظر `crewai.memory.storage.backend`) ومرّر مثيلًا إلى `Memory(storage=your_backend)`.
## الاستكشاف
فحص التسلسل الهرمي للنطاقات والفئات والسجلات:
```python
memory.tree() # Formatted tree of scopes and record counts
memory.tree("/project", max_depth=2) # Subtree view
memory.info("/project") # ScopeInfo: record_count, categories, oldest/newest
memory.list_scopes("/") # Immediate child scopes
memory.list_categories() # Category names and counts
memory.list_records(scope="/project/alpha", limit=20) # Records in a scope, newest first
```
## سلوك الفشل
إذا فشل LLM أثناء التحليل (خطأ شبكة، حد معدل، استجابة غير صالحة)، تتدهور الذاكرة بسلاسة:
- **تحليل الحفظ** -- يتم تسجيل تحذير ولا يزال يتم تخزين الذاكرة مع النطاق الافتراضي `/`، فئات فارغة، وأهمية `0.5`.
- **استخراج الذكريات** -- يتم تخزين المحتوى الكامل كذاكرة واحدة حتى لا يُفقد شيء.
- **تحليل الاستعلام** -- يتراجع الاسترجاع إلى اختيار نطاق بسيط وبحث متجهي حتى تستمر في الحصول على نتائج.
لا يتم رفع أي استثناء لفشل التحليل هذه؛ فقط فشل التخزين أو المُضمِّن سيرفع استثناءً.
## ملاحظة حول الخصوصية
يتم إرسال محتوى الذاكرة إلى LLM المُعدّ للتحليل (النطاق/الفئات/الأهمية عند الحفظ، تحليل الاستعلام والاسترجاع العميق الاختياري). للبيانات الحساسة، استخدم LLM محليًا (مثل Ollama) أو تأكد من أن مزودك يلبي متطلبات الامتثال الخاصة بك.
## أحداث الذاكرة
جميع عمليات الذاكرة تُصدر أحداثًا مع `source_type="unified_memory"`. يمكنك الاستماع للتوقيت والأخطاء والمحتوى.
| الحدث | الوصف | الخصائص الرئيسية |
| :---- | :---------- | :------------- |
| **MemoryQueryStartedEvent** | بداية الاستعلام | `query`, `limit` |
| **MemoryQueryCompletedEvent** | نجاح الاستعلام | `query`, `results`, `query_time_ms` |
| **MemoryQueryFailedEvent** | فشل الاستعلام | `query`, `error` |
| **MemorySaveStartedEvent** | بداية الحفظ | `value`, `metadata` |
| **MemorySaveCompletedEvent** | نجاح الحفظ | `value`, `save_time_ms` |
| **MemorySaveFailedEvent** | فشل الحفظ | `value`, `error` |
| **MemoryRetrievalStartedEvent** | بداية استرجاع الوكيل | `task_id` |
| **MemoryRetrievalCompletedEvent** | اكتمال استرجاع الوكيل | `task_id`, `memory_content`, `retrieval_time_ms` |
مثال: مراقبة وقت الاستعلام:
```python
from crewai.events import BaseEventListener, MemoryQueryCompletedEvent
class MemoryMonitor(BaseEventListener):
def setup_listeners(self, crewai_event_bus):
@crewai_event_bus.on(MemoryQueryCompletedEvent)
def on_done(source, event):
if getattr(event, "source_type", None) == "unified_memory":
print(f"Query '{event.query}' completed in {event.query_time_ms:.0f}ms")
```
## استكشاف المشاكل
**الذاكرة لا تستمر؟**
- تأكد من أن مسار التخزين قابل للكتابة (الافتراضي `./.crewai/memory`). مرّر `storage="./your_path"` لاستخدام مجلد مختلف، أو عيّن متغير البيئة `CREWAI_STORAGE_DIR`.
- عند استخدام فريق، تأكد من تعيين `memory=True` أو `memory=Memory(...)`.
**الاسترجاع بطيء؟**
- استخدم `depth="shallow"` لسياق الوكيل الروتيني. احتفظ بـ `depth="deep"` للاستعلامات المعقدة.
- زد `query_analysis_threshold` لتخطي تحليل LLM لمزيد من الاستعلامات.
**أخطاء تحليل LLM في السجلات؟**
- لا تزال الذاكرة تحفظ/تسترجع بإعدادات افتراضية آمنة. تحقق من مفاتيح API وحدود المعدل وتوفر النموذج إذا كنت تريد تحليل LLM كاملاً.
**أخطاء حفظ خلفية في السجلات؟**
- عمليات حفظ الذاكرة تعمل في خيط خلفي. تُصدر الأخطاء كـ `MemorySaveFailedEvent` لكنها لا تعطل الوكيل. تحقق من السجلات للسبب الجذري (عادة مشاكل اتصال LLM أو المُضمِّن).
**تعارضات الكتابة المتزامنة؟**
- عمليات LanceDB مُتسلسلة بقفل مشترك وتُعاد تلقائيًا عند التعارض. هذا يتعامل مع مثيلات `Memory` المتعددة التي تشير إلى نفس قاعدة البيانات (مثل ذاكرة وكيل + ذاكرة فريق). لا حاجة لإجراء.
**تصفح الذاكرة من الطرفية:**
```bash
crewai memory # Opens the TUI browser
crewai memory --storage-path ./my_memory # Point to a specific directory
```
**إعادة تعيين الذاكرة (مثلاً للاختبارات):**
```python
crew.reset_memories(command_type="memory") # Resets unified memory
# Or on a Memory instance:
memory.reset() # All scopes
memory.reset(scope="/project/old") # Only that subtree
```
## مرجع الإعداد
جميع الإعدادات تُمرر كمعاملات كلمة مفتاحية إلى `Memory(...)`. كل معامل له قيمة افتراضية معقولة.
| المعامل | الافتراضي | الوصف |
| :--- | :--- | :--- |
| `llm` | `"gpt-4o-mini"` | LLM للتحليل (اسم نموذج أو مثيل `BaseLLM`). |
| `storage` | `"lancedb"` | واجهة التخزين (`"lancedb"`، سلسلة مسار، أو مثيل `StorageBackend`). |
| `embedder` | `None` (افتراضي OpenAI) | المُضمِّن (قاموس إعداد، دالة قابلة للاستدعاء، أو `None` لافتراضي OpenAI). |
| `recency_weight` | `0.3` | وزن الحداثة في الدرجة المركبة. |
| `semantic_weight` | `0.5` | وزن التشابه الدلالي في الدرجة المركبة. |
| `importance_weight` | `0.2` | وزن الأهمية في الدرجة المركبة. |
| `recency_half_life_days` | `30` | أيام لتنصيف درجة الحداثة (اضمحلال أُسي). |
| `consolidation_threshold` | `0.85` | التشابه الذي يُشغّل فوقه التوحيد عند الحفظ. عيّن إلى `1.0` للتعطيل. |
| `consolidation_limit` | `5` | أقصى عدد سجلات حالية للمقارنة أثناء التوحيد. |
| `default_importance` | `0.5` | الأهمية المُعيّنة عندما لا تُوفَّر ويتم تخطي تحليل LLM. |
| `batch_dedup_threshold` | `0.98` | تشابه جيب التمام لإسقاط النسخ شبه المكررة داخل دفعة `remember_many()`. |
| `confidence_threshold_high` | `0.8` | ثقة الاسترجاع التي تُعاد فوقها النتائج مباشرة. |
| `confidence_threshold_low` | `0.5` | ثقة الاسترجاع التي يُشغّل تحتها استكشاف أعمق. |
| `complex_query_threshold` | `0.7` | للاستعلامات المعقدة، استكشف أعمق تحت هذه الثقة. |
| `exploration_budget` | `1` | عدد جولات الاستكشاف المدفوعة بـ LLM أثناء الاسترجاع العميق. |
| `query_analysis_threshold` | `200` | الاستعلامات الأقصر من هذا (بالأحرف) تتخطى تحليل LLM أثناء الاسترجاع العميق. |

View File

@@ -0,0 +1,155 @@
---
title: التخطيط
description: تعرّف على كيفية إضافة التخطيط إلى طاقم CrewAI وتحسين أدائه.
icon: ruler-combined
mode: "wide"
---
## نظرة عامة
تتيح لك ميزة التخطيط في CrewAI إضافة قدرة التخطيط إلى طاقمك. عند تفعيلها، قبل كل تكرار للطاقم،
يتم إرسال جميع معلومات الطاقم إلى AgentPlanner الذي يخطط للمهام خطوة بخطوة، ويُضاف هذا المخطط إلى وصف كل مهمة.
### استخدام ميزة التخطيط
البدء بميزة التخطيط سهل جدًا، الخطوة الوحيدة المطلوبة هي إضافة `planning=True` إلى طاقمك:
<CodeGroup>
```python Code
from crewai import Crew, Agent, Task, Process
# تجميع طاقمك مع قدرات التخطيط
my_crew = Crew(
agents=self.agents,
tasks=self.tasks,
process=Process.sequential,
planning=True,
)
```
</CodeGroup>
من هذه النقطة فصاعدًا، سيكون التخطيط مفعّلًا في طاقمك، وسيتم تخطيط المهام قبل كل تكرار.
<Warning>
عند تفعيل التخطيط، سيستخدم CrewAI `gpt-4o-mini` كنموذج LLM افتراضي للتخطيط، مما يتطلب مفتاح API صالحًا من OpenAI. نظرًا لأن وكلاءك قد يستخدمون نماذج LLM مختلفة، فقد يسبب ذلك ارتباكًا إذا لم يكن لديك مفتاح OpenAI API مهيأ أو إذا كنت تواجه سلوكًا غير متوقع متعلقًا باستدعاءات LLM API.
</Warning>
#### LLM التخطيط
يمكنك الآن تحديد نموذج LLM الذي سيُستخدم لتخطيط المهام.
عند تشغيل مثال الحالة الأساسية، سترى شيئًا مشابهًا للمخرجات أدناه، والتي تمثل مخرجات `AgentPlanner`
المسؤول عن إنشاء المنطق التدريجي لإضافته إلى مهام الوكلاء.
<CodeGroup>
```python Code
from crewai import Crew, Agent, Task, Process
# تجميع طاقمك مع قدرات التخطيط ونموذج LLM مخصص
my_crew = Crew(
agents=self.agents,
tasks=self.tasks,
process=Process.sequential,
planning=True,
planning_llm="gpt-4o"
)
# تشغيل الطاقم
my_crew.kickoff()
```
```markdown Result
[2024-07-15 16:49:11][INFO]: Planning the crew execution
**Step-by-Step Plan for Task Execution**
**Task Number 1: Conduct a thorough research about AI LLMs**
**Agent:** AI LLMs Senior Data Researcher
**Agent Goal:** Uncover cutting-edge developments in AI LLMs
**Task Expected Output:** A list with 10 bullet points of the most relevant information about AI LLMs
**Task Tools:** None specified
**Agent Tools:** None specified
**Step-by-Step Plan:**
1. **Define Research Scope:**
- Determine the specific areas of AI LLMs to focus on, such as advancements in architecture, use cases, ethical considerations, and performance metrics.
2. **Identify Reliable Sources:**
- List reputable sources for AI research, including academic journals, industry reports, conferences (e.g., NeurIPS, ACL), AI research labs (e.g., OpenAI, Google AI), and online databases (e.g., IEEE Xplore, arXiv).
3. **Collect Data:**
- Search for the latest papers, articles, and reports published in 2024 and early 2025.
- Use keywords like "Large Language Models 2025", "AI LLM advancements", "AI ethics 2025", etc.
4. **Analyze Findings:**
- Read and summarize the key points from each source.
- Highlight new techniques, models, and applications introduced in the past year.
5. **Organize Information:**
- Categorize the information into relevant topics (e.g., new architectures, ethical implications, real-world applications).
- Ensure each bullet point is concise but informative.
6. **Create the List:**
- Compile the 10 most relevant pieces of information into a bullet point list.
- Review the list to ensure clarity and relevance.
**Expected Output:**
A list with 10 bullet points of the most relevant information about AI LLMs.
---
**Task Number 2: Review the context you got and expand each topic into a full section for a report**
**Agent:** AI LLMs Reporting Analyst
**Agent Goal:** Create detailed reports based on AI LLMs data analysis and research findings
**Task Expected Output:** A fully fledged report with the main topics, each with a full section of information. Formatted as markdown without '```'
**Task Tools:** None specified
**Agent Tools:** None specified
**Step-by-Step Plan:**
1. **Review the Bullet Points:**
- Carefully read through the list of 10 bullet points provided by the AI LLMs Senior Data Researcher.
2. **Outline the Report:**
- Create an outline with each bullet point as a main section heading.
- Plan sub-sections under each main heading to cover different aspects of the topic.
3. **Research Further Details:**
- For each bullet point, conduct additional research if necessary to gather more detailed information.
- Look for case studies, examples, and statistical data to support each section.
4. **Write Detailed Sections:**
- Expand each bullet point into a comprehensive section.
- Ensure each section includes an introduction, detailed explanation, examples, and a conclusion.
- Use markdown formatting for headings, subheadings, lists, and emphasis.
5. **Review and Edit:**
- Proofread the report for clarity, coherence, and correctness.
- Make sure the report flows logically from one section to the next.
- Format the report according to markdown standards.
6. **Finalize the Report:**
- Ensure the report is complete with all sections expanded and detailed.
- Double-check formatting and make any necessary adjustments.
**Expected Output:**
A fully fledged report with the main topics, each with a full section of information. Formatted as markdown without '```'.
```
</CodeGroup>

View File

@@ -0,0 +1,66 @@
---
title: العمليات
description: دليل تفصيلي حول إدارة سير العمل من خلال العمليات في CrewAI، مع تفاصيل التنفيذ المحدّثة.
icon: bars-staggered
mode: "wide"
---
## نظرة عامة
<Tip>
تنسّق العمليات تنفيذ المهام بواسطة الوكلاء، على غرار إدارة المشاريع في الفرق البشرية.
تضمن هذه العمليات توزيع المهام وتنفيذها بكفاءة، وفقًا لاستراتيجية محددة مسبقًا.
</Tip>
## تنفيذات العمليات
- **تسلسلي**: ينفذ المهام بالتتابع، مما يضمن إكمال المهام بتقدم منظم.
- **هرمي**: ينظم المهام في تسلسل إداري هرمي، حيث يتم تفويض المهام وتنفيذها بناءً على سلسلة أوامر منظمة. يجب تحديد نموذج لغة المدير (`manager_llm`) أو وكيل مدير مخصص (`manager_agent`) في الطاقم لتفعيل العملية الهرمية، مما يسهّل إنشاء وإدارة المهام من قبل المدير.
## دور العمليات في العمل الجماعي
تُمكّن العمليات الوكلاء الأفراد من العمل كوحدة متماسكة، مما يبسّط جهودهم لتحقيق أهداف مشتركة بكفاءة وتناسق.
## تعيين العمليات للطاقم
لتعيين عملية لطاقم، حدد نوع العملية عند إنشاء الطاقم لتعيين استراتيجية التنفيذ. للعملية الهرمية، تأكد من تحديد `manager_llm` أو `manager_agent` لوكيل المدير.
```python
from crewai import Crew, Process
# مثال: إنشاء طاقم بعملية تسلسلية
crew = Crew(
agents=my_agents,
tasks=my_tasks,
process=Process.sequential
)
# مثال: إنشاء طاقم بعملية هرمية
# تأكد من توفير manager_llm أو manager_agent
crew = Crew(
agents=my_agents,
tasks=my_tasks,
process=Process.hierarchical,
manager_llm="gpt-4o"
# أو
# manager_agent=my_manager_agent
)
```
**ملاحظة:** تأكد من تعريف `my_agents` و `my_tasks` قبل إنشاء كائن `Crew`، وللعملية الهرمية، يُعد `manager_llm` أو `manager_agent` مطلوبًا أيضًا.
## العملية التسلسلية
تعكس هذه الطريقة سير عمل الفريق الديناميكي، وتتقدم عبر المهام بطريقة مدروسة ومنهجية. يتبع تنفيذ المهام الترتيب المحدد مسبقًا في قائمة المهام، حيث يعمل ناتج مهمة واحدة كسياق للمهمة التالية.
لتخصيص سياق المهمة، استخدم معامل `context` في فئة `Task` لتحديد المخرجات التي يجب استخدامها كسياق للمهام اللاحقة.
## العملية الهرمية
تحاكي التسلسل الهرمي المؤسسي، حيث يسمح CrewAI بتحديد وكيل مدير مخصص أو إنشاء واحد تلقائيًا، مما يتطلب تحديد نموذج لغة المدير (`manager_llm`). يشرف هذا الوكيل على تنفيذ المهام، بما في ذلك التخطيط والتفويض والتحقق. لا يتم تعيين المهام مسبقًا؛ يخصص المدير المهام للوكلاء بناءً على قدراتهم، ويراجع المخرجات، ويقيّم اكتمال المهام.
## فئة Process: نظرة عامة مفصلة
تم تنفيذ فئة `Process` كتعداد (`Enum`)، مما يضمن أمان الأنواع ويقيّد قيم العملية على الأنواع المحددة (`sequential`، `hierarchical`).
## الخلاصة
التعاون المنظم الذي تسهّله العمليات داخل CrewAI ضروري لتمكين العمل الجماعي المنهجي بين الوكلاء.
تم تحديث هذه الوثائق لتعكس أحدث الميزات والتحسينات، مما يضمن وصول المستخدمين إلى أحدث المعلومات وأكثرها شمولاً.

View File

@@ -0,0 +1,162 @@
---
title: بنية الإنتاج
description: أفضل الممارسات لبناء تطبيقات ذكاء اصطناعي جاهزة للإنتاج مع CrewAI
icon: server
mode: "wide"
---
# عقلية التدفق أولاً
عند بناء تطبيقات ذكاء اصطناعي إنتاجية مع CrewAI، **نوصي بالبدء بتدفق (Flow)**.
بينما يمكن تشغيل أطقم أو وكلاء فرديين، فإن تغليفهم في تدفق يوفر الهيكل اللازم لتطبيق متين وقابل للتوسع.
## لماذا التدفقات؟
1. **إدارة الحالة**: توفر التدفقات طريقة مدمجة لإدارة الحالة عبر مراحل مختلفة من تطبيقك. هذا ضروري لتمرير البيانات بين الأطقم والحفاظ على السياق ومعالجة مدخلات المستخدم.
2. **التحكم**: تتيح لك التدفقات تحديد مسارات تنفيذ دقيقة، بما في ذلك الحلقات والشرطيات ومنطق التفريع. هذا أساسي لمعالجة الحالات الاستثنائية وضمان سلوك تطبيقك بشكل متوقع.
3. **المراقبة**: توفر التدفقات هيكلًا واضحًا يسهّل تتبع التنفيذ وتصحيح الأخطاء ومراقبة الأداء. نوصي باستخدام [تتبع CrewAI](/ar/observability/tracing) للحصول على رؤى تفصيلية. ما عليك سوى تشغيل `crewai login` لتفعيل ميزات المراقبة المجانية.
## البنية
يبدو تطبيق CrewAI الإنتاجي النموذجي هكذا:
```mermaid
graph TD
Start((Start)) --> Flow[Flow Orchestrator]
Flow --> State{State Management}
State --> Step1[Step 1: Data Gathering]
Step1 --> Crew1[Research Crew]
Crew1 --> State
State --> Step2{Condition Check}
Step2 -- "Valid" --> Step3[Step 3: Execution]
Step3 --> Crew2[Action Crew]
Step2 -- "Invalid" --> End((End))
Crew2 --> End
```
### 1. فئة التدفق
فئة `Flow` هي نقطة الدخول. تحدد مخطط الحالة والطرق التي تنفذ منطقك.
```python
from crewai.flow.flow import Flow, listen, start
from pydantic import BaseModel
class AppState(BaseModel):
user_input: str = ""
research_results: str = ""
final_report: str = ""
class ProductionFlow(Flow[AppState]):
@start()
def gather_input(self):
# ... منطق الحصول على المدخلات ...
pass
@listen(gather_input)
def run_research_crew(self):
# ... تشغيل طاقم ...
pass
```
### 2. إدارة الحالة
استخدم نماذج Pydantic لتعريف حالتك. يضمن هذا أمان الأنواع ويوضح البيانات المتاحة في كل مرحلة.
- **اجعلها بسيطة**: خزّن فقط ما تحتاجه للاستمرار بين المراحل.
- **استخدم بيانات منظمة**: تجنب القواميس غير المنظمة قدر الإمكان.
### 3. الأطقم كوحدات عمل
فوّض المهام المعقدة إلى الأطقم. يجب أن يكون الطاقم مركّزًا على هدف محدد (مثل "البحث في موضوع"، "كتابة مقال مدونة").
- **لا تبالغ في هندسة الأطقم**: اجعلها مركّزة.
- **مرر الحالة بشكل صريح**: مرر البيانات الضرورية من حالة التدفق إلى مدخلات الطاقم.
```python
@listen(gather_input)
def run_research_crew(self):
crew = ResearchCrew()
result = crew.kickoff(inputs={"topic": self.state.user_input})
self.state.research_results = result.raw
```
## عناصر التحكم الأولية
استفد من عناصر التحكم الأولية في CrewAI لإضافة المتانة والتحكم إلى أطقمك.
### 1. حواجز المهام
استخدم [حواجز المهام](/ar/concepts/tasks#task-guardrails) للتحقق من مخرجات المهام قبل قبولها. يضمن هذا أن وكلاءك ينتجون نتائج عالية الجودة.
```python
def validate_content(result: TaskOutput) -> Tuple[bool, Any]:
if len(result.raw) < 100:
return (False, "Content is too short. Please expand.")
return (True, result.raw)
task = Task(
...,
guardrail=validate_content
)
```
### 2. المخرجات المنظمة
استخدم دائمًا المخرجات المنظمة (`output_pydantic` أو `output_json`) عند تمرير البيانات بين المهام أو إلى تطبيقك. يمنع هذا أخطاء التحليل ويضمن أمان الأنواع.
```python
class ResearchResult(BaseModel):
summary: str
sources: List[str]
task = Task(
...,
output_pydantic=ResearchResult
)
```
### 3. خطافات LLM
استخدم [خطافات LLM](/ar/learn/llm-hooks) لفحص أو تعديل الرسائل قبل إرسالها إلى LLM، أو لتنقية الاستجابات.
```python
@before_llm_call
def log_request(context):
print(f"Agent {context.agent.role} is calling the LLM...")
```
## أنماط النشر
عند نشر تدفقك، ضع في اعتبارك ما يلي:
### CrewAI Enterprise
أسهل طريقة لنشر تدفقك هي استخدام CrewAI Enterprise. تتعامل مع البنية التحتية والمصادقة والمراقبة نيابة عنك.
راجع [دليل النشر](/ar/enterprise/guides/deploy-to-amp) للبدء.
```bash
crewai deploy create
```
### التنفيذ غير المتزامن
للمهام طويلة التشغيل، استخدم `kickoff_async` لتجنب حظر واجهتك البرمجية.
### الاستمرارية
استخدم مزيّن `@persist` لحفظ حالة تدفقك في قاعدة بيانات. يتيح لك هذا استئناف التنفيذ إذا تعطلت العملية أو إذا كنت بحاجة لانتظار مدخلات بشرية.
```python
@persist
class ProductionFlow(Flow[AppState]):
# ...
```
افتراضيًا، يستأنف `@persist` تدفقًا عند توفير `kickoff(inputs={"id": <uuid>})`، مما يمدّ نفس تاريخ `flow_uuid`. لـ **تفرع** تدفق مستمر إلى نسبٍ جديد — ترطيب الحالة من تشغيل سابق ولكن الكتابة تحت `state.id` جديد — مرّر `restore_from_state_id`:
```python
flow.kickoff(restore_from_state_id="<previous-run-state-id>")
```
يحصل التشغيل الجديد على `state.id` جديد (مولّد تلقائيًا، أو `inputs["id"]` إذا تم تثبيته) لذا لا تمتد كتابات `@persist` الخاصة به إلى تاريخ المصدر. الجمع مع `from_checkpoint` يطلق `ValueError`؛ اختر مصدر ترطيب واحدًا.
## الخلاصة
- **ابدأ بتدفق.**
- **حدد حالة واضحة.**
- **استخدم الأطقم للمهام المعقدة.**
- **انشر مع API واستمرارية.**

View File

@@ -0,0 +1,148 @@
---
title: الاستدلال
description: "تعرّف على كيفية تفعيل واستخدام استدلال الوكيل لتحسين تنفيذ المهام."
icon: brain
mode: "wide"
---
## نظرة عامة
استدلال الوكيل هو ميزة تتيح للوكلاء التأمل في المهمة وإنشاء خطة قبل التنفيذ. يساعد هذا الوكلاء على التعامل مع المهام بشكل أكثر منهجية ويضمن استعدادهم لأداء العمل المطلوب.
## الاستخدام
لتفعيل الاستدلال لوكيل، ما عليك سوى تعيين `reasoning=True` عند إنشاء الوكيل:
```python
from crewai import Agent
agent = Agent(
role="Data Analyst",
goal="Analyze complex datasets and provide insights",
backstory="You are an experienced data analyst with expertise in finding patterns in complex data.",
reasoning=True, # تفعيل الاستدلال
max_reasoning_attempts=3 # اختياري: تعيين حد أقصى لمحاولات الاستدلال
)
```
## كيف يعمل
عند تفعيل الاستدلال، قبل تنفيذ المهمة، سيقوم الوكيل بما يلي:
1. التأمل في المهمة وإنشاء خطة مفصلة
2. تقييم ما إذا كان مستعدًا لتنفيذ المهمة
3. تحسين الخطة حسب الحاجة حتى يصبح مستعدًا أو يصل إلى max_reasoning_attempts
4. حقن خطة الاستدلال في وصف المهمة قبل التنفيذ
تساعد هذه العملية الوكيل على تقسيم المهام المعقدة إلى خطوات يمكن إدارتها وتحديد التحديات المحتملة قبل البدء.
## خيارات التهيئة
<ParamField body="reasoning" type="bool" default="False">
تفعيل أو تعطيل الاستدلال
</ParamField>
<ParamField body="max_reasoning_attempts" type="int" default="None">
الحد الأقصى لعدد المحاولات لتحسين الخطة قبل المتابعة بالتنفيذ. إذا كانت القيمة None (الافتراضي)، سيستمر الوكيل في التحسين حتى يصبح مستعدًا.
</ParamField>
## مثال
إليك مثالًا كاملًا:
```python
from crewai import Agent, Task, Crew
# إنشاء وكيل مع تفعيل الاستدلال
analyst = Agent(
role="Data Analyst",
goal="Analyze data and provide insights",
backstory="You are an expert data analyst.",
reasoning=True,
max_reasoning_attempts=3 # اختياري: تعيين حد لمحاولات الاستدلال
)
# إنشاء مهمة
analysis_task = Task(
description="Analyze the provided sales data and identify key trends.",
expected_output="A report highlighting the top 3 sales trends.",
agent=analyst
)
# إنشاء طاقم وتشغيل المهمة
crew = Crew(agents=[analyst], tasks=[analysis_task])
result = crew.kickoff()
print(result)
```
## معالجة الأخطاء
صُممت عملية الاستدلال لتكون متينة، مع معالجة أخطاء مدمجة. إذا حدث خطأ أثناء الاستدلال، سيتابع الوكيل تنفيذ المهمة بدون خطة الاستدلال. يضمن هذا إمكانية تنفيذ المهام حتى في حالة فشل عملية الاستدلال.
إليك كيفية التعامل مع الأخطاء المحتملة في الكود الخاص بك:
```python
from crewai import Agent, Task
import logging
# إعداد التسجيل لالتقاط أي أخطاء في الاستدلال
logging.basicConfig(level=logging.INFO)
# إنشاء وكيل مع تفعيل الاستدلال
agent = Agent(
role="Data Analyst",
goal="Analyze data and provide insights",
reasoning=True,
max_reasoning_attempts=3
)
# إنشاء مهمة
task = Task(
description="Analyze the provided sales data and identify key trends.",
expected_output="A report highlighting the top 3 sales trends.",
agent=agent
)
# تنفيذ المهمة
# إذا حدث خطأ أثناء الاستدلال، سيتم تسجيله وسيستمر التنفيذ
result = agent.execute_task(task)
```
## مثال على مخرجات الاستدلال
إليك مثالًا على شكل خطة الاستدلال لمهمة تحليل البيانات:
```
Task: Analyze the provided sales data and identify key trends.
Reasoning Plan:
I'll analyze the sales data to identify the top 3 trends.
1. Understanding of the task:
I need to analyze sales data to identify key trends that would be valuable for business decision-making.
2. Key steps I'll take:
- First, I'll examine the data structure to understand what fields are available
- Then I'll perform exploratory data analysis to identify patterns
- Next, I'll analyze sales by time periods to identify temporal trends
- I'll also analyze sales by product categories and customer segments
- Finally, I'll identify the top 3 most significant trends
3. Approach to challenges:
- If the data has missing values, I'll decide whether to fill or filter them
- If the data has outliers, I'll investigate whether they're valid data points or errors
- If trends aren't immediately obvious, I'll apply statistical methods to uncover patterns
4. Use of available tools:
- I'll use data analysis tools to explore and visualize the data
- I'll use statistical tools to identify significant patterns
- I'll use knowledge retrieval to access relevant information about sales analysis
5. Expected outcome:
A concise report highlighting the top 3 sales trends with supporting evidence from the data.
READY: I am ready to execute the task.
```
تساعد خطة الاستدلال هذه الوكيل على تنظيم نهجه تجاه المهمة، والنظر في التحديات المحتملة، وضمان تقديم المخرجات المتوقعة.

View File

@@ -0,0 +1,373 @@
---
title: المهارات
description: حزم المهارات المبنية على نظام الملفات التي تحقن خبرة المجال والتعليمات في إرشادات الوكلاء.
icon: bolt
mode: "wide"
---
## نظرة عامة
المهارات هي مجلدات مستقلة توفر للوكلاء **تعليمات وإرشادات ومواد مرجعية خاصة بالمجال**. تُعرّف كل مهارة بملف `SKILL.md` يحتوي على بيانات وصفية YAML ومحتوى Markdown.
عند التفعيل، يتم حقن تعليمات المهارة مباشرة في إرشادات مهمة الوكيل — مما يمنح الوكيل خبرة دون الحاجة لأي تغييرات في الكود.
<Note type="info" title="المهارات مقابل الأدوات — التمييز الأساسي">
**المهارات ليست أدوات.** هذه هي نقطة الارتباك الأكثر شيوعًا.
- **المهارات** تحقن *تعليمات وسياق* في إرشادات الوكيل. تخبر الوكيل *كيف يفكر* في مشكلة ما.
- **الأدوات** تمنح الوكيل *دوال قابلة للاستدعاء* لاتخاذ إجراءات (البحث، قراءة الملفات، استدعاء APIs).
غالبًا ما تحتاج **كليهما**: مهارات للخبرة، وأدوات للإجراء. يتم تكوينهما بشكل مستقل ويُكمّلان بعضهما.
</Note>
---
## البداية السريعة
### 1. إنشاء مهارة باستخدام سطر الأوامر (CLI)
واجهة سطر الأوامر هي الطريقة المدعومة لإنشاء مهارة — فهي تُنشئ لك هيكل المجلد وملف `SKILL.md` صالحًا:
```shell Terminal
crewai skill create code-review
```
داخل مشروع طاقم (حيث يوجد `pyproject.toml`) يُنشئ هذا الأمر `./skills/code-review/`؛ وخارج المشروع يُنشئ `./code-review/` في المجلد الحالي (يمكنك فرض هذا السلوك باستخدام `--no-project`):
```
skills/
└── code-review/
├── SKILL.md # Required — instructions (pre-filled template)
├── references/ # Optional — reference docs
├── scripts/ # Optional — executable scripts
└── assets/ # Optional — static files
```
### 2. كتابة SKILL.md الخاص بك
```markdown
---
name: code-review
description: Guidelines for conducting thorough code reviews with focus on security and performance.
metadata:
author: your-team
version: "1.0"
---
## إرشادات مراجعة الكود
عند مراجعة الكود، اتبع قائمة التحقق هذه:
1. **الأمان**: تحقق من ثغرات الحقن وتجاوز المصادقة وكشف البيانات
2. **الأداء**: ابحث عن استعلامات N+1 والتخصيصات غير الضرورية والاستدعاءات المحظورة
3. **القابلية للقراءة**: تأكد من وضوح التسمية والتعليقات المناسبة والأسلوب المتسق
4. **الاختبارات**: تحقق من تغطية اختبار كافية للوظائف الجديدة
### مستويات الخطورة
- **حرج**: ثغرات أمنية، مخاطر فقدان البيانات → حظر الدمج
- **رئيسي**: مشاكل أداء، أخطاء منطقية → طلب تغييرات
- **ثانوي**: مسائل أسلوبية، اقتراحات تسمية → الموافقة مع تعليقات
```
### 3. ربطها بوكيل
```python
from crewai import Agent
from crewai_tools import GithubSearchTool, FileReadTool
reviewer = Agent(
role="Senior Code Reviewer",
goal="Review pull requests for quality and security issues",
backstory="Staff engineer with expertise in secure coding practices.",
skills=["./skills"], # يحقن إرشادات المراجعة
tools=[GithubSearchTool(), FileReadTool()], # يسمح للوكيل بقراءة الكود
)
```
الوكيل الآن لديه **خبرة** (من المهارة) و**قدرات** (من الأدوات) معًا.
---
## المهارات + الأدوات: العمل معًا
إليك أنماط شائعة توضح كيف تُكمّل المهارات والأدوات بعضهما:
### النمط 1: مهارات فقط (خبرة المجال، بدون إجراءات مطلوبة)
استخدم عندما يحتاج الوكيل لتعليمات محددة لكن لا يحتاج لاستدعاء خدمات خارجية:
```python
agent = Agent(
role="Technical Writer",
goal="Write clear API documentation",
backstory="Expert technical writer",
skills=["./skills/api-docs-style"], # إرشادات وقوالب الكتابة
# لا حاجة لأدوات — الوكيل يكتب بناءً على السياق المقدم
)
```
### النمط 2: أدوات فقط (إجراءات، بدون خبرة خاصة)
استخدم عندما يحتاج الوكيل لاتخاذ إجراءات لكن لا يحتاج لتعليمات مجال محددة:
```python
from crewai_tools import SerperDevTool, ScrapeWebsiteTool
agent = Agent(
role="Web Researcher",
goal="Find information about a topic",
backstory="Skilled at finding information online",
tools=[SerperDevTool(), ScrapeWebsiteTool()], # يمكنه البحث والاستخراج
# لا حاجة لمهارات — البحث العام لا يحتاج إرشادات خاصة
)
```
### النمط 3: مهارات + أدوات (خبرة وإجراءات)
النمط الأكثر شيوعًا في العالم الحقيقي. المهارة توفر *كيف* تقترب من العمل؛ الأدوات توفر *ما* يمكن للوكيل فعله:
```python
from crewai_tools import SerperDevTool, FileReadTool, CodeInterpreterTool
analyst = Agent(
role="Security Analyst",
goal="Audit infrastructure for vulnerabilities",
backstory="Expert in cloud security and compliance",
skills=["./skills/security-audit"], # منهجية وقوائم تحقق التدقيق
tools=[
SerperDevTool(), # البحث عن ثغرات معروفة
FileReadTool(), # قراءة ملفات التكوين
CodeInterpreterTool(), # تشغيل سكربتات التحليل
],
)
```
### النمط 4: مهارات + MCP
المهارات تعمل مع خوادم MCP بنفس الطريقة التي تعمل بها مع الأدوات:
```python
agent = Agent(
role="Data Analyst",
goal="Analyze customer data and generate reports",
backstory="Expert data analyst with strong statistical background",
skills=["./skills/data-analysis"], # منهجية التحليل
mcps=["https://data-warehouse.example.com/sse"], # وصول بيانات عن بُعد
)
```
### النمط 5: مهارات + تطبيقات
المهارات يمكن أن توجّه كيف يستخدم الوكيل تكاملات المنصة:
```python
agent = Agent(
role="Customer Support Agent",
goal="Respond to customer inquiries professionally",
backstory="Experienced support representative",
skills=["./skills/support-playbook"], # قوالب الردود وقواعد التصعيد
apps=["gmail", "zendesk"], # يمكنه إرسال رسائل بريد وتحديث التذاكر
)
```
---
## إنشاء المهارات ونشرها وتثبيتها
للمهارات دورة حياة كاملة تُدار عبر واجهة سطر الأوامر: **أنشئها باستخدام `crewai skill create`، وانشرها باستخدام `crewai skill publish`** — إنشاء المجلدات يدويًا يصلح للتجارب المحلية، لكن واجهة سطر الأوامر هي سير العمل المقصود، وهي تحافظ على صحة هيكل المهارة وبياناتها الوصفية.
### الإنشاء
```shell Terminal
crewai skill create my-skill
```
يُنشئ هذا الأمر المجلد (داخل `./skills/` في مشروع الطاقم) مع قالب `SKILL.md`، بالإضافة إلى مجلدات فارغة `scripts/` و `references/` و `assets/`. عدّل `SKILL.md` لتعريف التعليمات.
### النشر
نفّذ الأمر من داخل مجلد المهارة (حيث يوجد `SKILL.md`):
```shell Terminal
cd skills/my-skill
crewai skill publish
```
يقرأ النشر الحقول `name` و `description` و `metadata.version` من البيانات الوصفية في مقدمة `SKILL.md` ويدفع المهارة إلى سجل CrewAI. **المهارات المنشورة تكون دائمًا مقيّدة بنطاق مؤسستك** — مثل الأدوات، لا يستطيع رؤيتها وتثبيتها إلا أعضاء المؤسسة الناشرة؛ ولا توجد رؤية عامة. أعلام مفيدة:
| العلم | التأثير |
| :--- | :--- |
| `--org <slug>` | النشر تحت مؤسسة محددة (يتجاوز الإعدادات). |
| `--force` | تخطي التحقق من حالة git (تغييرات غير مُثبتة، إلخ). |
### التثبيت
ثبّت مهارة منشورة عبر مرجعها `@org/name`:
```shell Terminal
crewai skill install @acme/code-review
```
داخل مشروع الطاقم تُثبَّت المهارة في `./skills/{name}/`؛ وخارج المشروع تذهب إلى ذاكرة التخزين المؤقتة المشتركة في `~/.crewai/skills/{org}/{name}/`.
يمكن للوكلاء أيضًا الإشارة إلى مهارات السجل مباشرة — يتم حلّها من ذاكرة التخزين المؤقتة المحلية (أو من مجلد `skills/` في المشروع) وقت التشغيل:
```python
agent = Agent(
role="Senior Code Reviewer",
goal="Review pull requests for quality and security issues",
backstory="Staff engineer with expertise in secure coding practices.",
skills=["@acme/code-review"], # registry ref, resolved locally
)
```
### عرض القائمة
```shell Terminal
crewai skill list
```
يعرض المهارات المثبّتة من مجلد المشروع `./skills/` ومن ذاكرة التخزين المؤقتة العامة معًا، مع إصداراتها ومساراتها.
---
## المهارات على مستوى الطاقم
يمكن تعيين المهارات على الطاقم لتُطبّق على **جميع الوكلاء**:
```python
from crewai import Crew
crew = Crew(
agents=[researcher, writer, reviewer],
tasks=[research_task, write_task, review_task],
skills=["./skills"], # جميع الوكلاء يحصلون على هذه المهارات
)
```
المهارات على مستوى الوكيل لها الأولوية — إذا تم اكتشاف نفس المهارة في كلا المستويين، يتم استخدام نسخة الوكيل.
---
## تنسيق SKILL.md
```markdown
---
name: my-skill
description: وصف قصير لما تفعله هذه المهارة ومتى تُستخدم.
license: Apache-2.0 # اختياري
compatibility: crewai>=0.1.0 # اختياري
metadata: # اختياري
author: your-name
version: "1.0"
allowed-tools: web-search file-read # اختياري، تجريبي
---
التعليمات للوكيل تُكتب هنا. يتم حقن محتوى Markdown هذا
في إرشادات الوكيل عند تفعيل المهارة.
```
### حقول البيانات الوصفية
| الحقل | مطلوب | الوصف |
| :-------------- | :------- | :----------------------------------------------------------------------- |
| `name` | نعم | 1-64 حرف. أحرف صغيرة أبجدية رقمية وشرطات. يجب أن يطابق اسم المجلد. |
| `description` | نعم | 1-1024 حرف. يصف ما تفعله المهارة ومتى تُستخدم. |
| `license` | لا | اسم الترخيص أو مرجع لملف ترخيص مضمّن. |
| `compatibility` | لا | حد أقصى 500 حرف. متطلبات البيئة (منتجات، حزم، شبكة). |
| `metadata` | لا | تعيين مفتاح-قيمة نصي عشوائي. |
| `allowed-tools` | لا | قائمة أدوات معتمدة مسبقًا مفصولة بمسافات. تجريبي. |
---
## هيكل المجلد
```
my-skill/
├── SKILL.md # مطلوب — البيانات الوصفية + التعليمات
├── scripts/ # اختياري — سكربتات قابلة للتنفيذ
├── references/ # اختياري — مستندات مرجعية
└── assets/ # اختياري — ملفات ثابتة (إعدادات، بيانات)
```
يجب أن يتطابق اسم المجلد مع حقل `name` في `SKILL.md`. مجلدات `scripts/` و `references/` و `assets/` متاحة في مسار المهارة `path` للوكلاء الذين يحتاجون للإشارة إلى الملفات مباشرة.
---
## المهارات المحمّلة مسبقًا
للمزيد من التحكم، يمكنك اكتشاف المهارات وتفعيلها برمجيًا:
```python
from pathlib import Path
from crewai.skills import discover_skills, activate_skill
# اكتشاف جميع المهارات في مجلد
skills = discover_skills(Path("./skills"))
# تفعيلها (تحميل محتوى SKILL.md الكامل)
activated = [activate_skill(s) for s in skills]
# تمرير إلى وكيل
agent = Agent(
role="Researcher",
goal="Find relevant information",
backstory="An expert researcher.",
skills=activated,
)
```
---
## كيف يتم تحميل المهارات
تستخدم المهارات **الكشف التدريجي** — تحمّل فقط ما هو مطلوب في كل مرحلة:
| المرحلة | ما يتم تحميله | متى |
| :--------- | :------------------------------------ | :------------------ |
| الاكتشاف | الاسم، الوصف، حقول البيانات الوصفية | `discover_skills()` |
| التفعيل | نص محتوى SKILL.md الكامل | `activate_skill()` |
أثناء التنفيذ العادي للوكيل (تمرير مسارات المجلدات عبر `skills=["./skills"]`)، يتم اكتشاف المهارات وتفعيلها تلقائيًا. التحميل التدريجي مهم فقط عند استخدام الواجهة البرمجية.
---
## المهارات مقابل المعرفة
كلا المهارات والمعرفة تُعدّل إرشادات الوكيل، لكنهما يخدمان أغراضًا مختلفة:
| الجانب | المهارات | المعرفة |
| :--- | :--- | :--- |
| **ما توفره** | تعليمات، إجراءات، إرشادات | حقائق، بيانات، معلومات |
| **كيف تُخزّن** | ملفات Markdown (SKILL.md) | مُضمّنة في مخزن متجهي (ChromaDB) |
| **كيف تُسترجع** | يتم حقن المحتوى الكامل في الإرشادات | البحث الدلالي يجد الأجزاء ذات الصلة |
| **الأفضل لـ** | المنهجيات، قوائم التحقق، أدلة الأسلوب | مستندات الشركة، معلومات المنتج، بيانات مرجعية |
| **يُعيّن عبر** | `skills=["./skills"]` | `knowledge_sources=[source]` |
**القاعدة العامة:** إذا كان الوكيل يحتاج لاتباع *عملية*، استخدم مهارة. إذا كان يحتاج للرجوع إلى *بيانات*، استخدم المعرفة.
---
## الأسئلة الشائعة
<AccordionGroup>
<Accordion title="هل أحتاج لتعيين المهارات والأدوات معًا؟">
يعتمد على حالة الاستخدام. المهارات والأدوات **مستقلتان** — يمكنك استخدام أيّ منهما أو كليهما أو لا شيء.
- **مهارات فقط**: عندما يحتاج الوكيل خبرة لكن لا يحتاج إجراءات خارجية (مثال: الكتابة بإرشادات أسلوبية)
- **أدوات فقط**: عندما يحتاج الوكيل إجراءات لكن لا يحتاج منهجية خاصة (مثال: بحث بسيط على الويب)
- **كليهما**: عندما يحتاج الوكيل خبرة وإجراءات (مثال: تدقيق أمني بقوائم تحقق محددة وقدرة على فحص الكود)
</Accordion>
<Accordion title="هل توفر المهارات أدوات تلقائيًا؟">
**لا.** حقل `allowed-tools` في SKILL.md هو بيانات وصفية تجريبية فقط — لا يُنشئ أو يحقن أي أدوات. يجب عليك دائمًا تعيين الأدوات بشكل منفصل عبر `tools=[]` أو `mcps=[]` أو `apps=[]`.
</Accordion>
<Accordion title="ماذا يحدث إذا عيّنت نفس المهارة على كل من الوكيل والطاقم؟">
المهارة على مستوى الوكيل لها الأولوية. يتم إزالة التكرار حسب الاسم — مهارات الوكيل تُعالج أولاً، لذا إذا ظهر نفس اسم المهارة في كلا المستويين، تُستخدم نسخة الوكيل.
</Accordion>
<Accordion title="ما الحجم الأقصى لمحتوى SKILL.md؟">
هناك تحذير ناعم عند 50,000 حرف، لكن بدون حد صارم. حافظ على تركيز المهارات وإيجازها للحصول على أفضل النتائج — الحقن الكبيرة في الإرشادات قد تُشتت انتباه الوكيل.
</Accordion>
</AccordionGroup>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,49 @@
---
title: الاختبار
description: تعرّف على كيفية اختبار طاقم CrewAI وتقييم أدائه.
icon: vial
mode: "wide"
---
## نظرة عامة
يُعد الاختبار جزءًا حيويًا من عملية التطوير، ومن الضروري التأكد من أن طاقمك يعمل كما هو متوقع. مع CrewAI، يمكنك اختبار طاقمك وتقييم أدائه بسهولة باستخدام إمكانيات الاختبار المدمجة.
### استخدام ميزة الاختبار
أضفنا أمر CLI `crewai test` لتسهيل اختبار طاقمك. سيقوم هذا الأمر بتشغيل طاقمك لعدد محدد من التكرارات وتوفير مقاييس أداء مفصلة. المعاملات هي `n_iterations` و `model`، وهي اختيارية وتكون قيمها الافتراضية 2 و `gpt-4o-mini` على التوالي. حاليًا، المزود الوحيد المتاح هو OpenAI.
```bash
crewai test
```
إذا أردت تشغيل المزيد من التكرارات أو استخدام نموذج مختلف، يمكنك تحديد المعاملات هكذا:
```bash
crewai test --n_iterations 5 --model gpt-4o
```
أو باستخدام الصيغة المختصرة:
```bash
crewai test -n 5 -m gpt-4o
```
عند تشغيل أمر `crewai test`، سيتم تنفيذ الطاقم للعدد المحدد من التكرارات، وستُعرض مقاييس الأداء في نهاية التشغيل.
سيظهر جدول الدرجات في النهاية لعرض أداء الطاقم من حيث المقاييس التالية:
<center>**درجات المهام (1-10 الأعلى أفضل)**</center>
| المهام/الطاقم/الوكلاء | التشغيل 1 | التشغيل 2 | المجموع المتوسط | الوكلاء | معلومات إضافية |
|:------------------|:-----:|:-----:|:----------:|:------------------------------:|:---------------------------------|
| المهمة 1 | 9.0 | 9.5 | **9.2** | Professional Insights | |
| | | | | Researcher | |
| المهمة 2 | 9.0 | 10.0 | **9.5** | Company Profile Investigator | |
| المهمة 3 | 9.0 | 9.0 | **9.0** | Automation Insights | |
| | | | | Specialist | |
| المهمة 4 | 9.0 | 9.0 | **9.0** | Final Report Compiler | Automation Insights Specialist |
| الطاقم | 9.00 | 9.38 | **9.2** | | |
| زمن التنفيذ (ثانية) | 126 | 145 | **135** | | |
يوضح المثال أعلاه نتائج الاختبار لتشغيلين للطاقم مع مهمتين، مع الدرجة الإجمالية المتوسطة لكل مهمة والطاقم ككل.

View File

@@ -0,0 +1,290 @@
---
title: الأدوات
description: فهم واستخدام الأدوات ضمن إطار عمل CrewAI لتعاون الوكلاء وتنفيذ المهام.
icon: screwdriver-wrench
mode: "wide"
---
## نظرة عامة
تُمكّن أدوات CrewAI الوكلاء بقدرات تتراوح من البحث على الويب وتحليل البيانات إلى التعاون وتفويض المهام بين الزملاء.
توضح هذه الوثائق كيفية إنشاء هذه الأدوات ودمجها والاستفادة منها ضمن إطار عمل CrewAI، بما في ذلك التركيز على أدوات التعاون.
<Note type="info" title="الأدوات هي أحد أنواع قدرات الوكيل الخمسة">
الأدوات تمنح الوكلاء **دوال قابلة للاستدعاء** لاتخاذ إجراءات. تعمل جنبًا إلى جنب مع [MCP](/ar/mcp/overview) (خوادم أدوات عن بُعد) و[التطبيقات](/ar/concepts/agent-capabilities) (تكاملات المنصة) و[المهارات](/ar/concepts/skills) (خبرة المجال) و[المعرفة](/ar/concepts/knowledge) (حقائق مُسترجعة). راجع نظرة عامة على [قدرات الوكيل](/ar/concepts/agent-capabilities) لفهم متى تستخدم كل نوع.
</Note>
## ما هي الأداة؟
الأداة في CrewAI هي مهارة أو وظيفة يمكن للوكلاء استخدامها لأداء إجراءات مختلفة.
يشمل ذلك أدوات من [مجموعة أدوات CrewAI](https://github.com/joaomdmoura/crewai-tools) و[أدوات LangChain](https://python.langchain.com/docs/integrations/tools)،
مما يُمكّن كل شيء من عمليات البحث البسيطة إلى التفاعلات المعقدة والعمل الجماعي الفعال بين الوكلاء.
<Note type="info" title="تحسين المؤسسات: مستودع الأدوات">
يوفر CrewAI AMP مستودع أدوات شامل مع تكاملات جاهزة لأنظمة الأعمال الشائعة وواجهات API. انشر الوكلاء مع أدوات المؤسسة في دقائق بدلاً من أيام.
يتضمن مستودع أدوات المؤسسة:
- موصلات جاهزة لأنظمة المؤسسة الشائعة
- واجهة إنشاء أدوات مخصصة
- إمكانيات التحكم في الإصدارات والمشاركة
- ميزات الأمان والامتثال
</Note>
## الخصائص الرئيسية للأدوات
- **المنفعة**: مصممة لمهام مثل البحث على الويب وتحليل البيانات وإنشاء المحتوى وتعاون الوكلاء.
- **التكامل**: تعزز قدرات الوكلاء من خلال دمج الأدوات بسلاسة في سير عملهم.
- **القابلية للتخصيص**: توفر المرونة لتطوير أدوات مخصصة أو استخدام الأدوات الموجودة، لتلبية الاحتياجات المحددة للوكلاء.
- **معالجة الأخطاء**: تتضمن آليات معالجة أخطاء قوية لضمان التشغيل السلس.
- **آلية التخزين المؤقت**: تتميز بتخزين مؤقت ذكي لتحسين الأداء وتقليل العمليات المتكررة.
- **الدعم غير المتزامن**: تتعامل مع الأدوات المتزامنة وغير المتزامنة، مما يُمكّن العمليات غير الحاجبة.
## استخدام أدوات CrewAI
لتعزيز قدرات وكلائك بأدوات CrewAI، ابدأ بتثبيت حزمة الأدوات الإضافية:
```bash
pip install 'crewai[tools]'
```
إليك مثالًا يوضح استخدامها:
```python Code
import os
from crewai import Agent, Task, Crew
# استيراد أدوات crewAI
from crewai_tools import (
DirectoryReadTool,
FileReadTool,
SerperDevTool,
WebsiteSearchTool
)
# إعداد مفاتيح API
os.environ["SERPER_API_KEY"] = "Your Key" # serper.dev API key
os.environ["OPENAI_API_KEY"] = "Your Key"
# إنشاء الأدوات
docs_tool = DirectoryReadTool(directory='./blog-posts')
file_tool = FileReadTool()
search_tool = SerperDevTool()
web_rag_tool = WebsiteSearchTool()
# إنشاء الوكلاء
researcher = Agent(
role='Market Research Analyst',
goal='Provide up-to-date market analysis of the AI industry',
backstory='An expert analyst with a keen eye for market trends.',
tools=[search_tool, web_rag_tool],
verbose=True
)
writer = Agent(
role='Content Writer',
goal='Craft engaging blog posts about the AI industry',
backstory='A skilled writer with a passion for technology.',
tools=[docs_tool, file_tool],
verbose=True
)
# تعريف المهام
research = Task(
description='Research the latest trends in the AI industry and provide a summary.',
expected_output='A summary of the top 3 trending developments in the AI industry with a unique perspective on their significance.',
agent=researcher
)
write = Task(
description='Write an engaging blog post about the AI industry, based on the research analyst\'s summary. Draw inspiration from the latest blog posts in the directory.',
expected_output='A 4-paragraph blog post formatted in markdown with engaging, informative, and accessible content, avoiding complex jargon.',
agent=writer,
output_file='blog-posts/new_post.md'
)
# تجميع طاقم مع تفعيل التخطيط
crew = Crew(
agents=[researcher, writer],
tasks=[research, write],
verbose=True,
planning=True,
)
# تنفيذ المهام
crew.kickoff()
```
## أدوات CrewAI المتاحة
- **معالجة الأخطاء**: جميع الأدوات مبنية بقدرات معالجة الأخطاء، مما يسمح للوكلاء بإدارة الاستثناءات بسلاسة ومتابعة مهامهم.
- **آلية التخزين المؤقت**: جميع الأدوات تدعم التخزين المؤقت، مما يُمكّن الوكلاء من إعادة استخدام النتائج المحصلة سابقًا بكفاءة، مما يقلل الحمل على الموارد الخارجية ويسرّع وقت التنفيذ. يمكنك أيضًا تحديد تحكم أدق في آلية التخزين المؤقت باستخدام خاصية `cache_function` على الأداة.
إليك قائمة بالأدوات المتاحة وأوصافها:
| الأداة | الوصف |
| :------------------------------- | :--------------------------------------------------------------------------------------------- |
| **ApifyActorsTool** | أداة تدمج Apify Actors مع سير عملك لمهام استخراج البيانات من الويب والأتمتة. |
| **BrowserbaseLoadTool** | أداة للتفاعل مع المتصفحات واستخراج البيانات منها. |
| **CodeDocsSearchTool** | أداة RAG محسّنة للبحث في وثائق الكود والمستندات التقنية ذات الصلة. |
| **CodeInterpreterTool** | أداة لتفسير كود Python. |
| **ComposioTool** | تُمكّن استخدام أدوات Composio. |
| **CSVSearchTool** | أداة RAG مصممة للبحث في ملفات CSV، مخصصة للتعامل مع البيانات المنظمة. |
| **DALL-E Tool** | أداة لإنشاء الصور باستخدام DALL-E API. |
| **DirectorySearchTool** | أداة RAG للبحث في المجلدات، مفيدة للتنقل في أنظمة الملفات. |
| **DOCXSearchTool** | أداة RAG للبحث في مستندات DOCX، مثالية لمعالجة ملفات Word. |
| **DirectoryReadTool** | تسهّل قراءة ومعالجة هياكل المجلدات ومحتوياتها. |
| **ExaSearchTool** | أداة مصممة لإجراء عمليات بحث شاملة عبر مصادر بيانات متنوعة. |
| **FileReadTool** | تُمكّن قراءة واستخراج البيانات من الملفات، مع دعم تنسيقات ملفات متنوعة. |
| **FirecrawlSearchTool** | أداة للبحث في صفحات الويب باستخدام Firecrawl وإرجاع النتائج. |
| **FirecrawlCrawlWebsiteTool** | أداة لزحف صفحات الويب باستخدام Firecrawl. |
| **FirecrawlScrapeWebsiteTool** | أداة لاستخراج محتوى عناوين URL لصفحات الويب باستخدام Firecrawl. |
| **GithubSearchTool** | أداة RAG للبحث في مستودعات GitHub، مفيدة لبحث الكود والوثائق. |
| **SerperDevTool** | أداة متخصصة لأغراض التطوير، مع وظائف محددة قيد التطوير. |
| **TXTSearchTool** | أداة RAG مركّزة على البحث في ملفات النص (.txt)، مناسبة للبيانات غير المنظمة. |
| **JSONSearchTool** | أداة RAG مصممة للبحث في ملفات JSON، تخدم التعامل مع البيانات المنظمة. |
| **LlamaIndexTool** | تُمكّن استخدام أدوات LlamaIndex. |
| **MDXSearchTool** | أداة RAG مخصصة للبحث في ملفات Markdown (MDX)، مفيدة للوثائق. |
| **PDFSearchTool** | أداة RAG للبحث في مستندات PDF، مثالية لمعالجة المستندات الممسوحة ضوئيًا. |
| **PGSearchTool** | أداة RAG محسّنة للبحث في قواعد بيانات PostgreSQL، مناسبة لاستعلامات قواعد البيانات. |
| **Vision Tool** | أداة لإنشاء الصور باستخدام DALL-E API. |
| **RagTool** | أداة RAG للأغراض العامة قادرة على التعامل مع مصادر وأنواع بيانات متنوعة. |
| **ScrapeElementFromWebsiteTool** | تُمكّن استخراج عناصر محددة من المواقع، مفيدة لاستخراج البيانات المستهدف. |
| **ScrapeWebsiteTool** | تسهّل استخراج المواقع بالكامل، مثالية لجمع البيانات الشامل. |
| **WebsiteSearchTool** | أداة RAG للبحث في محتوى المواقع، محسّنة لاستخراج بيانات الويب. |
| **XMLSearchTool** | أداة RAG مصممة للبحث في ملفات XML، مناسبة لتنسيقات البيانات المنظمة. |
| **YoutubeChannelSearchTool** | أداة RAG للبحث في قنوات YouTube، مفيدة لتحليل محتوى الفيديو. |
| **YoutubeVideoSearchTool** | أداة RAG للبحث في مقاطع فيديو YouTube، مثالية لاستخراج بيانات الفيديو. |
## إنشاء أدواتك الخاصة
<Tip>
يمكن للمطورين إنشاء `أدوات مخصصة` مصممة خصيصًا لاحتياجات وكلائهم أو
استخدام الخيارات الجاهزة.
</Tip>
هناك طريقتان رئيسيتان لإنشاء أداة CrewAI:
### الوراثة من `BaseTool`
```python Code
from crewai.tools import BaseTool
from pydantic import BaseModel, Field
class MyToolInput(BaseModel):
"""Input schema for MyCustomTool."""
argument: str = Field(..., description="Description of the argument.")
class MyCustomTool(BaseTool):
name: str = "Name of my tool"
description: str = "What this tool does. It's vital for effective utilization."
args_schema: Type[BaseModel] = MyToolInput
def _run(self, argument: str) -> str:
# منطق أداتك هنا
return "Tool's result"
```
## دعم الأدوات غير المتزامنة
يدعم CrewAI الأدوات غير المتزامنة، مما يتيح لك تنفيذ أدوات تجري عمليات غير حاجبة مثل طلبات الشبكة وعمليات الإدخال/الإخراج على الملفات أو عمليات async أخرى بدون حجب مسار التنفيذ الرئيسي.
### إنشاء أدوات غير متزامنة
يمكنك إنشاء أدوات غير متزامنة بطريقتين:
#### 1. استخدام مزيّن `tool` مع دوال Async
```python Code
from crewai.tools import tool
@tool("fetch_data_async")
async def fetch_data_async(query: str) -> str:
"""Asynchronously fetch data based on the query."""
# محاكاة عملية غير متزامنة
await asyncio.sleep(1)
return f"Data retrieved for {query}"
```
#### 2. تنفيذ طرق Async في فئات الأدوات المخصصة
```python Code
from crewai.tools import BaseTool
class AsyncCustomTool(BaseTool):
name: str = "async_custom_tool"
description: str = "An asynchronous custom tool"
async def _run(self, query: str = "") -> str:
"""Asynchronously run the tool"""
# تنفيذك غير المتزامن هنا
await asyncio.sleep(1)
return f"Processed {query} asynchronously"
```
### استخدام الأدوات غير المتزامنة
تعمل الأدوات غير المتزامنة بسلاسة في كل من سير عمل الطاقم القياسي وسير عمل التدفق:
```python Code
# في طاقم قياسي
agent = Agent(role="researcher", tools=[async_custom_tool])
# في تدفق
class MyFlow(Flow):
@start()
async def begin(self):
crew = Crew(agents=[agent])
result = await crew.kickoff_async()
return result
```
يتعامل إطار عمل CrewAI تلقائيًا مع تنفيذ الأدوات المتزامنة وغير المتزامنة، لذا لا تحتاج للقلق بشأن كيفية استدعائها بشكل مختلف.
### استخدام مزيّن `tool`
```python Code
from crewai.tools import tool
@tool("Name of my tool")
def my_tool(question: str) -> str:
"""Clear description for what this tool is useful for, your agent will need this information to use it."""
# منطق الدالة هنا
return "Result from your custom tool"
```
### آلية التخزين المؤقت المخصصة
<Tip>
يمكن للأدوات اختياريًا تنفيذ `cache_function` لضبط سلوك
التخزين المؤقت. تحدد هذه الدالة متى يتم تخزين النتائج مؤقتًا بناءً على شروط
محددة، مما يوفر تحكمًا دقيقًا في منطق التخزين المؤقت.
</Tip>
```python Code
from crewai.tools import tool
@tool
def multiplication_tool(first_number: int, second_number: int) -> str:
"""Useful for when you need to multiply two numbers together."""
return first_number * second_number
def cache_func(args, result):
# في هذه الحالة، نخزّن النتيجة مؤقتًا فقط إذا كانت من مضاعفات 2
cache = result % 2 == 0
return cache
multiplication_tool.cache_function = cache_func
writer1 = Agent(
role="Writer",
goal="You write lessons of math for kids.",
backstory="You're an expert in writing and you love to teach kids but you know nothing of math.",
tools=[multiplication_tool],
allow_delegation=False,
)
#...
```
## الخلاصة
الأدوات محورية في توسيع قدرات وكلاء CrewAI، مما يمكّنهم من تنفيذ مجموعة واسعة من المهام والتعاون بفعالية.
عند بناء حلول مع CrewAI، استفد من كل من الأدوات المخصصة والموجودة لتمكين وكلائك وتعزيز نظام الذكاء الاصطناعي البيئي. فكّر في استخدام معالجة الأخطاء وآليات التخزين المؤقت ومرونة معاملات الأدوات لتحسين أداء وقدرات وكلائك.

View File

@@ -0,0 +1,197 @@
---
title: التدريب
description: تعرّف على كيفية تدريب وكلاء CrewAI من خلال تقديم ملاحظات مبكرة والحصول على نتائج متسقة.
icon: dumbbell
mode: "wide"
---
## نظرة عامة
تتيح لك ميزة التدريب في CrewAI تدريب وكلاء الذكاء الاصطناعي باستخدام واجهة سطر الأوامر (CLI).
بتشغيل الأمر `crewai train -n <n_iterations>`، يمكنك تحديد عدد التكرارات لعملية التدريب.
أثناء التدريب، يستخدم CrewAI تقنيات لتحسين أداء وكلائك مع التغذية الراجعة البشرية.
يساعد هذا الوكلاء على تحسين فهمهم واتخاذ القرارات وحل المشكلات.
### تدريب طاقمك باستخدام CLI
لاستخدام ميزة التدريب، اتبع الخطوات التالية:
1. افتح الطرفية أو موجه الأوامر.
2. انتقل إلى المجلد حيث يقع مشروع CrewAI.
3. شغّل الأمر التالي:
```shell
crewai train -n <n_iterations> -f <filename.pkl>
```
<Tip>
استبدل `<n_iterations>` بعدد تكرارات التدريب المرغوب و`<filename>` باسم الملف المناسب المنتهي بـ `.pkl`.
</Tip>
<Note>
إذا حذفت `-f`، فإن المخرجات تُحفظ افتراضيًا في `trained_agents_data.pkl` في مجلد العمل الحالي. يمكنك تمرير مسار مطلق للتحكم في مكان كتابة الملف.
</Note>
### تدريب طاقمك برمجيًا
لتدريب طاقمك برمجيًا، استخدم الخطوات التالية:
1. حدد عدد التكرارات للتدريب.
2. حدد معاملات الإدخال لعملية التدريب.
3. نفّذ أمر التدريب داخل كتلة try-except للتعامل مع الأخطاء المحتملة.
```python Code
n_iterations = 2
inputs = {"topic": "CrewAI Training"}
filename = "your_model.pkl"
try:
YourCrewName_Crew().crew().train(
n_iterations=n_iterations,
inputs=inputs,
filename=filename
)
except Exception as e:
raise Exception(f"An error occurred while training the crew: {e}")
```
## كيف تُستخدم بيانات التدريب من قبل الوكلاء
يستخدم CrewAI مخرجات التدريب بطريقتين: أثناء التدريب لدمج ملاحظاتك البشرية، وبعد التدريب لتوجيه الوكلاء باقتراحات موحدة.
### تدفق بيانات التدريب
```mermaid
flowchart TD
A["Start training<br/>CLI: crewai train -n -f<br/>or Python: crew.train(...)"] --> B["Setup training mode<br/>- task.human_input = true<br/>- disable delegation<br/>- init training_data.pkl + trained file"]
subgraph "Iterations"
direction LR
C["Iteration i<br/>initial_output"] --> D["User human_feedback"]
D --> E["improved_output"]
E --> F["Append to training_data.pkl<br/>by agent_id and iteration"]
end
B --> C
F --> G{"More iterations?"}
G -- "Yes" --> C
G -- "No" --> H["Evaluate per agent<br/>aggregate iterations"]
H --> I["Consolidate<br/>suggestions[] + quality + final_summary"]
I --> J["Save by agent role to trained file<br/>(default: trained_agents_data.pkl)"]
J --> K["Normal (non-training) runs"]
K --> L["Auto-load suggestions<br/>from trained_agents_data.pkl"]
L --> M["Append to prompt<br/>for consistent improvements"]
```
### أثناء تشغيلات التدريب
- في كل تكرار، يسجل النظام لكل وكيل:
- `initial_output`: الإجابة الأولى للوكيل
- `human_feedback`: ملاحظاتك المضمّنة عند الطلب
- `improved_output`: إجابة المتابعة للوكيل بعد الملاحظات
- تُخزن هذه البيانات في ملف عمل باسم `training_data.pkl` مفهرس بمعرّف الوكيل الداخلي والتكرار.
- أثناء نشاط التدريب، يُلحق الوكيل تلقائيًا ملاحظاتك البشرية السابقة بأمره لتطبيق تلك التعليمات في المحاولات اللاحقة ضمن جلسة التدريب.
التدريب تفاعلي: تُعيّن المهام `human_input = true`، لذا سيتوقف التشغيل في بيئة غير تفاعلية بانتظار مدخلات المستخدم.
### بعد اكتمال التدريب
- عند انتهاء `train(...)`، يقيّم CrewAI بيانات التدريب المجمعة لكل وكيل وينتج نتيجة موحدة تحتوي على:
- `suggestions`: تعليمات واضحة وقابلة للتنفيذ مستخلصة من ملاحظاتك والفرق بين المخرجات الأولية/المحسنة
- `quality`: درجة من 0-10 تعكس التحسن
- `final_summary`: مجموعة خطوات عمل تفصيلية للمهام المستقبلية
- تُحفظ هذه النتائج الموحدة في اسم الملف الذي تمرره إلى `train(...)` (الافتراضي عبر CLI هو `trained_agents_data.pkl`). تُفهرس الإدخالات بدور الوكيل `role` لتطبيقها عبر الجلسات.
- أثناء التنفيذ العادي (غير التدريب)، يحمّل كل وكيل تلقائيًا `suggestions` الموحدة ويلحقها بأمر المهمة كتعليمات إلزامية. يمنحك هذا تحسينات متسقة بدون تغيير تعريفات الوكلاء.
### ملخص الملفات
- `training_data.pkl` (مؤقت، لكل جلسة):
- الهيكل: `agent_id -> { iteration_number: { initial_output, human_feedback, improved_output } }`
- الغرض: التقاط البيانات الخام والملاحظات البشرية أثناء التدريب
- الموقع: يُحفظ في مجلد العمل الحالي (CWD)
- `trained_agents_data.pkl` (أو اسم ملفك المخصص):
- الهيكل: `agent_role -> { suggestions: string[], quality: number, final_summary: string }`
- الغرض: استمرار التوجيه الموحد للتشغيلات المستقبلية
- الموقع: يُكتب في CWD افتراضيًا؛ استخدم `-f` لتعيين مسار مخصص (بما في ذلك المطلق)
## اعتبارات نماذج اللغة الصغيرة
<Warning>
عند استخدام نماذج لغة أصغر (≤7 مليار معامل) لتقييم بيانات التدريب، كن على علم أنها قد تواجه تحديات في إنتاج مخرجات منظمة واتباع التعليمات المعقدة.
</Warning>
### قيود النماذج الصغيرة في تقييم التدريب
<CardGroup cols={2}>
<Card title="دقة مخرجات JSON" icon="triangle-exclamation">
غالبًا ما تواجه النماذج الأصغر صعوبة في إنتاج استجابات JSON صالحة مطلوبة لتقييمات التدريب المنظمة، مما يؤدي إلى أخطاء تحليل وبيانات غير مكتملة.
</Card>
<Card title="جودة التقييم" icon="chart-line">
قد توفر النماذج تحت 7 مليار معامل تقييمات أقل دقة مع عمق استدلال محدود مقارنة بالنماذج الأكبر.
</Card>
<Card title="اتباع التعليمات" icon="list-check">
قد لا تُتبع معايير تقييم التدريب المعقدة بالكامل أو تُراعى من قبل النماذج الأصغر.
</Card>
<Card title="الاتساق" icon="rotate">
قد تفتقر التقييمات عبر تكرارات تدريب متعددة إلى الاتساق مع النماذج الأصغر.
</Card>
</CardGroup>
### توصيات للتدريب
<Tabs>
<Tab title="أفضل ممارسة">
لجودة تدريب مثالية وتقييمات موثوقة، نوصي بشدة باستخدام نماذج بحد أدنى 7 مليار معامل أو أكبر:
```python
from crewai import Agent, Crew, Task, LLM
# الحد الأدنى الموصى به لتقييم التدريب
llm = LLM(model="mistral/open-mistral-7b")
# خيارات أفضل لتقييم تدريب موثوق
llm = LLM(model="anthropic/claude-3-sonnet-20240229-v1:0")
llm = LLM(model="gpt-4o")
# استخدم هذا LLM مع وكلائك
agent = Agent(
role="Training Evaluator",
goal="Provide accurate training feedback",
llm=llm
)
```
<Tip>
توفر النماذج الأكثر قوة ملاحظات أعلى جودة مع استدلال أفضل، مما يؤدي إلى تكرارات تدريب أكثر فعالية.
</Tip>
</Tab>
<Tab title="استخدام النماذج الصغيرة">
إذا كان يجب عليك استخدام نماذج أصغر لتقييم التدريب، كن على علم بهذه القيود:
```python
# استخدام نموذج أصغر (توقع بعض القيود)
llm = LLM(model="huggingface/microsoft/Phi-3-mini-4k-instruct")
```
<Warning>
بينما يتضمن CrewAI تحسينات للنماذج الصغيرة، توقع نتائج تقييم أقل موثوقية ودقة قد تتطلب تدخلاً بشريًا أكبر أثناء التدريب.
</Warning>
</Tab>
</Tabs>
### نقاط مهمة يجب ملاحظتها
- **متطلب العدد الصحيح الموجب:** تأكد من أن عدد التكرارات (`n_iterations`) هو عدد صحيح موجب. سيرمي الكود `ValueError` إذا لم يتحقق هذا الشرط.
- **متطلب اسم الملف:** تأكد من أن اسم الملف ينتهي بـ `.pkl`. سيرمي الكود `ValueError` إذا لم يتحقق هذا الشرط.
- **معالجة الأخطاء:** يتعامل الكود مع أخطاء العمليات الفرعية والاستثناءات غير المتوقعة، ويوفر رسائل خطأ للمستخدم.
- يُطبق التوجيه المدرّب في وقت الأمر؛ لا يعدّل تهيئة وكيل Python/YAML.
- يحمّل الوكلاء تلقائيًا الاقتراحات المدربة من ملف باسم `trained_agents_data.pkl` الموجود في مجلد العمل الحالي. إذا درّبت إلى اسم ملف مختلف، أعد تسميته إلى `trained_agents_data.pkl` قبل التشغيل، أو اضبط المحمّل في الكود.
- يمكنك تغيير اسم ملف المخرجات عند استدعاء `crewai train` بـ `-f/--filename`. المسارات المطلقة مدعومة إذا أردت الحفظ خارج CWD.
من المهم ملاحظة أن عملية التدريب قد تستغرق بعض الوقت، اعتمادًا على تعقيد وكلائك وستتطلب أيضًا ملاحظاتك في كل تكرار.
بمجرد اكتمال التدريب، سيكون وكلاؤك مجهزين بقدرات ومعرفة محسّنة، وجاهزين لمعالجة المهام المعقدة وتقديم رؤى أكثر اتساقًا وقيمة.
تذكر تحديث وإعادة تدريب وكلائك بانتظام لضمان بقائهم على اطلاع بأحدث المعلومات والتطورات في المجال.

View File

@@ -0,0 +1,112 @@
---
title: "راقب أتمتاتك"
description: "راقب صحة الأسطول واستهلاك LLM وسلوك كل أتمتة من تبويب Automations."
sidebarTitle: "المراقبة"
icon: "gauge"
mode: "wide"
---
<Info>
**تنقل وثائق ACP (إصدار تجريبي)**
- [نظرة عامة](/ar/enterprise/features/agent-control-plane/overview)
- **المراقبة** *(أنت هنا)*
- [السياسات](/edge/ar/enterprise/features/agent-control-plane/policies)
</Info>
## نظرة عامة
تبويب **Automations** هو عرض العمليات للقراءة فقط في [Agent Control Plane](/ar/enterprise/features/agent-control-plane/overview). يجمع بين بطاقتَي مقاييس و sankey تفاعلي وجدولين فرعيين — **Automations** و **Consumption** — يمكنك البحث والتصفية والفرز فيهما.
<Frame>
![نظرة عامة على Agent Control Plane](/images/enterprise/acp-overview-automations-sankey.png)
</Frame>
تحترم جميع المخططات والجداول مُحدّد **آخر 24 ساعة / الأسبوع الماضي / آخر 30 يوماً** في أعلى اليمين. تقارن قيم الفرق النافذة المختارة بالنافذة السابقة بنفس الطول.
<Note>
تعرض الصفوف بيانات فقط لعمليات النشر على **crewAI v1.13 أو أحدث** — تظهر عمليات النشر الأقدم في لافتة *"We've detected N other automations that we can't display"* أسفل sankey ولا تساهم بأي مقاييس حتى يتم تحديثها وإعادة نشرها. راجع [نظرة عامة — المتطلبات](/ar/enterprise/features/agent-control-plane/overview#المتطلبات).
</Note>
## لوحة المعلومات
يحتوي رأس الصفحة على بطاقتَي مقاييس و sankey تفاعلي. النقر على أي من البطاقتين يبدّل sankey بين وضعَين:
- **وضع الصحة** — `إجمالي الأتمتات → حِزم الحالة (Critical / Warning / Healthy)`. انقر على حِزمة لتصفية جدول Automations إلى عمليات النشر تلك فقط.
- **وضع الاستهلاك** — `مزودو النماذج → الأتمتات → التكلفة الإجمالية`. انقر على مزود لتصفية جدول Consumption إلى ذلك المزود.
| البطاقة | ما تعرضه |
|------|---------------|
| **Automations** | الأتمتات `active` (والعدد الإجمالي)، إجمالي `errors` في النافذة، `active executions` الحالية (والإجمالي في النافذة)، مع الفرق مقابل الفترة السابقة. |
| **Consumption** | إجمالي `cost` و `tokens used`، مع فرق التكلفة مقابل الفترة السابقة. |
<Frame>
![نظرة عامة مع sankey الاستهلاك](/images/enterprise/acp-overview-consumption-sankey.png)
</Frame>
## جدول Automations
التبويب الفرعي **Automations** هو تفصيل صحة الأسطول لكل deployment. كل صف هو crew أو flow منشور.
<Frame>
![جدول الأتمتات مع تفصيل حالة الصحة](/images/enterprise/acp-automations-table.png)
</Frame>
| العمود | ما يعرضه |
|--------|---------------|
| **Automation** | اسم الـ deployment وأي وسوم مُسنَدة إليه (مثل `production`، `financial`). |
| **Last execution** | الوقت المنقضي منذ آخر تنفيذ. |
| **Health Status Breakdown** | شريط مكدّس بنسب `Critical` / `Warning` / `Healthy` لعمليات التنفيذ في النافذة. |
| **Executions with Errors** | إجمالي عمليات التنفيذ الفاشلة في النافذة. |
| **PII detection applied** | `Yes` إذا كان هناك تكوين PII لكل deployment أو [سياسة PII](/edge/ar/enterprise/features/agent-control-plane/policies) مطابِقة نشطة. |
| **Executions** | إجمالي عمليات التنفيذ في النافذة. |
| **Last updated** | متى أُعيد نشر الـ deployment آخر مرة. |
| **Crew Version** | إصدار `crewai` الذي يُبلِّغ عنه الـ deployment. يشير أيقونة المعلومات بجانب الإصدارات الأقل من `1.13` إلى صفوف لا يمكنها المساهمة بالمقاييس. |
ابحث بالاسم، صفِّ حسب `Status` (`Healthy` / `Warning` / `Critical`)، وافرز بأي رأس عمود. انقر على اسم الـ deployment لفتح **لوحة الأتمتة**.
## جدول Consumption
التبويب الفرعي **Consumption** هو تفصيل إنفاق LLM واستخدام الرموز لكل deployment.
<Frame>
![جدول الاستهلاك مُفصَّل حسب مزود LLM](/images/enterprise/acp-consumption-table.png)
</Frame>
| العمود | ما يعرضه |
|--------|---------------|
| **Automation** | اسم الـ deployment. |
| **Last execution** | الوقت المنقضي منذ آخر تنفيذ. |
| **Tokens used** | صف واحد لكل مزود LLM تستخدمه هذه الأتمتة، مع الفرق مقابل الفترة السابقة. |
| **Cost** | التكلفة لكل مزود LLM، مع الفرق مقابل الفترة السابقة. |
| **Total cost** | المجموع عبر جميع المزودين، مع الفرق. |
| **Executions** | إجمالي عمليات التنفيذ في النافذة. |
| **Last updated** | متى أُعيد نشر الـ deployment آخر مرة. |
| **Crew Version** | إصدار `crewai` الذي يُبلِّغ عنه الـ deployment. |
صفِّ حسب **LLM provider** وافرز حسب `Cost` أو `Executions` أو `Last run`.
<Info>
**عادة ما تعني الخلايا الفارغة (`—` أو `$0.00`) أن الـ deployment أدنى من crewAI v1.13.** في اللقطة أعلاه، تظهر *Automation F* (`1.7.0`) و *Automation I* (`1.12.2`) فارغة في الرموز والتكلفة — لا تزال عمليات التنفيذ تعمل، لكنها لا تُصدِر التليمتري على مستوى المزود الذي يُغذِّي هذا الجدول. حدّث هذه الـ crews وأعد نشرها لبدء جمع بيانات الاستهلاك.
</Info>
## ذو صلة
<CardGroup cols={2}>
<Card title="Agent Control Plane — نظرة عامة" icon="book-open" href="/ar/enterprise/features/agent-control-plane/overview">
ما هو ACP، المتطلبات، مستويات الخطط، و RBAC.
</Card>
<Card title="Agent Control Plane — السياسات" icon="shield-check" href="/edge/ar/enterprise/features/agent-control-plane/policies">
طبّق سياسات PII Redaction على مستوى المؤسسة عبر العديد من الأتمتات.
</Card>
<Card title="Traces" icon="timeline" href="/ar/enterprise/features/traces">
تعمّق في تنفيذ واحد لرؤية تفكير الوكيل واستدعاءات الأدوات واستخدام الرموز.
</Card>
<Card title="النشر إلى AMP" icon="rocket" href="/ar/enterprise/guides/deploy-to-amp">
انشر crew على إصدار crewAI يدعم Agent Control Plane.
</Card>
</CardGroup>
<Card title="تحتاج مساعدة؟" icon="headset" href="mailto:support@crewai.com">
تواصل مع فريق الدعم للمساعدة في تفسير المقاييس داخل Agent Control Plane.
</Card>

View File

@@ -0,0 +1,82 @@
---
title: نظرة عامة على Agent Control Plane
description: "مركز عمليات موحّد للأتمتات الجارية — صحة الأسطول واستهلاك LLM والسياسات على مستوى المؤسسة في مكان واحد."
sidebarTitle: نظرة عامة
icon: "book-open"
---
<Info>
**تنقل وثائق ACP (إصدار تجريبي)**
- **نظرة عامة** *(أنت هنا)*
- [المراقبة](/ar/enterprise/features/agent-control-plane/monitoring)
- [السياسات](/edge/ar/enterprise/features/agent-control-plane/policies)
</Info>
## نظرة عامة
**Agent Control Plane** (ACP) هو مركز العمليات لكل ما يعمل لديك على CrewAI AMP. إنها شاشة واحدة — مقسّمة إلى تبويبَي **Automations** و **Policies** — تمنح فريقك القدرة على:
- مراقبة **حالة (الصحة)** كل أتمتة حيّة (crew أو flow) بتفصيل `Critical` / `Warning` / `Healthy` وعدد عمليات التنفيذ.
- تتبع **استهلاك LLM** — الرموز (tokens) والتكلفة — لكل أتمتة ولكل مزود ولكل نموذج، مع الفرق مقابل الفترة السابقة.
- التعمّق في أي أتمتة منفردة أو مزود نماذج لرؤية المخططات الزمنية وتفصيل البيانات لكل مزود.
- تطبيق **سياسات (Policies)** على مستوى المؤسسة (اليوم: PII Redaction) عبر العديد من الأتمتات دفعة واحدة بدلاً من تعديل كل deployment على حدة.
<Frame>
![نظرة عامة على Agent Control Plane](/images/enterprise/acp-overview-automations-sankey.png)
</Frame>
<Note>
Agent Control Plane مُوسوم حالياً بـ **Beta** في CrewAI Platform.
</Note>
يجيب التبويبان عن سؤالَين مختلفَين:
- **Automations** — *"كيف يتصرف أسطولي الآن، وكم يكلّفني؟"* راجع [المراقبة](/ar/enterprise/features/agent-control-plane/monitoring).
- **Policies** — *"كيف أفرض سياسة (مثل PII redaction) عبر العديد من عمليات النشر دون إعادة نشر كل واحدة؟"* راجع [السياسات](/edge/ar/enterprise/features/agent-control-plane/policies).
## المتطلبات
<Warning>
يُشترط **crewAI v1.13 أو أحدث** ليتمكن أي أتمتة من تعبئة أي بيانات على هذه الصفحة — تمر بيانات الصحة وعمليات التنفيذ والأخطاء والرموز والتكلفة عبر التليمتري الذي تم تفعيله في `crewai==1.13`. تظهر عمليات النشر الأقدم في لافتة *"We've detected N other automations that we can't display"* ولا تساهم بأي صفوف حتى يتم تحديثها وإعادة نشرها.
</Warning>
<Warning>
يُشترط **خطة Enterprise أو Ultra** لإنشاء أو تعديل [السياسات](/edge/ar/enterprise/features/agent-control-plane/policies). يمكن للمؤسسات على الخطط الأدنى فتح تبويب Policies وعرض السياسات الموجودة، ولكن يُعرض المحرر للقراءة فقط مع شارة قفل "Enterprise" والتنبيه *"PII Redaction policies require an Enterprise plan."*. المراقبة (تبويب Automations) متاحة في جميع الخطط حيث يكون هذا الميزة مفعّلة.
</Warning>
- يجب أن تكون ميزة **Agent Control Plane** مفعّلة لمؤسستك. إن لم ترها في الشريط الجانبي، اطلب من مالك الحساب تفعيلها.
- داخل ACP، يحكم [RBAC](/ar/enterprise/features/rbac) الوصول: `read` للعرض في لوحة المعلومات والسياسات، و`manage` لإنشاء وتعديل وتشغيل/إيقاف وحذف السياسات.
- يمكن ضبط نطاق جميع المخططات والجداول إلى **آخر 24 ساعة** أو **الأسبوع الماضي** أو **آخر 30 يوماً** عبر مُحدّد الوقت في أعلى اليمين. تقارن قيم الفرق (`↑ 8 vs yesterday`, `↓ $20.57 vs yesterday` وغيرها) النافذة المختارة بالنافذة السابقة بنفس الطول.
## ما يمكنك فعله هنا
<CardGroup cols={2}>
<Card title="المراقبة" icon="gauge" href="/ar/enterprise/features/agent-control-plane/monitoring">
راقب صحة الأسطول وإنفاق LLM عبر بطاقات المقاييس و sankey التفاعلي وجداول لكل أتمتة ولوحات جانبية للتعمق في أي أتمتة أو مزود.
</Card>
<Card title="السياسات" icon="shield-check" href="/edge/ar/enterprise/features/agent-control-plane/policies">
طبّق سياسات PII Redaction على مستوى المؤسسة بنطاق محدد بالأدوات والوسوم. تسري التغييرات في التنفيذ التالي — دون الحاجة لإعادة نشر.
</Card>
</CardGroup>
## ذو صلة
<CardGroup cols={2}>
<Card title="Traces" icon="timeline" href="/ar/enterprise/features/traces">
تعمّق في تنفيذ واحد لرؤية تفكير الوكيل واستدعاءات الأدوات واستخدام الرموز.
</Card>
<Card title="RBAC" icon="users" href="/ar/enterprise/features/rbac">
أدِر من يمكنه قراءة Agent Control Plane ومن يمكنه تعديل السياسات.
</Card>
<Card title="PII Redaction للـ Traces" icon="lock" href="/ar/enterprise/features/pii-trace-redactions">
كتالوج الكيانات وضبط PII لكل deployment التي تستند إليها السياسات.
</Card>
<Card title="النشر إلى AMP" icon="rocket" href="/ar/enterprise/guides/deploy-to-amp">
انشر crew على إصدار crewAI يدعم Agent Control Plane.
</Card>
</CardGroup>
<Card title="تحتاج مساعدة؟" icon="headset" href="mailto:support@crewai.com">
تواصل مع فريق الدعم للمساعدة في تفسير المقاييس أو تصميم السياسات.
</Card>

View File

@@ -0,0 +1,122 @@
---
title: "إعداد السياسات"
description: "طبّق سياسات على مستوى المؤسسة عبر العديد من الأتمتات من مكان واحد."
sidebarTitle: "السياسات"
icon: "shield-check"
mode: "wide"
---
<Info>
**تنقل وثائق ACP (إصدار تجريبي)**
- [نظرة عامة](/ar/enterprise/features/agent-control-plane/overview)
- [المراقبة](/ar/enterprise/features/agent-control-plane/monitoring)
- **السياسات** *(أنت هنا)*
</Info>
## نظرة عامة
تتيح لك السياسات تطبيق سياسات — اليوم: **PII Redaction** — عبر العديد من الأتمتات دفعة واحدة، بدلاً من ضبط كل deployment على حدة. افتح تبويب **Policies** في [Agent Control Plane](/ar/enterprise/features/agent-control-plane/overview) لإدارتها.
<Frame>
![قائمة السياسات](/images/enterprise/acp-policies-list.png)
</Frame>
تعرض كل بطاقة سياسة الاسم والوصف و**النطاق (scope)** الذي تنطبق عليه السياسة (الأدوات والوسوم المختارة) وعدد **الأتمتات المُفعَّلة** — عمليات النشر التي تطابق النطاق حالياً. يقوم المُفتاح على اليمين بتشغيل السياسة أو إيقافها دون حذفها.
## المتطلبات
<Warning>
يُشترط **خطة Enterprise أو Ultra** لإنشاء أو تعديل سياسات PII Redaction. يمكن للمؤسسات على الخطط الأدنى فتح تبويب Policies وعرض السياسات الموجودة، ولكن يُعرض المحرر للقراءة فقط مع شارة قفل "Enterprise" والتنبيه *"PII Redaction policies require an Enterprise plan."* — تواصل مع مالك حسابك أو المبيعات للترقية.
</Warning>
- يجب أن تكون ميزة **Agent Control Plane** مفعّلة لمؤسستك. راجع [نظرة عامة — المتطلبات](/ar/enterprise/features/agent-control-plane/overview#المتطلبات).
- تحتاج إلى صلاحية `manage` ضمن [RBAC](/ar/enterprise/features/rbac) على Agent Control Plane لإنشاء وتعديل وتشغيل/إيقاف وحذف السياسات. صلاحية `read` كافية لعرضها.
- تُسجَّل جميع تغييرات السياسات بإصدارات للتدقيق.
## أنواع السياسات المتاحة
| النوع | ما تفعله |
|------|---------------|
| **PII Redaction** | تطبّق PII redaction على عمليات التنفيذ لكل أتمتة مطابِقة، باستخدام نفس كتالوج الكيانات و recognizers المخصصة الموثَّقة في [PII Redaction للـ Traces](/ar/enterprise/features/pii-trace-redactions). |
سيتم إضافة أنواع سياسات أخرى مع الوقت.
## إنشاء سياسة
<Frame>
<img src="/images/enterprise/acp-policies-new-side-panel.png" alt="لوحة تعديل سياسة جانبية بالشروط ونوع قناع PII" width="450" />
</Frame>
<Steps>
<Step title="افتح المحرر">
انقر على **+ Create new** في أعلى يمين تبويب Policies، أو على **View Details** في بطاقة سياسة موجودة.
</Step>
<Step title="سَمِّ السياسة وصِفها">
أعطِ السياسة اسماً واضحاً (مثل *Mask PII (CC)*) ووصفاً يشرح متى تنطبق. يظهر كلاهما على بطاقة السياسة وفي مودال Engaged Automations.
</Step>
<Step title="اختر النوع">
اليوم **PII Redaction** فقط متاحة.
</Step>
<Step title="حدّد الشروط">
تحدد الشروط الأتمتات التي تنخرط معها السياسة. كلاهما اختياري ويستخدم دلالات **مساواة المجموعات (set-equality)**:
- **Tools** — تنخرط فقط الأتمتات التي تتطابق مجموعة أدواتها **تطابقاً تامّاً** مع الأدوات المختارة. اختر من تطبيقات Studio و MCPs والأدوات مفتوحة المصدر وأدوات سجل Tool Repository.
- **Automations** — تنخرط فقط الأتمتات التي تتطابق مجموعة وسومها **تطابقاً تامّاً** مع الوسوم المختارة.
ترك مُحدِّد فارغ يعني "بدون تصفية على هذا البعد". ترك كليهما فارغَين يعني أن السياسة تنطبق على **كل** أتمتة في المؤسسة.
</Step>
<Step title="اضبط جدول PII Mask Type">
حدّد كل نوع كيان تريد تغطيته واختر **Mask** (يستبدل بتسمية الكيان مثل `<CREDIT_CARD>`) أو **Redact** (يحذف النص المطابِق بالكامل). راجع [PII Redaction للـ Traces](/ar/enterprise/features/pii-trace-redactions) للاطلاع على كتالوج الكيانات الكامل وكيفية إضافة recognizers مخصصة على مستوى المؤسسة.
</Step>
<Step title="احفظ">
تنطبق السياسة على عمليات التنفيذ **المستقبلية** لكل أتمتة مُفعَّلة بمجرد الحفظ. لا حاجة لإعادة النشر.
</Step>
</Steps>
## الأتمتات المُفعَّلة
انقر على **Engaged N automations** في أي بطاقة سياسة لرؤية أي عمليات النشر تطابقها السياسة حالياً بالضبط، إلى جانب آخر تنفيذ لكل منها.
<Frame>
![مودال الأتمتات المُفعَّلة](/images/enterprise/acp-policies-engaged-modal.png)
</Frame>
هذه هي أسرع طريقة للتحقق من نطاق سياسة قبل تمكينها — على سبيل المثال، للتأكد من أن سياسة محدَّدة بنطاق وسم `production` لا تطابق عن طريق الخطأ deployment تجريبي.
## سياسات على مستوى المؤسسة مقابل إعدادات لكل deployment
يمكن ضبط PII Redaction في مكانين:
- **لكل deployment** — ضمن **Settings → PII Protection** على كل deployment على حدة ([الدليل](/ar/enterprise/features/pii-trace-redactions))
- **على مستوى المؤسسة** — كسياسة في هذه الصفحة
عندما يتطابق نطاق سياسة مُفعَّلة على مستوى المؤسسة مع deployment، يُجاوز تكوين الكيانات الخاص بالسياسة **إعدادات PII المملوكة من قبل الـ deployment** لعمليات تنفيذ ذلك الـ deployment — تصبح السياسة المصدر الوحيد للحقيقة طالما هي مرتبطة. عطّل السياسة أو فُكَّ ارتباطها (أو غيِّر نطاقها بحيث لا تتطابق بعد الآن) ويعود الـ deployment إلى إعدادات PII Protection الخاصة به.
فضّل السياسات على مستوى المؤسسة عندما تريد فرض سياسة متسقة عبر العديد من عمليات النشر؛ احتفظ بالضبط لكل deployment للاستثناءات الفردية.
## ذو صلة
<CardGroup cols={2}>
<Card title="Agent Control Plane — نظرة عامة" icon="book-open" href="/ar/enterprise/features/agent-control-plane/overview">
ما هو ACP، المتطلبات، مستويات الخطط، و RBAC.
</Card>
<Card title="Agent Control Plane — المراقبة" icon="gauge" href="/ar/enterprise/features/agent-control-plane/monitoring">
راقب الأتمتات واستهلاك LLM عبر أسطولك.
</Card>
<Card title="PII Redaction للـ Traces" icon="lock" href="/ar/enterprise/features/pii-trace-redactions">
كتالوج الكيانات، recognizers المخصصة، والضبط لكل deployment.
</Card>
<Card title="RBAC" icon="users" href="/ar/enterprise/features/rbac">
أدِر من يمكنه إنشاء أو تعديل السياسات.
</Card>
</CardGroup>
<Card title="تحتاج مساعدة؟" icon="headset" href="mailto:support@crewai.com">
تواصل مع فريق الدعم للمساعدة في تصميم سياسات لمؤسستك.
</Card>

View File

@@ -0,0 +1,155 @@
---
title: 'مستودعات الوكلاء'
description: 'تعرّف على كيفية استخدام مستودعات الوكلاء لمشاركة وإعادة استخدام وكلائك عبر الفرق والمشاريع'
icon: 'people-group'
mode: "wide"
---
تتيح مستودعات الوكلاء لمستخدمي المؤسسات تخزين ومشاركة وإعادة استخدام تعريفات الوكلاء عبر الفرق والمشاريع. تُمكّن هذه الميزة المؤسسات من الاحتفاظ بمكتبة مركزية من الوكلاء الموحدين، مما يعزز الاتساق ويقلل من ازدواجية الجهود.
<Frame>
![Agent Repositories](/images/enterprise/agent-repositories.png)
</Frame>
## فوائد مستودعات الوكلاء
- **التوحيد**: الحفاظ على تعريفات وكلاء متسقة عبر مؤسستك
- **إعادة الاستخدام**: إنشاء وكيل مرة واحدة واستخدامه في أطقم ومشاريع متعددة
- **الحوكمة**: تطبيق سياسات على مستوى المؤسسة لتهيئات الوكلاء
- **التعاون**: تمكين الفرق من المشاركة والبناء على عمل بعضهم البعض
## إنشاء واستخدام مستودعات الوكلاء
1. يجب أن يكون لديك حساب في CrewAI، جرّب [الخطة المجانية](https://app.crewai.com).
2. أنشئ وكلاء بأدوار وأهداف محددة لسير عملك.
3. هيّئ الأدوات والقدرات لكل مساعد متخصص.
4. انشر الوكلاء عبر المشاريع من خلال الواجهة المرئية أو تكامل API.
<Frame>
![Agent Repositories](/images/enterprise/create-agent-repository.png)
</Frame>
### تحميل الوكلاء من المستودعات
يمكنك تحميل الوكلاء من المستودعات في الكود باستخدام معامل `from_repository` للتشغيل محليًا:
```python
from crewai import Agent
# إنشاء وكيل بتحميله من مستودع
# يتم تحميل الوكيل بجميع إعداداته المحددة مسبقًا
researcher = Agent(
from_repository="market-research-agent"
)
```
### تجاوز إعدادات المستودع
يمكنك تجاوز إعدادات محددة من المستودع بتوفيرها في التهيئة:
```python
researcher = Agent(
from_repository="market-research-agent",
goal="Research the latest trends in AI development", # تجاوز هدف المستودع
verbose=True # إضافة إعداد غير موجود في المستودع
)
```
### مثال: إنشاء طاقم مع وكلاء المستودع
```python
from crewai import Crew, Agent, Task
# تحميل الوكلاء من المستودعات
researcher = Agent(
from_repository="market-research-agent"
)
writer = Agent(
from_repository="content-writer-agent"
)
# إنشاء المهام
research_task = Task(
description="Research the latest trends in AI",
agent=researcher
)
writing_task = Task(
description="Write a comprehensive report based on the research",
agent=writer
)
# إنشاء الطاقم
crew = Crew(
agents=[researcher, writer],
tasks=[research_task, writing_task],
verbose=True
)
# تشغيل الطاقم
result = crew.kickoff()
```
### مثال: استخدام `kickoff()` مع وكلاء المستودع
يمكنك أيضًا استخدام وكلاء المستودع مباشرة مع طريقة `kickoff()` للتفاعلات الأبسط:
```python
from crewai import Agent
from pydantic import BaseModel
from typing import List
# تعريف تنسيق مخرجات منظم
class MarketAnalysis(BaseModel):
key_trends: List[str]
opportunities: List[str]
recommendation: str
# تحميل وكيل من المستودع
analyst = Agent(
from_repository="market-analyst-agent",
verbose=True
)
# الحصول على استجابة حرة
result = analyst.kickoff("Analyze the AI market in 2025")
print(result.raw) # الوصول إلى الاستجابة الخام
# الحصول على مخرجات منظمة
structured_result = analyst.kickoff(
"Provide a structured analysis of the AI market in 2025",
response_format=MarketAnalysis
)
# الوصول إلى البيانات المنظمة
print(f"Key Trends: {structured_result.pydantic.key_trends}")
print(f"Recommendation: {structured_result.pydantic.recommendation}")
```
## أفضل الممارسات
1. **اصطلاح التسمية**: استخدم أسماء واضحة ووصفية لوكلاء المستودع
2. **التوثيق**: أدرج أوصافًا شاملة لكل وكيل
3. **إدارة الأدوات**: تأكد من توفر الأدوات المشار إليها بواسطة وكلاء المستودع في بيئتك
4. **التحكم في الوصول**: أدر الصلاحيات لضمان أن أعضاء الفريق المصرّح لهم فقط يمكنهم تعديل وكلاء المستودع
## إدارة المؤسسة
للتبديل بين المؤسسات أو عرض مؤسستك الحالية، استخدم واجهة سطر أوامر CrewAI:
```bash
# عرض المؤسسة الحالية
crewai org current
# التبديل إلى مؤسسة مختلفة
crewai org switch <org_id>
# عرض جميع المؤسسات المتاحة
crewai org list
```
<Note>
عند تحميل الوكلاء من المستودعات، يجب أن تكون مصادقًا ومتحولًا إلى المؤسسة الصحيحة. إذا تلقيت أخطاء، تحقق من حالة المصادقة وإعدادات المؤسسة باستخدام أوامر CLI أعلاه.
</Note>

View File

@@ -0,0 +1,104 @@
---
title: الأتمتة
description: "إدارة ونشر ومراقبة أطقمك المباشرة (الأتمتة) في مكان واحد."
icon: "rocket"
mode: "wide"
---
## نظرة عامة
الأتمتة هي مركز العمليات المباشرة لأطقمك المنشورة. استخدمها للنشر من GitHub أو ملف ZIP، وإدارة متغيرات البيئة، وإعادة النشر عند الحاجة، ومراقبة حالة كل أتمتة.
<Frame>
![Automations Overview](/images/enterprise/automations-overview.png)
</Frame>
## طرق النشر
### النشر من GitHub
استخدم هذا للمشاريع ذات التحكم في الإصدارات والنشر المستمر.
<Steps>
<Step title="ربط GitHub">
انقر على <b>Configure GitHub</b> وصرّح بالوصول.
</Step>
<Step title="اختيار المستودع والفرع">
اختر <b>المستودع</b> و<b>الفرع</b> الذي تريد النشر منه.
</Step>
<Step title="تفعيل النشر التلقائي (اختياري)">
فعّل <b>النشر التلقائي للالتزامات الجديدة</b> لإرسال التحديثات مع كل دفع.
</Step>
<Step title="إضافة متغيرات البيئة">
أضف المتغيرات السرية فرديًا أو استخدم <b>العرض الجماعي</b> لمتغيرات متعددة.
</Step>
<Step title="النشر">
انقر على <b>Deploy</b> لإنشاء الأتمتة المباشرة.
</Step>
</Steps>
<Frame>
![GitHub Deployment](/images/enterprise/deploy-from-github.png)
</Frame>
### النشر من ZIP
انشر بسرعة بدون Git — ارفع حزمة مضغوطة من مشروعك.
<Steps>
<Step title="اختيار الملف">
اختر أرشيف ZIP من جهازك.
</Step>
<Step title="إضافة متغيرات البيئة">
وفّر أي متغيرات أو مفاتيح مطلوبة.
</Step>
<Step title="النشر">
انقر على <b>Deploy</b> لإنشاء الأتمتة المباشرة.
</Step>
</Steps>
<Frame>
![ZIP Deployment](/images/enterprise/deploy-from-zip.png)
</Frame>
## لوحة تحكم الأتمتة
يعرض الجدول جميع الأتمتة المباشرة مع التفاصيل الرئيسية:
- **CREW**: اسم الأتمتة
- **STATUS**: متصل / فشل / قيد التنفيذ
- **URL**: نقطة نهاية التشغيل/الحالة
- **TOKEN**: رمز الأتمتة
- **ACTIONS**: إعادة النشر، الحذف، والمزيد
استخدم عناصر التحكم في أعلى اليمين للتصفية والبحث:
- البحث بالاسم
- التصفية حسب <b>الحالة</b>
- التصفية حسب <b>المصدر</b> (GitHub / Studio / ZIP)
بعد النشر، يمكنك عرض تفاصيل الأتمتة واستخدام القائمة المنسدلة **الخيارات** لـ `الدردشة مع هذا الطاقم`، `تصدير مكون React` و`التصدير كـ MCP`.
<Frame>
![Automations Table](/images/enterprise/automations-table.png)
</Frame>
## أفضل الممارسات
- فضّل نشر GitHub للتحكم في الإصدارات وCI/CD
- استخدم إعادة النشر للتقدم بعد تحديثات الكود أو التهيئة أو اضبطه على النشر التلقائي مع كل دفع
## ذات صلة
<CardGroup cols={3}>
<Card title="نشر طاقم" href="/ar/enterprise/guides/deploy-to-amp" icon="rocket">
انشر طاقمًا من GitHub أو ملف ZIP.
</Card>
<Card title="مشغلات الأتمتة" href="/ar/enterprise/guides/automation-triggers" icon="trigger">
شغّل الأتمتة عبر webhooks أو API.
</Card>
<Card title="أتمتة Webhook" href="/ar/enterprise/guides/webhook-automation" icon="webhook">
بث الأحداث والتحديثات في الوقت الفعلي إلى أنظمتك.
</Card>
</CardGroup>

View File

@@ -0,0 +1,88 @@
---
title: استوديو الطاقم
description: "إنشاء أتمتة جديدة بمساعدة الذكاء الاصطناعي ومحرر مرئي واختبار متكامل."
icon: "pencil"
mode: "wide"
---
## نظرة عامة
استوديو الطاقم هو مساحة عمل تفاعلية بمساعدة الذكاء الاصطناعي لإنشاء أتمتة جديدة من الصفر باستخدام اللغة الطبيعية ومحرر سير عمل مرئي.
<Frame>
![Crew Studio Overview](/images/enterprise/crew-studio-overview.png)
</Frame>
## الإنشاء المبني على الأوامر النصية
- صِف الأتمتة التي تريدها؛ يقوم الذكاء الاصطناعي بإنشاء الوكلاء والمهام والأدوات.
- استخدم الإدخال الصوتي عبر أيقونة الميكروفون إذا فضّلت ذلك.
- ابدأ من أوامر مدمجة لحالات الاستخدام الشائعة.
<Frame>
![Prompt Builder](/images/enterprise/crew-studio-prompt.png)
</Frame>
## المحرر المرئي
يعكس اللوح سير العمل كعُقد وأسهم مع ثلاث لوحات داعمة تتيح لك تهيئة سير العمل بسهولة بدون كتابة كود؛ ما يُعرف بـ "**البرمجة الحدسية لوكلاء الذكاء الاصطناعي**".
يمكنك استخدام وظيفة السحب والإفلات لإضافة الوكلاء والمهام والأدوات إلى اللوح أو استخدام قسم الدردشة لبناء الوكلاء. يتشارك كلا النهجين الحالة ويمكن استخدامهما بالتبادل.
- **أفكار AI (يسار)**: الاستدلال المتدفق أثناء تصميم سير العمل
- **اللوح (المركز)**: الوكلاء والمهام كعقد متصلة
- **الموارد (يمين)**: مكونات السحب والإفلات (وكلاء، مهام، أدوات)
<Frame>
![Visual Canvas](/images/enterprise/crew-studio-canvas.png)
</Frame>
## التنفيذ والتصحيح
انتقل إلى عرض <b>التنفيذ</b> لتشغيل سير العمل ومراقبته:
- الجدول الزمني للأحداث
- سجلات مفصلة (التفاصيل، الرسائل، البيانات الخام)
- اختبارات محلية قبل النشر
<Frame>
![Execution View](/images/enterprise/crew-studio-execution.png)
</Frame>
## النشر والتصدير
- <b>انشر</b> لنشر أتمتة مباشرة
- <b>حمّل</b> المصدر كملف ZIP للتطوير المحلي أو التخصيص
<Frame>
![Publish & Download](/images/enterprise/crew-studio-publish.png)
</Frame>
بعد النشر، يمكنك عرض تفاصيل الأتمتة واستخدام القائمة المنسدلة **الخيارات** لـ `الدردشة مع هذا الطاقم`، `تصدير مكون React` و`التصدير كـ MCP`.
<Frame>
![Published Automation](/images/enterprise/crew-studio-published.png)
</Frame>
## أفضل الممارسات
- كرر بسرعة في الاستوديو؛ انشر فقط عندما يكون مستقرًا
- اقصر الأدوات على الحد الأدنى من الصلاحيات المطلوبة
- استخدم التتبعات للتحقق من السلوك والأداء
## ذات صلة
<CardGroup cols={4}>
<Card title="تفعيل استوديو الطاقم" href="/ar/enterprise/guides/enable-crew-studio" icon="palette">
تفعيل استوديو الطاقم.
</Card>
<Card title="بناء طاقم" href="/ar/enterprise/guides/build-crew" icon="paintbrush">
بناء طاقم.
</Card>
<Card title="نشر طاقم" href="/ar/enterprise/guides/deploy-to-amp" icon="rocket">
نشر طاقم من GitHub أو ملف ZIP.
</Card>
<Card title="تصدير مكون React" href="/ar/enterprise/guides/react-component-export" icon="download">
تصدير مكون React.
</Card>
</CardGroup>

View File

@@ -0,0 +1,558 @@
---
title: "إدارة HITL للتدفقات"
description: "مراجعة بشرية بمستوى المؤسسات للتدفقات مع إشعارات البريد الإلكتروني أولاً وقواعد التوجيه وإمكانيات الاستجابة التلقائية"
icon: "users-gear"
mode: "wide"
---
<Note>
تتطلب ميزات إدارة Flow HITL مزيّن `@human_feedback`، المتاح في **CrewAI الإصدار 1.8.0 أو أحدث**. تنطبق هذه الميزات تحديدًا على **التدفقات (Flows)**، وليس الأطقم (Crews).
</Note>
يوفر CrewAI Enterprise نظامًا شاملًا لإدارة الإنسان في الحلقة (HITL) للتدفقات يحوّل سير عمل الذكاء الاصطناعي إلى عمليات تعاونية بين الإنسان والذكاء الاصطناعي. تستخدم المنصة **بنية البريد الإلكتروني أولاً** التي تمكّن أي شخص لديه عنوان بريد إلكتروني من الرد على طلبات المراجعة — بدون الحاجة لحساب على المنصة.
## نظرة عامة
<CardGroup cols={3}>
<Card title="تصميم البريد الإلكتروني أولاً" icon="envelope">
يمكن للمستجيبين الرد مباشرة على رسائل الإشعار لتقديم الملاحظات
</Card>
<Card title="توجيه مرن" icon="route">
توجيه الطلبات إلى بريد إلكتروني محدد بناءً على أنماط الطرق أو حالة التدفق
</Card>
<Card title="استجابة تلقائية" icon="clock">
تهيئة استجابات احتياطية تلقائية عندما لا يرد أي شخص في الوقت المحدد
</Card>
</CardGroup>
### الفوائد الرئيسية
- **نموذج ذهني بسيط**: عناوين البريد الإلكتروني عالمية؛ لا حاجة لإدارة مستخدمين أو أدوار المنصة
- **مستجيبون خارجيون**: يمكن لأي شخص لديه بريد إلكتروني الرد، حتى غير مستخدمي المنصة
- **تعيين ديناميكي**: سحب بريد المعيّن مباشرة من حالة التدفق (مثل `sales_rep_email`)
- **تهيئة مخفضة**: إعدادات أقل للتهيئة، وقت أسرع للقيمة
- **البريد الإلكتروني كقناة رئيسية**: يفضل معظم المستخدمين الرد عبر البريد الإلكتروني بدلاً من تسجيل الدخول إلى لوحة التحكم
## إعداد نقاط المراجعة البشرية في التدفقات
هيّئ نقاط تفتيش المراجعة البشرية داخل تدفقاتك باستخدام مزيّن `@human_feedback`. عندما يصل التنفيذ إلى نقطة مراجعة، يتوقف النظام ويُخطر المعيّن عبر البريد الإلكتروني وينتظر الاستجابة.
```python
from crewai.flow.flow import Flow, start, listen, or_
from crewai.flow.human_feedback import human_feedback, HumanFeedbackResult
class ContentApprovalFlow(Flow):
@start()
def generate_content(self):
return "Generated marketing copy for Q1 campaign..."
@human_feedback(
message="Please review this content for brand compliance:",
emit=["approved", "rejected", "needs_revision"],
)
@listen(or_("generate_content", "needs_revision"))
def review_content(self):
return "Marketing copy for review..."
@listen("approved")
def publish_content(self, result: HumanFeedbackResult):
print(f"Publishing approved content. Reviewer notes: {result.feedback}")
@listen("rejected")
def archive_content(self, result: HumanFeedbackResult):
print(f"Content rejected. Reason: {result.feedback}")
```
للحصول على تفاصيل التنفيذ الكاملة، راجع دليل [التغذية الراجعة البشرية في التدفقات](/ar/learn/human-feedback-in-flows).
### معاملات المزيّن
| المعامل | النوع | الوصف |
|-----------|------|-------------|
| `message` | `str` | الرسالة المعروضة للمراجع البشري |
| `emit` | `list[str]` | خيارات الاستجابة الصالحة (تُعرض كأزرار في الواجهة) |
## تهيئة المنصة
الوصول إلى تهيئة HITL من: **النشر** ← **الإعدادات** ← **تهيئة الإنسان في الحلقة**
<Frame>
<img src="/images/enterprise/hitl-settings-overview.png" alt="HITL Configuration Settings" />
</Frame>
### إشعارات البريد الإلكتروني
تبديل لتفعيل أو تعطيل إشعارات البريد الإلكتروني لطلبات HITL.
| الإعداد | الافتراضي | الوصف |
|---------|---------|-------------|
| إشعارات البريد الإلكتروني | مفعّل | إرسال رسائل عند طلب الملاحظات |
<Note>
عند التعطيل، يجب على المستجيبين استخدام واجهة لوحة التحكم أو يجب تهيئة webhooks لأنظمة إشعارات مخصصة.
</Note>
### هدف SLA
تعيين وقت استجابة مستهدف لأغراض التتبع والمقاييس.
| الإعداد | الوصف |
|---------|-------------|
| هدف SLA (دقائق) | وقت الاستجابة المستهدف. يُستخدم لمقاييس لوحة التحكم وتتبع SLA |
اتركه فارغًا لتعطيل تتبع SLA.
## إشعارات واستجابات البريد الإلكتروني
يستخدم نظام HITL بنية البريد الإلكتروني أولاً حيث يمكن للمستجيبين الرد مباشرة على رسائل الإشعار.
### كيف تعمل استجابات البريد الإلكتروني
<Steps>
<Step title="إرسال الإشعار">
عند إنشاء طلب HITL، يُرسل بريد إلكتروني إلى المستجيب المعيّن مع محتوى المراجعة والسياق.
</Step>
<Step title="عنوان الرد">
يتضمن البريد عنوان رد خاص مع رمز موقّع للمصادقة.
</Step>
<Step title="رد المستخدم">
يرد المستجيب ببساطة على البريد بملاحظاته — بدون حاجة لتسجيل الدخول.
</Step>
<Step title="التحقق من الرمز">
تستقبل المنصة الرد، وتتحقق من الرمز الموقّع، وتطابق بريد المرسل.
</Step>
<Step title="استئناف التدفق">
تُسجل الملاحظات ويستمر التدفق مع مدخلات الإنسان.
</Step>
</Steps>
### تنسيق الاستجابة
يمكن للمستجيبين الرد بـ:
- **خيار emit**: إذا تطابق الرد مع خيار `emit` (مثل "approved")، يُستخدم مباشرة
- **نص حر**: أي نص استجابة يُمرر إلى التدفق كملاحظات
- **نص عادي**: يُستخدم السطر الأول من نص الرد كملاحظات
### رسائل التأكيد
بعد معالجة الرد، يستلم المستجيب رسالة تأكيد تشير إلى ما إذا تم إرسال الملاحظات بنجاح أو حدث خطأ.
### أمان رمز البريد
- الرموز موقّعة تشفيريًا للأمان
- تنتهي صلاحية الرموز بعد 7 أيام
- يجب أن يتطابق بريد المرسل مع البريد المصرّح به في الرمز
- تُرسل رسائل تأكيد/خطأ بعد المعالجة
## قواعد التوجيه
توجيه طلبات HITL إلى عناوين بريد إلكتروني محددة بناءً على أنماط الطرق.
<Frame>
<img src="/images/enterprise/hitl-settings-routing-rules.png" alt="HITL Routing Rules Configuration" />
</Frame>
### هيكل القاعدة
```json
{
"name": "Approvals to Finance",
"match": {
"method_name": "approve_*"
},
"assign_to_email": "finance@company.com",
"assign_from_input": "manager_email"
}
```
### أنماط المطابقة
| النمط | الوصف | مثال المطابقة |
|---------|-------------|---------------|
| `approve_*` | حرف بدل (أي أحرف) | `approve_payment`، `approve_vendor` |
| `review_?` | حرف واحد | `review_a`، `review_1` |
| `validate_payment` | مطابقة تامة | `validate_payment` فقط |
### أولوية التعيين
1. **تعيين ديناميكي** (`assign_from_input`): إذا تم تهيئته، يسحب البريد من حالة التدفق
2. **بريد ثابت** (`assign_to_email`): يرجع إلى البريد المهيأ
3. **منشئ النشر**: إذا لم تتطابق أي قاعدة، يُستخدم بريد منشئ النشر
### مثال التعيين الديناميكي
إذا كانت حالة تدفقك تحتوي على `{"sales_rep_email": "alice@company.com"}`، هيّئ:
```json
{
"name": "Route to Sales Rep",
"match": {
"method_name": "review_*"
},
"assign_from_input": "sales_rep_email"
}
```
سيتم تعيين الطلب إلى `alice@company.com` تلقائيًا.
<Tip>
**حالة استخدام**: اسحب المعيّن من CRM أو قاعدة البيانات أو خطوة تدفق سابقة لتوجيه المراجعات ديناميكيًا إلى الشخص المناسب.
</Tip>
## الاستجابة التلقائية
الاستجابة تلقائيًا لطلبات HITL إذا لم يستجب أي شخص خلال المهلة المحددة. يضمن هذا عدم تعليق التدفقات إلى أجل غير مسمى.
### التهيئة
| الإعداد | الوصف |
|---------|-------------|
| مفعّل | تبديل لتفعيل الاستجابة التلقائية |
| المهلة (دقائق) | الوقت المنتظر قبل الاستجابة التلقائية |
| النتيجة الافتراضية | قيمة الاستجابة (يجب أن تطابق خيار `emit`) |
<Frame>
<img src="/images/enterprise/hitl-settings-auto-respond.png" alt="HITL Auto-Response Configuration" />
</Frame>
### حالات الاستخدام
- **الامتثال لـ SLA**: ضمان عدم تعليق التدفقات إلى أجل غير مسمى
- **الموافقة الافتراضية**: الموافقة التلقائية على الطلبات منخفضة المخاطر بعد انتهاء المهلة
- **التراجع السلس**: المتابعة بافتراضي آمن عندما يكون المراجعون غير متاحين
<Warning>
استخدم الاستجابة التلقائية بحذر. فعّلها فقط للمراجعات غير الحرجة حيث تكون الاستجابة الافتراضية مقبولة.
</Warning>
## عملية المراجعة
### واجهة لوحة التحكم
توفر واجهة مراجعة HITL تجربة نظيفة ومركّزة للمراجعين:
- **عرض Markdown**: تنسيق غني لمحتوى المراجعة مع تمييز الصيغة
- **لوحة السياق**: عرض حالة التدفق وتاريخ التنفيذ والمعلومات ذات الصلة
- **إدخال الملاحظات**: تقديم ملاحظات وتعليقات مفصلة مع قرارك
- **إجراءات سريعة**: أزرار خيارات emit بنقرة واحدة مع تعليقات اختيارية
<Frame>
<img src="/images/enterprise/hitl-list-pending-feedbacks.png" alt="HITL Pending Requests List" />
</Frame>
### طرق الاستجابة
يمكن للمراجعين الاستجابة عبر ثلاث قنوات:
| الطريقة | الوصف |
|--------|-------------|
| **الرد عبر البريد** | الرد مباشرة على رسالة الإشعار |
| **لوحة التحكم** | استخدام واجهة لوحة تحكم المؤسسة |
| **API/Webhook** | استجابة برمجية عبر API |
### السجل ومسار التدقيق
يتم تتبع كل تفاعل HITL بجدول زمني كامل:
- سجل القرارات (موافقة/رفض/مراجعة)
- هوية المراجع والطابع الزمني
- الملاحظات والتعليقات المقدمة
- طريقة الاستجابة (بريد/لوحة تحكم/API)
- مقاييس وقت الاستجابة
## التحليلات والمراقبة
تتبع أداء HITL مع تحليلات شاملة.
### لوحة تحكم الأداء
<Frame>
<img src="/images/enterprise/hitl-metrics.png" alt="HITL Metrics Dashboard" />
</Frame>
<CardGroup cols={2}>
<Card title="أوقات الاستجابة" icon="stopwatch">
مراقبة متوسط وميديان أوقات الاستجابة حسب المراجع أو التدفق.
</Card>
<Card title="اتجاهات الحجم" icon="chart-bar">
تحليل أنماط حجم المراجعة لتحسين قدرة الفريق.
</Card>
<Card title="توزيع القرارات" icon="chart-pie">
عرض معدلات الموافقة/الرفض عبر أنواع المراجعة المختلفة.
</Card>
<Card title="تتبع SLA" icon="chart-line">
تتبع نسبة المراجعات المكتملة ضمن أهداف SLA.
</Card>
</CardGroup>
### التدقيق والامتثال
إمكانيات تدقيق جاهزة للمؤسسات للمتطلبات التنظيمية:
- سجل قرارات كامل مع الطوابع الزمنية
- التحقق من هوية المراجع
- سجلات تدقيق غير قابلة للتغيير
- إمكانيات التصدير لتقارير الامتثال
## حالات الاستخدام الشائعة
<AccordionGroup>
<Accordion title="المراجعات الأمنية" icon="shield-halved">
**حالة الاستخدام**: أتمتة استبيانات الأمان الداخلية مع التحقق البشري
- يولّد الذكاء الاصطناعي الردود على الاستبيانات الأمنية
- يراجع فريق الأمن ويتحقق من الدقة عبر البريد الإلكتروني
- يتم تجميع الردود المعتمدة في التقديم النهائي
- مسار تدقيق كامل للامتثال
</Accordion>
<Accordion title="الموافقة على المحتوى" icon="file-lines">
**حالة الاستخدام**: محتوى تسويقي يتطلب مراجعة قانونية/العلامة التجارية
- يولّد الذكاء الاصطناعي نصوص تسويقية أو محتوى وسائل التواصل
- التوجيه إلى بريد فريق العلامة التجارية لمراجعة النبرة/الأسلوب
- النشر التلقائي عند الموافقة
</Accordion>
<Accordion title="الموافقات المالية" icon="money-bill">
**حالة الاستخدام**: تقارير النفقات، شروط العقود، تخصيصات الميزانية
- يعالج الذكاء الاصطناعي مسبقًا ويصنف الطلبات المالية
- التوجيه بناءً على عتبات المبالغ باستخدام التعيين الديناميكي
- الحفاظ على مسار تدقيق كامل للامتثال المالي
</Accordion>
<Accordion title="التعيين الديناميكي من CRM" icon="database">
**حالة الاستخدام**: توجيه المراجعات إلى مالكي الحسابات من CRM
- يجلب التدفق بريد مالك الحساب من CRM
- تخزين البريد في حالة التدفق (مثل `account_owner_email`)
- استخدام `assign_from_input` للتوجيه إلى الشخص المناسب تلقائيًا
</Accordion>
<Accordion title="ضمان الجودة" icon="magnifying-glass">
**حالة الاستخدام**: التحقق من مخرجات الذكاء الاصطناعي قبل التسليم للعميل
- يولّد الذكاء الاصطناعي محتوى أو ردود موجهة للعميل
- يراجع فريق ضمان الجودة عبر إشعار البريد الإلكتروني
- حلقات الملاحظات تحسّن أداء الذكاء الاصطناعي بمرور الوقت
</Accordion>
</AccordionGroup>
## واجهة Webhooks API
عندما تتوقف تدفقاتك للملاحظات البشرية، يمكنك تهيئة webhooks لإرسال بيانات الطلب إلى تطبيقك. يتيح هذا:
- بناء واجهات موافقة مخصصة
- التكامل مع الأدوات الداخلية (Jira، ServiceNow، لوحات تحكم مخصصة)
- توجيه الموافقات إلى أنظمة طرف ثالث
- إشعارات تطبيقات الجوال
- أنظمة القرار المؤتمتة
<Frame>
<img src="/images/enterprise/hitl-settings-webhook.png" alt="HITL Webhook Configuration" />
</Frame>
### تهيئة Webhooks
<Steps>
<Step title="الانتقال إلى الإعدادات">
اذهب إلى **النشر** ← **الإعدادات** ← **الإنسان في الحلقة**
</Step>
<Step title="توسيع قسم Webhooks">
انقر لتوسيع تهيئة **Webhooks**
</Step>
<Step title="إضافة عنوان Webhook">
أدخل عنوان webhook الخاص بك (يجب أن يكون HTTPS في الإنتاج)
</Step>
<Step title="حفظ التهيئة">
انقر على **حفظ التهيئة** للتفعيل
</Step>
</Steps>
يمكنك تهيئة webhooks متعددة. يستقبل كل webhook نشط جميع أحداث HITL.
### أحداث Webhook
ستستقبل نقطة النهاية طلبات HTTP POST لهذه الأحداث:
| نوع الحدث | متى يُطلق |
|------------|----------------|
| `new_request` | يتوقف تدفق ويطلب ملاحظات بشرية |
### حمولة Webhook
تستقبل جميع webhooks حمولة JSON بهذا الهيكل:
```json
{
"event": "new_request",
"request": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"flow_id": "flow_abc123",
"method_name": "review_article",
"message": "Please review this article for publication.",
"emit_options": ["approved", "rejected", "request_changes"],
"state": {
"article_id": 12345,
"author": "john@example.com",
"category": "technology"
},
"metadata": {},
"created_at": "2026-01-14T12:00:00Z"
},
"deployment": {
"id": 456,
"name": "Content Review Flow",
"organization_id": 789
},
"callback_url": "https://api.crewai.com/...",
"assigned_to_email": "reviewer@company.com"
}
```
### الرد على الطلبات
لإرسال الملاحظات، **أرسل POST إلى `callback_url`** المضمّن في حمولة webhook.
```http
POST {callback_url}
Content-Type: application/json
{
"feedback": "Approved. Great article!",
"source": "my_custom_app"
}
```
### الأمان
<Info>
جميع طلبات webhook موقّعة تشفيريًا باستخدام HMAC-SHA256 لضمان الأصالة ومنع التلاعب.
</Info>
#### أمان Webhook
- **توقيعات HMAC-SHA256**: يتضمن كل webhook توقيعًا تشفيريًا
- **أسرار لكل webhook**: لكل webhook سر توقيع فريد
- **مشفرة أثناء التخزين**: أسرار التوقيع مشفرة في قاعدة البيانات
- **التحقق من الطابع الزمني**: يمنع هجمات الإعادة
#### ترويسات التوقيع
يتضمن كل طلب webhook هذه الترويسات:
| الترويسة | الوصف |
|--------|-------------|
| `X-Signature` | توقيع HMAC-SHA256: `sha256=<hex_digest>` |
| `X-Timestamp` | الطابع الزمني Unix عند توقيع الطلب |
#### التحقق
تحقق بحساب:
```python
import hmac
import hashlib
expected = hmac.new(
signing_secret.encode(),
f"{timestamp}.{payload}".encode(),
hashlib.sha256
).hexdigest()
if hmac.compare_digest(expected, signature):
# توقيع صالح
```
### معالجة الأخطاء
يجب أن تعيد نقطة نهاية webhook كود حالة 2xx لتأكيد الاستلام:
| استجابتك | سلوكنا |
|---------------|--------------|
| 2xx | تم تسليم Webhook بنجاح |
| 4xx/5xx | مسجل كفشل، بدون إعادة محاولة |
| مهلة (30 ثانية) | مسجل كفشل، بدون إعادة محاولة |
## الأمان والتحكم في الوصول المبني على الأدوار
### الوصول إلى لوحة التحكم
يُتحكم في وصول HITL على مستوى النشر:
| الصلاحية | القدرة |
|------------|------------|
| `manage_human_feedback` | تهيئة إعدادات HITL، عرض جميع الطلبات |
| `respond_to_human_feedback` | الرد على الطلبات، عرض الطلبات المعيّنة |
### تصريح استجابة البريد الإلكتروني
للردود عبر البريد:
1. يشفّر رمز الرد البريد المصرّح به
2. يجب أن يتطابق بريد المرسل مع بريد الرمز
3. يجب ألا يكون الرمز منتهي الصلاحية (7 أيام افتراضيًا)
4. يجب أن يكون الطلب لا يزال معلقًا
### مسار التدقيق
يتم تسجيل جميع إجراءات HITL:
- إنشاء الطلب
- تغييرات التعيين
- إرسال الاستجابة (مع المصدر: لوحة تحكم/بريد/API)
- حالة استئناف التدفق
## استكشاف الأخطاء وإصلاحها
### عدم إرسال الرسائل
1. تحقق من تفعيل "إشعارات البريد الإلكتروني" في التهيئة
2. تحقق من مطابقة قواعد التوجيه لاسم الطريقة
3. تحقق من صلاحية بريد المعيّن
4. تحقق من احتياطي منشئ النشر إذا لم تتطابق أي قواعد توجيه
### عدم معالجة ردود البريد
1. تحقق من عدم انتهاء صلاحية الرمز (7 أيام افتراضيًا)
2. تحقق من مطابقة بريد المرسل للبريد المعيّن
3. تأكد من أن الطلب لا يزال معلقًا (لم يتم الرد عليه بعد)
### عدم استئناف التدفق
1. تحقق من حالة الطلب في لوحة التحكم
2. تحقق من إمكانية الوصول إلى callback URL
3. تأكد من أن النشر لا يزال قيد التشغيل
## أفضل الممارسات
<Tip>
**ابدأ ببساطة**: ابدأ بإشعارات البريد الإلكتروني لمنشئ النشر، ثم أضف قواعد التوجيه مع نضوج سير عملك.
</Tip>
1. **استخدم التعيين الديناميكي**: اسحب عناوين بريد المعيّنين من حالة التدفق للتوجيه المرن.
2. **هيّئ الاستجابة التلقائية**: أعد استجابة احتياطية للمراجعات غير الحرجة لمنع تعليق التدفقات.
3. **راقب أوقات الاستجابة**: استخدم التحليلات لتحديد الاختناقات وتحسين عملية المراجعة.
4. **اجعل رسائل المراجعة واضحة**: اكتب رسائل واضحة وقابلة للتنفيذ في مزيّن `@human_feedback`.
5. **اختبر تدفق البريد**: أرسل طلبات اختبار للتحقق من تسليم البريد قبل الانتقال للإنتاج.
## الموارد ذات الصلة
<CardGroup cols={2}>
<Card title="التغذية الراجعة البشرية في التدفقات" icon="code" href="/ar/learn/human-feedback-in-flows">
دليل التنفيذ لمزيّن `@human_feedback`
</Card>
<Card title="دليل سير عمل Flow HITL" icon="route" href="/ar/enterprise/guides/human-in-the-loop">
دليل خطوة بخطوة لإعداد سير عمل HITL
</Card>
<Card title="تهيئة RBAC" icon="shield-check" href="/ar/enterprise/features/rbac">
تهيئة التحكم في الوصول المبني على الأدوار لمؤسستك
</Card>
<Card title="بث Webhook" icon="bolt" href="/ar/enterprise/features/webhook-streaming">
إعداد إشعارات الأحداث في الوقت الفعلي
</Card>
</CardGroup>

View File

@@ -0,0 +1,251 @@
---
title: حاجز الهلوسة
description: "منع واكتشاف هلوسات الذكاء الاصطناعي في مهام CrewAI"
icon: "shield-check"
mode: "wide"
---
## نظرة عامة
حاجز الهلوسة هو ميزة مؤسسية تتحقق من المحتوى المولّد بالذكاء الاصطناعي لضمان أنه مبني على الحقائق ولا يحتوي على هلوسات. يحلل مخرجات المهام مقابل سياق مرجعي ويوفر ملاحظات مفصلة عند اكتشاف محتوى محتمل الهلوسة.
## ما هي الهلوسات؟
تحدث هلوسات الذكاء الاصطناعي عندما تولّد نماذج اللغة محتوى يبدو معقولاً لكنه غير صحيح من الناحية الواقعية أو غير مدعوم بالسياق المقدم. يساعد حاجز الهلوسة في منع هذه المشكلات من خلال:
- مقارنة المخرجات مع السياق المرجعي
- تقييم الأمانة للمادة المصدرية
- توفير ملاحظات مفصلة حول المحتوى المشكل
- دعم عتبات مخصصة لصرامة التحقق
## الاستخدام الأساسي
### إعداد الحاجز
```python
from crewai.tasks.hallucination_guardrail import HallucinationGuardrail
from crewai import LLM
# الاستخدام الأساسي - سيستخدم expected_output للمهمة كسياق
guardrail = HallucinationGuardrail(
llm=LLM(model="gpt-4o-mini")
)
# مع سياق مرجعي صريح
context_guardrail = HallucinationGuardrail(
context="AI helps with various tasks including analysis and generation.",
llm=LLM(model="gpt-4o-mini")
)
```
### الإضافة إلى المهام
```python
from crewai import Task
# إنشاء مهمتك مع الحاجز
task = Task(
description="Write a summary about AI capabilities",
expected_output="A factual summary based on the provided context",
agent=my_agent,
guardrail=guardrail # إضافة الحاجز للتحقق من المخرجات
)
```
## التهيئة المتقدمة
### التحقق بعتبة مخصصة
للتحقق الأكثر صرامة، يمكنك تعيين عتبة أمانة مخصصة (مقياس 0-10):
```python
# حاجز صارم يتطلب درجة أمانة عالية
strict_guardrail = HallucinationGuardrail(
context="Quantum computing uses qubits that exist in superposition states.",
llm=LLM(model="gpt-4o-mini"),
threshold=8.0 # يتطلب درجة >= 8 لاجتياز التحقق
)
```
### تضمين سياق استجابة الأدوات
عندما تستخدم مهمتك أدوات، يمكنك تضمين استجابات الأدوات لتحقق أكثر دقة:
```python
# حاجز مع سياق استجابة الأدوات
weather_guardrail = HallucinationGuardrail(
context="Current weather information for the requested location",
llm=LLM(model="gpt-4o-mini"),
tool_response="Weather API returned: Temperature 22°C, Humidity 65%, Clear skies"
)
```
## كيف يعمل
### عملية التحقق
1. **تحليل السياق**: يقارن الحاجز مخرجات المهمة مع السياق المرجعي المقدم
2. **تسجيل الأمانة**: يستخدم مقيّمًا داخليًا لتعيين درجة أمانة (0-10)
3. **تحديد الحكم**: يحدد ما إذا كان المحتوى أمينًا أو يحتوي على هلوسات
4. **التحقق من العتبة**: إذا تم تعيين عتبة مخصصة، يتحقق مقابل تلك الدرجة
5. **توليد الملاحظات**: يوفر أسبابًا مفصلة عند فشل التحقق
### منطق التحقق
- **الوضع الافتراضي**: يستخدم التحقق المبني على الحكم (FAITHFUL مقابل HALLUCINATED)
- **وضع العتبة**: يتطلب أن تلبي درجة الأمانة العتبة المحددة أو تتجاوزها
- **معالجة الأخطاء**: يتعامل بسلاسة مع أخطاء التقييم ويوفر ملاحظات إعلامية
## نتائج الحاجز
يعيد الحاجز نتائج منظمة تشير إلى حالة التحقق:
```python
# مثال على هيكل نتيجة الحاجز
{
"valid": False,
"feedback": "Content appears to be hallucinated (score: 4.2/10, verdict: HALLUCINATED). The output contains information not supported by the provided context."
}
```
### خصائص النتيجة
- **valid**: قيمة منطقية تشير إلى ما إذا اجتازت المخرجات التحقق
- **feedback**: شرح مفصل عند فشل التحقق، يتضمن:
- درجة الأمانة
- تصنيف الحكم
- أسباب محددة للفشل
## التكامل مع نظام المهام
### التحقق التلقائي
عند إضافة حاجز إلى مهمة، يتحقق تلقائيًا من المخرجات قبل اعتبار المهمة مكتملة:
```python
# تدفق التحقق من مخرجات المهمة
task_output = agent.execute_task(task)
validation_result = guardrail(task_output)
if validation_result.valid:
# المهمة تكتمل بنجاح
return task_output
else:
# المهمة تفشل مع ملاحظات التحقق
raise ValidationError(validation_result.feedback)
```
### تتبع الأحداث
يتكامل الحاجز مع نظام أحداث CrewAI لتوفير المراقبة:
- **بدء التحقق**: عند بدء تقييم الحاجز
- **اكتمال التحقق**: عند انتهاء التقييم بالنتائج
- **فشل التحقق**: عند حدوث أخطاء تقنية أثناء التقييم
## أفضل الممارسات
### إرشادات السياق
<Steps>
<Step title="توفير سياق شامل">
أدرج جميع المعلومات الواقعية ذات الصلة التي يجب أن يبني عليها الذكاء الاصطناعي مخرجاته:
```python
context = """
Company XYZ was founded in 2020 and specializes in renewable energy solutions.
They have 150 employees and generated $50M revenue in 2023.
Their main products include solar panels and wind turbines.
"""
```
</Step>
<Step title="الحفاظ على صلة السياق">
أدرج فقط المعلومات المرتبطة مباشرة بالمهمة لتجنب الارتباك:
```python
# جيد: سياق مركّز
context = "The current weather in New York is 18°C with light rain."
# تجنب: معلومات غير ذات صلة
context = "The weather is 18°C. The city has 8 million people. Traffic is heavy."
```
</Step>
<Step title="تحديث السياق بانتظام">
تأكد من أن السياق المرجعي يعكس معلومات حالية ودقيقة.
</Step>
</Steps>
### اختيار العتبة
<Steps>
<Step title="البدء بالتحقق الافتراضي">
ابدأ بدون عتبات مخصصة لفهم الأداء الأساسي.
</Step>
<Step title="الضبط بناءً على المتطلبات">
- **محتوى عالي الأهمية**: استخدم عتبة 8-10 للدقة القصوى
- **محتوى عام**: استخدم عتبة 6-7 للتحقق المتوازن
- **محتوى إبداعي**: استخدم عتبة 4-5 أو التحقق الافتراضي المبني على الحكم
</Step>
<Step title="المراقبة والتكرار">
تتبع نتائج التحقق واضبط العتبات بناءً على الإيجابيات/السلبيات الكاذبة.
</Step>
</Steps>
## اعتبارات الأداء
### التأثير على زمن التنفيذ
- **عبء التحقق**: يضيف كل حاجز حوالي 1-3 ثوانٍ لكل مهمة
- **كفاءة LLM**: اختر نماذج فعالة للتقييم (مثل gpt-4o-mini)
### تحسين التكلفة
- **اختيار النموذج**: استخدم نماذج أصغر وفعالة لتقييم الحاجز
- **حجم السياق**: اجعل السياق المرجعي موجزًا لكن شاملًا
- **التخزين المؤقت**: فكّر في تخزين نتائج التحقق مؤقتًا للمحتوى المتكرر
## استكشاف الأخطاء وإصلاحها
<Accordion title="فشل التحقق دائمًا">
**الأسباب المحتملة:**
- السياق مقيّد جدًا أو غير مرتبط بمخرجات المهمة
- العتبة معينة عالية جدًا لنوع المحتوى
- السياق المرجعي يحتوي على معلومات قديمة
**الحلول:**
- مراجعة وتحديث السياق ليتطابق مع متطلبات المهمة
- خفض العتبة أو استخدام التحقق الافتراضي المبني على الحكم
- التأكد من أن السياق حالي ودقيق
</Accordion>
<Accordion title="إيجابيات كاذبة (محتوى صالح يُعلّم كغير صالح)">
**الأسباب المحتملة:**
- العتبة عالية جدًا للمهام الإبداعية أو التفسيرية
- السياق لا يغطي جميع الجوانب الصالحة للمخرجات
- نموذج التقييم محافظ بشكل مفرط
**الحلول:**
- خفض العتبة أو استخدام التحقق الافتراضي
- توسيع السياق ليشمل محتوى مقبول أوسع
- الاختبار مع نماذج تقييم مختلفة
</Accordion>
<Accordion title="أخطاء التقييم">
**الأسباب المحتملة:**
- مشكلات في الاتصال بالشبكة
- نموذج LLM غير متاح أو محدود المعدل
- مخرجات مهمة أو سياق غير صالح
**الحلول:**
- التحقق من الاتصال بالشبكة وحالة خدمة LLM
- تنفيذ منطق إعادة المحاولة للأعطال المؤقتة
- التحقق من تنسيق مخرجات المهمة قبل تقييم الحاجز
</Accordion>
<Card title="هل تحتاج مساعدة؟" icon="headset" href="mailto:support@crewai.com">
تواصل مع فريق الدعم للمساعدة في تهيئة حاجز الهلوسة أو استكشاف الأخطاء وإصلاحها.
</Card>

View File

@@ -0,0 +1,45 @@
---
title: السوق
description: "اكتشف وثبّت وأدِر الأصول القابلة لإعادة الاستخدام لطواقم مؤسستك."
icon: "store"
mode: "wide"
---
## نظرة عامة
يوفر السوق واجهة منظمة لاكتشاف عمليات التكامل والأدوات الداخلية والأصول القابلة لإعادة الاستخدام التي تسرّع تطوير الطواقم.
<Frame>
![نظرة عامة على السوق](/images/enterprise/marketplace-overview.png)
</Frame>
## قابلية الاكتشاف
- تصفح حسب الفئة والقدرة
- ابحث عن الأصول بالاسم أو الكلمة المفتاحية
## التثبيت والتفعيل
- تثبيت بنقرة واحدة للأصول المعتمدة
- تفعيل أو تعطيل لكل طاقم حسب الحاجة
- تهيئة متغيرات البيئة والنطاقات المطلوبة
<Frame>
![التثبيت والتهيئة](/images/enterprise/marketplace-install.png)
</Frame>
يمكنك أيضاً تنزيل القوالب مباشرة من السوق بالنقر على زر `Download` لاستخدامها محلياً أو تعديلها حسب احتياجاتك.
## ذو صلة
<CardGroup cols={3}>
<Card title="الأدوات والتكاملات" href="/ar/enterprise/features/tools-and-integrations" icon="wrench">
اربط التطبيقات الخارجية وأدِر الأدوات الداخلية التي يمكن لوكلائك استخدامها.
</Card>
<Card title="مستودع الأدوات" href="/ar/enterprise/guides/tool-repository#tool-repository" icon="toolbox">
انشر وثبّت الأدوات لتعزيز قدرات طواقمك.
</Card>
<Card title="مستودع الوكلاء" href="/ar/enterprise/features/agent-repositories" icon="people-group">
خزّن وشارك وأعد استخدام تعريفات الوكلاء عبر الفرق والمشاريع.
</Card>
</CardGroup>

View File

@@ -0,0 +1,82 @@
---
title: بطاقة واحدة لكل خطوة
description: "كل خطوة على لوحة Studio هي بطاقة واحدة تجمع بين المهمة والوكيل الذي ينفّذها."
icon: "layer-group"
mode: "wide"
---
## نظرة عامة
على لوحة Studio، تُمثَّل كل خطوة عمل بـ **بطاقة واحدة**. تجمع البطاقة بين عنصرين كانا في السابق في عُقد منفصلة:
- **المهمة** — ماذا تفعل (الاسم، الوصف، المخرجات المتوقعة، وتنسيق الاستجابة).
- **الوكيل** — من ينفّذها (الوكيل المُعيَّن ونموذجه وأدواته).
الوكيل ليس مشاركًا مستقلاً في سير العمل لديك — بل هو سمة من سمات المهمة: *أي وكيل ينفّذ هذا العمل.* وضع المهمة والوكيل في بطاقة واحدة يجعل هذه العلاقة واضحة، ويحوّل أتمتتك إلى سلسلة واحدة من وحدات العمل من اليسار إلى اليمين يسهل قراءتها بنظرة واحدة.
<Frame caption="بطاقة واحدة لكل خطوة: المهمة مع ملخص للوكيل المُعيَّن في التذييل.">
![بطاقات الخطوات الموحّدة على اللوحة](/images/enterprise/merged-step-card-canvas.png)
</Frame>
## على اللوحة
تعرض كل بطاقة مطوية ما يلي:
- **اسم المهمة ووصفها** في الأعلى.
- **تذييل يلخّص الوكيل المُعيَّن** — الصورة الرمزية والاسم والنموذج والأدوات.
لا توجد عقدة وكيل منفصلة ولا حافة عمودية من الوكيل ← المهمة. تتصل خطواتك مباشرةً ببعضها البعض بالترتيب الذي تُنفَّذ به.
## في المحرّر
افتح بطاقة لتحريرها. العرض الموسّع هو البطاقة نفسها في حالة مفصّلة — وليس شاشة مختلفة — منظّمة في قسمين موسومين بوضوح.
<Frame caption="المحرّر الموسّع: قسم المهمة مفتوح، والوكيل ملخّص أسفله.">
![محرّر الخطوة الموسّع](/images/enterprise/merged-step-card-editor.png)
</Frame>
### المهمة — ماذا تفعل
مفتوحة افتراضيًا، لأنها ما تحرّره عادةً:
- **الاسم**
- **الوصف**
- **المخرجات المتوقعة**
- **تنسيق الاستجابة** — يظهر هنا لأنه يتحكم تحديدًا في ما تقرأه الخطوات اللاحقة (مثل التوجيه) من هذه الخطوة.
### الوكيل — من ينفّذها
يُعرض الوكيل المُعيَّن كملخّص — **الاسم والنموذج والأدوات في سطر واحد**. ويُحفَظ إعداده الأعمق خلف قسمين قابلين للطي:
- **الدور والهدف والخلفية**
- **إعدادات الوكيل** — الاستدلال، الحد الأقصى لمحاولات الاستدلال، السماح بالتفويض، الحد الأقصى للتكرارات، وإعدادات LLM.
<Tip>
الإعداد الكامل للوكيل — الدور، الهدف، الخلفية، النموذج، الأدوات، إعدادات LLM، وكامل كتلة إعدادات الوكيل — موجود خلف القسمين القابلين للطي **الدور والهدف والخلفية** و**إعدادات الوكيل**، منظّمًا حسب عدد مرّات تحريرك له.
</Tip>
## التبديل مقابل تحرير الوكيل
هناك طريقتان متمايزتان للتعامل مع الوكيل في البطاقة، وكل منهما تؤدي وظيفة مختلفة:
- **التبديل (Swap)** يعيد تعيين *أي* وكيل ينفّذ هذه المهمة. استخدم عنصر التحكم **تبديل** لاختيار وكيل مختلف من هذا المشروع، أو اختيار واحد من مستودع الوكلاء، أو إنشاء وكيل جديد. هذا مقصور على نطاق المهمة.
- **تحرير** الوكيل — بفتح **الدور والهدف والخلفية** أو **إعدادات الوكيل** — يغيّر الوكيل *نفسه*.
<Frame caption="التبديل يغيّر الوكيل الذي ينفّذ المهمة.">
![لوحة تبديل الوكيل](/images/enterprise/merged-step-card-swap-agent.png)
</Frame>
<Warning>
**الوكلاء قابلون لإعادة الاستخدام ومشتركون.** يمكن للوكيل نفسه تنفيذ أكثر من مهمة عبر مشروعك. تحرير دور الوكيل أو خلفيته أو إعداداته يحدّث ذلك الوكيل **في كل مكان يُستخدم فيه** — وليس فقط في البطاقة التي فتحتها. إذا أردت تطبيق تغيير على خطوة واحدة فقط، فقم **بالتبديل** إلى وكيل مختلف بدلاً من تحرير الوكيل المشترك.
</Warning>
## ذات صلة
<CardGroup cols={2}>
<Card title="Crew Studio" href="/ar/enterprise/features/crew-studio" icon="pencil">
أنشئ الأتمتة بمساعدة الذكاء الاصطناعي ومحرّر مرئي.
</Card>
<Card title="مستودعات الوكلاء" href="/ar/enterprise/features/agent-repositories" icon="users">
إدارة الوكلاء وإعادة استخدامهم عبر أتمتتك.
</Card>
</CardGroup>

View File

@@ -0,0 +1,342 @@
---
title: إخفاء البيانات الشخصية في التتبعات
description: "إخفاء البيانات الحساسة تلقائياً من تتبعات تنفيذ الطواقم والتدفقات"
icon: "lock"
mode: "wide"
---
## نظرة عامة
إخفاء البيانات الشخصية (PII Redaction) هو ميزة في CrewAI AMP تكتشف تلقائياً وتُقنّع معلومات التعريف الشخصية (PII) في تتبعات تنفيذ الطواقم والتدفقات. يضمن ذلك عدم كشف البيانات الحساسة مثل أرقام بطاقات الائتمان وأرقام الضمان الاجتماعي وعناوين البريد الإلكتروني والأسماء في تتبعات CrewAI AMP. يمكنك أيضاً إنشاء مُعرّفات مخصصة لحماية البيانات الخاصة بمؤسستك.
<Info>
إخفاء البيانات الشخصية متاح في خطة Enterprise.
يجب أن يكون إصدار النشر 1.8.0 أو أعلى.
</Info>
<Frame>
![نظرة عامة على إخفاء البيانات الشخصية](/images/enterprise/pii_mask_recognizer_trace_example.png)
</Frame>
## أهمية إخفاء البيانات الشخصية
عند تشغيل وكلاء الذكاء الاصطناعي في بيئة الإنتاج، غالباً ما تمر معلومات حساسة عبر طواقمك:
- بيانات العملاء من تكاملات CRM
- معلومات مالية من معالجات الدفع
- تفاصيل شخصية من إرسالات النماذج
- بيانات الموظفين الداخلية
بدون إخفاء مناسب، تظهر هذه البيانات في التتبعات، مما يجعل الامتثال للوائح مثل GDPR وHIPAA وPCI-DSS أمراً صعباً. يحل إخفاء البيانات الشخصية هذه المشكلة عن طريق إقناع البيانات الحساسة تلقائياً قبل تخزينها في التتبعات.
## كيف يعمل
1. **الاكتشاف** - مسح بيانات أحداث التتبع بحثاً عن أنماط PII المعروفة
2. **التصنيف** - تحديد نوع البيانات الحساسة (بطاقة ائتمان، SSN، بريد إلكتروني، إلخ.)
3. **الإقناع/الإخفاء** - استبدال البيانات الحساسة بقيم مُقنّعة بناءً على تهيئتك
```
Original: "Contact john.doe@company.com or call 555-123-4567"
Redacted: "Contact <EMAIL_ADDRESS> or call <PHONE_NUMBER>"
```
## تفعيل إخفاء البيانات الشخصية
<Info>
يجب أن تكون على خطة Enterprise وأن يكون إصدار النشر 1.8.0 أو أعلى لاستخدام هذه الميزة.
</Info>
<Steps>
<Step title="الانتقال إلى إعدادات الطاقم">
في لوحة تحكم CrewAI AMP، اختر طاقمك المنشور وانتقل إلى أحد عمليات النشر/الأتمتة، ثم انتقل إلى **Settings** → **PII Protection**.
</Step>
<Step title="تفعيل حماية البيانات الشخصية">
فعّل **PII Redaction for Traces**. سيؤدي ذلك إلى تفعيل المسح والإخفاء التلقائي لبيانات التتبع.
<Info>
تحتاج إلى تفعيل إخفاء البيانات الشخصية يدوياً لكل عملية نشر.
</Info>
<Frame>
![تفعيل إخفاء البيانات الشخصية](/images/enterprise/pii_mask_recognizer_enable.png)
</Frame>
</Step>
<Step title="تهيئة أنواع الكيانات">
اختر أنواع البيانات الشخصية التي تريد اكتشافها وإخفاءها. يمكن تفعيل أو تعطيل كل كيان بشكل فردي.
<Frame>
![تهيئة الكيانات](/images/enterprise/pii_mask_recognizer_supported_entities.png)
</Frame>
</Step>
<Step title="الحفظ">
احفظ تهيئتك. سيكون إخفاء البيانات الشخصية نشطاً في جميع عمليات تنفيذ الطاقم اللاحقة، دون الحاجة لإعادة النشر.
</Step>
</Steps>
## أنواع الكيانات المدعومة
يدعم CrewAI أنواع كيانات PII التالية، منظمة حسب الفئة.
### الكيانات العالمية
| الكيان | الوصف | مثال |
|--------|-------|------|
| `CREDIT_CARD` | أرقام بطاقات الائتمان/الخصم | "4111-1111-1111-1111" |
| `CRYPTO` | عناوين محافظ العملات الرقمية | "bc1qxy2kgd..." |
| `DATE_TIME` | التواريخ والأوقات | "January 15, 2024" |
| `EMAIL_ADDRESS` | عناوين البريد الإلكتروني | "john@example.com" |
| `IBAN_CODE` | أرقام الحسابات المصرفية الدولية | "DE89 3704 0044 0532 0130 00" |
| `IP_ADDRESS` | عناوين IPv4 وIPv6 | "192.168.1.1" |
| `LOCATION` | المواقع الجغرافية | "New York City" |
| `MEDICAL_LICENSE` | أرقام التراخيص الطبية | "MD12345" |
| `NRP` | الجنسيات أو المجموعات الدينية أو السياسية | - |
| `PERSON` | الأسماء الشخصية | "John Doe" |
| `PHONE_NUMBER` | أرقام الهواتف بتنسيقات مختلفة | "+1 (555) 123-4567" |
| `URL` | عناوين URL | "https://example.com" |
### كيانات خاصة بالولايات المتحدة
| الكيان | الوصف | مثال |
|--------|-------|------|
| `US_BANK_NUMBER` | أرقام الحسابات المصرفية الأمريكية | "1234567890" |
| `US_DRIVER_LICENSE` | أرقام رخص القيادة الأمريكية | "D1234567" |
| `US_ITIN` | رقم تعريف دافع الضرائب الفردي | "900-70-0000" |
| `US_PASSPORT` | أرقام جوازات السفر الأمريكية | "123456789" |
| `US_SSN` | أرقام الضمان الاجتماعي | "123-45-6789" |
## إجراءات الإخفاء
لكل كيان مُفعّل، يمكنك تهيئة كيفية إخفاء البيانات:
| الإجراء | الوصف | مثال على المخرجات |
|---------|-------|-------------------|
| `mask` | الاستبدال بتسمية نوع الكيان | `<CREDIT_CARD>` |
| `redact` | إزالة النص بالكامل | *(فارغ)* |
## المُعرّفات المخصصة
بالإضافة إلى الكيانات المدمجة، يمكنك إنشاء **مُعرّفات مخصصة** لاكتشاف أنماط PII الخاصة بمؤسستك.
<Frame>
![المُعرّفات المخصصة](/images/enterprise/pii_mask_recognizer.png)
</Frame>
### أنواع المُعرّفات
لديك خياران للمُعرّفات المخصصة:
| النوع | الأفضل لـ | مثال على حالة الاستخدام |
|-------|-----------|------------------------|
| **قائم على النمط (Regex)** | بيانات منظمة بتنسيقات متوقعة | مبالغ الرواتب، معرّفات الموظفين، رموز المشاريع |
| **قائمة الحظر (Deny-list)** | مطابقة النصوص بالضبط | أسماء الشركات، الأسماء الرمزية الداخلية، مصطلحات محددة |
### إنشاء مُعرّف مخصص
<Steps>
<Step title="الانتقال إلى المُعرّفات المخصصة">
انتقل إلى **Settings** → **Organization** → **Add Recognizer** في إعدادات مؤسستك.
</Step>
<Step title="تهيئة المُعرّف">
<Frame>
![تهيئة المُعرّف](/images/enterprise/pii_mask_recognizer_create.png)
</Frame>
هيّئ الحقول التالية:
- **Name**: اسم وصفي للمُعرّف
- **Entity Type**: تسمية الكيان التي ستظهر في المخرجات المُخفاة (مثل `EMPLOYEE_ID`، `SALARY`)
- **Type**: اختر بين Regex Pattern أو Deny List
- **Pattern/Values**: نمط Regex أو قائمة نصوص للمطابقة
- **Confidence Threshold**: الحد الأدنى للنتيجة (0.0-1.0) المطلوبة لتفعيل الإخفاء عند المطابقة. القيم الأعلى (مثل 0.8) تقلل الإيجابيات الخاطئة لكن قد تفوّت بعض المطابقات. القيم الأقل (مثل 0.5) تلتقط المزيد من المطابقات لكن قد تُفرط في الإخفاء. القيمة الافتراضية هي 0.8.
- **Context Words** (اختياري): كلمات تزيد ثقة الاكتشاف عند وجودها بالقرب
</Step>
<Step title="الحفظ">
احفظ المُعرّف. سيكون متاحاً للتفعيل في عمليات النشر الخاصة بك.
</Step>
</Steps>
### فهم أنواع الكيانات
يحدد **Entity Type** كيفية ظهور المحتوى المُطابق في التتبعات المُخفاة:
```
Entity Type: SALARY
Pattern: salary:\s*\$\s*\d+
Input: "Employee salary: $50,000"
Output: "Employee <SALARY>"
```
### استخدام كلمات السياق
تحسّن كلمات السياق الدقة عن طريق زيادة الثقة عند ظهور مصطلحات محددة بالقرب من النمط المُطابق:
```
Context Words: "project", "code", "internal"
Entity Type: PROJECT_CODE
Pattern: PRJ-\d{4}
```
عندما تظهر كلمة "project" أو "code" بالقرب من "PRJ-1234"، يكون لدى المُعرّف ثقة أعلى بأنها مطابقة حقيقية، مما يقلل الإيجابيات الخاطئة.
## عرض التتبعات المُخفاة
بمجرد تفعيل إخفاء البيانات الشخصية، ستعرض تتبعاتك قيماً مُخفاة بدلاً من البيانات الحساسة:
```
Task Output: "Customer <PERSON> placed order #12345.
Contact email: <EMAIL_ADDRESS>, phone: <PHONE_NUMBER>.
Payment processed for card ending in <CREDIT_CARD>."
```
القيم المُخفاة مُعلّمة بوضوح بأقواس زاوية وتسمية نوع الكيان (مثل `<EMAIL_ADDRESS>`)، مما يسهّل فهم البيانات التي تمت حمايتها مع السماح لك بتصحيح الأخطاء ومراقبة سلوك الطاقم.
## أفضل الممارسات
### اعتبارات الأداء
<Steps>
<Step title="فعّل الكيانات المطلوبة فقط">
كل كيان مُفعّل يضيف عبء معالجة. فعّل فقط الكيانات ذات الصلة ببياناتك.
</Step>
<Step title="استخدم أنماطاً محددة">
للمُعرّفات المخصصة، استخدم أنماطاً محددة لتقليل الإيجابيات الخاطئة وتحسين الأداء. أنماط Regex هي الأفضل عند تحديد أنماط معينة في التتبعات مثل الرواتب ومعرّفات الموظفين ورموز المشاريع وغيرها. مُعرّفات قائمة الحظر هي الأفضل عند تحديد نصوص بعينها في التتبعات مثل أسماء الشركات والأسماء الرمزية الداخلية وغيرها.
</Step>
<Step title="استفد من كلمات السياق">
تحسّن كلمات السياق الدقة عن طريق تفعيل الاكتشاف فقط عندما يتطابق النص المحيط.
</Step>
</Steps>
## استكشاف الأخطاء وإصلاحها
<Accordion title="البيانات الشخصية لا تُخفى">
**الأسباب المحتملة:**
- نوع الكيان غير مُفعّل في التهيئة
- النمط لا يتطابق مع تنسيق البيانات
- المُعرّف المخصص يحتوي على أخطاء في الصياغة
**الحلول:**
- تحقق من أن الكيان مُفعّل في Settings → Security
- اختبر أنماط Regex مع بيانات نموذجية
- تحقق من السجلات بحثاً عن أخطاء التهيئة
</Accordion>
<Accordion title="إخفاء بيانات أكثر من اللازم">
**الأسباب المحتملة:**
- أنواع كيانات واسعة جداً مُفعّلة (مثل `DATE_TIME` تلتقط التواريخ في كل مكان)
- أنماط المُعرّف المخصص عامة جداً
**الحلول:**
- عطّل الكيانات التي تسبب إيجابيات خاطئة
- اجعل الأنماط المخصصة أكثر تحديداً
- أضف كلمات سياق لتحسين الدقة
</Accordion>
<Accordion title="مشاكل الأداء">
**الأسباب المحتملة:**
- عدد كبير جداً من الكيانات المُفعّلة
- الكيانات القائمة على NLP (مثل `PERSON` و`LOCATION` و`NRP`) مكلفة حسابياً لأنها تستخدم نماذج تعلم الآلة
**الحلول:**
- فعّل فقط الكيانات التي تحتاجها فعلاً
- فكّر في استخدام بدائل قائمة على الأنماط حيثما أمكن
- راقب أوقات معالجة التتبعات في لوحة التحكم
</Accordion>
---
## مثال عملي: مطابقة نمط الراتب
يوضح هذا المثال كيفية إنشاء مُعرّف مخصص لاكتشاف وإقناع معلومات الرواتب في تتبعاتك.
### حالة الاستخدام
يعالج طاقمك بيانات موظفين أو بيانات مالية تتضمن معلومات رواتب بتنسيقات مثل:
- `salary: $50,000`
- `salary: $125,000.00`
- `salary:$1,500.50`
تريد إقناع هذه القيم تلقائياً لحماية بيانات التعويضات الحساسة.
### التهيئة
<Frame>
![تهيئة مُعرّف الراتب](/images/enterprise/pii_mask_custom_recognizer_salary.png)
</Frame>
| الحقل | القيمة |
|-------|--------|
| **Name** | `SALARY` |
| **Entity Type** | `SALARY` |
| **Type** | Regex Pattern |
| **Regex Pattern** | `salary:\s*\$\s*\d{1,3}(,\d{3})*(\.\d{2})?` |
| **Action** | Mask |
| **Confidence Threshold** | `0.8` |
| **Context Words** | `salary, compensation, pay, wage, income` |
### تحليل نمط Regex
| مكون النمط | المعنى |
|------------|--------|
| `salary:` | يطابق النص الحرفي "salary:" |
| `\s*` | يطابق صفر أو أكثر من أحرف المسافات البيضاء |
| `\$` | يطابق علامة الدولار (مُهرّبة) |
| `\s*` | يطابق صفر أو أكثر من أحرف المسافات البيضاء بعد $ |
| `\d{1,3}` | يطابق 1-3 أرقام (مثل "1"، "50"، "125") |
| `(,\d{3})*` | يطابق الآلاف المفصولة بفواصل (مثل ",000"، ",500,000") |
| `(\.\d{2})?` | يطابق اختيارياً السنتات (مثل ".00"، ".50") |
### أمثلة على النتائج
```
Original: "Employee record shows salary: $125,000.00 annually"
Redacted: "Employee record shows <SALARY> annually"
Original: "Base salary:$50,000 with bonus potential"
Redacted: "Base <SALARY> with bonus potential"
```
<Tip>
إضافة كلمات سياق مثل "salary" و"compensation" و"pay" و"wage" و"income" تساعد في زيادة ثقة الاكتشاف عند ظهور هذه المصطلحات بالقرب من النمط المُطابق، مما يقلل الإيجابيات الخاطئة.
</Tip>
### تفعيل المُعرّف لعمليات النشر
<Warning>
إنشاء مُعرّف مخصص على مستوى المؤسسة لا يفعّله تلقائياً لعمليات النشر. يجب عليك تفعيل كل مُعرّف يدوياً لكل عملية نشر تريد تطبيقه عليها.
</Warning>
بعد إنشاء المُعرّف المخصص، فعّله لكل عملية نشر:
<Steps>
<Step title="الانتقال إلى عملية النشر">
انتقل إلى عملية النشر/الأتمتة وافتح **Settings** → **PII Protection**.
</Step>
<Step title="اختيار المُعرّفات المخصصة">
تحت **Mask Recognizers**، سترى المُعرّفات المحددة على مستوى مؤسستك. حدد المربع بجانب المُعرّفات التي تريد تفعيلها.
<Frame>
![تفعيل المُعرّف المخصص](/images/enterprise/pii_mask_recognizers_options.png)
</Frame>
</Step>
<Step title="حفظ التهيئة">
احفظ تغييراتك. سيكون المُعرّف نشطاً في جميع عمليات التنفيذ اللاحقة لعملية النشر هذه.
</Step>
</Steps>
<Info>
كرر هذه العملية لكل عملية نشر تحتاج فيها إلى المُعرّف المخصص. يمنحك ذلك تحكماً دقيقاً في المُعرّفات النشطة في البيئات المختلفة (مثل بيئة التطوير مقابل بيئة الإنتاج).
</Info>

View File

@@ -0,0 +1,256 @@
---
title: "التحكم في الوصول القائم على الأدوار (RBAC)"
description: "تحكم في الوصول إلى الطواقم والأدوات والبيانات باستخدام الأدوار والنطاقات والصلاحيات الدقيقة."
icon: "shield"
mode: "wide"
---
## نظرة عامة
يتيح RBAC في CrewAI AMP إدارة وصول آمنة وقابلة للتوسع من خلال طبقتين:
1. **صلاحيات الميزات** — تتحكم في ما يمكن لكل دور القيام به عبر المنصة (إدارة، قراءة، أو بدون وصول)
2. **صلاحيات على مستوى الكيان** — وصول دقيق للأتمتات الفردية ومتغيرات البيئة واتصالات LLM ومستودعات Git
<Frame>
<img src="/images/enterprise/users_and_roles.png" alt="نظرة عامة على RBAC في CrewAI AMP" />
</Frame>
## المستخدمون والأدوار
يُعيَّن لكل عضو في مساحة عمل CrewAI دور يحدد صلاحيات الوصول عبر الميزات المختلفة.
يمكنك:
- استخدام الأدوار المحددة مسبقاً (Owner، Member)
- إنشاء أدوار مخصصة مصممة لصلاحيات محددة
- تعيين الأدوار في أي وقت عبر لوحة الإعدادات
يمكنك تهيئة المستخدمين والأدوار في Settings → Roles.
<Steps>
<Step title="فتح إعدادات الأدوار">
انتقل إلى <b>Settings → Roles</b> في CrewAI AMP.
</Step>
<Step title="اختيار نوع الدور">
استخدم دوراً محدداً مسبقاً (<b>Owner</b>، <b>Member</b>) أو انقر على{" "}
<b>Create role</b> لتحديد دور مخصص.
</Step>
<Step title="التعيين للأعضاء">
اختر المستخدمين وعيّن لهم الدور. يمكنك تغيير ذلك في أي وقت.
</Step>
</Steps>
### الأدوار المحددة مسبقاً
| الدور | الوصف |
| :---------- | :-------------------------------------------------------------------- |
| **Owner** | وصول كامل لجميع الميزات والإعدادات. لا يمكن تقييده. |
| **Member** | وصول للقراءة لمعظم الميزات، وصول إدارة لمتغيرات البيئة واتصالات LLM ومشاريع Studio. لا يمكنه تعديل إعدادات المؤسسة أو الإعدادات الافتراضية. |
### ملخص التهيئة
| المجال | مكان التهيئة | الخيارات |
| :-------------------- | :--------------------------------- | :-------------------------------------- |
| المستخدمون والأدوار | Settings → Roles | محددة مسبقاً: Owner، Member؛ أدوار مخصصة |
| رؤية الأتمتة | Automation → Settings → Visibility | خاص؛ قائمة بيضاء للمستخدمين/الأدوار |
---
## مصفوفة صلاحيات الميزات
لكل دور مستوى صلاحية لكل منطقة ميزة. المستويات الثلاثة هي:
- **إدارة (Manage)** — وصول كامل للقراءة/الكتابة (إنشاء، تعديل، حذف)
- **قراءة (Read)** — وصول للعرض فقط
- **بدون وصول (No access)** — الميزة مخفية/غير قابلة للوصول
| الميزة | Owner | Member (افتراضي) | المستويات المتاحة | الوصف |
| :------------------------ | :------ | :--------------- | :--------------------------------- | :-------------------------------------------------------------- |
| `usage_dashboards` | Manage | Read | Manage / Read / No access | عرض مقاييس وتحليلات الاستخدام |
| `crews_dashboards` | Manage | Read | Manage / Read / No access | عرض لوحات النشر والوصول إلى تفاصيل الأتمتة |
| `invitations` | Manage | Read | Manage / Read / No access | دعوة أعضاء جدد إلى المؤسسة |
| `training_ui` | Manage | Read | Manage / Read / No access | الوصول إلى واجهات التدريب/الضبط الدقيق |
| `tools` | Manage | Read | Manage / Read / No access | إنشاء وإدارة الأدوات |
| `agents` | Manage | Read | Manage / Read / No access | إنشاء وإدارة الوكلاء |
| `environment_variables` | Manage | Manage | Manage / No access | إنشاء وإدارة متغيرات البيئة |
| `llm_connections` | Manage | Manage | Manage / No access | تهيئة اتصالات مزودي LLM |
| `default_settings` | Manage | No access | Manage / No access | تعديل الإعدادات الافتراضية على مستوى المؤسسة |
| `organization_settings` | Manage | No access | Manage / No access | إدارة الفوترة والخطط وتهيئة المؤسسة |
| `studio_projects` | Manage | Manage | Manage / No access | إنشاء وتعديل المشاريع في Studio |
<Tip>
عند إنشاء دور مخصص، يمكن ضبط معظم الميزات على **Manage** أو **Read** أو **No access**. ومع ذلك، فإن `environment_variables` و`llm_connections` و`default_settings` و`organization_settings` و`studio_projects` تدعم فقط **Manage** أو **No access** — لا يوجد خيار للقراءة فقط لهذه الميزات.
</Tip>
---
## النشر من GitHub أو Zip
من أكثر أسئلة RBAC شيوعاً: _"ما الصلاحيات التي يحتاجها عضو الفريق للنشر؟"_
### النشر من GitHub
لنشر أتمتة من مستودع GitHub، يحتاج المستخدم إلى:
1. **`crews_dashboards`**: على الأقل `Read` — مطلوب للوصول إلى لوحة الأتمتات حيث يتم إنشاء عمليات النشر
2. **الوصول إلى مستودع Git** (إذا كان RBAC على مستوى الكيان لمستودعات Git مفعلاً): يجب منح دور المستخدم الوصول إلى مستودع Git المحدد عبر صلاحيات مستوى الكيان
3. **`studio_projects`: `Manage`** — إذا كان يبني الطاقم في Studio قبل النشر
### النشر من Zip
لنشر أتمتة من ملف Zip، يحتاج المستخدم إلى:
1. **`crews_dashboards`**: على الأقل `Read` — مطلوب للوصول إلى لوحة الأتمتات
2. **تفعيل نشر Zip**: يجب ألا تكون المؤسسة قد عطلت نشر Zip في إعدادات المؤسسة
### مرجع سريع: الحد الأدنى من الصلاحيات للنشر
| الإجراء | صلاحيات الميزات المطلوبة | متطلبات إضافية |
| :------------------- | :----------------------------------- | :----------------------------------------------- |
| النشر من GitHub | `crews_dashboards: Read` | وصول كيان مستودع Git (إذا كان Git RBAC مفعلاً) |
| النشر من Zip | `crews_dashboards: Read` | يجب تفعيل نشر Zip على مستوى المؤسسة |
| البناء في Studio | `studio_projects: Manage` | — |
| تهيئة مفاتيح LLM | `llm_connections: Manage` | — |
| ضبط متغيرات البيئة | `environment_variables: Manage` | وصول مستوى الكيان (إذا كان RBAC الكيان مفعلاً) |
---
## التحكم في الوصول على مستوى الأتمتة (صلاحيات الكيان)
بالإضافة إلى الأدوار على مستوى المؤسسة، يدعم CrewAI صلاحيات دقيقة على مستوى الكيان تقيد الوصول إلى موارد فردية.
### رؤية الأتمتة
تدعم الأتمتات إعدادات رؤية تقيد الوصول حسب المستخدم أو الدور. هذا مفيد لـ:
- الحفاظ على خصوصية الأتمتات الحساسة أو التجريبية
- إدارة الرؤية عبر الفرق الكبيرة أو المتعاونين الخارجيين
- اختبار الأتمتات في سياقات معزولة
يمكن تهيئة عمليات النشر كخاصة، مما يعني أن المستخدمين والأدوار المدرجين في القائمة البيضاء فقط سيتمكنون من التفاعل معها.
يمكنك تهيئة التحكم في الوصول على مستوى الأتمتة في Automation → Settings → علامة تبويب Visibility.
<Steps>
<Step title="فتح علامة تبويب الرؤية">
انتقل إلى <b>Automation → Settings → Visibility</b>.
</Step>
<Step title="ضبط الرؤية">
اختر <b>Private</b> لتقييد الوصول. يحتفظ مالك المؤسسة دائماً
بالوصول.
</Step>
<Step title="القائمة البيضاء للوصول">
أضف مستخدمين وأدواراً محددة مسموح لهم بالعرض والتشغيل والوصول
إلى السجلات/المقاييس/الإعدادات.
</Step>
<Step title="الحفظ والتحقق">
احفظ التغييرات، ثم تأكد من أن المستخدمين غير المدرجين في القائمة البيضاء لا يمكنهم عرض أو تشغيل
الأتمتة.
</Step>
</Steps>
### الرؤية الخاصة: نتائج الوصول
| الإجراء | المالك | مستخدم/دور في القائمة البيضاء | غير مدرج في القائمة البيضاء |
| :--------------------------- | :---- | :---------------------------- | :-------------------------- |
| عرض الأتمتة | ✓ | ✓ | ✗ |
| تشغيل الأتمتة/API | ✓ | ✓ | ✗ |
| الوصول إلى السجلات/المقاييس/الإعدادات | ✓ | ✓ | ✗ |
<Tip>
يتمتع مالك المؤسسة دائماً بالوصول. في الوضع الخاص، يمكن فقط للمستخدمين
والأدوار المدرجين في القائمة البيضاء العرض والتشغيل والوصول إلى السجلات/المقاييس/الإعدادات.
</Tip>
<Frame>
<img src="/images/enterprise/visibility.png" alt="إعدادات رؤية الأتمتة في CrewAI AMP" />
</Frame>
### أنواع صلاحيات النشر
عند منح وصول على مستوى الكيان لأتمتة محددة، يمكنك تعيين أنواع الصلاحيات التالية:
| الصلاحية | ما تسمح به |
| :------------------- | :-------------------------------------------------- |
| `run` | تنفيذ الأتمتة واستخدام API الخاص بها |
| `traces` | عرض تتبعات التنفيذ والسجلات |
| `manage_settings` | تعديل، إعادة نشر، استرجاع، أو حذف الأتمتة |
| `human_in_the_loop` | الرد على طلبات الإنسان في الحلقة (HITL) |
| `full_access` | جميع ما سبق |
### RBAC على مستوى الكيان لموارد أخرى
عند تفعيل RBAC على مستوى الكيان، يمكن أيضاً التحكم في الوصول لهذه الموارد حسب المستخدم أو الدور:
| المورد | يتم التحكم فيه بواسطة | الوصف |
| :-------------------- | :--------------------------------- | :------------------------------------------------------------- |
| متغيرات البيئة | علامة ميزة RBAC الكيان | تقييد أي الأدوار/المستخدمين يمكنهم عرض أو إدارة متغيرات بيئة محددة |
| اتصالات LLM | علامة ميزة RBAC الكيان | تقييد الوصول لتهيئات مزودي LLM محددة |
| مستودعات Git | إعداد RBAC لمستودعات Git بالمؤسسة | تقييد أي الأدوار/المستخدمين يمكنهم الوصول لمستودعات متصلة محددة |
---
## أنماط الأدوار الشائعة
بينما يأتي CrewAI بدوري Owner وMember، تستفيد معظم الفرق من إنشاء أدوار مخصصة. إليك الأنماط الشائعة:
### دور المطور
دور لأعضاء الفريق الذين يبنون وينشرون الأتمتات لكن لا يديرون إعدادات المؤسسة.
| الميزة | الصلاحية |
| :------------------------ | :---------- |
| `usage_dashboards` | Read |
| `crews_dashboards` | Manage |
| `invitations` | Read |
| `training_ui` | Read |
| `tools` | Manage |
| `agents` | Manage |
| `environment_variables` | Manage |
| `llm_connections` | Manage |
| `default_settings` | No access |
| `organization_settings` | No access |
| `studio_projects` | Manage |
### دور المشاهد / أصحاب المصلحة
دور للمعنيين غير التقنيين الذين يحتاجون لمراقبة الأتمتات وعرض النتائج.
| الميزة | الصلاحية |
| :------------------------ | :---------- |
| `usage_dashboards` | Read |
| `crews_dashboards` | Read |
| `invitations` | No access |
| `training_ui` | Read |
| `tools` | Read |
| `agents` | Read |
| `environment_variables` | No access |
| `llm_connections` | No access |
| `default_settings` | No access |
| `organization_settings` | No access |
| `studio_projects` | No access |
### دور مسؤول العمليات / المنصة
دور لمشغلي المنصة الذين يديرون إعدادات البنية التحتية لكن قد لا يبنون الوكلاء.
| الميزة | الصلاحية |
| :------------------------ | :---------- |
| `usage_dashboards` | Manage |
| `crews_dashboards` | Manage |
| `invitations` | Manage |
| `training_ui` | Read |
| `tools` | Read |
| `agents` | Read |
| `environment_variables` | Manage |
| `llm_connections` | Manage |
| `default_settings` | Manage |
| `organization_settings` | Read |
| `studio_projects` | No access |
---
<Card title="تحتاج مساعدة؟" icon="headset" href="mailto:support@crewai.com">
تواصل مع فريق الدعم للمساعدة في أسئلة RBAC.
</Card>

View File

@@ -0,0 +1,321 @@
---
title: AWS Workload Identity (اتحاد OIDC)
description: تكوين AWS Secrets Manager عبر Workload Identity للوصول إلى الأسرار بشكل مراعٍ للتدوير وبدون بيانات اعتماد
sidebarTitle: بـ Workload Identity
icon: "id-badge"
---
## نظرة عامة
يُكوِّن هذا الدليل AWS Secrets Manager كمزود أسرار باستخدام **Workload Identity Federation**: تُصدر CrewAI Platform رموز OIDC قصيرة الأمد، وتُبادلها للحصول على بيانات اعتماد AWS عبر STS، وتقرأ أسرارك — دون تخزين أي مفتاح وصول AWS طويل الأمد في أي مكان.
<Note>
**لماذا هذا المسار:** تُحَلّ الأسرار وقت تنفيذ الأتمتة، لذا **تنتشر القيم المُدوَّرة إلى الإطلاق التالي بدون إعادة نشر**. إن كنت تحتاج فقط بيانات اعتماد ثابتة ولا تهتم بانتشار التدوير، راجع الدليل الأبسط [AWS — المفاتيح الثابتة / AssumeRole](/ar/enterprise/features/secrets-manager/aws).
</Note>
### كيف يعمل وقت التشغيل
1. يطلب عامل النشر JWT OIDC طازج من CrewAI Platform.
2. يستدعي العامل `sts:AssumeRoleWithWebIdentity` على دور IAM الذي ستُعدّه أدناه، مُقدِّماً الـ JWT.
3. تتحقق AWS STS من الـ JWT مقابل مُصدر OIDC العام لـ CrewAI Platform (لذا يجب أن يكون تنصيب منصتك قابلاً للوصول من AWS)، ثم تُعيد بيانات اعتماد AWS قصيرة الأمد.
4. يستخدم العامل تلك البيانات لاستدعاء `secretsmanager:GetSecretValue`.
5. تُحقن القيمة المجلوبة كقيمة لمتغير البيئة لإطلاق الأتمتة ذاك.
تُخزَّن رموز موضوع OIDC مؤقتاً لنحو ساعة لتفادي إعادة الإصدار في كل إطلاق. تُجلب قيم الأسرار طازجة في كل إطلاق بغض النظر عن حالة ذاكرة OIDC المؤقتة، وهذا ما يجعل هذا المسار مراعياً للتدوير.
## المتطلبات المسبقة
<Note>
قبل البدء، تأكد من امتلاكك:
- يجب أن تتضمن صورة حاوية الأتمتة إصدار CrewAI runtime رقم `1.14.5` أو أحدث.
- حساب AWS لديه إذن إنشاء مزوّدي OIDC وأدوار وسياسات IAM.
- منطقة AWS التي تعيش (أو ستعيش) فيها أسرارك، مثلاً `us-east-1`.
- مؤسسة على CrewAI Platform يمتلك مستخدمك فيها إذني `workload_identity_configs: manage` و `secret_providers: manage`. راجع [الأذونات (RBAC)](/ar/enterprise/features/secrets-manager/usage#permissions-rbac).
- **UUID مؤسسة CrewAI الخاصة بك.** يمكنك العثور عليه في صفحة إعدادات المؤسسة في CrewAI Platform — تُربط سياسة الثقة في الخطوة 3 دور IAM بهذه المؤسسة تحديداً.
- **يجب أن يكون تنصيب CrewAI Platform قابلاً للوصول من AWS عبر HTTPS** ليتمكّن AWS STS من جلب وثيقة اكتشاف OIDC و JWKS أثناء التحقق من الرمز. تأكد مع مسؤول المنصة من أن المضيف متاح عبر الإنترنت (أو أن AWS يمكنه الوصول إليه شبكياً عبر VPC peering أو ما يعادله).
</Note>
## الخطوة 1 — العثور على عنوان مُصدر OIDC لـ CrewAI Platform
ينشر تنصيب CrewAI Platform وثيقة اكتشاف OpenID Connect على `https://<your-platform-host>/.well-known/openid-configuration`. الحقل `issuer` في تلك الوثيقة هو الرابط الذي ستُسجِّله AWS كمزود OIDC موثوق.
افتح الرابط في المتصفح (مع استبدال `<your-platform-host>` بمضيفك الفعلي، مثلاً `app.crewai.com`):
```
https://<your-platform-host>/.well-known/openid-configuration
```
ينبغي أن ترى JSON يحتوي على:
```json
{
"issuer": "https://<your-platform-host>",
"jwks_uri": "https://<your-platform-host>/oauth2/jwks",
...
}
```
سجّل القيمة الدقيقة لـ `issuer` — ستستخدمها في الخطوة 3.
<Tip>
إذا أعاد الرابط 404 أو 503، اتصل بمسؤول المنصة. يتطلب مُصدر OIDC تكوين مفتاح توقيع خاص وقت التنصيب. راجع دليل تنصيب المنصة لتكوين `OIDC_PRIVATE_KEY` و `OIDC_ISSUER`.
</Tip>
## الخطوة 2 — تسجيل CrewAI Platform كمزود هوية OIDC في IAM
افتح [وحدة تحكم IAM ← Identity providers](https://console.aws.amazon.com/iam/home#/identity_providers) وانقر على **Add provider**.
- **Provider type:** OpenID Connect.
- **Provider URL:** قيمة `issuer` من الخطوة 1 (مثلاً `https://app.crewai.com`).
- **Audience:** `sts.amazonaws.com`
انقر على **Add provider**.
أو عبر CLI:
```bash
aws iam create-open-id-connect-provider \
--url "https://<your-platform-host>" \
--client-id-list "sts.amazonaws.com" \
--thumbprint-list "$(echo | openssl s_client -servername <your-platform-host> -connect <your-platform-host>:443 2>/dev/null | openssl x509 -fingerprint -noout -sha1 | cut -d= -f2 | tr -d ':')"
```
انسخ **OpenIDConnectProviderArn** من المخرجات (أو ARN المزود من الوحدة). ستستخدمه في الخطوة 3.
<Note>
لا تتحقق AWS فعلياً من بصمة الإبهام لاستدعاءات STS WebIdentity — فهي دائماً تُعيد جلب JWKS وقت التحقق — لكن واجهة الـ API تتطلب وجود الحقل.
</Note>
{/* SCREENSHOT: AWS IAM "Add identity provider" form filled with the Platform issuer URL and audience sts.amazonaws.com → /images/secrets-manager/aws-wi/01-add-oidc-provider.png */}
{/* SCREENSHOT: Provider detail page showing the provider's ARN → /images/secrets-manager/aws-wi/02-oidc-provider-arn.png */}
## الخطوة 3 — إنشاء دور IAM
احفظ كـ `trust-policy.json`، مع استبدال `<YOUR_ACCOUNT_ID>` و `<your-platform-host>` (مضيف المُصدر **بدون** `https://` أو `http://`، مثلاً `app.crewai.com`) و `<YOUR_CREWAI_ORG_UUID>` (من المتطلبات المسبقة):
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Federated": "arn:aws:iam::<YOUR_ACCOUNT_ID>:oidc-provider/<your-platform-host>"
},
"Action": "sts:AssumeRoleWithWebIdentity",
"Condition": {
"StringEquals": {
"<your-platform-host>:aud": "sts.amazonaws.com",
"<your-platform-host>:sub": "organization:<YOUR_CREWAI_ORG_UUID>"
}
}
}
]
}
```
أنشئ الدور:
```bash
aws iam create-role \
--role-name crewai-secrets-reader \
--assume-role-policy-document file://trust-policy.json
```
انسخ **Role Arn** من المخرجات — هذا هو `aws_role_arn` الخاص بك. ستلصقه في CrewAI Platform في الخطوة 6.
<Tip>
يحدّد الشرطان نطاق الثقة بدقة: يقيّد `aud` افتراض الدور إلى الرموز ذات جمهور AWS STS، ويقصر `sub` الاتحاد على مؤسسة CrewAI محددة — تُقبل فقط الرموز المُصدَرة لأتمتات تلك المؤسسة. تُعيّن CrewAI Platform كلا الادّعاءين دائماً على رموز AWS workload identity.
</Tip>
{/* SCREENSHOT: IAM "Create role" with Web Identity trust type, federated provider selector pointing at the CrewAI Platform OIDC provider → /images/secrets-manager/aws-wi/03-create-role-trust.png */}
## الخطوة 4 — إنشاء وإرفاق سياسة IAM لوصول Secrets Manager + KMS
احفظ كـ `secrets-policy.json`، مع استبدال العناصر النائبة بمعرّف حسابك ومنطقتك وبادئة اسم السر و ARN(s) مفاتيح KMS التي تُشفّر تلك الأسرار:
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "SecretsManagerListForUI",
"Effect": "Allow",
"Action": "secretsmanager:ListSecrets",
"Resource": "*"
},
{
"Sid": "SecretsManagerRead",
"Effect": "Allow",
"Action": [
"secretsmanager:GetSecretValue"
],
"Resource": "arn:aws:secretsmanager:<REGION>:<YOUR_ACCOUNT_ID>:secret:<SECRET_NAME_PREFIX>-*"
},
{
"Sid": "KMSDecrypt",
"Effect": "Allow",
"Action": [
"kms:Decrypt"
],
"Resource": "arn:aws:kms:<REGION>:<YOUR_ACCOUNT_ID>:key/<KMS_KEY_ID>"
}
]
}
```
تُشغّل `SecretsManagerListForUI` ميزة **الاقتراح التلقائي لاسم السر** في نموذج متغيرات البيئة وزر **Test Connection** على بيانات الاعتماد. يقبل `secretsmanager:ListSecrets` فقط `Resource: "*"` — فهو محصور على مستوى الحساب في طبقة IAM.
أرفق السياسة بالدور إما عبر CLI (سياسة مضمنة، أبسط) أو واجهة الوحدة؛ للبيئات التي تعيد استخدام نفس الأذونات عبر أدوار متعددة، استخدم علامة التبويب **Managed policy** لسياسة مُسمّاة قابلة لإعادة الاستخدام.
<Tabs>
<Tab title="سياسة مضمنة (CLI)">
```bash
aws iam put-role-policy \
--role-name crewai-secrets-reader \
--policy-name SecretsManagerRead \
--policy-document file://secrets-policy.json
```
يُرفق هذا السياسة **مضمنةً** بالدور. السياسات المضمنة مرتبطة بالدور ولا يمكن إعادة استخدامها على أدوار أخرى.
</Tab>
<Tab title="سياسة مُدارة (CLI، قابلة لإعادة الاستخدام)">
```bash
POLICY_ARN=$(aws iam create-policy \
--policy-name CrewAISecretsReader \
--policy-document file://secrets-policy.json \
--query 'Policy.Arn' --output text)
aws iam attach-role-policy \
--role-name crewai-secrets-reader \
--policy-arn "$POLICY_ARN"
```
السياسة المُدارة هي مورد IAM مستقل يمكنك إرفاقه بأدوار متعددة.
</Tab>
<Tab title="وحدة التحكم (UI)">
1. افتح [وحدة تحكم IAM ← Roles](https://console.aws.amazon.com/iam/home#/roles) واختر **crewai-secrets-reader**.
2. في علامة التبويب **Permissions**، انقر على **Add permissions** ← **Create inline policy**.
3. بدّل إلى محرر **JSON** والصق محتوى `secrets-policy.json`.
4. انقر على **Next**، أعطِ السياسة اسماً (مثلاً `SecretsManagerRead`)، وانقر على **Create policy**.
لإنشاء سياسة مُدارة قابلة لإعادة الاستخدام بدلاً من ذلك، استخدم **IAM ← Policies ← Create policy** ثم أرفقها بالدور من علامة التبويب **Permissions** الخاصة بالدور.
{/* SCREENSHOT: IAM Role detail → Permissions → Create inline policy with JSON editor → /images/secrets-manager/aws-wi/03b-attach-inline-policy.png */}
</Tab>
</Tabs>
## الخطوة 5 — إنشاء سر واحد على الأقل في AWS
إذا لم يكن لديك سر للاختبار، أنشئ واحداً الآن:
```bash
aws secretsmanager create-secret \
--region <REGION> \
--name crewai-test-keyword \
--secret-string "hello from aws"
```
أو عبر [وحدة تحكم AWS Secrets Manager](https://console.aws.amazon.com/secretsmanager/) ← **Store a new secret**.
{/* SCREENSHOT: AWS Secrets Manager "Store a new secret" page with a sample value → /images/secrets-manager/aws-wi/04-create-secret.png */}
## الخطوة 6 — إضافة تكوين Workload Identity في CrewAI Platform
في CrewAI Platform، انتقل إلى **Settings** ← **Workload Identity** وانقر على **Add Workload Identity Config**.
{/* SCREENSHOT: Sidebar highlighting Settings → Workload Identity → /images/secrets-manager/aws-wi/05-amp-settings-wi-nav.png */}
{/* SCREENSHOT: Empty state of Workload Identity page with "Add Workload Identity Config" button → /images/secrets-manager/aws-wi/06-amp-wi-empty-state.png */}
املأ النموذج:
- **Name:** اسم وصفي، مثلاً `aws-prod`.
- **Cloud Provider:** `AWS`.
- **AWS Role ARN:** **Role Arn** من الخطوة 3.
- **AWS Region:** المنطقة التي تعيش فيها أسرارك، مثلاً `us-east-1`.
- (اختياري) حدّد **Set as default for AWS** إذا كنت ترغب في أن يكون تكوين WI هذا هو الافتراضي المُحدَّد عند إنشاء بيانات اعتماد سر مدعومة بـ AWS.
انقر على **Create**.
{/* SCREENSHOT: "Add Workload Identity Config" form with AWS, role ARN, and region filled in → /images/secrets-manager/aws-wi/07-amp-add-wi-config-aws.png */}
{/* SCREENSHOT: Workload Identity list showing the new AWS row with "(default)" badge if applicable → /images/secrets-manager/aws-wi/08-amp-wi-list-with-aws.png */}
## الخطوة 7 — إضافة بيانات اعتماد مزود أسرار مرتبطة بتكوين WI
انتقل إلى **Settings** ← **Secret Provider Credentials** وانقر على **Add Credential**.
املأ النموذج:
- **Name:** اسم وصفي، مثلاً `aws-prod-wi`.
- **Provider:** `AWS Secrets Manager`.
- **Authentication Method:** `Workload Identity` (بدلاً من المفاتيح الثابتة / AssumeRole).
- **Workload Identity Configuration:** اختر التكوين الذي أنشأته في الخطوة 6 (مثلاً `aws-prod`).
- (اختياري) حدّد **Set as default credential for this provider**.
سيطلب النموذج فقط **AWS Region** ضمن Workload Identity — حقول بيانات الاعتماد الثابتة (Access Key ID و Secret Access Key و Role ARN و External ID) مخفية عمداً لأنها لا تنطبق على هذا المسار؛ يأتي ARN الدور من تكوين WI المرتبط.
انقر على **Create**.
{/* SCREENSHOT: "Add Secret Provider Credential" form with AWS + Workload Identity + WI config dropdown selected → /images/secrets-manager/aws-wi/09-amp-add-credential-aws-wi.png */}
## الخطوة 8 — اختبار الاتصال
بعد حفظ بيانات الاعتماد، انقر على **Test Connection**. لبيانات اعتماد workload-identity، يتحقق هذا من مصافحة OIDC: تُصدر CrewAI Platform JWT، وتبادله مع AWS STS عبر `sts:AssumeRoleWithWebIdentity`، وتؤكد أن بيانات الاعتماد الناتجة يمكنها استدعاء `sts:GetCallerIdentity` مقابل الدور المُفترَض. نتيجة خضراء تعني أن ارتباط الاتحاد سليم.
نجاح Test Connection يُثبت أن سياسة الثقة وتسجيل مزود OIDC وشرط الجمهور موصولة جميعها بشكل صحيح. لا يُثبت ذلك أن IAM لكل سر صحيح — يُمارَس `secretsmanager:GetSecretValue` على ARN سر محدد بشكل منفصل عندما يُحَلّ متغير بيئة عند الإطلاق. راجع [استكشاف الأخطاء](#troubleshooting) لأنماط فشل المصافحة.
## الخطوة 9 — الإشارة إلى السر في متغير بيئة
الآن أَشِر إلى السر على أتمتة، تماماً كما تفعل مع أي متغير بيئة مدعوم بمدير أسرار. راجع [استخدام مدير الأسرار](/ar/enterprise/features/secrets-manager/usage#referencing-secrets-in-environment-variables) لحقول النموذج والسلوك.
الفرق الوحيد بين متغيرات البيئة المدعومة بـ WI والمدعومة بمفاتيح ثابتة هو **متى** يُقرأ السر:
- **مدعوم بـ WI:** تُقرأ قيمة السر طازجة في كل إطلاق أتمتة.
- **مدعوم بمفاتيح ثابتة:** تُقرأ قيمة السر وقت النشر وتُدمج في صورة النشر.
## الخطوة 10 — التحقق من التدوير
بعد تشغيل عملية النشر، دوّر السر في AWS:
```bash
aws secretsmanager update-secret \
--region <REGION> \
--secret-id crewai-test-keyword \
--secret-string "rotated value"
```
أطلق إطلاق أتمتة جديداً. ستكون بيئة الإطلاق ترى `"rotated value"` — بدون إعادة نشر ولا إعادة تشغيل عامل ولا انتظار TTL.
للتأكد في السجلات (إذا كان لديك وصول إلى العامل)، ابحث عن:
```
Workload identity config '<id>' (aws): N secret(s) resolved
```
يظهر هذا السطر لكل إطلاق ويُشير إلى استدعاء `GetSecretValue` طازج مقابل AWS.
## استكشاف الأخطاء
| العَرَض | السبب المحتمل |
|---|---|
| يفشل Test Connection بخطأ مصافحة | رُفض استدعاء `sts:AssumeRoleWithWebIdentity`. تحقق من أن ARN الكيان الموحَّد في سياسة الثقة يشير إلى `oidc-provider/<your-platform-host>` (المضيف **بدون** `https://` أو `http://` وبدون شرطة مائلة لاحقة)، وأن شرط الجمهور هو بالضبط `sts.amazonaws.com`، وأن شرط `sub` يطابق UUID مؤسسة CrewAI الخاصة بك، وأن رابط اكتشاف OIDC للمنصة قابل للوصول من AWS عبر الإنترنت العام. |
| `InvalidIdentityToken: Couldn't retrieve verification key from your identity provider` | لا يمكن لـ AWS STS الوصول إلى مضيف CrewAI Platform لجلب JWKS. تأكد من أن المضيف متاح عبر الإنترنت من AWS، وأن رابط اكتشاف OIDC يُعيد 200، وأن نقطة نهاية JWKS قابلة للوصول. |
| `AccessDenied: Not authorized to perform sts:AssumeRoleWithWebIdentity` | عدم تطابق سياسة الثقة. تحقق من الخطوة 3 من جديد: يجب أن يتضمن ARN الكيان الموحَّد `oidc-provider/<your-platform-host>` (المضيف **بدون** `https://` أو `http://` وبدون شرطة مائلة لاحقة)، ويجب أن يكون شرط الجمهور بالضبط `sts.amazonaws.com`، وأن يساوي شرط `sub` بالضبط `organization:<YOUR_CREWAI_ORG_UUID>`. |
| يُظهر الاقتراح التلقائي لاسم السر `AccessDenied: secretsmanager:ListSecrets` | يفتقد الدور إلى `secretsmanager:ListSecrets` مع `Resource: "*"`. أضف بيان `SecretsManagerListForUI` من الخطوة 4. |
| يفشل الإطلاق في حلّ سر رغم نجاح Test Connection | ارتباط WI سليم، لكن IAM المحصور بالمورد مفقود على السر الفاشل. راجع أذونات `secretsmanager:GetSecretValue` و `kms:Decrypt` للدور على ARN ذلك السر بعينه ومفتاح KMS الخاص به. |
| `RegionDisabledException` / لم يُعثر على أسرار | لا تطابق المنطقة في تكوين Workload Identity المكان الفعلي للسر. تحقق من الخطوة 6 من جديد. |
| لا تُلتقط القيمة المُدوَّرة في الإطلاق التالي | تأكد من أن متغير البيئة على الأتمتة يشير إلى بيانات اعتماد مدعومة بـ Workload Identity (وليس بيانات اعتماد بمفاتيح ثابتة). يدمج المسار الثابت القيم في صورة النشر. |
### روابط مرجعية
- AWS: [Creating OpenID Connect (OIDC) identity providers](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_oidc.html)
- AWS: [Configuring a role for OpenID Connect federation](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_oidc_relying-party.html)
- AWS: [STS:AssumeRoleWithWebIdentity API reference](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithWebIdentity.html)
## الخطوات التالية
- [استخدام الأسرار في متغيرات البيئة وإدارة الأذونات](/ar/enterprise/features/secrets-manager/usage)
- للتنوع متعدد السحاب، راجع أيضاً [GCP Workload Identity Federation](/ar/enterprise/features/secrets-manager/gcp-workload-identity) و [Azure Workload Identity Federation](/ar/enterprise/features/secrets-manager/azure-workload-identity).

View File

@@ -0,0 +1,295 @@
---
title: AWS Secrets Manager (بيانات اعتماد ثابتة)
description: تكوين AWS Secrets Manager كمزود أسرار لـ CrewAI Platform باستخدام مفاتيح الوصول الثابتة أو AssumeRole
sidebarTitle: ببيانات اعتماد ثابتة
icon: "key"
---
## نظرة عامة
يأخذك هذا الدليل عبر تكوين AWS Secrets Manager كمزود أسرار لمؤسستك على CrewAI Platform، باستخدام **بيانات الاعتماد الثابتة** (مفاتيح الوصول، اختيارياً مع AssumeRole). بنهاية الدليل، ستتمكن CrewAI Platform من قراءة الأسرار المخزّنة في حساب AWS الخاص بك وحقنها كقيم متغيرات بيئة وقت التشغيل.
<Note>
يغطي هذا الدليل مسار **بيانات الاعتماد الثابتة** — تُحَلّ الأسرار وقت النشر وتُدمج في صورة النشر. تتطلب القيم المُدوَّرة إعادة نشر. إذا أردت أسراراً مراعية للتدوير تُحدَّث في كل إطلاق أتمتة (بدون إعادة نشر)، راجع [AWS Workload Identity (اتحاد OIDC)](/ar/enterprise/features/secrets-manager/aws-workload-identity).
</Note>
<Note>
يغطي هذا الدليل التكوين من جانب AWS وإعداد بيانات الاعتماد في CrewAI Platform. للإشارة بعدها إلى سر من متغير بيئة، راجع [استخدام مدير الأسرار](/ar/enterprise/features/secrets-manager/usage).
</Note>
## المتطلبات المسبقة
<Note>
قبل البدء، تأكد من امتلاكك:
- حساب AWS لديه إذن إنشاء مستخدمي IAM وسياسات يديرها العميل و(اختيارياً) أدوار IAM.
- منطقة AWS التي تعيش (أو ستعيش) فيها أسرارك، مثلاً `us-east-1`.
- مؤسسة على CrewAI Platform يمتلك مستخدمك فيها إذن `secret_providers: manage`. راجع [الأذونات (RBAC)](/ar/enterprise/features/secrets-manager/usage#permissions-rbac).
</Note>
## اختر طريقة المصادقة
تدعم CrewAI Platform طريقتين لمصادقة المنصة مع AWS Secrets Manager. اختر واحدة قبل أن تبدأ — تختلف الخطوات أدناه بناءً على اختيارك.
| الطريقة | متى تُستخدم | المقايضات |
|---|---|---|
| **مفاتيح الوصول الثابتة** | البداية، عمليات نشر بحساب واحد | أبسط إعداد؛ يجب تدوير مفاتيح الوصول يدوياً |
| **AssumeRole** | عبر الحسابات، تشديد الإنتاج | بيانات اعتماد قصيرة الأمد؛ يدعم External ID؛ يتطلب دور IAM إضافي |
تستخدم بقية هذا الدليل علامات تبويب في الخطوات 35 لتتمكن من اتباع المسار المطابق لاختيارك.
## الخطوة 1 — إنشاء مستخدم IAM
افتح [وحدة تحكم IAM](https://console.aws.amazon.com/iam/)، انتقل إلى **Users**، ثم انقر على **Create user**.
- الاسم المقترح: `crewai-secrets-reader`.
- اترك **Provide user access to the AWS Management Console** بدون تحديد — هذا الكيان تستخدمه CrewAI Platform برمجياً، وليس البشر.
- انقر على **Next**.
في صفحة **Set permissions**، اترك الاختيار الافتراضي. ستُرفق السياسة في الخطوة 3.
انقر على **Next**، راجع، وانقر على **Create user**.
للتفاصيل الكاملة، راجع وثائق AWS: [Create an IAM user in your AWS account](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html).
{/* SCREENSHOT: AWS IAM "Create user" form filled with name "crewai-secrets-reader" → /images/secrets-manager/aws/01-create-iam-user.png */}
## الخطوة 2 — إنشاء سياسة IAM
تحتاج CrewAI Platform إلى وصول للقراءة فقط إلى AWS Secrets Manager وإذن لفك تشفير الأسرار عبر KMS. أنشئ سياسة يديرها العميل بـ JSON التالي.
في وحدة تحكم IAM، انتقل إلى **Policies**، ثم انقر على **Create policy**.
اختر علامة التبويب **JSON** واستبدل المحتوى بـ:
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "SecretsManagerRead",
"Effect": "Allow",
"Action": [
"secretsmanager:ListSecrets",
"secretsmanager:GetSecretValue",
"secretsmanager:DescribeSecret"
],
"Resource": "*"
},
{
"Sid": "KMSDecrypt",
"Effect": "Allow",
"Action": [
"kms:DescribeKey",
"kms:Decrypt"
],
"Resource": "*"
}
]
}
```
انقر على **Next**، ثم في صفحة **Review and create**:
- **Policy name:** `CrewAISecretsManagerRead`
- **Description (optional):** `Read-only access to AWS Secrets Manager for CrewAI Platform`
انقر على **Create policy**.
<Tip>
تمنح السياسة أعلاه `*` على `Resource` للبساطة. في الإنتاج، حدّد نطاق `Resource` إلى ARNs الخاصة بالأسرار التي يجب على CrewAI Platform الوصول إليها، وحدّد نطاق `kms:Decrypt` إلى ARNs مفاتيح KMS التي تُشفّر تلك الأسرار. راجع [إرشادات AWS حول أقل الامتيازات](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_create-console.html).
</Tip>
{/* SCREENSHOT: AWS IAM "Create policy" → JSON tab with the policy above pasted → /images/secrets-manager/aws/02-create-policy-json-editor.png */}
{/* SCREENSHOT: AWS IAM "Review and create policy" page with name "CrewAISecretsManagerRead" → /images/secrets-manager/aws/03-policy-review-and-create.png */}
## الخطوة 3 — إرفاق السياسة
<Tabs>
<Tab title="مفاتيح الوصول الثابتة">
1. في وحدة تحكم IAM، انتقل إلى **Users** وانقر على المستخدم الذي أنشأته في الخطوة 1.
2. في علامة التبويب **Permissions**، انقر على **Add permissions** ← **Attach policies directly**.
3. ابحث عن `CrewAISecretsManagerRead`، حدّدها، وانقر على **Next**.
4. انقر على **Add permissions**.
{/* SCREENSHOT: "Add permissions" → "Attach policies directly" with CrewAISecretsManagerRead selected → /images/secrets-manager/aws/04a-attach-policy-to-user.png */}
</Tab>
<Tab title="AssumeRole">
مع AssumeRole، تُرفَق السياسة بـ **دور** IAM منفصل (وليس مباشرة بالمستخدم). يحتاج المستخدم من الخطوة 1 فقط إلى إذن لاستدعاء `sts:AssumeRole` على ذلك الدور.
**إنشاء الدور:**
1. في وحدة تحكم IAM، انتقل إلى **Roles** وانقر على **Create role**.
2. **Trusted entity type:** AWS account. اختر **This account** (أو **Another AWS account** لإعدادات عبر الحسابات، ثم أدخل معرّف حساب AWS الذي يستضيف مستخدم IAM من الخطوة 1).
3. (موصى به) حدّد **Require external ID** وأدخل قيمة تُولّدها بنفسك — هذا سر مشترك ستلصقه في CrewAI Platform في الخطوة 5.
4. انقر على **Next**.
5. أرفق سياسة `CrewAISecretsManagerRead`.
6. انقر على **Next**، سمِّ الدور `CrewAISecretsManagerRole`، وانقر على **Create role**.
**اسمح لمستخدم IAM بافتراض الدور:**
1. افتح الدور الذي أنشأته للتو وانسخ **ARN** الخاص به.
2. في وحدة تحكم IAM، انتقل إلى **Users**، انقر على المستخدم من الخطوة 1، وفي علامة التبويب **Permissions** انقر على **Add permissions** ← **Create inline policy**.
3. في علامة التبويب **JSON**، الصق ما يلي (استبدل `ROLE_ARN_FROM_ABOVE`):
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Resource": "ROLE_ARN_FROM_ABOVE"
}
]
}
```
4. سمِّ السياسة `CrewAIAssumeSecretsRole` وانقر على **Create policy**.
{/* SCREENSHOT: IAM "Create role" trust policy step with External ID checkbox enabled → /images/secrets-manager/aws/04b-create-role-trust-policy.png */}
{/* SCREENSHOT: Inline sts:AssumeRole policy attached to the IAM user → /images/secrets-manager/aws/04c-attach-assumerole-on-user.png */}
</Tab>
</Tabs>
## الخطوة 4 — الحصول على بيانات الاعتماد
<Tabs>
<Tab title="مفاتيح الوصول الثابتة">
1. في وحدة تحكم IAM، افتح المستخدم من الخطوة 1.
2. انقر على علامة التبويب **Security credentials**.
3. تحت **Access keys**، انقر على **Create access key**.
4. اختر **Application running outside AWS** (أو **Other**) كحالة استخدام. انقر على **Next**.
5. (اختياري) أضف وسماً وصفياً. انقر على **Create access key**.
6. انقر على **Show** للكشف عن مفتاح الوصول السري، ثم انسخ كلاً من **Access key ID** و **Secret access key**، أو انقر على **Download .csv file**.
<Warning>
يظهر مفتاح الوصول السري مرة واحدة فقط. إذا أغلقت هذه الصفحة دون نسخه، فستحتاج إلى حذف المفتاح وإنشاء واحد جديد.
</Warning>
للتفاصيل الكاملة، راجع وثائق AWS: [Manage access keys for IAM users](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html).
{/* SCREENSHOT: Access key use-case selector ("Application running outside AWS") → /images/secrets-manager/aws/05a-create-access-key-use-case.png */}
{/* SCREENSHOT: "Retrieve access keys" page with Show/Download buttons → /images/secrets-manager/aws/06a-retrieve-access-keys.png */}
</Tab>
<Tab title="AssumeRole">
حتى مع AssumeRole، لا تزال CrewAI Platform تحتاج إلى مفتاح وصول لمستخدم IAM — فهي تستخدم تلك المفاتيح كهوية المتصل لتنفيذ استدعاء `sts:AssumeRole`.
1. أنشئ مفتاح وصول للمستخدم تماماً كما هو موضح في علامة التبويب **مفاتيح الوصول الثابتة** أعلاه.
2. افتح الدور الذي أنشأته في الخطوة 3 وانسخ:
- **Role ARN** (من ملخص الدور).
- **External ID** الذي كوّنته (إن وُجد) — قد عيّنته بنفسك في الخطوة 3، فتأكد من أنه بحوزتك.
{/* SCREENSHOT: IAM role detail page showing Role ARN → /images/secrets-manager/aws/05b-role-arn-detail.png */}
</Tab>
</Tabs>
## الخطوة 5 — إضافة بيانات الاعتماد في CrewAI Platform
في CrewAI Platform، انتقل إلى **Settings** ← **Secret Provider Credentials** وانقر على **Add Credential**.
{/* SCREENSHOT: Sidebar/nav highlighting Settings → Secret Provider Credentials → /images/secrets-manager/usage/01-amp-settings-nav.png */}
{/* SCREENSHOT: Empty state of Secret Provider Credentials page with "Add Credential" button → /images/secrets-manager/usage/02-amp-credentials-empty-state.png */}
<Tabs>
<Tab title="مفاتيح الوصول الثابتة">
املأ النموذج:
- **Name:** اسم وصفي، مثلاً `aws-prod`.
- **Provider:** `AWS Secrets Manager`.
- **Region:** منطقة AWS التي تعيش فيها أسرارك، مثلاً `us-east-1`. يجب أن تطابق منطقة الأسرار التي تريد قراءتها.
- **Access Key ID:** القيمة من الخطوة 4.
- **Secret Access Key:** القيمة من الخطوة 4.
- (اختياري) حدّد **Set as default credential for this provider**. تُستخدم بيانات الاعتماد الافتراضية بواسطة متغيرات البيئة التي تشير إلى أسرار AWS بدون تحديد بيانات اعتماد صراحةً.
اترك **Role ARN** و **External ID** فارغين.
انقر على **Create**.
{/* SCREENSHOT: "Add Secret Provider Credential" form with AWS + static access keys filled in → /images/secrets-manager/usage/03a-amp-add-credential-form-aws-static.png */}
</Tab>
<Tab title="AssumeRole">
املأ النموذج:
- **Name:** اسم وصفي، مثلاً `aws-prod-assumerole`.
- **Provider:** `AWS Secrets Manager`.
- **Region:** منطقة AWS التي تعيش فيها أسرارك.
- **Access Key ID:** مفتاح وصول مستخدم IAM من الخطوة 4 (يُستخدم لاستدعاء STS).
- **Secret Access Key:** مفتاح الوصول السري لمستخدم IAM من الخطوة 4.
- **Role ARN:** Role ARN الذي نسخته في الخطوة 4.
- **External ID:** External ID الذي عيّنته على سياسة الثقة الخاصة بالدور (احذفه إن لم يوجد).
- (اختياري) حدّد **Set as default credential for this provider**.
انقر على **Create**.
{/* SCREENSHOT: "Add Secret Provider Credential" form with AWS + AssumeRole fields filled in → /images/secrets-manager/usage/03b-amp-add-credential-form-aws-assumerole.png */}
</Tab>
</Tabs>
<Note>
**كيف تتصرف الطريقتان وقت التشغيل:**
- مع **مفاتيح الوصول الثابتة** فقط، تستدعي CrewAI Platform AWS Secrets Manager مباشرةً باستخدام المفاتيح التي قدّمتها.
- عند تعيين **Role ARN**، تستدعي CrewAI Platform أولاً `sts:AssumeRole` بمفاتيح الوصول المقدَّمة (و External ID إن كان مكوَّناً)، ثم تستخدم بيانات الاعتماد قصيرة الأمد التي تُعيدها STS لقراءة أسرارك.
</Note>
{/* SCREENSHOT: Credentials list showing the new AWS row, with "(default)" badge if applicable → /images/secrets-manager/usage/04-amp-credential-created.png */}
## الخطوة 6 — إنشاء سر واحد على الأقل في AWS
إذا لم يكن لديك بالفعل أسرار في AWS Secrets Manager، أنشئ واحداً الآن لتتمكن من التحقق من الاتصال في الخطوة 7.
في [وحدة تحكم AWS Secrets Manager](https://console.aws.amazon.com/secretsmanager/)، انقر على **Store a new secret**.
- **Secret type:** اختر **Other type of secret**.
- **Key/value pairs** — إما:
- إدخال زوج أو أكثر من مفتاح/قيمة (موصى به للأسرار المهيكلة)، أو
- استخدام علامة التبويب **Plaintext** لقيمة نصية واحدة.
- **Encryption key:** استخدم `aws/secretsmanager` (المفتاح الذي يديره AWS) ما لم تكن لديك متطلبات محددة لمفتاح KMS.
انقر على **Next**، ثم أدخل:
- **Secret name:** اسم فريد، مثلاً `crewai/openai-api-key`.
- **Description (optional):** ملاحظة قصيرة عن غرض السر.
انقر على **Next** عبر خطوات التدوير والمراجعة، ثم انقر على **Store**.
<Note>
**صيغة الإشارة بمفتاح JSON.** إذا خزّنت سراً بأزواج مفتاح/قيمة متعددة (كائن JSON)، يمكن لـ CrewAI Platform استخراج حقل محدد باستخدام صيغة `secret-name#json_key` في إشارات متغيرات البيئة. على سبيل المثال، يمكن الإشارة إلى سر باسم `database-credentials` بـ `{"username": "...", "password": "..."}` باسم `database-credentials#password`. راجع [استخدام مدير الأسرار](/ar/enterprise/features/secrets-manager/usage#referencing-secrets-in-environment-variables) للتفاصيل.
</Note>
للتفاصيل الكاملة، راجع وثائق AWS: [Create an AWS Secrets Manager secret](https://docs.aws.amazon.com/secretsmanager/latest/userguide/create_secret.html).
{/* SCREENSHOT: AWS Secrets Manager "Choose secret type" page → /images/secrets-manager/aws/07-create-secret-store-type.png */}
{/* SCREENSHOT: AWS Secrets Manager "Configure secret" page with name and description → /images/secrets-manager/aws/08-create-secret-name.png */}
## الخطوة 7 — اختبار الاتصال
عُد إلى CrewAI Platform، في صفحة **Secret Provider Credentials**، اعثر على بيانات الاعتماد التي أنشأتها للتو وانقر على **Test Connection**.
تؤكد رسالة نجاح أن CrewAI Platform يمكنها المصادقة مع AWS وقراءة الأسرار من حسابك.
{/* SCREENSHOT: Success toast after clicking "Test Connection" → /images/secrets-manager/usage/05-amp-test-connection-success.png */}
إذا فشل الاختبار، تحقق من الأسباب الأكثر شيوعاً:
| العَرَض | السبب المحتمل |
|---|---|
| `AccessDenied` على `secretsmanager:ListSecrets` | السياسة غير مُرفقة، أو المستخدم خاطئ. تحقق من الخطوة 3 من جديد. |
| `AccessDenied` على `kms:Decrypt` | بيان `KMSDecrypt` مفقود، أو أن أسرارك تستخدم مفتاح KMS يديره العميل لا يغطّيه `Resource: "*"`. |
| `InvalidClientTokenId` / `SignatureDoesNotMatch` | معرّف مفتاح الوصول أو مفتاح الوصول السري خاطئ. تحقق من الخطوتين 4 و 5 من جديد. |
| `RegionDisabledException` / لم يُعثر على أسرار | لا تطابق **Region** الخاصة ببيانات الاعتماد المكان الفعلي لأسرارك. |
| `AccessDenied` على `sts:AssumeRole` (AssumeRole فقط) | سياسة `sts:AssumeRole` المضمنة مفقودة على مستخدم IAM، أو لا تسمح سياسة الثقة الخاصة بالدور بهذا الكيان، أو لا يتطابق External ID. |
| ينجح الاختبار فوراً بعد إنشاء مستخدم IAM، لكنه يفشل في المرة التالية | تستغرق بيانات اعتماد IAM أحياناً دقيقة أو دقيقتين للانتشار عالمياً. أعد المحاولة. |
## الخطوات التالية
الآن وقد اتصلت AWS، توجّه إلى [استخدام مدير الأسرار](/ar/enterprise/features/secrets-manager/usage) من أجل:
- منح أعضاء المؤسسة الأذونات الصحيحة لاستخدام (أو إدارة) مدير الأسرار.
- الإشارة إلى أسرار AWS الخاصة بك من متغيرات بيئة CrewAI Platform.
إذا كنت تريد أسراراً **مراعية للتدوير** تنتشر دون إعادة نشر، انتقل إلى [AWS Workload Identity (اتحاد OIDC)](/ar/enterprise/features/secrets-manager/aws-workload-identity) — نفس مخزن الأسرار، بدون بيانات اعتماد ثابتة، وتُجلب الأسرار في كل إطلاق.

View File

@@ -0,0 +1,275 @@
---
title: Azure Workload Identity Federation
description: تكوين Azure Key Vault عبر Microsoft Entra Workload Identity Federation للوصول إلى الأسرار بشكل مراعٍ للتدوير وبدون بيانات اعتماد
sidebarTitle: بـ Workload Identity
icon: "id-badge"
---
## نظرة عامة
يُكوِّن هذا الدليل Azure Key Vault كمزود أسرار باستخدام **Microsoft Entra Workload Identity Federation**: تُصدر CrewAI Platform رموز OIDC قصيرة الأمد، وتُبادلها للحصول على رمز وصول Entra عبر منصة هوية Microsoft، وتقرأ أسرارك — دون تخزين أي سر عميل في أي مكان.
<Note>
**لماذا هذا المسار:** تُحَلّ الأسرار وقت تنفيذ الأتمتة، لذا **تنتشر القيم المُدوَّرة إلى الإطلاق التالي بدون إعادة نشر**. إن كنت تحتاج فقط بيانات اعتماد ثابتة، راجع الدليل الأبسط [Azure Key Vault — سر العميل](/ar/enterprise/features/secrets-manager/azure).
</Note>
### كيف يعمل وقت التشغيل
1. يطلب عامل النشر JWT OIDC طازج من CrewAI Platform.
2. يُقدّم العامل الـ JWT إلى Microsoft Entra على `https://login.microsoftonline.com/<tenant>/oauth2/v2.0/token` كـ `client_assertion` (`urn:ietf:params:oauth:client-assertion-type:jwt-bearer`)، مع الإشارة إلى App Registration الذي يطابق **Federated Identity Credential** الخاص به مُصدر الـ JWT وموضوعه.
3. تتحقق Entra من الـ JWT مقابل وثيقة اكتشاف OIDC و JWKS لمنصتك، ثم تُعيد رمز وصول قصير الأمد محصور بـ `https://vault.azure.net/.default`.
4. يستدعي العامل Azure Key Vault لقراءة السر.
5. تُحقن القيمة المجلوبة كقيمة لمتغير البيئة لإطلاق الأتمتة ذاك.
تُخزَّن رموز موضوع OIDC مؤقتاً لنحو ساعة لتفادي إعادة الإصدار في كل إطلاق. تُجلب قيم الأسرار طازجة في كل إطلاق بغض النظر عن حالة ذاكرة OIDC المؤقتة، وهذا ما يجعل هذا المسار مراعياً للتدوير.
## المتطلبات المسبقة
<Note>
قبل البدء، تأكد من امتلاكك:
- يجب أن تتضمن صورة حاوية الأتمتة إصدار CrewAI runtime رقم `1.14.5` أو أحدث.
- اشتراك Azure ومستأجر Microsoft Entra يمكنك إدارته.
- إذن في المستأجر لإنشاء App Registrations وإضافة Federated Identity Credentials.
- Key Vault يستخدم **Azure RBAC** للترخيص (وليس النموذج القديم لسياسة الوصول).
- مؤسسة على CrewAI Platform يمتلك مستخدمك فيها إذني `workload_identity_configs: manage` و `secret_providers: manage`. راجع [الأذونات (RBAC)](/ar/enterprise/features/secrets-manager/usage#permissions-rbac).
- **يجب أن يكون تنصيب CrewAI Platform قابلاً للوصول من Microsoft Entra عبر HTTPS** ليتمكّن Entra من جلب وثيقة اكتشاف OIDC و JWKS أثناء التحقق من الرمز. تأكد مع مسؤول المنصة من أن المضيف متاح عبر الإنترنت.
</Note>
## الخطوة 1 — العثور على عنوان مُصدر OIDC لـ CrewAI Platform
ينشر تنصيب CrewAI Platform وثيقة اكتشاف OpenID Connect على `https://<your-platform-host>/.well-known/openid-configuration`. الحقل `issuer` هناك هو الرابط الذي ستُسجِّله Microsoft Entra كمُصدر اتحاد موثوق.
افتح الرابط في المتصفح:
```
https://<your-platform-host>/.well-known/openid-configuration
```
ينبغي أن ترى JSON يحتوي على:
```json
{
"issuer": "https://<your-platform-host>",
"jwks_uri": "https://<your-platform-host>/oauth2/jwks",
...
}
```
سجّل القيمة الدقيقة لـ `issuer` — ستستخدمها في الخطوة 3.
<Tip>
إذا أعاد الرابط 404 أو 503، اتصل بمسؤول المنصة. يتطلب مُصدر OIDC تكوين مفتاح توقيع خاص وقت التنصيب. راجع دليل تنصيب المنصة لتكوين `OIDC_PRIVATE_KEY` و `OIDC_ISSUER`.
</Tip>
## الخطوة 2 — إنشاء App Registration
في [بوابة Microsoft Entra](https://entra.microsoft.com)، انتقل إلى **App registrations** وانقر على **New registration**.
- **Name:** `crewai-secrets-reader`
- **Supported account types:** `Accounts in this organizational directory only (Single tenant)`.
- اترك **Redirect URI** فارغاً.
انقر على **Register**. سجّل **Application (client) ID** و **Directory (tenant) ID** في لوحة نظرة عامة التطبيق — ستستخدمها في الخطوة 6.
{/* SCREENSHOT: Azure portal "Register an application" form with name "crewai-secrets-reader" → /images/secrets-manager/azure-wi/01-register-app.png */}
## الخطوة 3 — إضافة Federated Identity Credential
يُخبر Federated Identity Credential Microsoft Entra: *ثِق برموز JWT المُصدَرة من هذا المُصدر، بهذا الموضوع، عندما تُقدَّم كتأكيد عميل لهذا App Registration.*
في App Registration، انتقل إلى **Certificates & secrets** ← **Federated credentials** ← **Add credential**.
- **Federated credential scenario:** `Other issuer`.
- **Issuer:** رابط مُصدر CrewAI Platform من الخطوة 1، مثلاً `https://<your-platform-host>`.
- **Subject identifier:** `organization:<YOUR_CREWAI_ORG_UUID>` — قيمة ادّعاء `sub` في JWT بالضبط. اعثر على UUID مؤسستك في إعدادات مؤسسة CrewAI Platform. يقصر هذا الاتحاد على مؤسسة CrewAI محددة — تُقبل فقط الرموز المُصدَرة لأتمتات تلك المؤسسة.
- **Name:** أي تسمية وصفية، مثلاً `crewai-org-prod`.
- **Audience:** `api://AzureADTokenExchange`. هذا هو الجمهور الثابت الذي تتطلبه Microsoft Entra للبيانات الموحَّدة، وهو ما تُعيّنه CrewAI Platform في ادّعاء `aud` في JWT.
انقر على **Add**.
<Tip>
**العزل لكل مؤسسة.** يقيّد معرّف الموضوع (`organization:<UUID>`) Federated Identity Credential لرموز مؤسسة CrewAI محددة. إذا كان من المفترض أن تتشارك مؤسسات CrewAI متعددة App Registration واحداً، أضف Federated Identity Credential لكل مؤسسة (كل منها بـ UUID المؤسسة).
</Tip>
للتفاصيل الكاملة، راجع وثائق Microsoft: [Configure a federated identity credential on an app](https://learn.microsoft.com/en-us/entra/workload-id/workload-identity-federation-create-trust).
{/* SCREENSHOT: "Add credential" panel with scenario = "Other issuer", issuer URL, subject "organization:<uuid>", audience "api://AzureADTokenExchange" → /images/secrets-manager/azure-wi/02-add-federated-credential.png */}
## الخطوة 4 — منح App Registration وصولاً إلى Key Vault
امنح App Registration دور **Key Vault Secrets User** على الخزنة المستهدفة — نفس الدور الذي تستخدمه لمسار بيانات الاعتماد الثابتة. استخدم إما على مستوى الخزنة (أبسط) أو لكل سر (أقل الامتيازات).
<Tabs>
<Tab title="على مستوى الخزنة (أبسط)">
```bash
az role assignment create \
--assignee <APPLICATION_CLIENT_ID> \
--role "Key Vault Secrets User" \
--scope $(az keyvault show --name <VAULT_NAME> --query id -o tsv)
```
يمنح النطاق على مستوى الخزنة إذن `secrets/list` الذي يعتمد عليه **الاقتراح التلقائي لاسم السر** في نموذج متغير البيئة لـ CrewAI Platform. اختر هذه التبويبة إذا أردت أن يعمل الاقتراح التلقائي.
{/* SCREENSHOT: Key Vault "Add role assignment" panel with "Key Vault Secrets User" and the App Registration selected → /images/secrets-manager/azure-wi/03-grant-vault-rbac.png */}
</Tab>
<Tab title="لكل سر (أقل الامتيازات)">
```bash
az role assignment create \
--assignee <APPLICATION_CLIENT_ID> \
--role "Key Vault Secrets User" \
--scope $(az keyvault secret show --vault-name <VAULT_NAME> --name <SECRET_NAME> --query id -o tsv)
```
تُعطّل الارتباطات لكل سر **الاقتراح التلقائي لاسم السر** في نموذج متغير البيئة لـ CrewAI Platform (يتطلب الاقتراح التلقائي `secrets/list`، وهو محصور بنطاق الخزنة فقط). اكتب اسم السر الكامل بدلاً من ذلك.
{/* SCREENSHOT: Per-secret IAM panel with the App Registration assigned **Key Vault Secrets User** at the secret resource scope → /images/secrets-manager/azure-wi/04-per-secret-rbac.png */}
</Tab>
<Tab title="البوابة (UI)">
لتعيين **على مستوى الخزنة**:
1. افتح Key Vault الخاص بك في بوابة Azure.
2. انقر على **Access control (IAM)** ← **Add** ← **Add role assignment**.
3. اختر الدور **Key Vault Secrets User** ← **Next**.
4. انقر على **Select members**، ابحث عن App Registration `crewai-secrets-reader`، انقر على **Select**.
5. انقر على **Review + assign**.
لتعيين **لكل سر**، استخدم نفس التدفق لكن ابدأ من **Objects** ← **Secrets** ← اختر السر ← لوحة **Access control (IAM)** الخاصة به. تُعطّل الارتباطات لكل سر الاقتراح التلقائي (راجع تبويبة لكل سر أعلاه).
</Tab>
</Tabs>
## الخطوة 5 — إنشاء سر واحد على الأقل في Key Vault
إذا لم يكن لديك سر للاختبار، أنشئ واحداً عبر Azure CLI:
```bash
az keyvault secret set \
--vault-name <VAULT_NAME> \
--name openai-api-key \
--value "sk-your-actual-key"
```
أو عبر بوابة Azure:
1. افتح Key Vault الخاص بك وانتقل إلى **Objects** ← **Secrets**.
2. انقر على **Generate/Import**.
3. **Upload options:** `Manual`. **Name:** اسم السر (مثلاً `openai-api-key`). **Secret value:** الصق القيمة.
4. انقر على **Create**.
<Note>
**اصطلاحات اسم السر.** لا يمكن أن تحتوي أسماء أسرار Azure Key Vault على شرطات سفلية. تُحوّل CrewAI Platform تلقائياً الشرطات السفلية إلى شرطات عند استدعاء Azure (مثلاً، `db_password` تُرسل كـ `db-password`)، لذا يمكنك الاحتفاظ بأسماء متغيرات بيئة بنمط الشرطة السفلية — لكن السر الأساسي في Key Vault يجب أن يستخدم الشرطات.
</Note>
## الخطوة 6 — إضافة تكوين Workload Identity في CrewAI Platform
في CrewAI Platform، انتقل إلى **Settings** ← **Workload Identity** وانقر على **Add Workload Identity Config**.
املأ النموذج:
- **Name:** اسم وصفي، مثلاً `azure-prod`.
- **Cloud Provider:** `Azure`.
- **Tenant ID:** **Directory (tenant) ID** الخاص بـ Microsoft Entra من الخطوة 2.
- **Client ID:** **Application (client) ID** الخاص بـ App Registration من الخطوة 2.
- (اختياري) حدّد **Set as default for Azure** إذا كنت ترغب في أن يكون هذا هو تكوين WI الافتراضي المُحدَّد عند إنشاء بيانات اعتماد سر مدعومة بـ Azure.
**Audience** ثابت على `api://AzureADTokenExchange` — تتطلب Microsoft Entra هذا الجمهور بالضبط للبيانات الموحَّدة، لذا لا يظهر حقل Audience في النموذج.
انقر على **Create**.
{/* SCREENSHOT: "Add Workload Identity Config" form with Azure, tenant ID, client ID populated → /images/secrets-manager/azure-wi/05-amp-add-wi-config-azure.png */}
{/* SCREENSHOT: Workload Identity list showing AWS, GCP, and Azure rows → /images/secrets-manager/azure-wi/06-amp-wi-list-with-azure.png */}
## الخطوة 7 — إضافة بيانات اعتماد مزود أسرار مرتبطة بتكوين WI
انتقل إلى **Settings** ← **Secret Provider Credentials** وانقر على **Add Credential**.
املأ النموذج:
- **Name:** اسم وصفي، مثلاً `azure-prod-wi`.
- **Provider:** `Azure Key Vault`.
- **Authentication Method:** `Workload Identity`.
- **Workload Identity Configuration:** اختر التكوين الذي أنشأته في الخطوة 6.
- **Key Vault URL:** اسم مضيف DNS للخزنة، مثلاً `https://my-vault.vault.azure.net`.
- (اختياري) حدّد **Set as default credential for this provider**.
سيطلب النموذج فقط **Key Vault URL** ضمن Workload Identity — حقول بيانات الاعتماد الثابتة (Tenant ID و Client ID و Client Secret) مخفية عمداً لأنها لا تنطبق على هذا المسار؛ يأتي المستأجر والعميل من تكوين WI المرتبط.
انقر على **Create**.
<Tip>
**App Registration واحد، خزائن متعددة.** يعيش Key Vault URL على بيانات الاعتماد، وليس على تكوين WI. لذا يمكن لـ App Registration واحد (وتكوين WI واحد) خدمة عدة Key Vaults — فقط أنشئ بيانات اعتماد مزود أسرار واحدة لكل خزنة، جميعها مرتبطة بنفس تكوين WI.
</Tip>
{/* SCREENSHOT: "Add Secret Provider Credential" form with Azure + Workload Identity + WI config dropdown + vault URL → /images/secrets-manager/azure-wi/07-amp-add-credential-azure-wi.png */}
## الخطوة 8 — اختبار الاتصال
بعد حفظ بيانات الاعتماد، انقر على **Test Connection**. لبيانات اعتماد workload-identity، يتحقق هذا من مصافحة OIDC: تُصدر CrewAI Platform JWT، وتُقدّمه إلى Microsoft Entra كـ `client_assertion` موحَّد، وتؤكد أن Entra تُعيد رمز وصول محصور بالخزنة. نتيجة خضراء تعني أن ارتباط الاتحاد سليم.
نجاح Test Connection يُثبت أن مُصدر Federated Identity Credential وموضوعه وجمهوره كلها متطابقة، وأن App Registration قابل للوصول. لا يُثبت ذلك أن RBAC لكل سر في Key Vault صحيح — يُمارَس `getSecret` على سر محدد بشكل منفصل عندما يُحَلّ متغير بيئة عند الإطلاق. راجع [استكشاف الأخطاء](#troubleshooting) لأنماط فشل المصافحة.
## الخطوة 9 — الإشارة إلى السر في متغير بيئة
أَشِر إلى السر على أتمتة، تماماً كما تفعل مع أي متغير بيئة مدعوم بمدير أسرار. راجع [استخدام مدير الأسرار](/ar/enterprise/features/secrets-manager/usage#referencing-secrets-in-environment-variables) لحقول النموذج والسلوك.
## الخطوة 10 — التحقق من التدوير
بعد تشغيل عملية النشر، دوّر السر في Key Vault:
```bash
az keyvault secret set \
--vault-name <VAULT_NAME> \
--name openai-api-key \
--value "rotated value"
```
أطلق إطلاق أتمتة جديداً. ستكون بيئة الإطلاق ترى `"rotated value"` — بدون إعادة نشر ولا إعادة تشغيل عامل ولا انتظار TTL.
للتأكد في سجلات العامل، ابحث عن:
```
Workload identity config '<id>' (azure): N secret(s) resolved
```
يظهر هذا السطر لكل إطلاق ويُشير إلى استدعاء `getSecret` طازج مقابل Azure Key Vault.
للتحقق من البداية إلى النهاية باستخدام البصمة، راجع [التحقق من التدوير من البداية إلى النهاية](/ar/enterprise/features/secrets-manager/verify-rotation).
## استكشاف الأخطاء
| العَرَض | السبب المحتمل |
|---|---|
| يفشل Test Connection بخطأ مصافحة | رفضت Microsoft Entra `client_assertion` الموحَّد. تحقق من أن **Issuer** في Federated Identity Credential يطابق قيمة `issuer` للمنصة بالضبط، وأن **Subject** هو `organization:<your-org-uuid>` (يطابق ادّعاء `sub` في JWT)، وأن **Audience** هو `api://AzureADTokenExchange`، وأن رابط اكتشاف OIDC للمنصة قابل للوصول من Entra عبر الإنترنت العام. |
| `AADSTS70021: No matching federated identity record found for presented assertion` | لا يتطابق **Issuer** + **Subject** + **Audience** في Federated Identity Credential مع الـ JWT بالضبط. تحقق من الخطوة 3 من جديد: يجب أن يكون الموضوع `organization:<your-org-uuid>` (يطابق ادّعاء `sub` في JWT)، ويجب أن يكون الجمهور `api://AzureADTokenExchange`. |
| `AADSTS700024: Client assertion is not within its valid time range` | ساعة مضيف CrewAI Platform منحرفة بشكل كبير عن الوقت الحقيقي. تحقق من NTP على المضيف. |
| `AADSTS50013: Assertion failed signature validation` | لم تستطع Microsoft Entra التحقق من توقيع الـ JWT. تأكد من أن `https://<your-platform-host>/oauth2/jwks` قابل للوصول من الإنترنت العام ويُقدّم JWKS صالحاً. |
| يُظهر الاقتراح التلقائي لاسم السر `Forbidden — does not have permission to perform action 'Microsoft.KeyVault/vaults/secrets/.../list'` | دور **Key Vault Secrets User** الخاص بـ App Registration محصور بسر واحد. امنح الدور على نطاق الخزنة ليُسمح بإجراء `list` في مستوى البيانات. راجع الخطوة 4. |
| يفشل الإطلاق في حلّ سر رغم نجاح Test Connection | ارتباط WI سليم، لكن RBAC لكل سر في Key Vault مفقود على السر الفاشل. راجع **Key Vault Secrets User** على ذلك السر تحديداً (أو وسّع تعيين الدور إلى نطاق الخزنة). |
| `Forbidden — request was not authorized` (الخزنة تستخدم سياسات الوصول القديمة) | لم يتم تحويل الخزنة إلى Azure RBAC. ضمن **Access configuration** للخزنة، عيّن نموذج الإذن إلى **Azure role-based access control** وأعد منح الدور من الخطوة 4. |
| `azure_vault_url is required for Azure secret resolution` (سجلات العامل) | تفتقد بيانات اعتماد مزود الأسرار إلى **Key Vault URL**. تحقق من الخطوة 7 من جديد. |
| لا تُلتقط القيمة المُدوَّرة في الإطلاق التالي | تأكد من أن متغير البيئة على الأتمتة يشير إلى بيانات اعتماد مدعومة بـ Workload Identity (وليس بيانات اعتماد بمفاتيح ثابتة). يدمج المسار الثابت القيم في صورة النشر. |
### روابط مرجعية
- Microsoft: [Microsoft Entra Workload Identity Federation overview](https://learn.microsoft.com/en-us/entra/workload-id/workload-identity-federation)
- Microsoft: [Configure a federated identity credential on an app](https://learn.microsoft.com/en-us/entra/workload-id/workload-identity-federation-create-trust)
- Microsoft: [Azure Key Vault RBAC guide](https://learn.microsoft.com/en-us/azure/key-vault/general/rbac-guide)
## الخطوات التالية
- [استخدام الأسرار في متغيرات البيئة وإدارة الأذونات](/ar/enterprise/features/secrets-manager/usage)
- للتنوع متعدد السحاب، إعداد ما يعادله لـ AWS موجود في [AWS Workload Identity (اتحاد OIDC)](/ar/enterprise/features/secrets-manager/aws-workload-identity) وما يعادله لـ GCP في [GCP Workload Identity Federation](/ar/enterprise/features/secrets-manager/gcp-workload-identity).
## مرجع لقطات الشاشة
تُربط العناصر النائبة أعلاه بـ:
- `01-register-app.png` — نموذج "Register an application" في بوابة Azure مع `crewai-secrets-reader`.
- `02-add-federated-credential.png` — App Registration ← Certificates & secrets ← Federated credentials ← Add credential، مع **Other issuer**، رابط مُصدر المنصة، الموضوع `organization:<uuid>`، الجمهور `api://AzureADTokenExchange`.
- `03-grant-vault-rbac.png` — Key Vault ← Access control (IAM) ← Add role assignment، مع **Key Vault Secrets User** و App Registration المختار.
- `04-per-secret-rbac.png` — نفس النموذج لكن في نطاق IAM سر واحد (مسار أقل الامتيازات البديل).
- `05-amp-add-wi-config-azure.png` — نموذج "Add Workload Identity Config" في CrewAI Platform مع Cloud Provider = Azure و Tenant ID و Client ID مأهولين.
- `06-amp-wi-list-with-azure.png` — صفحة قائمة Workload Identity بعد الإنشاء، تُظهر صفوفاً لـ AWS و GCP وتكوين Azure الجديد.
- `07-amp-add-credential-azure-wi.png` — نموذج "Add Secret Provider Credential" مع Provider = Azure Key Vault، Auth = Workload Identity، تكوين WI المختار، و Key Vault URL مأهول.

View File

@@ -0,0 +1,196 @@
---
title: Azure Key Vault
description: تكوين Azure Key Vault كمزود أسرار لـ CrewAI Platform من البداية إلى النهاية
sidebarTitle: ببيانات اعتماد ثابتة
icon: "key"
---
## نظرة عامة
يأخذك هذا الدليل عبر تكوين Azure Key Vault كمزود أسرار لمؤسستك على CrewAI Platform، باستخدام **App Registration في Microsoft Entra مع سر عميل**. بنهاية الدليل، ستتمكن CrewAI Platform من قراءة الأسرار المخزّنة في Azure Key Vault الخاص بك وحقنها كقيم متغيرات بيئة وقت التشغيل.
<Note>
يغطي هذا الدليل مسار **بيانات الاعتماد الثابتة** — تُحَلّ الأسرار وقت النشر وتُدمج في صورة النشر. تتطلب القيم المُدوَّرة إعادة نشر. إذا أردت أسراراً مراعية للتدوير تُحدَّث في كل إطلاق أتمتة، راجع [Azure Workload Identity Federation](/ar/enterprise/features/secrets-manager/azure-workload-identity).
</Note>
<Note>
يغطي هذا الدليل التكوين من جانب Azure وإعداد بيانات الاعتماد في CrewAI Platform. للإشارة بعدها إلى سر من متغير بيئة، راجع [استخدام مدير الأسرار](/ar/enterprise/features/secrets-manager/usage).
</Note>
## المتطلبات المسبقة
<Note>
قبل البدء، تأكد من امتلاكك:
- اشتراك Azure لديه إذن إنشاء App Registrations في Microsoft Entra ومنح تعيينات أدوار على موارد Key Vault.
- Key Vault يستخدم **Azure RBAC** للترخيص (وليس النموذج القديم لسياسة الوصول). إذا كان الخزنة لا تزال تستخدم سياسات الوصول، فحوّلها إلى RBAC ضمن لوحة **Access configuration** للخزنة.
- مؤسسة على CrewAI Platform يمتلك مستخدمك فيها إذن `secret_providers: manage`. راجع [الأذونات (RBAC)](/ar/enterprise/features/secrets-manager/usage#permissions-rbac).
</Note>
## الخطوة 1 — إنشاء App Registration
App Registration هي الهوية من جانب Microsoft Entra التي ستُصادق بها CrewAI Platform.
في [بوابة Microsoft Entra](https://entra.microsoft.com)، انتقل إلى **App registrations** وانقر على **New registration**.
- **Name:** `crewai-secrets-reader`
- **Supported account types:** `Accounts in this organizational directory only (Single tenant)`.
- اترك **Redirect URI** فارغاً.
انقر على **Register**. سجّل **Application (client) ID** و **Directory (tenant) ID** في لوحة نظرة عامة التطبيق — ستلصق كليهما في CrewAI Platform في الخطوة 4.
للتفاصيل الكاملة، راجع وثائق Microsoft: [Register an application with the Microsoft identity platform](https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app).
{/* SCREENSHOT: Azure "Register an application" form with name "crewai-secrets-reader" → /images/secrets-manager/azure/01-register-app.png */}
## الخطوة 2 — إنشاء سر عميل
في App Registration، انتقل إلى **Certificates & secrets** ← **Client secrets** ← **New client secret**.
- **Description:** `crewai-platform`
- **Expires:** اختر مدة تتطابق مع سياسة التدوير لديك (تحدّد Microsoft هذا بـ 24 شهراً كحد أقصى).
انقر على **Add**. انسخ عمود **Value** فوراً — لا يمكن إعادة عرضه أبداً بمجرد مغادرة الصفحة.
<Warning>
أسرار العميل هي بيانات اعتماد ثابتة طويلة الأمد. خزّن القيمة بأمان (في مدير كلمات مرور أو مخزن أسرارك الخاص) ودوّرها قبل انتهاء الصلاحية. للقضاء على بيانات الاعتماد الثابتة تماماً، استخدم [Azure Workload Identity Federation](/ar/enterprise/features/secrets-manager/azure-workload-identity) بدلاً من ذلك.
</Warning>
{/* SCREENSHOT: "Client secrets" tab with the new secret row and the "Value" column highlighted → /images/secrets-manager/azure/02-create-client-secret.png */}
## الخطوة 3 — منح App Registration وصولاً إلى Key Vault
تحتاج CrewAI Platform إلى وصول قراءة للأسرار في Key Vault الخاص بك. استخدم أحد نطاقين — **على مستوى الخزنة** للبساطة، أو **لكل سر** لأقل الامتيازات.
<Tabs>
<Tab title="على مستوى الخزنة (أبسط)">
في [وحدة تحكم Key Vault](https://portal.azure.com/#view/HubsExtension/BrowseResource/resourceType/Microsoft.KeyVault%2Fvaults)، افتح الخزنة الهدف، ثم انتقل إلى **Access control (IAM)** ← **Add** ← **Add role assignment**.
- **Role:** **Key Vault Secrets User**
- **Assign access to:** User, group, or service principal
- **Members:** ابحث عن App Registration الخاص بك (`crewai-secrets-reader`) واختره.
انقر على **Review + assign**.
أو عبر Azure CLI:
```bash
az role assignment create \
--assignee <APPLICATION_CLIENT_ID> \
--role "Key Vault Secrets User" \
--scope $(az keyvault show --name <VAULT_NAME> --query id -o tsv)
```
{/* SCREENSHOT: Key Vault "Add role assignment" panel with "Key Vault Secrets User" and the App Registration selected → /images/secrets-manager/azure/03-grant-vault-rbac.png */}
</Tab>
<Tab title="لكل سر (أقل الامتيازات)">
امنح الدور على مستوى سر فردي. كرّر لكل سر ينبغي أن تصل إليه CrewAI Platform:
```bash
az role assignment create \
--assignee <APPLICATION_CLIENT_ID> \
--role "Key Vault Secrets User" \
--scope $(az keyvault secret show --vault-name <VAULT_NAME> --name <SECRET_NAME> --query id -o tsv)
```
{/* SCREENSHOT: Per-secret "Access control (IAM)" panel showing role assignment scoped to one secret → /images/secrets-manager/azure/04-per-secret-rbac.png */}
</Tab>
</Tabs>
<Tip>
يسمح دور **Key Vault Secrets User** بقراءة قيم الأسرار لكن ليس سرد جميع الأسرار في الخزنة. يستدعي الاقتراح التلقائي لاسم السر في CrewAI Platform أيضاً `list` — هذا الإذن مُضمَّن في الدور على نطاق الخزنة، لكن **ليس** على نطاق لكل سر. مع ارتباطات لكل سر، لن يقترح الإكمال التلقائي أسراراً؛ اكتب اسم السر الكامل بدلاً من ذلك.
</Tip>
## الخطوة 4 — إضافة بيانات الاعتماد في CrewAI Platform
في CrewAI Platform، انتقل إلى **Settings** ← **Secret Provider Credentials** وانقر على **Add Credential**.
{/* SCREENSHOT: Sidebar/nav highlighting Settings → Secret Provider Credentials → /images/secrets-manager/usage/01-amp-settings-nav.png */}
املأ النموذج:
- **Name:** اسم وصفي، مثلاً `azure-prod`.
- **Provider:** `Azure Key Vault`.
- **Key Vault URL:** اسم مضيف DNS للخزنة، مثلاً `https://my-vault.vault.azure.net`.
- **Tenant ID:** **Directory (tenant) ID** الخاص بـ Microsoft Entra من الخطوة 1.
- **Client ID:** **Application (client) ID** الخاص بـ App Registration من الخطوة 1.
- **Client Secret:** **Value** الذي نسخته في الخطوة 2.
- (اختياري) حدّد **Set as default credential for this provider**. تُستخدم بيانات الاعتماد الافتراضية بواسطة متغيرات البيئة التي تشير إلى أسرار Azure بدون تحديد بيانات اعتماد صراحةً.
انقر على **Create**.
{/* SCREENSHOT: "Add Secret Provider Credential" form with Azure fields filled in → /images/secrets-manager/azure/05-amp-add-credential-form-azure.png */}
## الخطوة 5 — إنشاء سر واحد على الأقل في Azure Key Vault
إذا لم يكن لديك بالفعل أسرار في Key Vault، أنشئ واحداً الآن لتتمكن من التحقق من الاتصال في الخطوة 6.
في وحدة تحكم Key Vault، انتقل إلى **Objects** ← **Secrets** ← **Generate/Import**.
- **Upload options:** `Manual`
- **Name:** مثلاً `openai-api-key`
- **Secret value:** الصق قيمة سرّك
- اترك الباقي على القيم الافتراضية.
انقر على **Create**.
أو عبر Azure CLI:
```bash
az keyvault secret set \
--vault-name <VAULT_NAME> \
--name openai-api-key \
--value "sk-your-actual-key"
```
<Note>
**اصطلاحات اسم السر.** لا يمكن أن تحتوي أسماء أسرار Azure Key Vault على شرطات سفلية. تُحوّل CrewAI Platform تلقائياً الشرطات السفلية إلى شرطات عند استدعاء Azure (مثلاً، `db_password` تُرسل كـ `db-password`)، لذا يمكنك الاحتفاظ بأسماء متغيرات بيئة بنمط الشرطة السفلية — لكن السر الأساسي في Key Vault يجب أن يستخدم الشرطات.
</Note>
<Note>
**صيغة الإشارة بمفتاح JSON.** يتعامل Key Vault مع قيم الأسرار كسلاسل معتمة. إذا حدث أن كانت قيمة سرّك كائن JSON، يمكن لـ CrewAI Platform استخراج حقل واحد باستخدام صيغة `secret-name#json_key` (مثلاً `database-credentials#password`). راجع [استخدام مدير الأسرار](/ar/enterprise/features/secrets-manager/usage#referencing-secrets-in-environment-variables) للتفاصيل.
</Note>
للتفاصيل الكاملة، راجع وثائق Microsoft: [Set and retrieve a secret](https://learn.microsoft.com/en-us/azure/key-vault/secrets/quick-create-cli).
{/* SCREENSHOT: Azure Key Vault "Create a secret" form with name and value → /images/secrets-manager/azure/06-create-secret.png */}
## الخطوة 6 — اختبار الاتصال
عُد إلى CrewAI Platform، في صفحة **Secret Provider Credentials**، اعثر على بيانات الاعتماد التي أنشأتها للتو وانقر على **Test Connection**.
تؤكد رسالة نجاح أن CrewAI Platform يمكنها المصادقة مع Microsoft Entra وقراءة الأسرار من خزنتك.
{/* SCREENSHOT: Success toast after clicking "Test Connection" on the Azure credential → /images/secrets-manager/azure/07-test-connection-success.png */}
إذا فشل الاختبار، تحقق من الأسباب الأكثر شيوعاً:
| العَرَض | السبب المحتمل |
|---|---|
| `AADSTS7000215: Invalid client secret provided` | **Client Secret** الملصوق خاطئ أو منتهي الصلاحية. أعد إنشاء السر (الخطوة 2) وحدّث بيانات الاعتماد. |
| `AADSTS700016: Application not found in the directory` | لا يطابق **Tenant ID** أو **Client ID** الـ App Registration. تحقق من الخطوة 4 من جديد. |
| `Forbidden — caller does not have permission` | يفتقد App Registration إلى دور **Key Vault Secrets User** على الخزنة (أو لكل سر). تحقق من الخطوة 3 من جديد. |
| `Vault not found` / أخطاء DNS | **Key Vault URL** خاطئ، أو أن خزنتك لديها نقاط نهاية خاصة تمنع الوصول العام. تأكد من أن المضيف يستجيب لـ `curl https://<vault-name>.vault.azure.net/secrets?api-version=7.4`. |
| `Forbidden — request was not authorized` (الخزنة تستخدم سياسات الوصول القديمة) | لم يتم تحويل الخزنة إلى Azure RBAC. ضمن **Access configuration** للخزنة، عيّن نموذج الإذن إلى **Azure role-based access control** وأعد منح الدور من الخطوة 3. |
## الخطوات التالية
الآن وقد اتصل Azure Key Vault، توجّه إلى [استخدام مدير الأسرار](/ar/enterprise/features/secrets-manager/usage) من أجل:
- منح أعضاء المؤسسة الأذونات الصحيحة لاستخدام (أو إدارة) مدير الأسرار.
- الإشارة إلى أسرار Azure الخاصة بك من متغيرات بيئة CrewAI Platform.
إذا كنت تريد أسراراً **مراعية للتدوير** تنتشر دون إعادة نشر، انتقل إلى [Azure Workload Identity Federation](/ar/enterprise/features/secrets-manager/azure-workload-identity) — نفس الخزنة، بدون سر عميل للتدوير، وتُجلب الأسرار في كل إطلاق.
## مرجع لقطات الشاشة
تُربط العناصر النائبة أعلاه بـ:
- `01-register-app.png` — نموذج "Register an application" في بوابة Azure مع `crewai-secrets-reader`.
- `02-create-client-secret.png` — App Registration ← Certificates & secrets ← Client secrets، مع صف السر المُنشأ حديثاً (عمود Value مُميَّز قبل تمويهه).
- `03-grant-vault-rbac.png` — Key Vault ← Access control (IAM) ← Add role assignment، مع اختيار **Key Vault Secrets User** و App Registration كعضو.
- `04-per-secret-rbac.png` — نفس اللوحة لكن بنطاق سر واحد (مسار أقل الامتيازات البديل).
- `05-amp-add-credential-form-azure.png` — نموذج "Add Secret Provider Credential" في CrewAI Platform: Provider = Azure Key Vault، جميع الحقول الخمسة مأهولة.
- `06-create-secret.png` — لوحة "Create a secret" في Azure Key Vault مع `openai-api-key` وقيمة ملصوقة.
- `07-test-connection-success.png` — رسالة نجاح / حالة صف في CrewAI Platform بعد النقر على **Test Connection** على بيانات الاعتماد.

View File

@@ -0,0 +1,273 @@
---
title: GCP Workload Identity Federation
description: تكوين Google Cloud Secret Manager عبر Workload Identity Federation للوصول إلى الأسرار بشكل مراعٍ للتدوير وبدون بيانات اعتماد
sidebarTitle: بـ Workload Identity
icon: "id-badge"
---
## نظرة عامة
يُكوِّن هذا الدليل Google Cloud Secret Manager كمزود أسرار باستخدام **Workload Identity Federation**: تُصدر CrewAI Platform رموز OIDC قصيرة الأمد، وتُبادلها للحصول على بيانات اعتماد Google Cloud عبر خدمة Security Token Service، وتقرأ أسرارك — دون تخزين أي مفتاح حساب خدمة طويل الأمد في أي مكان.
<Note>
**لماذا هذا المسار:** تُحَلّ الأسرار وقت تنفيذ الأتمتة، لذا **تنتشر القيم المُدوَّرة إلى الإطلاق التالي بدون إعادة نشر**. إن كنت تحتاج فقط بيانات اعتماد ثابتة، راجع الدليل الأبسط [GCP — مفتاح حساب الخدمة](/ar/enterprise/features/secrets-manager/gcp).
</Note>
### كيف يعمل وقت التشغيل
1. يطلب عامل النشر JWT OIDC طازج من CrewAI Platform.
2. يبادل العامل الـ JWT للحصول على بيانات اعتماد Google موحَّدة عبر [Security Token Service](https://cloud.google.com/iam/docs/reference/sts/rest)، مع الإشارة إلى Workload Identity Pool Provider الذي ستُعدّه أدناه.
3. يستدعي العامل `secretmanager.googleapis.com:accessSecretVersion` لقراءة السر، باستخدام بيانات الاعتماد الموحَّدة مباشرةً (يمتلك الكيان الموحَّد `roles/secretmanager.secretAccessor` — راجع الخطوة 4).
4. تُحقن القيمة المجلوبة كقيمة لمتغير البيئة لإطلاق الأتمتة ذاك.
تُخزَّن رموز موضوع OIDC مؤقتاً لنحو ساعة لتفادي إعادة الإصدار في كل إطلاق. تُجلب قيم الأسرار طازجة في كل إطلاق بغض النظر عن حالة ذاكرة OIDC المؤقتة، وهذا ما يجعل هذا المسار مراعياً للتدوير.
## المتطلبات المسبقة
<Note>
قبل البدء، تأكد من امتلاكك:
- يجب أن تتضمن صورة حاوية الأتمتة إصدار CrewAI runtime رقم `1.14.5` أو أحدث.
- مشروع Google Cloud مع تفعيل **Secret Manager API** و **Security Token Service API** و **IAM Credentials API**. فعّلها عبر الوحدة أو:
```bash
gcloud services enable secretmanager.googleapis.com sts.googleapis.com iamcredentials.googleapis.com \
--project=<YOUR_PROJECT_ID>
```
- إذن في المشروع لإنشاء Workload Identity Pools وأدوار IAM وحسابات الخدمة و(إن لزم) الأسرار.
- مؤسسة على CrewAI Platform يمتلك مستخدمك فيها إذني `workload_identity_configs: manage` و `secret_providers: manage`. راجع [الأذونات (RBAC)](/ar/enterprise/features/secrets-manager/usage#permissions-rbac).
- **يجب أن يكون تنصيب CrewAI Platform قابلاً للوصول من Google Cloud عبر HTTPS** ليتمكّن GCP STS من جلب وثيقة اكتشاف OIDC و JWKS أثناء التحقق من الرمز. تأكد مع مسؤول المنصة من أن المضيف متاح عبر الإنترنت.
</Note>
## الخطوة 1 — العثور على عنوان مُصدر OIDC لـ CrewAI Platform
ينشر تنصيب CrewAI Platform وثيقة اكتشاف OpenID Connect على `https://<your-platform-host>/.well-known/openid-configuration`. الحقل `issuer` هناك هو الرابط الذي ستُسجِّله Google كمزود OIDC موثوق.
افتح الرابط في المتصفح:
```
https://<your-platform-host>/.well-known/openid-configuration
```
ينبغي أن ترى JSON يحتوي على:
```json
{
"issuer": "https://<your-platform-host>",
"jwks_uri": "https://<your-platform-host>/oauth2/jwks",
...
}
```
سجّل القيمة الدقيقة لـ `issuer` — ستستخدمها في الخطوة 3.
<Tip>
إذا أعاد الرابط 404 أو 503، اتصل بمسؤول المنصة. يتطلب مُصدر OIDC تكوين مفتاح توقيع خاص وقت التنصيب. راجع دليل تنصيب المنصة لتكوين `OIDC_PRIVATE_KEY` و `OIDC_ISSUER`.
</Tip>
## الخطوة 2 — إنشاء Workload Identity Pool
Workload Identity Pool هو حاوية من جانب Google Cloud للهويات الخارجية الموثوقة. ستُسجِّل CrewAI Platform كمزود داخل هذه الحوض.
```bash
gcloud iam workload-identity-pools create crewai-pool \
--project=<YOUR_PROJECT_ID> \
--location=global \
--display-name="CrewAI Platform"
```
أو في [وحدة تحكم Workload Identity Pools](https://console.cloud.google.com/iam-admin/workload-identity-pools)، انقر على **Create Pool**.
{/* SCREENSHOT: GCP "Create Workload Identity Pool" form with name "crewai-pool" → /images/secrets-manager/gcp-wi/01-create-pool.png */}
## الخطوة 3 — إضافة CrewAI Platform كمزود OIDC في الحوض
```bash
gcloud iam workload-identity-pools providers create-oidc crewai-provider \
--project=<YOUR_PROJECT_ID> \
--location=global \
--workload-identity-pool=crewai-pool \
--display-name="CrewAI Platform OIDC" \
--issuer-uri="https://<your-platform-host>" \
--attribute-mapping="google.subject=assertion.sub,attribute.organization=assertion.organization_id" \
--attribute-condition="assertion.organization_id != ''"
```
يُخبر `--attribute-mapping` Google كيفية ربط ادّعاءات JWT بسمات Google:
- `google.subject` هو معرّف الكيان — نربطه بادّعاء `sub` في JWT، الذي تُعيّنه CrewAI Platform إلى `organization:<uuid>`.
- `attribute.organization` هو سمة مخصصة — نربطها بادّعاء `organization_id` في JWT لتتمكّن من الإشارة إليها في ارتباطات IAM لاحقاً.
`--attribute-condition` هو فحص دفاع في العمق يرفض الرموز التي تفتقد لادّعاء `organization_id`.
احصل على **اسم مورد المزود** (ستحتاجه للجمهور وارتباطات IAM):
```bash
gcloud iam workload-identity-pools providers describe crewai-provider \
--project=<YOUR_PROJECT_ID> \
--location=global \
--workload-identity-pool=crewai-pool \
--format="value(name)"
```
يبدو الناتج هكذا:
```
projects/<PROJECT_NUMBER>/locations/global/workloadIdentityPools/crewai-pool/providers/crewai-provider
```
هذه هي قيمة **Workload Identity Provider** الخاصة بك في CrewAI Platform في الخطوة 6. تحسب CrewAI Platform تلقائياً جمهور OIDC كـ `//iam.googleapis.com/<this-resource-name>` عند إصدار الرموز.
{/* SCREENSHOT: "Add provider to pool" form with OIDC selected, issuer URI, audience defaults, attribute mapping → /images/secrets-manager/gcp-wi/02-add-oidc-provider.png */}
## الخطوة 4 — منح الوصول إلى Secret Manager للكيان الموحَّد
اربط دوري Secret Manager كليهما على نطاق المشروع بالكيان الموحَّد — دور يُفعّل الاقتراح التلقائي لاسم السر في نموذج متغير البيئة، والآخر يسمح بقراءة قيم الأسرار عند إطلاق الأتمتة. كلاهما مطلوبان لتعمل الميزة من البداية إلى النهاية.
```bash
PRINCIPAL_SET="principalSet://iam.googleapis.com/projects/<PROJECT_NUMBER>/locations/global/workloadIdentityPools/crewai-pool/attribute.organization/<YOUR_CREWAI_ORG_UUID>"
# Required for the Secret Name autocomplete (calls secretmanager.secrets.list)
gcloud projects add-iam-policy-binding <YOUR_PROJECT_ID> \
--member="$PRINCIPAL_SET" \
--role="roles/secretmanager.viewer"
# Required to read secret values at kickoff
gcloud projects add-iam-policy-binding <YOUR_PROJECT_ID> \
--member="$PRINCIPAL_SET" \
--role="roles/secretmanager.secretAccessor"
```
استبدل `<PROJECT_NUMBER>` برقم المشروع الرقمي (`gcloud projects describe <YOUR_PROJECT_ID> --format='value(projectNumber)'`) و `<YOUR_CREWAI_ORG_UUID>` بـ UUID مؤسسة CrewAI Platform التي يجب أن يُسمح لها بقراءة أسرارك. يمكنك العثور على UUID المؤسسة في واجهة المنصة في صفحة إعدادات المؤسسة، أو عبر الـ API. يقصر هذا الاتحاد على مؤسسة CrewAI محددة — تُقبل فقط الرموز المُصدَرة لأتمتات تلك المؤسسة.
أو عبر وحدة تحكم Google Cloud:
1. افتح **IAM & Admin** ← **IAM** لمشروعك.
2. انقر على **GRANT ACCESS**.
3. **New principals:** الصق سلسلة `principalSet://...attribute.organization/<YOUR_CREWAI_ORG_UUID>` الكاملة.
4. عيّن الدور **Secret Manager Viewer** (`roles/secretmanager.viewer`).
5. انقر على **SAVE**.
6. انقر على **GRANT ACCESS** مرة أخرى وكرّر مع الدور **Secret Manager Secret Accessor** (`roles/secretmanager.secretAccessor`).
<Tip>
**العزل لكل مؤسسة.** يقيّد النمط `principalSet://...attribute.organization/<UUID>` الوصول إلى رموز مؤسسة محددة. إذا كانت لديك مؤسسات CrewAI متعددة تتشارك مشروع Google Cloud واحد، كرّر كلا الارتباطين لكل مؤسسة بالـ UUID الصحيح — أو استخدم شرط سمة أقل تقييداً إن لم يكن العزل ضرورياً.
</Tip>
<Tip>
**تحديد نطاق `secretAccessor` لكل سر (اختياري).** إذا كنت تفضّل عدم منح `roles/secretmanager.secretAccessor` على نطاق المشروع، احذف الارتباط الثاني أعلاه واربط لكل سر بدلاً من ذلك:
```bash
gcloud secrets add-iam-policy-binding <SECRET_NAME> \
--member="$PRINCIPAL_SET" \
--role="roles/secretmanager.secretAccessor" \
--project=<YOUR_PROJECT_ID>
```
أبقِ `roles/secretmanager.viewer` على نطاق المشروع في كلا الحالتين — `secretmanager.secrets.list` (الذي يعتمد عليه الاقتراح التلقائي) لا يمكن منحه لكل سر.
</Tip>
## الخطوة 5 — إنشاء سر واحد على الأقل في GCP
إذا لم يكن لديك سر للاختبار، أنشئ واحداً عبر CLI `gcloud`:
```bash
echo -n "hello from gcp" | gcloud secrets create crewai-test-keyword \
--data-file=- \
--project=<YOUR_PROJECT_ID> \
--replication-policy=automatic
```
أو عبر [وحدة تحكم Secret Manager](https://console.cloud.google.com/security/secret-manager):
1. افتح **Secret Manager** في مشروع GCP الخاص بك.
2. انقر على **+ CREATE SECRET**.
3. **Name:** `crewai-test-keyword`. **Secret value:** الصق قيمتك.
4. انقر على **CREATE SECRET**.
## الخطوة 6 — إضافة تكوين Workload Identity في CrewAI Platform
في CrewAI Platform، انتقل إلى **Settings** ← **Workload Identity** وانقر على **Add Workload Identity Config**.
املأ النموذج:
- **Name:** اسم وصفي، مثلاً `gcp-prod`.
- **Cloud Provider:** `GCP`.
- **Workload Identity Provider:** اسم مورد المزود من الخطوة 3، مثلاً `projects/<PROJECT_NUMBER>/locations/global/workloadIdentityPools/crewai-pool/providers/crewai-provider`.
- (اختياري) بدّل **Default Configuration** إذا كنت ترغب في أن يكون هذا هو تكوين WI الافتراضي المُحدَّد عند إنشاء بيانات اعتماد سر مدعومة بـ GCP.
انقر على **Create**.
{/* SCREENSHOT: "Add Workload Identity Config" form with GCP and provider resource name → /images/secrets-manager/gcp-wi/03-amp-add-wi-config-gcp.png */}
{/* SCREENSHOT: Workload Identity list showing both AWS and GCP rows → /images/secrets-manager/gcp-wi/04-amp-wi-list-with-gcp.png */}
## الخطوة 7 — إضافة بيانات اعتماد مزود أسرار مرتبطة بتكوين WI
انتقل إلى **Settings** ← **Secret Provider Credentials** وانقر على **Add Credential**.
املأ النموذج:
- **Name:** اسم وصفي، مثلاً `gcp-prod-wi`.
- **Provider:** `Google Cloud Secret Manager`.
- **Authentication Method:** `Workload Identity`.
- **Workload Identity Configuration:** اختر التكوين الذي أنشأته في الخطوة 6.
- **Project ID:** معرّف مشروع GCP الخاص بك (نفس المشروع الذي يملك الأسرار).
- (اختياري) حدّد **Set as default credential for this provider**.
سيطلب النموذج فقط **Project ID** ضمن Workload Identity — حقل **Service Account JSON** مخفي عمداً لأنه لا ينطبق على هذا المسار؛ تأتي الهوية الموحَّدة من تكوين WI المرتبط.
انقر على **Create**.
{/* SCREENSHOT: "Add Secret Provider Credential" form with GCP + Workload Identity + WI config dropdown → /images/secrets-manager/gcp-wi/05-amp-add-credential-gcp-wi.png */}
## الخطوة 8 — اختبار الاتصال
بعد حفظ بيانات الاعتماد، انقر على **Test Connection**. لبيانات اعتماد workload-identity، يتحقق هذا من مصافحة OIDC: تُصدر CrewAI Platform JWT وتبادله عبر Security Token Service للحصول على رمز وصول Google موحَّد. نتيجة خضراء تعني أن ارتباط الاتحاد سليم.
نجاح Test Connection يُثبت أن Workload Identity Pool ومزود OIDC وربط السمات وشرط السمة موصولة جميعها بشكل صحيح. لا يُثبت ذلك أن IAM في Secret Manager صحيح — يُمارَس `secretmanager.secrets.list` و `secretmanager.versions.access` بشكل منفصل عند تحميل الاقتراح التلقائي لاسم السر أو عندما يُحَلّ متغير بيئة عند الإطلاق. راجع [استكشاف الأخطاء](#troubleshooting) لأنماط فشل المصافحة.
## الخطوة 9 — الإشارة إلى السر في متغير بيئة
أَشِر إلى السر على أتمتة، تماماً كما تفعل مع أي متغير بيئة مدعوم بمدير أسرار. راجع [استخدام مدير الأسرار](/ar/enterprise/features/secrets-manager/usage#referencing-secrets-in-environment-variables) لحقول النموذج والسلوك.
## الخطوة 10 — التحقق من التدوير
بعد تشغيل عملية النشر، دوّر السر في GCP بإضافة إصدار جديد (يقرأ Secret Manager دائماً أحدث إصدار مفعَّل افتراضياً):
```bash
echo -n "rotated value" | gcloud secrets versions add crewai-test-keyword \
--data-file=- \
--project=<YOUR_PROJECT_ID>
```
أطلق إطلاق أتمتة جديداً. ستكون بيئة الإطلاق ترى `"rotated value"` — بدون إعادة نشر ولا إعادة تشغيل عامل ولا انتظار TTL.
للتأكد في سجلات العامل، ابحث عن:
```
Workload identity config '<id>' (gcp): N secret(s) resolved
```
يظهر هذا السطر لكل إطلاق ويُشير إلى استدعاء `accessSecretVersion` طازج مقابل GCP.
## استكشاف الأخطاء
| العَرَض | السبب المحتمل |
|---|---|
| يفشل Test Connection بخطأ مصافحة | رُفض تبادل رمز STS. تحقق من وجود Workload Identity Pool، وأن مُصدر مزود OIDC يطابق قيمة `issuer` للمنصة، وأن شرط السمة يقبل ادّعاءات JWT. تأكد من أن رابط اكتشاف OIDC للمنصة قابل للوصول من GCP عبر الإنترنت العام. |
| `Could not refresh access token: invalid_target` | لا يطابق ادّعاء الجمهور الجمهور المتوقع لمزود Workload Identity. تُعيّن CrewAI Platform الجمهور تلقائياً؛ إذا خصّصته، فتأكد من أنه يطابق `//iam.googleapis.com/<provider-resource-name>`. |
| `Failed to fetch JWKS from issuer` | لا يمكن لـ GCP STS الوصول إلى مضيف CrewAI Platform. تأكد من أن المضيف متاح عبر الإنترنت وأن `/.well-known/openid-configuration` يُعيد 200. |
| `Attribute condition rejected token` | يتطلب شرط السمة لمزود OIDC (الخطوة 3) `organization_id`. تُعيّن CrewAI Platform هذا الادّعاء دائماً، لذا يعني هذا عادةً تكوين حوض/مزود خاطئاً. تحقق من شرط السمة للمزود من جديد. |
| يُظهر الاقتراح التلقائي لاسم السر `PERMISSION_DENIED: secretmanager.secrets.list` | يفتقد الكيان الموحَّد إلى `roles/secretmanager.viewer` على نطاق المشروع. إذن `secretmanager.secrets.list` محصور بنطاق المشروع فقط ولا يمكن منحه لكل سر. راجع الخطوة 4. |
| يفشل الإطلاق في حلّ سر رغم نجاح Test Connection | ارتباط WI سليم، لكن `secretmanager.versions.access` مفقود على السر الفاشل. راجع `roles/secretmanager.secretAccessor` (على نطاق المشروع، أو لكل سر إذا حدّدت النطاق بهذه الطريقة في الخطوة 4). |
| لا تُلتقط القيمة المُدوَّرة في الإطلاق التالي | تأكد من أن متغير البيئة على الأتمتة يشير إلى بيانات اعتماد مدعومة بـ Workload Identity (وليس بيانات اعتماد بمفاتيح ثابتة). يدمج المسار الثابت القيم في صورة النشر. |
### روابط مرجعية
- GCP: [Workload Identity Federation overview](https://cloud.google.com/iam/docs/workload-identity-federation)
- GCP: [Configure Workload Identity Federation with OIDC](https://cloud.google.com/iam/docs/workload-identity-federation-with-other-providers)
- GCP: [Secret Manager IAM roles](https://cloud.google.com/secret-manager/docs/access-control)
## الخطوات التالية
- [استخدام الأسرار في متغيرات البيئة وإدارة الأذونات](/ar/enterprise/features/secrets-manager/usage)
- للتنوع متعدد السحاب، راجع أيضاً [AWS Workload Identity (اتحاد OIDC)](/ar/enterprise/features/secrets-manager/aws-workload-identity) و [Azure Workload Identity Federation](/ar/enterprise/features/secrets-manager/azure-workload-identity).

View File

@@ -0,0 +1,189 @@
---
title: Google Cloud Secret Manager
description: تكوين Google Cloud Secret Manager كمزود أسرار لـ CrewAI Platform من البداية إلى النهاية
sidebarTitle: ببيانات اعتماد ثابتة
icon: "key"
---
## نظرة عامة
يأخذك هذا الدليل عبر تكوين Google Cloud Secret Manager كمزود أسرار لمؤسستك على CrewAI Platform، باستخدام **بيانات اعتماد حساب خدمة**. بنهاية الدليل، ستتمكن CrewAI Platform من قراءة الأسرار المخزّنة في مشروع Google Cloud الخاص بك وحقنها كقيم متغيرات بيئة وقت التشغيل.
<Note>
يغطي هذا الدليل مسار **بيانات الاعتماد الثابتة** — تُحَلّ الأسرار وقت النشر وتُدمج في صورة النشر. تتطلب القيم المُدوَّرة إعادة نشر. إذا أردت أسراراً مراعية للتدوير تُحدَّث في كل إطلاق أتمتة، راجع [GCP Workload Identity Federation](/ar/enterprise/features/secrets-manager/gcp-workload-identity).
</Note>
<Note>
يغطي هذا الدليل التكوين من جانب GCP وإعداد بيانات الاعتماد في CrewAI Platform. للإشارة بعدها إلى سر من متغير بيئة، راجع [استخدام مدير الأسرار](/ar/enterprise/features/secrets-manager/usage).
</Note>
## المتطلبات المسبقة
<Note>
قبل البدء، تأكد من امتلاكك:
- مشروع Google Cloud مع تفعيل **Secret Manager API**. فعّله في [وحدة تحكم APIs & Services](https://console.cloud.google.com/apis/library/secretmanager.googleapis.com) أو عبر `gcloud`:
```bash
gcloud services enable secretmanager.googleapis.com --project=YOUR_PROJECT_ID
```
- إذن في المشروع لإنشاء حسابات خدمة ومنح أدوار IAM و(إن لزم) إنشاء الأسرار.
- مؤسسة على CrewAI Platform يمتلك مستخدمك فيها إذن `secret_providers: manage`. راجع [الأذونات (RBAC)](/ar/enterprise/features/secrets-manager/usage#permissions-rbac).
</Note>
## الخطوة 1 — إنشاء حساب خدمة
حساب الخدمة هو الهوية من جانب GCP التي ستُصادق بها CrewAI Platform.
في [وحدة تحكم IAM & Admin ← Service Accounts](https://console.cloud.google.com/iam-admin/serviceaccounts)، انقر على **Create Service Account**.
- **Service account name:** `crewai-secrets-reader`
- **Service account ID:** يُملأ تلقائياً من الاسم (مثلاً `crewai-secrets-reader@YOUR_PROJECT_ID.iam.gserviceaccount.com`)
- **Description (optional):** "Read-only access to Secret Manager for CrewAI Platform"
انقر على **Create and Continue**. تخطَّ المنح الاختيارية في هذه الشاشة — ستُرفق الدور في الخطوة 2. انقر على **Done**.
للتفاصيل الكاملة، راجع وثائق GCP: [Create service accounts](https://cloud.google.com/iam/docs/service-accounts-create).
{/* SCREENSHOT: GCP "Create service account" form with name "crewai-secrets-reader" → /images/secrets-manager/gcp/01-create-service-account.png */}
## الخطوة 2 — منح الوصول إلى Secret Manager
تحتاج CrewAI Platform إلى إذن لسرد وقراءة الأسرار في مشروعك. استخدم أحد نطاقين — **على مستوى المشروع** للبساطة، أو **لكل سر** لأقل الامتيازات.
<Tabs>
<Tab title="على مستوى المشروع (أبسط)">
في [وحدة تحكم IAM](https://console.cloud.google.com/iam-admin/iam)، انقر على **Grant Access** و:
- **New principals:** بريد حساب الخدمة من الخطوة 1.
- **Role:** **Secret Manager Secret Accessor** (`roles/secretmanager.secretAccessor`).
انقر على **Save**.
أو عبر `gcloud`:
```bash
gcloud projects add-iam-policy-binding YOUR_PROJECT_ID \
--member="serviceAccount:crewai-secrets-reader@YOUR_PROJECT_ID.iam.gserviceaccount.com" \
--role="roles/secretmanager.secretAccessor"
```
{/* SCREENSHOT: GCP IAM "Grant access" panel with the service account and Secret Manager Secret Accessor role → /images/secrets-manager/gcp/02-iam-grant-access.png */}
</Tab>
<Tab title="لكل سر (أقل الامتيازات)">
امنح الدور فقط على الأسرار المحددة التي ينبغي أن تصل إليها CrewAI Platform. كرّر لكل سر:
```bash
gcloud secrets add-iam-policy-binding YOUR_SECRET_NAME \
--member="serviceAccount:crewai-secrets-reader@YOUR_PROJECT_ID.iam.gserviceaccount.com" \
--role="roles/secretmanager.secretAccessor" \
--project=YOUR_PROJECT_ID
```
أو في الوحدة: افتح كل سر في [Secret Manager](https://console.cloud.google.com/security/secret-manager)، انقر على **Permissions** في اللوحة اليمنى، وامنح **Secret Manager Secret Accessor** لحساب الخدمة.
{/* SCREENSHOT: Per-secret "Permissions" panel in Secret Manager with the service account granted accessor role → /images/secrets-manager/gcp/03-per-secret-permissions.png */}
</Tab>
</Tabs>
<Tip>
يمنح دور `roles/secretmanager.secretAccessor` وصول قراءة فقط لقيم الأسرار. تستدعي CrewAI Platform أيضاً `secretmanager.secrets.list` لتجربة الاقتراح التلقائي في نموذج متغير البيئة — هذا الإذن مُضمَّن في الدور على نطاق المشروع، لكن **ليس** على نطاق لكل سر. مع ارتباطات لكل سر، لن يقترح الإكمال التلقائي أسراراً؛ ستحتاج إلى كتابة اسم السر الكامل.
</Tip>
## الخطوة 3 — إنشاء مفتاح حساب الخدمة
افتح حساب الخدمة من الخطوة 1 في [وحدة تحكم IAM & Admin ← Service Accounts](https://console.cloud.google.com/iam-admin/serviceaccounts).
- انقر على علامة التبويب **Keys**.
- انقر على **Add Key** ← **Create new key**.
- **Key type:** JSON.
- انقر على **Create**. يُنزّل المتصفح ملف JSON — احتفظ به بأمان؛ لا يمكن إعادة تنزيله.
أو عبر `gcloud`:
```bash
gcloud iam service-accounts keys create ./crewai-secrets-reader.json \
--iam-account=crewai-secrets-reader@YOUR_PROJECT_ID.iam.gserviceaccount.com
```
<Warning>
مفتاح حساب الخدمة هو بيانات اعتماد ثابتة طويلة الأمد. خزّنه بأمان (في مدير كلمات مرور أو مخزن أسرارك الخاص) ودوّره بشكل منتظم. للقضاء على بيانات الاعتماد الثابتة تماماً، استخدم [GCP Workload Identity Federation](/ar/enterprise/features/secrets-manager/gcp-workload-identity) بدلاً من ذلك.
</Warning>
{/* SCREENSHOT: Service account "Keys" tab with the "Create new key" → JSON option → /images/secrets-manager/gcp/04-create-service-account-key.png */}
## الخطوة 4 — إضافة بيانات الاعتماد في CrewAI Platform
في CrewAI Platform، انتقل إلى **Settings** ← **Secret Provider Credentials** وانقر على **Add Credential**.
{/* SCREENSHOT: Sidebar/nav highlighting Settings → Secret Provider Credentials → /images/secrets-manager/usage/01-amp-settings-nav.png */}
املأ النموذج:
- **Name:** اسم وصفي، مثلاً `gcp-prod`.
- **Provider:** `Google Cloud Secret Manager`.
- **Project ID:** معرّف مشروع GCP الخاص بك (مثلاً `my-crewai-prod`).
- **Service Account JSON:** الصق المحتوى الكامل لملف JSON الذي نزّلته في الخطوة 3.
- (اختياري) حدّد **Set as default credential for this provider**. تُستخدم بيانات الاعتماد الافتراضية بواسطة متغيرات البيئة التي تشير إلى أسرار GCP بدون تحديد بيانات اعتماد صراحةً.
انقر على **Create**.
{/* SCREENSHOT: "Add Secret Provider Credential" form with GCP fields filled in → /images/secrets-manager/gcp/05-amp-add-credential-form-gcp.png */}
## الخطوة 5 — إنشاء سر واحد على الأقل في GCP
إذا لم يكن لديك بالفعل أسرار في GCP Secret Manager، أنشئ واحداً الآن لتتمكن من التحقق من الاتصال في الخطوة 6.
في [وحدة تحكم Secret Manager](https://console.cloud.google.com/security/secret-manager)، انقر على **Create secret**.
- **Name:** اسم فريد، مثلاً `openai-api-key`.
- **Secret value:** إما لصق قيمة خام أو رفع ملف.
- اترك إعدادات التدوير والتكرار وغيرها على القيم الافتراضية ما لم تكن لديك متطلبات محددة.
انقر على **Create secret**.
أو عبر `gcloud`:
```bash
echo -n "sk-your-actual-key" | gcloud secrets create openai-api-key \
--data-file=- \
--project=YOUR_PROJECT_ID \
--replication-policy=automatic
```
<Note>
**صيغة الإشارة بمفتاح JSON.** يتعامل GCP Secret Manager مع قيم الأسرار كبيانات معتمة. إذا حدث أن كانت قيمة سرّك سلسلة JSON، يمكن لـ CrewAI Platform استخراج حقل واحد باستخدام صيغة `secret-name#json_key` (مثلاً `database-credentials#password`). راجع [استخدام مدير الأسرار](/ar/enterprise/features/secrets-manager/usage#referencing-secrets-in-environment-variables) للتفاصيل.
</Note>
للتفاصيل الكاملة، راجع وثائق GCP: [Create a secret](https://cloud.google.com/secret-manager/docs/create-secret-quickstart).
{/* SCREENSHOT: GCP "Create secret" form with name and value → /images/secrets-manager/gcp/06-create-secret.png */}
## الخطوة 6 — اختبار الاتصال
عُد إلى CrewAI Platform، في صفحة **Secret Provider Credentials**، اعثر على بيانات الاعتماد التي أنشأتها للتو وانقر على **Test Connection**.
تؤكد رسالة نجاح أن CrewAI Platform يمكنها المصادقة مع GCP وقراءة الأسرار من مشروعك.
{/* SCREENSHOT: Success toast after clicking "Test Connection" on the GCP credential → /images/secrets-manager/gcp/07-test-connection-success.png */}
إذا فشل الاختبار، تحقق من الأسباب الأكثر شيوعاً:
| العَرَض | السبب المحتمل |
|---|---|
| `PERMISSION_DENIED` عند سرد الأسرار | يفتقد حساب الخدمة إلى `roles/secretmanager.secretAccessor`، أو حدّدت نطاقه لكل سر (لا يُمنح `list`). تحقق من الخطوة 2 من جديد. |
| `PERMISSION_DENIED` على `secretmanager.secrets.access` | نفس ما سبق، لكن لسر محدد. تأكد من أن حساب الخدمة يمتلك دور accessor على السر المعني. |
| `unauthorized_client` / `invalid_grant` | ملف Service Account JSON الملصوق غير صالح أو منتهي الصلاحية أو لحساب خدمة محذوف. أعد إنشاء المفتاح (الخطوة 3) والصقه من جديد. |
| `Project ID does not match` | لا يطابق حقل Project ID في CrewAI Platform المشروع الذي يملك حساب الخدمة / الأسرار. تحقق من الخطوة 4 من جديد. |
| `API not enabled` | Secret Manager API غير مفعَّل في المشروع. راجع المتطلبات المسبقة. |
## الخطوات التالية
الآن وقد اتصل GCP، توجّه إلى [استخدام مدير الأسرار](/ar/enterprise/features/secrets-manager/usage) من أجل:
- منح أعضاء المؤسسة الأذونات الصحيحة لاستخدام (أو إدارة) مدير الأسرار.
- الإشارة إلى أسرار GCP الخاصة بك من متغيرات بيئة CrewAI Platform.
إذا كنت تريد أسراراً **مراعية للتدوير** تنتشر دون إعادة نشر، انتقل إلى [GCP Workload Identity Federation](/ar/enterprise/features/secrets-manager/gcp-workload-identity) — نفس مخزن الأسرار، بدون بيانات اعتماد ثابتة، وتُجلب الأسرار في كل إطلاق.

View File

@@ -0,0 +1,96 @@
---
title: نظرة عامة على مدير الأسرار
description: ربط مخازن الأسرار الخارجية بمنصة CrewAI Platform والإشارة إلى الأسرار المُدارة من متغيرات البيئة
sidebarTitle: نظرة عامة
icon: "book-open"
---
## نظرة عامة
تُتيح ميزة مدير الأسرار لمؤسستك ربط مخزن أسرار خارجي — AWS Secrets Manager أو Google Cloud Secret Manager أو Azure Key Vault — والإشارة إلى تلك الأسرار مباشرةً من متغيرات البيئة على الأتمتات والطواقم لديك. بدلاً من لصق قيم نصية صريحة في المنصة، فإنك تخزّن مجموعة واحدة من بيانات الاعتماد لكل مزود وتُشير إلى الأسرار بالاسم.
يمنحك هذا:
- **تخزين مركزي** — إدارة الأسرار في مزوّدك بدلاً من تعديل إعدادات CrewAI Platform. لا تحتفظ CrewAI Platform بأي نسخة نصية صريحة من قيمة السر.
- **تقليل التعرّض** — لا تظهر القيم الحساسة أبداً كنص صريح في إعدادات CrewAI Platform.
- **قابلية تدقيق سحابية المنشأ** — يسجّل سجل التدقيق الخاص بمزوّدك كل قراءة لسر.
<Note>
يتطلب مدير الأسرار (مساران: بيانات الاعتماد الثابتة و Workload Identity) إصدار CrewAI runtime رقم `1.14.5` أو أحدث في صورة حاوية الأتمتة.
</Note>
## مساران: بيانات اعتماد ثابتة مقابل Workload Identity
هناك طريقتان لربط CrewAI Platform بمخزن أسرار السحابة لديك. **يختلفان اختلافاً كبيراً في سلوك التدوير**، لذا اختر بناءً على مدى تكرار تدوير أسرارك ومدى صرامة وضعك الأمني.
| الجانب | بيانات الاعتماد الثابتة | Workload Identity (اتحاد OIDC) |
|---|---|---|
| **المصادقة** | مفاتيح وصول / ملف JSON لحساب خدمة طويلة الأمد مخزّنة في CrewAI Platform | رموز قصيرة الأمد تُصدر لكل عملية عامل؛ لا تُخزَّن بيانات اعتماد ثابتة في أي مكان |
| **انتشار التدوير** | تُحَلّ وقت النشر و**تُدمج في صورة حاوية النشر** — تتطلب القيم المُدوَّرة إعادة نشر | تُحَلّ **وقت تنفيذ الأتمتة** — تنتشر القيم المُدوَّرة إلى الإطلاق التالي بدون إعادة نشر |
| **جهد الإعداد** | أقل — لصق المفاتيح / رفع ملف JSON لحساب الخدمة | أعلى — تسجيل CrewAI Platform كمزود OIDC في سحابتك وتكوين سياسات الثقة |
| **الأنسب لـ** | البداية، الأسرار قليلة التدوير، عمليات نشر بحساب واحد | الإنتاج، الأسرار كثيرة التدوير، البيئات التي تحكمها الامتثال وتمنع بيانات الاعتماد طويلة الأمد |
<Note>
**يستخدم كلا المسارين نفس تدفق الواجهة** للإشارة إلى الأسرار في متغيرات البيئة (راجع [استخدام مدير الأسرار](/ar/enterprise/features/secrets-manager/usage)). الفرق بالكامل في كيفية مصادقة المنصة لسحابتك ومتى تقرأ قيمة السر.
</Note>
### اختر دليل الإعداد الخاص بك
| المزود | بيانات الاعتماد الثابتة | Workload Identity |
|---|---|---|
| AWS Secrets Manager | [AWS — المفاتيح الثابتة / AssumeRole](/ar/enterprise/features/secrets-manager/aws) | [AWS — Workload Identity (OIDC)](/ar/enterprise/features/secrets-manager/aws-workload-identity) |
| Google Cloud Secret Manager | [GCP — مفتاح حساب الخدمة](/ar/enterprise/features/secrets-manager/gcp) | [GCP — Workload Identity Federation](/ar/enterprise/features/secrets-manager/gcp-workload-identity) |
| Azure Key Vault | [Azure — السر المُعرَّف للعميل](/ar/enterprise/features/secrets-manager/azure) | [Azure — Workload Identity Federation](/ar/enterprise/features/secrets-manager/azure-workload-identity) |
<Note>
واجهتا مدير الأسرار و Workload Identity مُوسومتان حالياً بـ **Beta** في CrewAI Platform.
</Note>
## كيف تتلاءم الأجزاء معاً
إعداد مدير الأسرار هو تدفق من ثلاث خطوات يشمل كلاً من مزود السحابة و CrewAI Platform:
1. **يُكوِّن المسؤول بيانات اعتماد المزود.** هذا هو العمل من جانب السحابة — ويختلف العمل اعتماداً على المسار (بيانات الاعتماد الثابتة أو Workload Identity) الذي تختاره. تغطي أدلة المزودين هذا من البداية إلى النهاية.
2. **يُشير المسؤول (أو عضو مصرَّح له) إلى سر في متغير بيئة.** من صفحة متغيرات البيئة، يختار المستخدم بيانات اعتماد المزود ويُحدّد اسم السر. راجع [استخدام مدير الأسرار](/ar/enterprise/features/secrets-manager/usage#referencing-secrets-in-environment-variables).
3. **تتلقى الأتمتة القيمة المحلولة وقت التشغيل.** عندما يعمل طاقم أو أتمتة، تجلب CrewAI Platform السر من مزوّدك وتحقنه كقيمة لمتغير البيئة. مع Workload Identity، يحدث هذا الجلب في كل إطلاق (مراعٍ للتدوير). مع بيانات الاعتماد الثابتة، يحدث الجلب وقت النشر وتُدمج القيمة في صورة النشر.
## الرؤية والنطاق
<Note>
تتّبع متغيرات البيئة المدعومة بـ WI نفس نموذج الإسناد الذي تتّبعه متغيرات البيئة العادية: لا تحلّ الأتمتة سوى متغيرات البيئة المدعومة بـ WI المُسنَدة إليها صراحةً. أَسنِد متغير WI إلى أتمتة من صفحة متغيرات البيئة الخاصة بتلك الأتمتة؛ المتغيرات المُعرَّفة على مستوى المنظمة أو في مشروع Studio لا تُحلّ عند الإطلاق حتى تُسنِدها.
</Note>
<Note>
تُشغَّل مرحلة جلب الأسرار في كل إطلاق، لكنها لا تقوم بعمل فعلي إلا حين تكون هناك متغيرات بيئة مدعومة بـ WI مُسنَدة إلى النشر. لكل متغير مُسنَد، يُحلّ وقت التشغيل القيمة من مزوّدك السحابي في كل إطلاق لـ crew أو flow أو training أو test أو checkpoint-restore ويكتبها في بيئة العملية. عند عدم وجود أي متغير مُسنَد، تكون المرحلة بلا أثر (no-op). وإلا فإن التكلفة تتناسب مع عدد المتغيرات المُسنَدة: تأخّر إضافي بسيط لكل إطلاق بالإضافة إلى إدخال واحد في سجل تدقيق السحابة لكل متغير.
</Note>
<Warning>
على مستوى *تكوينات* Workload Identity، لا يزال النطاق اليوم عاماً على مستوى المنظمة. تُهيَّأ كل أتمتة في المنظمة استناداً إلى جميع تكوينات Workload Identity التي سجّلتها المنظمة، ولا يمكنك اليوم ربط تكوين Workload Identity محدد بأتمتة بعينها. تحديد نطاق Workload Identity لكل أتمتة موجود في خارطة الطريق. حتى ذلك الحين، سجِّل فقط تكوينات Workload Identity التي يحقّ لكل أتمتة في منظمتك استخدامها.
</Warning>
## الأذونات
تتحكم ميزتان في CrewAI Platform بالوصول إلى مدير الأسرار:
- `secret_providers` — تتحكم بمن يستطيع عرض أو إدارة بيانات اعتماد المزودين.
- `environment_variables` — تتحكم بمن يستطيع إنشاء وتحرير متغيرات البيئة (بما فيها تلك التي تُشير إلى أسرار).
تتحكم ميزة ثالثة بإعداد Workload Identity:
- `workload_identity_configs` — تتحكم بمن يستطيع عرض أو إدارة تكوينات Workload Identity. مطلوبة فقط إذا كنت تستخدم مسار Workload Identity.
يتمتع المالكون دائماً بالوصول الكامل. لا يحصل الأعضاء على وصول إلى `secret_providers` أو `workload_identity_configs` افتراضياً ويجب منحهم الإذن عبر دور مخصص. راجع [الأذونات (RBAC)](/ar/enterprise/features/secrets-manager/usage#permissions-rbac) للحصول على المصفوفة الكاملة والتعليمات خطوة بخطوة.
## الخطوات التالية
اختر مسارك:
- **بيانات الاعتماد الثابتة** (أبسط، تتطلب إعادة نشر عند التدوير):
- [تكوين AWS Secrets Manager](/ar/enterprise/features/secrets-manager/aws)
- [تكوين Google Cloud Secret Manager](/ar/enterprise/features/secrets-manager/gcp)
- [تكوين Azure Key Vault](/ar/enterprise/features/secrets-manager/azure)
- **Workload Identity** (مراعٍ للتدوير، بدون إعادة نشر):
- [تكوين AWS Workload Identity](/ar/enterprise/features/secrets-manager/aws-workload-identity)
- [تكوين GCP Workload Identity Federation](/ar/enterprise/features/secrets-manager/gcp-workload-identity)
- [تكوين Azure Workload Identity Federation](/ar/enterprise/features/secrets-manager/azure-workload-identity)
- ثم: [استخدام الأسرار في متغيرات البيئة وإدارة الأذونات](/ar/enterprise/features/secrets-manager/usage)

View File

@@ -0,0 +1,137 @@
---
title: استخدام مدير الأسرار
description: إدارة الأذونات والإشارة إلى الأسرار المُدارة من متغيرات البيئة في CrewAI Platform
sidebarTitle: الاستخدام والأذونات
icon: "list-check"
---
## نظرة عامة
هذا الدليل محايد تجاه المزود. يفترض أنك (أو مسؤول آخر) قد كوّنت بالفعل بيانات اعتماد واحدة على الأقل لمزود أسرار. اختر دليل الإعداد الخاص بك بناءً على المسار الذي تريده:
- بيانات الاعتماد الثابتة: [AWS](/ar/enterprise/features/secrets-manager/aws) · [GCP](/ar/enterprise/features/secrets-manager/gcp)
- Workload Identity (مراعٍ للتدوير): [AWS](/ar/enterprise/features/secrets-manager/aws-workload-identity) · [GCP](/ar/enterprise/features/secrets-manager/gcp-workload-identity)
استخدم هذا الدليل من أجل:
- منح الأذونات الصحيحة لأعضاء المؤسسة.
- الإشارة إلى الأسرار من متغيرات البيئة على أتمتاتك.
- التحقق من أن كل شيء يُحَلّ بشكل صحيح وقت التشغيل.
## الأذونات (RBAC)
ثلاث ميزات في CrewAI Platform ذات صلة عند العمل مع مدير الأسرار:
- `secret_providers` — تتحكم بالوصول إلى صفحة **بيانات اعتماد مزود الأسرار**.
- `workload_identity_configs` — تتحكم بالوصول إلى صفحة **Workload Identity** (ذات صلة فقط إذا كنت تستخدم مسار WI).
- `environment_variables` — تتحكم بمن يستطيع إنشاء أو تحرير متغيرات البيئة.
لكل ميزة مستويا إجراء: `read` و `manage`. منح `manage` يستلزم تلقائياً `read`.
### ما يجب منحه
| الهدف | `secret_providers` | `workload_identity_configs` | `environment_variables` |
|---|---|---|---|
| استخدام بيانات اعتماد ثابتة موجودة في متغيرات البيئة (بدون تعديل المزود) | `read` | — | `manage` |
| إنشاء أو تحرير أو حذف بيانات الاعتماد الثابتة | `manage` | — | `manage` |
| استخدام بيانات اعتماد مدعومة بـ Workload Identity موجودة في متغيرات البيئة | `read` | — | `manage` |
| إنشاء أو تحرير أو حذف تكوينات Workload Identity (وبيانات الاعتماد التي تشير إليها) | `manage` | `manage` | `manage` |
<Note>
يتمتع **المالكون** تلقائياً بالوصول الكامل إلى كل ميزة. يستبعد دور **العضو** الافتراضي عمداً `secret_providers` و `workload_identity_configs` — يجب على المسؤولين تضمين الأعضاء صراحةً عبر دور مخصص.
</Note>
### كيفية التعيين
1. في CrewAI Platform، انتقل إلى **Settings** ← **Roles**. من هذه الصفحة يمكنك إنشاء أدوار جديدة وتحرير أذونات كل دور وتعيين الأدوار للأعضاء الحاليين في المؤسسة.
{/* SCREENSHOT: Sidebar highlighting Settings → Roles → /images/secrets-manager/usage/06-amp-settings-roles-nav.png */}
{/* SCREENSHOT: Roles list page with "Create Role" button visible → /images/secrets-manager/usage/07-amp-roles-list.png */}
2. انقر على **Create Role** لإنشاء دور جديد، أو افتح دوراً موجوداً لتحرير أذوناته.
3. في محرر أذونات الدور، بدّل الميزات ذات الصلة وفق الجدول أعلاه:
- `secret_providers`: اختر **read** إذا كان هذا الدور يحتاج فقط إلى استخدام بيانات الاعتماد الموجودة، أو **manage** إذا كان ينبغي أن يكون قادراً أيضاً على إنشاء بيانات الاعتماد وتحريرها وحذفها.
- `environment_variables`: اختر **manage** ليتمكن الدور من إنشاء متغيرات بيئة تُشير إلى الأسرار.
{/* SCREENSHOT: Role editor showing the secret_providers feature with read/manage toggles → /images/secrets-manager/usage/08-amp-role-editor-secret-providers-toggles.png */}
{/* SCREENSHOT: Role editor showing environment_variables toggles → /images/secrets-manager/usage/09-amp-role-editor-env-vars-toggles.png */}
4. احفظ الدور.
5. عيّن الدور للأعضاء ذوي الصلة من نفس صفحة Roles (أو قائمة أعضاء المؤسسة).
{/* SCREENSHOT: Member assignment screen where the new role is applied to a user → /images/secrets-manager/usage/10-amp-assign-role-to-member.png */}
## الإشارة إلى الأسرار في متغيرات البيئة
بمجرد وجود بيانات اعتماد للمزود وامتلاك دورك للأذونات الصحيحة، يمكنك الإشارة إلى الأسرار المُدارة من أي متغير بيئة.
في CrewAI Platform، انتقل إلى **Environment Variables** وانقر على **Add Environment Variables**.
{/* SCREENSHOT: Environment Variables empty state with "Add" button → /images/secrets-manager/usage/11-amp-env-vars-empty.png */}
املأ النموذج:
- **Key** — اسم متغير البيئة. يجب أن يبدأ بحرف أو شرطة سفلية ويحتوي فقط على حروف وأرقام وشرطات سفلية. عادةً بأحرف كبيرة، مثل `OPENAI_API_KEY`.
- **Value Source** — اختر من أين تأتي القيمة:
- **Direct Value** — قيمة نصية صريحة تكتبها. استخدم هذا عندما لا ترغب في إشراك مزود.
- **Use AWS default** (أو ما يعادله لمزوّدك) — تستخدم بيانات الاعتماد المُعلَّمة حالياً كافتراضية لذلك النوع من المزود.
- **بيانات اعتماد مُسمَّاة محددة** — اختر بيانات الاعتماد بالاسم. استخدم هذا إذا كانت لديك بيانات اعتماد متعددة لنفس المزود (مثلاً `aws-prod` و `aws-staging`) وتريد اختيار واحدة صراحةً.
{/* SCREENSHOT: Env var form with the "Value Source" dropdown open, showing "AWS default" + named credentials → /images/secrets-manager/usage/12-amp-env-var-form-source-selector.png */}
- **Secret Name** — اسم السر في مزوّدك. بمجرد اختيار بيانات الاعتماد، يُقدّم هذا الحقل اقتراحاً تلقائياً: ابدأ بالكتابة، وتستعلم CrewAI Platform مزوّدك عن أسماء الأسرار المطابقة.
استخدم الصيغة `secret-name#json_key` لاستخراج حقل واحد من سر مهيكل (JSON). على سبيل المثال، عند وجود سر `database-credentials` بقيمة `{"username": "...", "password": "..."}`، أَشِر إلى `database-credentials#password` لحقن كلمة المرور فقط.
{/* SCREENSHOT: Env var form with the secret name autocomplete dropdown showing live results → /images/secrets-manager/usage/13-amp-env-var-form-secret-name-autocomplete.png */}
<Note>
**ملاحظة Azure Key Vault:** لا يمكن أن تحتوي أسماء أسرار Azure على شرطات سفلية. تُحوّل CrewAI Platform تلقائياً الشرطات السفلية في حقل **Secret Name** إلى شرطات عند استدعاء Azure (مثلاً، `db_password` تُرسل كـ `db-password`).
</Note>
انقر على **Create** لحفظ المتغير.
{/* SCREENSHOT: Env var list with the new variable showing masked value and a "secret" indicator → /images/secrets-manager/usage/14-amp-env-var-created.png */}
<Tip>
عند تحرير متغير بيئة موجود، يحافظ ترك حقل **Value** فارغاً على القيمة الحالية. هذا مقصود — فهو يتيح لك تغيير حقول أخرى (مثل اسم السر أو بيانات الاعتماد) دون إعادة إدخال القيمة.
</Tip>
## التحقق من العمل
للتحقق من البداية إلى النهاية:
1. أَشِر إلى متغير البيئة على أتمتة أو طاقم أو عملية نشر تماماً كما تفعل مع أي متغير بيئة آخر.
2. انشر الأتمتة.
3. أطلق تشغيلاً وتأكد من اكتماله بنجاح.
### يعتمد سلوك التدوير على مسار بيانات الاعتماد
| مسار بيانات الاعتماد | متى يُقرأ السر | ما يتطلبه التدوير |
|---|---|---|
| **بيانات الاعتماد الثابتة** (مفاتيح AWS، ملف JSON لحساب خدمة GCP) | **وقت النشر** — تُدمج القيمة في صورة النشر | إعادة نشر الأتمتة بعد تدوير السر |
| **Workload Identity** (اتحاد OIDC، AWS أو GCP) | **في كل إطلاق أتمتة** — تُجلب القيمة طازجة من سحابتك | لا شيء — يرى الإطلاق التالي بعد التدوير القيمة الجديدة |
<Note>
**إذا كنت تحتاج أسراراً مراعية للتدوير** (بدون إعادة نشر عند التدوير)، استخدم مسار Workload Identity: [AWS WI](/ar/enterprise/features/secrets-manager/aws-workload-identity) أو [GCP WI](/ar/enterprise/features/secrets-manager/gcp-workload-identity). المقايضة هي مزيد من جهد الإعداد مقدماً (تسجيل CrewAI Platform كمزود OIDC في سحابتك) ولكن عمليات أبسط على المدى الطويل.
</Note>
إذا فشل النشر أو التشغيل بخطأ متعلق بسرك، تحقق من الأسباب الأكثر شيوعاً:
| العَرَض | السبب المحتمل |
|---|---|
| `no credential found` | يُشير متغير البيئة إلى مزود ولكن لم تُحدَّد بيانات اعتماد بعينها، ولا توجد بيانات اعتماد افتراضية مُعيّنة لذلك النوع من المزود. إما اختر بيانات اعتماد صراحةً على المتغير، أو علِّم بيانات اعتماد كافتراضية على صفحة **Secret Provider Credentials**. |
| `secret not found` | خطأ مطبعي في **Secret Name**، أو أن السر غير موجود في حساب/منطقة المزود التي تشير إليها بيانات الاعتماد. تحقق من كليهما. |
| تعمل الأتمتة بالقيمة القديمة بعد التدوير (مسار بيانات الاعتماد الثابتة) | القيمة السابقة مدمجة في صورة حاوية النشر. أعد نشر الأتمتة لاستيعاب القيمة المُدوَّرة. لتجنّب ذلك تماماً، حوّل بيانات الاعتماد إلى مسار Workload Identity. |
| تعمل الأتمتة بالقيمة القديمة بعد التدوير (مسار Workload Identity) | تأكد من أن متغير البيئة يُشير إلى بيانات اعتماد مدعومة بـ WI (وليس مفاتيح ثابتة). مع WI، ينبغي أن يرى الإطلاق التالي بعد التدوير القيمة الجديدة. إن لم يحدث ذلك، تحقق من أن السر قد تم تحديثه فعلاً في سحابتك (مثلاً، `aws secretsmanager get-secret-value`). |
| `JSON key not found` | عند استخدام `secret-name#json_key`، يجب أن يكون السر الأساسي كائن JSON صالحاً يحتوي على ذلك المفتاح. تحقق بقراءة السر مباشرة في مزوّدك. |
## الخطوات التالية
- [العودة إلى نظرة عامة على مدير الأسرار](/ar/enterprise/features/secrets-manager/overview)
- بيانات الاعتماد الثابتة: [AWS](/ar/enterprise/features/secrets-manager/aws) · [GCP](/ar/enterprise/features/secrets-manager/gcp)
- Workload Identity (مراعٍ للتدوير): [AWS](/ar/enterprise/features/secrets-manager/aws-workload-identity) · [GCP](/ar/enterprise/features/secrets-manager/gcp-workload-identity)

View File

@@ -0,0 +1,261 @@
---
title: التحقق من التدوير
description: مثال طاقم مستقل يُثبت أن تدوير الأسرار ينتشر إلى عمليات النشر الجارية دون إعادة نشر.
sidebarTitle: التحقق من التدوير
icon: "arrows-rotate"
---
## نظرة عامة
يوضّح لك هذا الدليل كيفية التحقق من أن **السر المُدوَّر في مزود السحابة لديك يُلتقط في أول إطلاق أتمتة لاحق** — بدون إعادة نشر ولا إعادة تشغيل عامل. هذا ذو صلة فقط عندما تكون قد كوّنت بيانات اعتماد مدعومة بـ Workload Identity ([AWS](/ar/enterprise/features/secrets-manager/aws-workload-identity)، [GCP](/ar/enterprise/features/secrets-manager/gcp-workload-identity)، [Azure](/ar/enterprise/features/secrets-manager/azure-workload-identity)). تتطلب عمليات نشر بيانات الاعتماد الثابتة إعادة نشر بعد التدوير؛ ليس هناك ما يجب التحقق منه هنا.
تستخدم الوصفة أدناه طاقماً صغيراً مستقلاً بأداة واحدة ووكيل واحد ومهمة واحدة. لا يُشير موجه الطاقم أبداً إلى قيمة السر — بدلاً من ذلك، تقرأ أداة القيمة من `os.environ` وتُفيد ببصمة SHA-256 لما تراه. دوّر السر في مزود السحابة، أطلق مرة أخرى، وتتغير البصمة.
<Note>
لماذا بصمة وليس القيمة الخام؟ وضع الأسرار الخام في إخراج LLM وسجلات التتبع هو متجه تسرب. البصمة كافية لتأكيد "أن القيمة تغيّرت" دون كتابة القيمة الفعلية في أي مكان يمكن رصده.
</Note>
## المتطلبات المسبقة
قبل تشغيل هذا التحقق:
- بيانات اعتماد مزود أسرار مدعومة بـ WI مكوَّنة ([AWS](/ar/enterprise/features/secrets-manager/aws-workload-identity)، [GCP](/ar/enterprise/features/secrets-manager/gcp-workload-identity)، [Azure](/ar/enterprise/features/secrets-manager/azure-workload-identity)).
- متغير بيئة على عملية النشر بـ `Secret = true`، المفتاح `API_KEY` (أو أي اسم تفضّله — اضبط الأداة أدناه لتطابقه)، يُشير إلى سر في مزود السحابة.
- طريقة لتحديث قيمة السر في مزود السحابة (وصول CLI أو وحدة تحكم السحابة).
- طريقة لإطلاق عملية النشر عبر HTTP (curl أو Postman أو علامة التبويب **Run** في CrewAI Platform).
## الخطوة 1 — هيكلة طاقم التحقق
أنشئ مشروع crew كلاسيكيًا لأن هذا المثال يربط أداة Python عبر `crew.py`:
```bash
crewai create crew rotation_verifier --classic --skip_provider
cd rotation_verifier
```
## الخطوة 2 — إضافة أداة صدى بيانات الاعتماد
استبدل `src/rotation_verifier/tools/custom_tool.py` بأداة تقرأ متغير البيئة المدعوم بسر وتُعيد بصمة:
```python src/rotation_verifier/tools/credential_echo_tool.py
"""Tool that verifies a runtime-injected secret without leaking the value.
Reads the secret-backed env var (populated by the workload-identity
secrets manager at kickoff time) and returns a stable fingerprint. Never
echo raw credential values into LLM output or logs in production code —
the fingerprint alone is sufficient to confirm rotation worked.
"""
from __future__ import annotations
import hashlib
import os
from crewai.tools import BaseTool
# Match the deployment environment variable's `key` field.
ENV_VAR_NAME = "API_KEY"
class CredentialEchoTool(BaseTool):
name: str = "credential_echo"
description: str = (
"Read the API credential from the worker's environment and return a "
"fingerprint summary. Use this exactly once when asked to verify the "
"current credential. Takes no arguments."
)
def _run(self) -> str:
value = os.environ.get(ENV_VAR_NAME)
if not value:
return (
f"ERROR: {ENV_VAR_NAME} env var is not set. The workload-"
"identity secret fetch did not run, or the deployment is "
"missing the secret-backed env var."
)
fingerprint = hashlib.sha256(value.encode()).hexdigest()[:12]
return f"Authenticated. credential.fingerprint=sha256:{fingerprint}"
```
## الخطوة 3 — استبدال تكوينات الوكيل والمهمة الافتراضية
يضم الطاقم وكيلاً واحداً ومهمة واحدة — كلاهما بأوصاف **لا تذكر أبداً** قيمة السر، لذا تبقى مفاتيح المهام مستقرة عبر عمليات التدوير.
```yaml src/rotation_verifier/config/agents.yaml
credential_checker:
role: >
Credential Verifier
goal: >
Confirm that the workload-identity-backed secret reached this worker
process and report a fingerprint of the current value.
backstory: >
You are a no-nonsense reliability engineer responsible for verifying
that secrets fetched at runtime via workload identity are present
and fresh. You always use the credential_echo tool exactly once and
report the result verbatim — you never make up values.
```
```yaml src/rotation_verifier/config/tasks.yaml
verify_credential_task:
description: >
Use the credential_echo tool to read the runtime-injected credential
and produce a one-line confirmation. The current year is {current_year}
(use it only in the timestamp; do not transform the credential output).
expected_output: >
A single line in the form:
"[{current_year}] <credential_echo tool's exact output>"
agent: credential_checker
```
## الخطوة 4 — توصيل فئة الطاقم
```python src/rotation_verifier/crew.py
from crewai import Agent, Crew, Process, Task
from crewai.project import CrewBase, agent, crew, task
from crewai.agents.agent_builder.base_agent import BaseAgent
from rotation_verifier.tools.credential_echo_tool import CredentialEchoTool
@CrewBase
class RotationVerifierCrew():
"""Single-task crew that verifies a workload-identity-backed secret
was successfully fetched at runtime.
Rotate the underlying secret in the cloud provider, kickoff again, and
the credential fingerprint in the agent's report changes — without any
re-deploy, worker restart, or input change. The crew prompt itself
never references the secret value.
"""
agents: list[BaseAgent]
tasks: list[Task]
@agent
def credential_checker(self) -> Agent:
return Agent(
config=self.agents_config["credential_checker"],
tools=[CredentialEchoTool()],
verbose=True,
)
@task
def verify_credential_task(self) -> Task:
return Task(config=self.tasks_config["verify_credential_task"])
@crew
def crew(self) -> Crew:
return Crew(
agents=self.agents,
tasks=self.tasks,
process=Process.sequential,
verbose=True,
)
```
## الخطوة 5 — نشر الطاقم وتكوين متغير بيئة السر
انشر هذا الطاقم على CrewAI Platform تماماً كما تنشر أي طاقم آخر. ثم على صفحة **Environment Variables** الخاصة بعملية النشر:
- **Key:** `API_KEY` (يجب أن يطابق `ENV_VAR_NAME` في الأداة)
- **Value Source:** بيانات الاعتماد المدعومة بـ WI التي أعدّتها في [AWS WI](/ar/enterprise/features/secrets-manager/aws-workload-identity) أو [GCP WI](/ar/enterprise/features/secrets-manager/gcp-workload-identity)
- **Secret Name:** اسم السر في Secret Manager الخاص بمزود السحابة لديك
{/* SCREENSHOT: Environment Variables form with key=API_KEY, secret-backed value source selected, secret name filled → /images/secrets-manager/verify-rotation/01-env-var-form.png */}
## الخطوة 6 — تشغيل الإطلاق الأول
استبدل `<DEPLOYMENT_AUTH_TOKEN>` و `<DEPLOYMENT_HOST>` بالقيم من علامة التبويب **Run** الخاصة بعملية النشر.
```bash
curl -m 60 \
-H "Authorization: Bearer <DEPLOYMENT_AUTH_TOKEN>" \
-H "Content-Type: application/json" \
-X POST https://<DEPLOYMENT_HOST>/kickoff \
-d '{"inputs":{"current_year":"2026"}}'
```
عندما يكتمل الإطلاق (بضع ثوان)، تحقق من إخراج الوكيل. سترى:
```
[2026] Authenticated. credential.fingerprint=sha256:004421b993c9
```
سجّل البصمة. هذا التجزئة مرتبط بشكل فريد بأي قيمة سر موجودة حالياً في مزود السحابة لديك.
## الخطوة 7 — تدوير السر في مزود السحابة
<Tabs>
<Tab title="AWS">
```bash
aws secretsmanager update-secret \
--region <REGION> \
--secret-id <SECRET_NAME> \
--secret-string "rotated value"
```
</Tab>
<Tab title="GCP">
أضف إصداراً جديداً (يقرأ Secret Manager دائماً `latest`):
```bash
echo -n "rotated value" | gcloud secrets versions add <SECRET_NAME> \
--data-file=- \
--project=<YOUR_PROJECT_ID>
```
</Tab>
<Tab title="Azure">
```bash
az keyvault secret set \
--vault-name <VAULT_NAME> \
--name <SECRET_NAME> \
--value "rotated value"
```
</Tab>
</Tabs>
## الخطوة 8 — تشغيل إطلاق ثانٍ والمقارنة
```bash
curl -m 60 \
-H "Authorization: Bearer <DEPLOYMENT_AUTH_TOKEN>" \
-H "Content-Type: application/json" \
-X POST https://<DEPLOYMENT_HOST>/kickoff \
-d '{"inputs":{"current_year":"2026"}}'
```
يُظهر إخراج الوكيل الآن **بصمة مختلفة**:
```
[2026] Authenticated. credential.fingerprint=sha256:e2fc89848f72
```
يُثبت هذا أن التدوير التُقط بواسطة عملية النشر الجارية دون إعادة نشر ولا إعادة تشغيل عامل ولا أي إجراء آخر من قِبل المشغّل.
## ما يتحقق منه هذا — وما لا يتحقق منه
**يتحقق من:**
- يعمل إصدار رمز OIDC الخاص بـ WI من CrewAI Platform.
- تقبل الثقة من جانب السحابة (مزود IAM OIDC لـ AWS، Workload Identity Pool لـ GCP، Federated Identity Credential لـ Azure) الرمز.
- تمتلك الهوية من جانب السحابة (IAM Role / حساب خدمة GCP / Entra App Registration) وصولاً لقراءة السر.
- تصل قيمة السر إلى `os.environ` لعملية العامل وقت الإطلاق.
- تنتشر عمليات التدوير اللاحقة إلى الإطلاق التالي.
**لا يتحقق من:**
- أن طواقم الإنتاج الفعلية لديك تتعامل مع التدوير بسلاسة — مثلاً، المهام طويلة الأمد التي تقرأ متغير البيئة مرة واحدة عند البدء ستستمر في استخدام القيمة القديمة حتى تنتهي المهمة. خطّط وفقاً لذلك: اقرأ الأسرار عند نقطة الاستخدام، وليس عند استيراد الوحدة.
## لماذا لا نُشير إلى السر مباشرةً في الموجه؟
سيضع عرض توضيحي يبدو أبسط قيمة السر مباشرةً في وصف مهمة (مثلاً، "البحث عن `{api_key}`") ويتفحص الموجه. **لا تفعل ذلك.** لسببين:
1. **يُسرّب السر إلى تتبعات استدعاء LLM والسجلات من جانب المزود.** يمكن لأي شخص لديه وصول للتتبعات قراءته.
2. **يُغيّر وصف المهمة في كل إطلاق.** تُحدّد CrewAI Platform المهام بتجزئة MD5 للوصف؛ القيمة المُدوَّرة تعني أن التجزئة تتغير لكل إطلاق، مما يكسر ربط المهمة من وقت النشر إلى وقت التشغيل. العَرَض: تُسجَّل سجلات المهام كـ `pending_run` إلى الأبد، أو تُسجَّل بعض مهام طاقم متعدد المهام فقط.
يتجاوز النمط القائم على الأداة في هذا الدليل كلتا المشكلتين: الموجه ثابت، تقرأ الأداة متغير البيئة وقت التشغيل، وتصل فقط بصمة القيمة إلى LLM.
## الخطوات التالية
- [العودة إلى نظرة عامة على مدير الأسرار](/ar/enterprise/features/secrets-manager/overview)
- بمجرد التحقق، أَسقط طاقم التحقق. يجب أن تتبع الطواقم الفعلية النمط نفسه: الوصول إلى الأسرار عبر `os.environ` داخل أداة، وعدم استبدالها أبداً في الموجهات.

View File

@@ -0,0 +1,123 @@
---
title: التدفقات في الاستوديو
description: "أنشئ سير عمل يعتمد على الأحداث يجمع بين التحكم الحتمي خطوة بخطوة والذكاء الوكيلي — دون كتابة أي كود."
icon: "diagram-project"
mode: "wide"
---
<Info>
**الطرح جارٍ حاليًا**: يجري طرح التدفقات في الاستوديو تدريجيًا خلال أسبوع 20 يوليو 2026. إذا لم يظهر لك خيار Flows في الاستوديو بعد، فهذا يعني أن الميزة لم تصل إلى مؤسستك بعد — عاود التحقق قريبًا.
</Info>
## نظرة عامة
يدعم الاستوديو الآن إنشاء **التدفقات (Flows)** إلى جانب فرق Crew. التدفقات هي سير عمل يعتمد على الأحداث تتحكم فيه بدقة في الخطوات التي تُنفَّذ وترتيبها وشروط تنفيذها — بينما تُفوِّض العمل الذكي داخل كل خطوة إلى وكلاء الذكاء الاصطناعي.
لإنشاء تدفق، افتح الاستوديو وصف الأتمتة التي تريدها، ثم اختر **Flows** من المحدد بجوار مربع الإدخال.
<Frame>
![محدد التدفقات في الاستوديو](/images/enterprise/studio-flows-selector.png)
</Frame>
## لماذا التدفقات؟
فرق Crew ممتازة عندما تريد أن يتعاون فريق من الوكلاء بشكل مستقل نحو هدف. لكن كثيرًا من الأتمتة الواقعية يحتاج إلى قدر أكبر من القابلية للتنبؤ: اجلب هذه البيانات أولًا، ثم لخصها، ثم انشر النتيجة — في كل مرة وبنفس الترتيب.
تمنحك التدفقات الأمرين معًا:
- **الحتمية حيث تهم**: تُنفَّذ الخطوات وفق تسلسل محدد وتفرعات صريحة، فتكون عمليات التشغيل قابلة للتنبؤ والتكرار وسهلة التصحيح.
- **الذكاء حيث تحتاجه**: كل خطوة يشغّلها وكيل (أو فريق Crew كامل)، لذا يستفيد العمل داخل الخطوة — التلخيص والتقييم والصياغة واتخاذ القرار — من قدرات الاستدلال الكاملة للنموذج اللغوي.
هذا المزيج هو ما يجعل التدفقات مناسبة للأتمتة في بيئات الإنتاج: البنية مضمونة، والاستقلالية محصورة في الخطوات التي تحتاجها.
## إنشاء تدفق
صف ما تريده بلغة طبيعية وسيصمم مساعد الاستوديو (Studio Assistant) التدفق لك — بإنشاء الخطوات وربطها ببعضها وتهيئة الوكلاء وتكاملات التطبيقات التي تحتاجها كل خطوة. تعرض اللوحة (Canvas) على اليمين سير العمل الناتج كعُقد متصلة، ويمكنك مواصلة التحسين عبر المحادثة أو تعديل أي عقدة مباشرة.
<Frame>
![لوحة التدفق مع مساعد الاستوديو](/images/enterprise/studio-flows-agent-node.png)
</Frame>
عندما تكون جاهزًا، استخدم **Run** لاختبار التدفق من البداية إلى النهاية، وافحص النتائج في تبويبي **Output** و**Traces**، ثم نفّذ **Deploy** عندما يستقر. يمكنك أيضًا مشاركة المشروع عبر **Share** أو تنزيل الكود المصدري عبر **Download**.
## أنواع العُقد
تتكون التدفقات من ثلاثة أنواع أساسية من العُقد. كل عقدة هي خطوة في سير العمل، ويمكنك المزج بينها بحرية.
### الوكيل المنفرد (Single Agent)
تُشغِّل عقدة Single Agent وكيلًا واحدًا لمهمة واحدة مركزة — وهي مثالية للخطوات محددة النطاق مثل جلب البيانات من تكامل، أو تحويل المحتوى، أو نشر رسالة.
عند النقر على عقدة الوكيل تُفتح تهيئتها الكاملة:
- **Task**: ما ينبغي أن تنجزه هذه الخطوة والمخرجات التي يجب أن تنتجها
- **Profile**: دور الوكيل وهدفه وخلفيته
- **Model**: النموذج اللغوي الذي يشغّل الوكيل
- **Apps**: التكاملات التي يمكن للوكيل استخدامها (مثل Linear وSlack وHubSpot)
- **Runtime Controls**: خيارات التخطيط قبل التنفيذ والتفويض والذاكرة
<Frame>
![تهيئة عقدة الوكيل المنفرد](/images/enterprise/studio-flows-agent-config.png)
</Frame>
### فرق Crew
تُضمِّن عقدة Crew فريقًا كاملًا — عدة وكلاء يتعاونون عبر عدة مهام — كخطوة واحدة في تدفقك. استخدمها عندما تكون الخطوة أكبر من أن يتولاها وكيل واحد، مثل تجميع البيانات وتلخيصها حسب الفريق ثم تنسيق النتيجة للتسليم.
<Frame>
![عقدة Crew داخل تدفق](/images/enterprise/studio-flows-crew-node.png)
</Frame>
يكشف فتح عقدة Crew عن بنيتها الداخلية: المهام التي تؤديها، والوكلاء المعيّنين لكل مهمة، والتطبيقات التي يستخدمونها. يعمل الفريق بشكل مستقل داخل الخطوة، ثم يسلّم مخرجاته إلى العقدة التالية في التدفق.
<Frame>
![داخل عقدة Crew](/images/enterprise/studio-flows-crew-detail.png)
</Frame>
هذا هو نمط الحتمية مع الذكاء الوكيلي عمليًا: يضمن التدفق *متى* يعمل الفريق، بينما يضيف الفريق ذكاءً تعاونيًا إلى *كيفية* إنجاز العمل.
### الموجِّه (Router)
تُفرِّع عقدة Router التدفق بناءً على شروط، بحيث تسلك النتائج المختلفة مسارات مختلفة. على سبيل المثال، يمكن لتدفق توجيه العملاء المحتملين تقييم العملاء الواردين ثم توجيه ذوي الجودة العالية إلى خطوة إسناد المبيعات، مع تسجيل البقية للمتابعة والرعاية لاحقًا.
<Frame>
![عقدة الموجّه مع تفرعات شرطية](/images/enterprise/studio-flows-router-node.png)
</Frame>
الموجِّهات هي ما يجعل التدفقات معتمدة على الأحداث فعليًا: يتعامل سير العمل نفسه مع كل الحالات، لكن كل عملية تشغيل تتبع فقط الفرع الذي تستدعيه بياناتها — بلا خطوات مهدرة ولا غموض حول ما سيحدث تاليًا.
## المزامنة مع مستودع الوكلاء
لا يلزم أن يبقى الوكلاء الذين تنشئهم في التدفقات حبيسي مشروع واحد. تتضمن كل عقدة وكيل زر **Publish to Agent Repository** الذي يحفظ الوكيل — بدوره وهدفه وخلفيته ونموذجه وتهيئته — في [مستودع الوكلاء](/ar/enterprise/features/agent-repositories) الخاص بمؤسستك.
يعمل هذا في الاتجاهين:
- **النشر**: رقِّ وكيلًا حسّنته داخل تدفق إلى المستودع ليتمكن باقي الفرق والمشاريع من إعادة استخدامه.
- **السحب**: أدخِل وكيلًا موجودًا من المستودع إلى تدفق جديد بدلًا من إعادة بنائه من الصفر.
ولأن وكلاء المستودع متزامنون عبر مؤسستك كلها، فإن أي تحسين على وكيل مشترك يعود بالنفع على كل تدفق يستخدمه — مما يحافظ على سلوك وكلاء متسق وخاضع للحوكمة وخالٍ من ازدواجية الجهد.
## أفضل الممارسات
- **اختر التدفق** عندما يكون للأتمتة تسلسل واضح أو منطق تفرّع؛ واختر Crew عندما يكون الطريق إلى الهدف مفتوحًا.
- **أبقِ مهام الوكلاء مركزة** — عقدة Single Agent بوصف مهمة محكم أكثر موثوقية من وكيل مطلوب منه ثلاثة أشياء.
- **استخدم الموجّهات لمعالجة كل حالة صراحةً**، بما في ذلك مسار "عدم فعل شيء" (مثل تسجيل العملاء المتجاوزين)، حتى تكون كل عمليات التشغيل محسوبة بالكامل.
- **انشر الوكلاء المستقرين في مستودع الوكلاء** لتبني مؤسستك مكتبة مشتركة بدلًا من نسخ متوازية لمرة واحدة.
- **اختبر عبر Run وافحص Traces** قبل النشر لاكتشاف مشكلات التكامل أو الموجِّهات النصية مبكرًا.
## ذات صلة
<CardGroup cols={4}>
<Card title="استوديو الطاقم" href="/ar/enterprise/features/crew-studio" icon="pencil">
أنشئ فرق Crew في الاستوديو.
</Card>
<Card title="مستودعات الوكلاء" href="/ar/enterprise/features/agent-repositories" icon="people-group">
شارك الوكلاء وأعد استخدامهم عبر مؤسستك.
</Card>
<Card title="مفاهيم التدفقات" href="/ar/concepts/flows" icon="diagram-project">
تعرّف على كيفية عمل التدفقات في إطار عمل CrewAI.
</Card>
<Card title="الأدوات والتكاملات" href="/ar/enterprise/features/tools-and-integrations" icon="plug">
اربط التطبيقات التي يستخدمها وكلاؤك.
</Card>
</CardGroup>

View File

@@ -0,0 +1,261 @@
---
title: الأدوات والتكاملات
description: "اربط التطبيقات الخارجية وأدِر الأدوات الداخلية التي يمكن لوكلائك استخدامها."
icon: "wrench"
mode: "wide"
---
## نظرة عامة
الأدوات والتكاملات هي المركز الرئيسي لربط تطبيقات الجهات الخارجية وإدارة الأدوات الداخلية التي يمكن لوكلائك استخدامها أثناء التشغيل.
<Frame>
![نظرة عامة على الأدوات والتكاملات](/images/enterprise/crew_connectors.png)
</Frame>
## استكشاف
<Tabs>
<Tab title="التكاملات" icon="plug">
## تطبيقات الوكلاء (التكاملات)
اربط تطبيقات المؤسسات (مثل Gmail وGoogle Drive وHubSpot وSlack) عبر OAuth لتمكين إجراءات الوكلاء.
{" "}
<Steps>
<Step title="الاتصال">
انقر على <b>Connect</b> في أحد التطبيقات وأكمل عملية OAuth.
</Step>
<Step title="التهيئة">
عدّل اختيارياً النطاقات والمشغلات وتوفر الإجراءات.
</Step>
<Step title="الاستخدام في الوكلاء">
تصبح الخدمات المتصلة متاحة كأدوات لوكلائك.
</Step>
</Steps>
{" "}
<Frame>![شبكة التكاملات](/images/enterprise/agent-apps.png)</Frame>
### ربط حسابك
1. انتقل إلى <Link href="https://app.crewai.com/crewai_plus/connectors">Integrations</Link>
2. انقر على <b>Connect</b> في الخدمة المطلوبة
3. أكمل تدفق OAuth وامنح النطاقات
4. انسخ رمز Enterprise من <Link href="https://app.crewai.com/crewai_plus/settings/integrations">Integration Settings</Link>
{" "}
<Frame>
![رمز Enterprise](/images/enterprise/enterprise_action_auth_token.png)
</Frame>
### تثبيت أدوات التكامل
لاستخدام التكاملات محلياً، تحتاج إلى تثبيت أحدث حزمة `crewai-tools`.
```bash
uv add crewai-tools
```
### إعداد متغيرات البيئة
{" "}
<Note>
لاستخدام التكاملات مع `Agent(apps=[])` يجب تعيين متغير البيئة
`CREWAI_PLATFORM_INTEGRATION_TOKEN` برمز Enterprise الخاص بك.
</Note>
```bash
export CREWAI_PLATFORM_INTEGRATION_TOKEN="your_enterprise_token"
```
أو أضفه إلى ملف `.env`:
```
CREWAI_PLATFORM_INTEGRATION_TOKEN=your_enterprise_token
```
### مثال على الاستخدام
{" "}
<Tip>
استخدم النهج المبسط الجديد لدمج تطبيقات المؤسسات. ما عليك سوى تحديد
التطبيق وإجراءاته مباشرة في تهيئة Agent.
</Tip>
```python
from crewai import Agent, Task, Crew
# Create an agent with Gmail capabilities
email_agent = Agent(
role="Email Manager",
goal="Manage and organize email communications",
backstory="An AI assistant specialized in email management and communication.",
apps=['gmail', 'gmail/send_email'] # Using canonical name 'gmail'
)
# Task to send an email
email_task = Task(
description="Draft and send a follow-up email to john@example.com about the project update",
agent=email_agent,
expected_output="Confirmation that email was sent successfully"
)
# Run the task
crew = Crew(
agents=[email_agent],
tasks=[email_task]
)
# Run the crew
crew.kickoff()
```
### تصفية الأدوات
```python
from crewai import Agent, Task, Crew
# Create agent with specific Gmail actions only
gmail_agent = Agent(
role="Gmail Manager",
goal="Manage gmail communications and notifications",
backstory="An AI assistant that helps coordinate gmail communications.",
apps=['gmail/fetch_emails'] # Using canonical name with specific action
)
notification_task = Task(
description="Find the email from john@example.com",
agent=gmail_agent,
expected_output="Email found from john@example.com"
)
crew = Crew(
agents=[gmail_agent],
tasks=[notification_task]
)
```
في الطاقم المنشور، يمكنك تحديد الإجراءات المتاحة لكل تكامل من صفحة إعدادات الخدمة.
{" "}
<Frame>
![تصفية الإجراءات](/images/enterprise/filtering_enterprise_action_tools.png)
</Frame>
### عمليات النشر المحددة النطاق (مؤسسات متعددة المستخدمين)
يمكنك تحديد نطاق كل تكامل لمستخدم معين. على سبيل المثال، طاقم يتصل بـ Google يمكنه استخدام حساب Gmail لمستخدم محدد.
{" "}
<Tip>مفيد عندما تحتاج فرق/مستخدمون مختلفون للحفاظ على فصل الوصول إلى البيانات.</Tip>
استخدم `user_bearer_token` لتحديد نطاق المصادقة للمستخدم الطالب. إذا لم يكن المستخدم مسجل الدخول، فلن يستخدم الطاقم التكاملات المتصلة. وإلا فسيعود إلى رمز الحامل الافتراضي المهيأ لعملية النشر.
{" "}
<Frame>![رمز حامل المستخدم](/images/enterprise/user_bearer_token.png)</Frame>
{" "}
<div id="catalog"></div>
### الكتالوج
#### الاتصالات والتعاون
- Gmail — إدارة الرسائل الإلكترونية والمسودات
- Slack — إشعارات وتنبيهات مساحة العمل
- Microsoft — تكامل Office 365 وTeams
#### إدارة المشاريع
- Jira — تتبع المشكلات وإدارة المشاريع
- ClickUp — إدارة المهام والإنتاجية
- Asana — تنسيق مهام ومشاريع الفريق
- Notion — إدارة الصفحات وقواعد البيانات
- Linear — تتبع مشاريع البرمجيات والأخطاء
- GitHub — إدارة المستودعات والمشكلات
#### إدارة علاقات العملاء
- Salesforce — إدارة حسابات وفرص CRM
- HubSpot — إدارة خط أنابيب المبيعات وجهات الاتصال
- Zendesk — إدارة تذاكر دعم العملاء
#### الأعمال والمالية
- Stripe — معالجة المدفوعات وإدارة العملاء
- Shopify — إدارة متجر ومنتجات التجارة الإلكترونية
#### الإنتاجية والتخزين
- Google Sheets — مزامنة بيانات جداول البيانات
- Google Calendar — إدارة الأحداث والجداول
- Box — تخزين الملفات وإدارة المستندات
...والمزيد قادم!
</Tab>
<Tab title="الأدوات الداخلية" icon="toolbox">
## الأدوات الداخلية
أنشئ أدوات مخصصة محلياً، وانشرها في مستودع أدوات CrewAI AMP واستخدمها في وكلائك.
{" "}
<Tip>
قبل تشغيل الأوامر أدناه، تأكد من تسجيل الدخول إلى حساب CrewAI AMP
بتشغيل هذا الأمر: ```bash crewai login ```
</Tip>
{" "}
<Frame>
![تفاصيل الأداة الداخلية](/images/enterprise/tools-integrations-internal.png)
</Frame>
{" "}
<Steps>
<Step title="الإنشاء">
أنشئ أداة جديدة محلياً. ```bash crewai tool create your-tool ```
</Step>
<Step title="النشر">
انشر الأداة في مستودع أدوات CrewAI AMP. ```bash crewai tool
publish ```
</Step>
<Step title="التثبيت">
ثبّت الأداة من مستودع أدوات CrewAI AMP. ```bash crewai tool
install your-tool ```
</Step>
</Steps>
الإدارة:
- الاسم والوصف
- الرؤية (خاص / عام)
- متغيرات البيئة المطلوبة
- سجل الإصدارات والتنزيلات
- وصول الفرق والأدوار
{" "}
<Frame>![تفاصيل الأداة الداخلية](/images/enterprise/tool-configs.png)</Frame>
</Tab>
</Tabs>
## ذو صلة
<CardGroup cols={2}>
<Card
title="مستودع الأدوات"
href="/ar/enterprise/guides/tool-repository#tool-repository"
icon="toolbox"
>
أنشئ وانشر وأدِر إصدارات الأدوات المخصصة لمؤسستك.
</Card>
<Card
title="أتمتة Webhook"
href="/ar/enterprise/guides/webhook-automation"
icon="bolt"
>
أتمت سير العمل وتكامل مع المنصات والخدمات الخارجية.
</Card>
</CardGroup>

View File

@@ -0,0 +1,148 @@
---
title: التتبعات
description: "استخدام التتبعات لمراقبة طواقمك"
icon: "timeline"
mode: "wide"
---
## نظرة عامة
توفر التتبعات رؤية شاملة لعمليات تنفيذ طواقمك، مما يساعدك على مراقبة الأداء وتصحيح الأخطاء وتحسين سير عمل وكلاء الذكاء الاصطناعي.
## ما هي التتبعات؟
التتبعات في CrewAI AMP هي سجلات تنفيذ مفصلة تلتقط كل جانب من جوانب عمل طاقمك، من المدخلات الأولية إلى المخرجات النهائية. تسجل:
- أفكار الوكلاء واستدلالاتهم
- تفاصيل تنفيذ المهام
- استخدام الأدوات ومخرجاتها
- مقاييس استهلاك الرموز
- أوقات التنفيذ
- تقديرات التكلفة
<Frame>![نظرة عامة على التتبعات](/images/enterprise/traces-overview.png)</Frame>
## الوصول إلى التتبعات
<Steps>
<Step title="الانتقال إلى علامة تبويب التتبعات">
في لوحة تحكم CrewAI AMP، انقر على **Traces** لعرض جميع سجلات التنفيذ.
</Step>
<Step title="اختيار عملية تنفيذ">
سترى قائمة بجميع عمليات تنفيذ الطاقم، مرتبة حسب التاريخ. انقر على أي عملية تنفيذ لعرض تتبعها المفصل.
</Step>
</Steps>
## فهم واجهة التتبع
تنقسم واجهة التتبع إلى عدة أقسام، يقدم كل منها رؤى مختلفة حول تنفيذ طاقمك:
### 1. ملخص التنفيذ
يعرض القسم العلوي مقاييس عالية المستوى حول التنفيذ:
- **إجمالي الرموز**: عدد الرموز المستهلكة عبر جميع المهام
- **رموز الطلب**: الرموز المستخدمة في الطلبات إلى LLM
- **رموز الإكمال**: الرموز المُنشأة في استجابات LLM
- **الطلبات**: عدد استدعاءات API المُجراة
- **وقت التنفيذ**: المدة الإجمالية لتشغيل الطاقم
- **التكلفة المقدرة**: التكلفة التقريبية بناءً على استخدام الرموز
<Frame>![ملخص التنفيذ](/images/enterprise/trace-summary.png)</Frame>
### 2. المهام والوكلاء
يعرض هذا القسم جميع المهام والوكلاء الذين كانوا جزءاً من تنفيذ الطاقم:
- اسم المهمة وتعيين الوكيل
- الوكلاء ونماذج LLM المستخدمة لكل مهمة
- الحالة (مكتملة/فاشلة)
- وقت التنفيذ الفردي للمهمة
<Frame>![قائمة المهام](/images/enterprise/trace-tasks.png)</Frame>
### 3. المخرجات النهائية
يعرض النتيجة النهائية التي أنتجها الطاقم بعد اكتمال جميع المهام.
<Frame>![المخرجات النهائية](/images/enterprise/final-output.png)</Frame>
### 4. الجدول الزمني للتنفيذ
تمثيل مرئي لوقت بدء وانتهاء كل مهمة، يساعدك على تحديد نقاط الاختناق أو أنماط التنفيذ المتوازي.
<Frame>![الجدول الزمني للتنفيذ](/images/enterprise/trace-timeline.png)</Frame>
### 5. عرض المهمة المفصل
عند النقر على مهمة محددة في الجدول الزمني أو قائمة المهام، سترى:
<Frame>![عرض المهمة المفصل](/images/enterprise/trace-detailed-task.png)</Frame>
- **مفتاح المهمة**: معرّف فريد للمهمة
- **معرّف المهمة**: معرّف تقني في النظام
- **الحالة**: الحالة الحالية (مكتملة/قيد التشغيل/فاشلة)
- **الوكيل**: الوكيل الذي نفّذ المهمة
- **LLM**: نموذج اللغة المستخدم لهذه المهمة
- **وقت البدء/الانتهاء**: متى بدأت المهمة واكتملت
- **وقت التنفيذ**: مدة هذه المهمة المحددة
- **وصف المهمة**: ما طُلب من الوكيل تنفيذه
- **المخرجات المتوقعة**: تنسيق المخرجات المطلوب
- **المدخلات**: أي مدخلات مقدمة لهذه المهمة من مهام سابقة
- **المخرجات**: النتيجة الفعلية التي أنتجها الوكيل
## استخدام التتبعات لتصحيح الأخطاء
التتبعات لا تقدر بثمن لاستكشاف المشكلات في طواقمك:
<Steps>
<Step title="تحديد نقاط الفشل">
عندما لا ينتج تنفيذ الطاقم النتائج المتوقعة، افحص التتبع لمعرفة أين حدث الخطأ. ابحث عن:
- المهام الفاشلة
- قرارات الوكيل غير المتوقعة
- أخطاء استخدام الأدوات
- التعليمات المُساء فهمها
<Frame>
![نقاط الفشل](/images/enterprise/failure.png)
</Frame>
</Step>
<Step title="تحسين الأداء">
استخدم مقاييس التنفيذ لتحديد نقاط اختناق الأداء:
- المهام التي استغرقت وقتاً أطول من المتوقع
- الاستخدام المفرط للرموز
- عمليات الأدوات المكررة
- استدعاءات API غير الضرورية
</Step>
<Step title="تحسين كفاءة التكلفة">
حلل استخدام الرموز وتقديرات التكلفة لتحسين كفاءة طاقمك:
- فكّر في استخدام نماذج أصغر للمهام الأبسط
- صقل الطلبات لتكون أكثر إيجازاً
- خزّن المعلومات المُوصول إليها بشكل متكرر مؤقتاً
- نظّم المهام لتقليل العمليات المكررة
</Step>
</Steps>
## الأداء والتجميع
يجمّع CrewAI تحميلات التتبع لتقليل العبء في عمليات التشغيل ذات الحجم الكبير:
- يقوم TraceBatchManager بتخزين الأحداث مؤقتاً وإرسالها في دفعات عبر عميل Plus API
- يقلل حركة الشبكة ويحسّن الموثوقية في الاتصالات غير المستقرة
- يُفعّل تلقائياً في مستمع التتبع الافتراضي؛ لا حاجة لتهيئة
يوفر ذلك تتبعاً أكثر استقراراً تحت الحمل مع الحفاظ على بيانات القياس المفصلة للمهام/الوكلاء.
<Card title="تحتاج مساعدة؟" icon="headset" href="mailto:support@crewai.com">
تواصل مع فريق الدعم للمساعدة في تحليل التتبعات أو أي ميزات أخرى في
CrewAI AMP.
</Card>

View File

@@ -0,0 +1,172 @@
---
title: بث Webhook
description: "استخدام بث Webhook لإرسال الأحداث إلى webhook الخاص بك"
icon: "webhook"
mode: "wide"
---
## نظرة عامة
يتيح لك بث أحداث Enterprise تلقي تحديثات webhook في الوقت الفعلي حول طواقمك وتدفقاتك المنشورة على CrewAI AMP، مثل استدعاءات النماذج واستخدام الأدوات وخطوات التدفق.
## الاستخدام
عند استخدام Kickoff API، أضف كائن `webhooks` إلى طلبك، على سبيل المثال:
```json
{
"inputs": { "foo": "bar" },
"webhooks": {
"events": ["crew_kickoff_started", "llm_call_started"],
"url": "https://your.endpoint/webhook",
"realtime": false,
"authentication": {
"strategy": "bearer",
"token": "my-secret-token"
}
}
}
```
إذا تم تعيين `realtime` إلى `true`، يتم تسليم كل حدث بشكل فردي وفوري، على حساب أداء الطاقم/التدفق.
## تنسيق Webhook
يرسل كل webhook قائمة بالأحداث:
```json
{
"events": [
{
"id": "event-id",
"execution_id": "crew-run-id",
"timestamp": "2025-02-16T10:58:44.965Z",
"type": "llm_call_started",
"data": {
"model": "gpt-4",
"messages": [
{ "role": "system", "content": "You are an assistant." },
{ "role": "user", "content": "Summarize this article." }
]
}
}
]
}
```
يختلف هيكل كائن `data` حسب نوع الحدث. راجع [قائمة الأحداث](https://github.com/crewAIInc/crewAI/tree/main/lib/crewai/src/crewai/events/types) على GitHub.
نظراً لأن الطلبات تُرسل عبر HTTP، لا يمكن ضمان ترتيب الأحداث. إذا كنت تحتاج الترتيب، استخدم حقل `timestamp`.
## الأحداث المدعومة
يدعم CrewAI كلاً من أحداث النظام والأحداث المخصصة في بث أحداث Enterprise. تُرسل هذه الأحداث إلى نقطة نهاية webhook المُهيأة أثناء تنفيذ الطاقم والتدفق.
### أحداث التدفق:
- `flow_created`
- `flow_started`
- `flow_finished`
- `flow_plot`
- `method_execution_started`
- `method_execution_finished`
- `method_execution_failed`
### أحداث الوكيل:
- `agent_execution_started`
- `agent_execution_completed`
- `agent_execution_error`
- `lite_agent_execution_started`
- `lite_agent_execution_completed`
- `lite_agent_execution_error`
- `agent_logs_started`
- `agent_logs_execution`
- `agent_evaluation_started`
- `agent_evaluation_completed`
- `agent_evaluation_failed`
### أحداث الطاقم:
- `crew_kickoff_started`
- `crew_kickoff_completed`
- `crew_kickoff_failed`
- `crew_train_started`
- `crew_train_completed`
- `crew_train_failed`
- `crew_test_started`
- `crew_test_completed`
- `crew_test_failed`
- `crew_test_result`
### أحداث المهام:
- `task_started`
- `task_completed`
- `task_failed`
- `task_evaluation`
### أحداث استخدام الأدوات:
- `tool_usage_started`
- `tool_usage_finished`
- `tool_usage_error`
- `tool_validate_input_error`
- `tool_selection_error`
- `tool_execution_error`
### أحداث LLM:
- `llm_call_started`
- `llm_call_completed`
- `llm_call_failed`
- `llm_stream_chunk`
### أحداث حواجز LLM:
- `llm_guardrail_started`
- `llm_guardrail_completed`
### أحداث الذاكرة:
- `memory_query_started`
- `memory_query_completed`
- `memory_query_failed`
- `memory_save_started`
- `memory_save_completed`
- `memory_save_failed`
- `memory_retrieval_started`
- `memory_retrieval_completed`
### أحداث المعرفة:
- `knowledge_search_query_started`
- `knowledge_search_query_completed`
- `knowledge_search_query_failed`
- `knowledge_query_started`
- `knowledge_query_completed`
- `knowledge_query_failed`
### أحداث الاستدلال:
- `agent_reasoning_started`
- `agent_reasoning_completed`
- `agent_reasoning_failed`
تتطابق أسماء الأحداث مع ناقل الأحداث الداخلي. راجع GitHub للقائمة الكاملة للأحداث.
يمكنك إصدار أحداثك المخصصة الخاصة، وسيتم تسليمها عبر تدفق webhook جنباً إلى جنب مع أحداث النظام.
<CardGroup>
<Card
title="GitHub"
icon="github"
href="https://github.com/crewAIInc/crewAI/tree/main/src/crewai/utilities/events"
>
القائمة الكاملة للأحداث
</Card>
<Card title="تحتاج مساعدة؟" icon="headset" href="mailto:support@crewai.com">
تواصل مع فريق الدعم للمساعدة في تكامل webhook أو
استكشاف الأخطاء.
</Card>
</CardGroup>

View File

@@ -0,0 +1,321 @@
---
title: "نظرة عامة على المشغلات"
description: "فهم كيفية عمل مشغلات CrewAI AMP وكيفية إدارتها وأين تجد أدلة التكامل الخاصة بكل خدمة"
icon: "face-smile"
mode: "wide"
---
تربط مشغلات CrewAI AMP أتمتاتك بالأحداث الفورية عبر الأدوات التي تستخدمها فرقك بالفعل. بدلاً من الاستعلام المتكرر عن الأنظمة أو الاعتماد على التشغيل اليدوي، تستمع المشغلات للتغييرات — رسائل بريد إلكتروني جديدة، تحديثات التقويم، تغييرات حالة CRM — وتطلق فوراً الطاقم أو التدفق الذي تحدده.
<Frame>
![نظرة عامة على مشغلات الأتمتة](/images/enterprise/crew_connectors.png)
</Frame>
### أدلة التكامل
تقدم الأدلة المفصلة شرحاً لعملية الإعداد وأمثلة على سير العمل لكل تكامل:
<CardGroup cols={2}>
<Card title="مشغل Gmail" icon="envelope">
<a href="/ar/enterprise/guides/gmail-trigger">فعّل الطواقم عند وصول رسائل بريد إلكتروني أو تحديث سلاسل المحادثات.</a>
</Card>
{" "}
<Card title="مشغل Google Calendar" icon="calendar-days">
<a href="/ar/enterprise/guides/google-calendar-trigger">
استجب لأحداث التقويم عند إنشائها أو تحديثها أو إلغائها.
</a>
</Card>
{" "}
<Card title="مشغل Google Drive" icon="folder-open">
<a href="/ar/enterprise/guides/google-drive-trigger">
تعامل مع تحميلات وتعديلات وحذف ملفات Drive.
</a>
</Card>
{" "}
<Card title="مشغل Outlook" icon="envelope-open">
<a href="/ar/enterprise/guides/outlook-trigger">
أتمت الاستجابات لرسائل Outlook الجديدة وتحديثات التقويم.
</a>
</Card>
{" "}
<Card title="مشغل OneDrive" icon="cloud">
<a href="/ar/enterprise/guides/onedrive-trigger">
راقب نشاط الملفات وتغييرات المشاركة في OneDrive.
</a>
</Card>
{" "}
<Card title="مشغل Microsoft Teams" icon="comments">
<a href="/ar/enterprise/guides/microsoft-teams-trigger">
ابدأ سير العمل عند إنشاء محادثات Teams جديدة.
</a>
</Card>
{" "}
<Card title="مشغل HubSpot" icon="hubspot">
<a href="/ar/enterprise/guides/hubspot-trigger">
أطلق الأتمتات من سير عمل HubSpot وأحداث دورة الحياة.
</a>
</Card>
{" "}
<Card title="مشغل Salesforce" icon="salesforce">
<a href="/ar/enterprise/guides/salesforce-trigger">
اربط عمليات Salesforce بـ CrewAI لأتمتة CRM.
</a>
</Card>
{" "}
<Card title="مشغل Slack" icon="slack">
<a href="/ar/enterprise/guides/slack-trigger">
ابدأ الطواقم مباشرة من أوامر Slack.
</a>
</Card>
<Card title="مشغل Zapier" icon="bolt">
<a href="/ar/enterprise/guides/zapier-trigger">اربط CrewAI بآلاف التطبيقات المدعومة من Zapier.</a>
</Card>
</CardGroup>
## قدرات المشغلات
مع المشغلات، يمكنك:
- **الاستجابة للأحداث الفورية** - تنفيذ سير العمل تلقائياً عند استيفاء شروط محددة
- **التكامل مع الأنظمة الخارجية** - الاتصال بمنصات مثل Gmail وOutlook وOneDrive وJIRA وSlack وStripe والمزيد
- **توسيع نطاق الأتمتة** - التعامل مع أحداث كبيرة الحجم دون تدخل يدوي
- **الحفاظ على السياق** - الوصول إلى بيانات المشغل داخل طواقمك وتدفقاتك
## إدارة المشغلات
### عرض المشغلات المتاحة
للوصول إلى مشغلات الأتمتة وإدارتها:
1. انتقل إلى عملية النشر في لوحة تحكم CrewAI
2. انقر على علامة تبويب **Triggers** لعرض جميع تكاملات المشغلات المتاحة
<Frame caption="مثال على مشغلات الأتمتة المتاحة لنشر Gmail">
<img
src="/images/enterprise/list-available-triggers.png"
alt="قائمة مشغلات الأتمتة المتاحة"
/>
</Frame>
يعرض هذا العرض جميع تكاملات المشغلات المتاحة لعملية النشر، مع حالة الاتصال الحالية.
### تفعيل وتعطيل المشغلات
يمكن تفعيل أو تعطيل كل مشغل بسهولة باستخدام مفتاح التبديل:
<Frame caption="تفعيل أو تعطيل المشغلات بالتبديل">
<img
src="/images/enterprise/trigger-selected.png"
alt="تفعيل أو تعطيل المشغلات بالتبديل"
/>
</Frame>
- **مُفعّل (تبديل أزرق)**: المشغل نشط وسينفذ عملية النشر تلقائياً عند حدوث الأحداث المحددة
- **مُعطّل (تبديل رمادي)**: المشغل غير نشط ولن يستجيب للأحداث
انقر ببساطة على التبديل لتغيير حالة المشغل. تسري التغييرات فوراً.
### مراقبة عمليات تنفيذ المشغلات
تتبع أداء وسجل عمليات التنفيذ المُشغّلة:
<Frame caption="قائمة عمليات التنفيذ المُشغّلة بواسطة الأتمتة">
<img
src="/images/enterprise/list-executions.png"
alt="قائمة عمليات التنفيذ المُشغّلة بواسطة الأتمتة"
/>
</Frame>
## بناء أتمتات مدفوعة بالمشغلات
قبل بناء أتمتتك، من المفيد فهم هيكل حمولات المشغلات التي ستتلقاها طواقمك وتدفقاتك.
### قائمة فحص إعداد المشغل
قبل ربط مشغل بالإنتاج، تأكد من:
- ربط التكامل تحت **Tools & Integrations** وإكمال خطوات OAuth أو مفتاح API
- تفعيل تبديل المشغل في عملية النشر التي يجب أن تستجيب للأحداث
- توفير متغيرات البيئة المطلوبة (رموز API، معرّفات المستأجر، الأسرار المشتركة)
- إنشاء أو تحديث المهام التي يمكنها تحليل الحمولة الواردة في أول مهمة طاقم أو خطوة تدفق
- تحديد ما إذا كنت ستمرر سياق المشغل تلقائياً باستخدام `allow_crewai_trigger_context`
- إعداد المراقبة — سجلات webhook وسجل تنفيذ CrewAI والتنبيهات الخارجية الاختيارية
### اختبار المشغلات محلياً باستخدام CLI
يوفر CrewAI CLI أوامر قوية لمساعدتك في تطوير واختبار الأتمتات المدفوعة بالمشغلات دون النشر في الإنتاج.
#### عرض المشغلات المتاحة
اعرض جميع المشغلات المتاحة للتكاملات المتصلة:
```bash
crewai triggers list
```
يعرض هذا الأمر جميع المشغلات المتاحة بناءً على تكاملاتك المتصلة، ويظهر:
- اسم التكامل وحالة الاتصال
- أنواع المشغلات المتاحة
- أسماء وأوصاف المشغلات
#### محاكاة تنفيذ المشغل
اختبر طاقمك بحمولات مشغل واقعية قبل النشر:
```bash
crewai triggers run <trigger_name>
```
على سبيل المثال:
```bash
crewai triggers run microsoft_onedrive/file_changed
```
يقوم هذا الأمر بـ:
- تنفيذ طاقمك محلياً
- تمرير حمولة مشغل كاملة وواقعية
- محاكاة كيفية استدعاء طاقمك في الإنتاج بالضبط
<Warning>
**ملاحظات تطوير مهمة:**
- استخدم `crewai triggers run <trigger>` لمحاكاة تنفيذ المشغل أثناء التطوير
- استخدام `crewai run` لن يحاكي استدعاءات المشغل ولن يمرر حمولة المشغل
- بعد النشر، سيتم تنفيذ طاقمك بحمولة المشغل الفعلية
- إذا كان طاقمك يتوقع معاملات غير موجودة في حمولة المشغل، فقد يفشل التنفيذ
</Warning>
### المشغلات مع الطاقم
تعمل تعريفات طاقمك الحالية بسلاسة مع المشغلات، تحتاج فقط إلى مهمة لتحليل الحمولة المستلمة:
```python
@CrewBase
class MyAutomatedCrew:
@agent
def researcher(self) -> Agent:
return Agent(
config=self.agents_config['researcher'],
)
@task
def parse_trigger_payload(self) -> Task:
return Task(
config=self.tasks_config['parse_trigger_payload'],
agent=self.researcher(),
)
@task
def analyze_trigger_content(self) -> Task:
return Task(
config=self.tasks_config['analyze_trigger_data'],
agent=self.researcher(),
)
```
سيتلقى الطاقم تلقائياً حمولة المشغل ويمكنه الوصول إليها عبر آليات سياق CrewAI القياسية.
<Note>
يمكن أن تتضمن مدخلات الطاقم والتدفق `crewai_trigger_payload`. يحقن CrewAI
هذه الحمولة تلقائياً: - المهام: تُلحق بوصف المهمة الأولى افتراضياً ("Trigger Payload: {crewai_trigger_payload}") - التحكم
عبر `allow_crewai_trigger_context`: عيّن `True` للحقن دائماً، `False` لعدم
الحقن أبداً - التدفقات: أي دالة `@start()` تقبل معامل
`crewai_trigger_payload` ستستلمه
</Note>
### التكامل مع التدفقات
للتدفقات، لديك تحكم أكبر في كيفية التعامل مع بيانات المشغل:
#### الوصول إلى حمولة المشغل
جميع دوال `@start()` في تدفقاتك ستقبل معاملاً إضافياً يسمى `crewai_trigger_payload`:
```python
from crewai.flow import Flow, start, listen
class MyAutomatedFlow(Flow):
@start()
def handle_trigger(self, crewai_trigger_payload: dict = None):
"""
This start method can receive trigger data
"""
if crewai_trigger_payload:
# Process the trigger data
trigger_id = crewai_trigger_payload.get('id')
event_data = crewai_trigger_payload.get('payload', {})
# Store in flow state for use by other methods
self.state.trigger_id = trigger_id
self.state.trigger_type = event_data
return event_data
# Handle manual execution
return None
@listen(handle_trigger)
def process_data(self, trigger_data):
"""
Process the data from the trigger
"""
# ... process the trigger
```
#### تشغيل الطواقم من التدفقات
عند تشغيل طاقم داخل تدفق تم تشغيله بمشغل، مرر حمولة المشغل كما هي:
```python
@start()
def delegate_to_crew(self, crewai_trigger_payload: dict = None):
"""
Delegate processing to a specialized crew
"""
crew = MySpecializedCrew()
# Pass the trigger payload to the crew
result = crew.crew().kickoff(
inputs={
'a_custom_parameter': "custom_value",
'crewai_trigger_payload': crewai_trigger_payload
},
)
return result
```
## استكشاف الأخطاء وإصلاحها
**المشغل لا يعمل:**
- تحقق من أن المشغل مُفعّل في علامة تبويب Triggers الخاصة بعملية النشر
- تحقق من حالة اتصال التكامل تحت Tools & Integrations
- تأكد من تهيئة جميع متغيرات البيئة المطلوبة بشكل صحيح
**فشل التنفيذ:**
- تحقق من سجلات التنفيذ لتفاصيل الأخطاء
- استخدم `crewai triggers run <trigger_name>` للاختبار محلياً ورؤية هيكل الحمولة بالضبط
- تحقق من أن طاقمك يمكنه التعامل مع معامل `crewai_trigger_payload`
- تأكد من أن طاقمك لا يتوقع معاملات غير مضمنة في حمولة المشغل
**مشاكل التطوير:**
- اختبر دائماً باستخدام `crewai triggers run <trigger>` قبل النشر لرؤية الحمولة الكاملة
- تذكر أن `crewai run` لا يحاكي استدعاءات المشغل — استخدم `crewai triggers run` بدلاً من ذلك
- استخدم `crewai triggers list` للتحقق من المشغلات المتاحة لتكاملاتك المتصلة
- بعد النشر، سيتلقى طاقمك حمولة المشغل الفعلية، لذا اختبر بدقة محلياً أولاً
تحوّل مشغلات الأتمتة عمليات نشر CrewAI إلى أنظمة استجابة مدفوعة بالأحداث يمكنها التكامل بسلاسة مع عمليات عملك وأدواتك الحالية.

View File

@@ -0,0 +1,54 @@
---
title: "إعداد Azure OpenAI"
description: "تهيئة Azure OpenAI مع Crew Studio لاتصالات LLM المؤسسية"
icon: "microsoft"
mode: "wide"
---
يرشدك هذا الدليل خلال ربط Azure OpenAI مع Crew Studio لعمليات الذكاء الاصطناعي المؤسسية السلسة.
## عملية الإعداد
<Steps>
<Step title="الوصول إلى Azure AI Foundry">
1. في Azure، انتقل إلى [Azure AI Foundry](https://ai.azure.com/) > اختر نشر Azure OpenAI الخاص بك.
2. في القائمة اليسرى، انقر على `Deployments`. إذا لم يكن لديك نشر، أنشئ واحداً بالنموذج المطلوب.
3. بمجرد الإنشاء، اختر النشر وحدد موقع `Target URI` و`Key` على الجانب الأيمن من الصفحة. أبقِ هذه الصفحة مفتوحة، حيث ستحتاج هذه المعلومات.
<Frame>
<img src="/images/enterprise/azure-openai-studio.png" alt="Azure AI Foundry" />
</Frame>
</Step>
<Step title="تهيئة اتصال CrewAI AMP">
4. في علامة تبويب أخرى، افتح `CrewAI AMP > LLM Connections`. سمِّ اتصال LLM، واختر Azure كمزود، واختر نفس النموذج الذي اخترته في Azure.
5. في نفس الصفحة، أضف متغيرات البيئة من الخطوة 3:
- واحد بالاسم `AZURE_DEPLOYMENT_TARGET_URL` (باستخدام Target URI). يجب أن يبدو الرابط هكذا: https://your-deployment.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2024-08-01-preview
- آخر بالاسم `AZURE_API_KEY` (باستخدام Key).
6. انقر على `Add Connection` لحفظ اتصال LLM.
</Step>
<Step title="ضبط التهيئة الافتراضية">
7. في `CrewAI AMP > Settings > Defaults > Crew Studio LLM Settings`، عيّن اتصال LLM والنموذج الجديدين كافتراضيين.
</Step>
<Step title="تهيئة الوصول إلى الشبكة">
8. تأكد من إعدادات الوصول إلى الشبكة:
- في Azure، انتقل إلى `Azure OpenAI > اختر النشر`.
- انتقل إلى `Resource Management > Networking`.
- تأكد من تفعيل `Allow access from all networks`. إذا كان هذا الإعداد مقيداً، فقد يُحظر وصول CrewAI إلى نقطة نهاية Azure OpenAI.
</Step>
</Steps>
## التحقق
أنت جاهز! سيستخدم Crew Studio الآن اتصال Azure OpenAI الخاص بك. اختبر الاتصال بإنشاء طاقم أو مهمة بسيطة للتأكد من أن كل شيء يعمل بشكل صحيح.
## استكشاف الأخطاء وإصلاحها
إذا واجهت مشكلات:
- تحقق من أن تنسيق Target URI يتطابق مع النمط المتوقع
- تحقق من صحة مفتاح API وأنه يملك الصلاحيات المناسبة
- تأكد من تهيئة الوصول إلى الشبكة للسماح باتصالات CrewAI
- تأكد من أن نموذج النشر يتطابق مع ما هيأته في CrewAI

View File

@@ -0,0 +1,48 @@
---
title: "بناء طاقم"
description: "الطاقم هو مجموعة من الوكلاء الذين يعملون معاً لإتمام مهمة."
icon: "people-arrows"
mode: "wide"
---
## نظرة عامة
يبسّط [CrewAI AMP](https://app.crewai.com) عملية **إنشاء** و**نشر** و**إدارة** وكلاء الذكاء الاصطناعي في بيئات الإنتاج.
## البدء
<iframe
className="w-full aspect-video rounded-xl"
src="https://www.youtube.com/embed/-kSOTtYzgEw"
title="بناء الطواقم باستخدام CrewAI CLI"
frameBorder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
></iframe>
### التثبيت والإعداد
<Card
title="اتبع دليل التثبيت القياسي"
icon="wrench"
href="/ar/installation"
>
اتبع دليل التثبيت القياسي لإعداد CrewAI CLI وإنشاء مشروعك
الأول.
</Card>
### بناء طاقمك
<Card title="دليل البدء السريع" icon="rocket" href="/ar/quickstart">
اتبع دليل البدء السريع لإنشاء أول طاقم وكلاء باستخدام تهيئة
YAML.
</Card>
## الدعم والموارد
للدعم الخاص بالمؤسسات أو الأسئلة، تواصل مع فريق الدعم المخصص على [support@crewai.com](mailto:support@crewai.com).
<Card title="حجز عرض توضيحي" icon="calendar" href="mailto:support@crewai.com">
احجز وقتاً مع فريقنا لمعرفة المزيد عن ميزات Enterprise وكيف يمكنها
إفادة مؤسستك.
</Card>

View File

@@ -0,0 +1,57 @@
---
title: "تصدير OpenTelemetry"
description: "تصدير التتبعات والسجلات من عمليات نشر CrewAI AMP إلى مجمّع OpenTelemetry الخاص بك"
icon: "magnifying-glass-chart"
mode: "wide"
---
يمكن لـ CrewAI AMP تصدير **التتبعات** و**السجلات** من OpenTelemetry من عمليات النشر مباشرة إلى مجمّعك الخاص. يتيح لك ذلك مراقبة أداء الوكلاء وتتبع استدعاءات LLM وتصحيح الأخطاء باستخدام مجموعة المراقبة الحالية.
تتبع بيانات القياس [اتفاقيات OpenTelemetry GenAI الدلالية](https://opentelemetry.io/docs/specs/semconv/gen-ai/) بالإضافة إلى سمات خاصة بـ CrewAI.
<Tip>
تُعدّ OpenTelemetry **مسار المراقبة الموصى به** — محايدة تجاه الموردين، وتعمل مع أي خلفية متوافقة مع OTLP (Grafana, Honeycomb, NewRelic، أو مجمّعك الخاص). إذا كنت تستخدم Datadog تحديدًا، فراجع دليل [تكامل Datadog](./datadog) المخصص، الذي يغطي كلًا من مسار وكيل Datadog واستيعاب OTLP من Datadog.
</Tip>
## المتطلبات المسبقة
<CardGroup cols={2}>
<Card title="حساب CrewAI AMP" icon="users">
يجب أن يكون لدى مؤسستك حساب CrewAI AMP نشط.
</Card>
<Card title="مجمّع OpenTelemetry" icon="server">
تحتاج إلى نقطة نهاية مجمّع متوافقة مع OpenTelemetry (مثل OTel Collector الخاص بك أو Datadog أو Grafana أو أي واجهة خلفية متوافقة مع OTLP).
</Card>
</CardGroup>
## إعداد مجمّع
1. في CrewAI AMP، انتقل إلى **Settings** > **OpenTelemetry Collectors**.
2. انقر على **Add Collector**.
3. اختر تكاملاً:
- **OpenTelemetry Traces** و**OpenTelemetry Logs** — صدّر إلى أي مجمّع أو واجهة خلفية متوافقة مع OTLP.
- **Datadog** — أرسل التتبعات مباشرة إلى استقبال OTLP الخاص بـ Datadog، دون الحاجة إلى مجمّع منفصل أو Datadog Agent.
4. هيّئ الاتصال. تعتمد الحقول على التكامل الذي اخترته:
<Tabs>
<Tab title="OpenTelemetry Traces / Logs">
إن **OpenTelemetry Traces** و**OpenTelemetry Logs** تكاملان منفصلان يتشاركان نفس الحقول — اختر التكامل المطابق للإشارة التي تريد تصديرها.
- **Endpoint** — نقطة نهاية OTLP لمجمّعك (مثل `https://otel-collector.example.com:4317`).
- **Service Name** — اسم لتعريف هذه الخدمة في منصة المراقبة.
- **Custom Headers** *(اختياري)* — أضف رؤوس المصادقة أو التوجيه كأزواج مفتاح-قيمة.
- **Certificate** *(اختياري)* — قدم شهادة TLS إذا كان مجمّعك يتطلبها.
<Frame>![تهيئة مجمّع OpenTelemetry](/images/crewai-otel-collector-opentelemetry.png)</Frame>
</Tab>
<Tab title="Datadog">
لإعداد Datadog، راجع دليل [تكامل Datadog](./datadog) المخصص — فهو يغطي كلًا من مسار وكيل Datadog (الموصى به، أرخص لحجم السجلات الكبير) واستيعاب OTLP من Datadog، مع خطوات تهيئة كاملة للمجمّع.
</Tab>
</Tabs>
5. *(اختياري)* انقر على **Test Connection** للتحقق من قدرة CrewAI على الوصول إلى نقطة النهاية باستخدام بيانات الاعتماد التي قدمتها.
6. انقر على **Save**.
<Tip>
يمكنك إضافة مجمّعات متعددة — على سبيل المثال، واحد للتتبعات وآخر للسجلات، أو الإرسال إلى واجهات خلفية مختلفة لأغراض مختلفة.
</Tip>

View File

@@ -0,0 +1,136 @@
---
title: "خوادم MCP المخصصة"
description: "اربط خوادم MCP الخاصة بك بـ CrewAI AMP مع وصول عام أو مصادقة بمفتاح API أو OAuth 2.0"
icon: "plug"
mode: "wide"
---
يدعم CrewAI AMP الاتصال بأي خادم MCP يُنفّذ [Model Context Protocol](https://modelcontextprotocol.io/). يمكنك إحضار خوادم عامة لا تتطلب مصادقة، وخوادم محمية بمفتاح API أو رمز حامل، وخوادم تستخدم OAuth 2.0 للوصول المفوّض الآمن.
## المتطلبات المسبقة
<CardGroup cols={2}>
<Card title="حساب CrewAI AMP" icon="user">
تحتاج إلى حساب [CrewAI AMP](https://app.crewai.com) نشط.
</Card>
<Card title="رابط خادم MCP" icon="link">
رابط خادم MCP الذي تريد الاتصال به. يجب أن يكون الخادم متاحاً من الإنترنت ويدعم نقل Streamable HTTP.
</Card>
</CardGroup>
## إضافة خادم MCP مخصص
<Steps>
<Step title="فتح الأدوات والتكاملات">
انتقل إلى **Tools & Integrations** في الشريط الجانبي الأيسر لـ CrewAI AMP، ثم اختر علامة تبويب **Connections**.
</Step>
<Step title="بدء إضافة خادم MCP مخصص">
انقر على زر **Add Custom MCP Server**. سيظهر مربع حوار مع نموذج التهيئة.
</Step>
<Step title="ملء المعلومات الأساسية">
- **Name** (مطلوب): اسم وصفي لخادم MCP (مثل "My Internal Tools Server").
- **Description**: ملخص اختياري لما يقدمه خادم MCP هذا.
- **Server URL** (مطلوب): الرابط الكامل لنقطة نهاية خادم MCP (مثل `https://my-server.example.com/mcp`).
</Step>
<Step title="اختيار طريقة المصادقة">
اختر إحدى طرق المصادقة الثلاث المتاحة بناءً على كيفية تأمين خادم MCP. راجع الأقسام أدناه لتفاصيل كل طريقة.
</Step>
<Step title="إضافة رؤوس مخصصة (اختياري)">
إذا كان خادم MCP يتطلب رؤوساً إضافية في كل طلب (مثل معرّفات المستأجر أو رؤوس التوجيه)، انقر على **+ Add Header** وقدم اسم الرأس وقيمته. يمكنك إضافة رؤوس مخصصة متعددة.
</Step>
<Step title="إنشاء الاتصال">
انقر على **Create MCP Server** لحفظ الاتصال. سيظهر خادم MCP المخصص الآن في قائمة الاتصالات وستكون أدواته متاحة للاستخدام في طواقمك.
</Step>
</Steps>
## طرق المصادقة
### بدون مصادقة
اختر هذا الخيار عندما يكون خادم MCP متاحاً للجمهور ولا يتطلب أي بيانات اعتماد. هذا شائع للخوادم مفتوحة المصدر أو الخوادم الداخلية العاملة خلف VPN.
### رمز المصادقة
استخدم هذه الطريقة عندما يكون خادم MCP محمياً بمفتاح API أو رمز حامل.
<Frame>
<img src="/images/enterprise/custom-mcp-auth-token.png" alt="خادم MCP مخصص برمز مصادقة" />
</Frame>
| الحقل | مطلوب | الوصف |
|-------|-------|-------|
| **Header Name** | نعم | اسم رأس HTTP الذي يحمل الرمز (مثل `X-API-Key`، `Authorization`). |
| **Value** | نعم | مفتاح API أو رمز الحامل الخاص بك. |
| **Add to** | لا | أين يتم إرفاق بيانات الاعتماد — **Header** (افتراضي) أو **Query parameter**. |
<Tip>
إذا كان خادمك يتوقع رمز `Bearer` في رأس `Authorization`، عيّن Header Name إلى `Authorization` والقيمة إلى `Bearer <your-token>`.
</Tip>
### OAuth 2.0
استخدم هذه الطريقة لخوادم MCP التي تتطلب تفويض OAuth 2.0. سيتعامل CrewAI مع تدفق OAuth الكامل، بما في ذلك تحديث الرمز.
<Frame>
<img src="/images/enterprise/custom-mcp-oauth.png" alt="خادم MCP مخصص مع OAuth 2.0" />
</Frame>
| الحقل | مطلوب | الوصف |
|-------|-------|-------|
| **Redirect URI** | — | مُعبأ مسبقاً وللقراءة فقط. انسخ هذا الرابط وسجّله كرابط إعادة توجيه مصرّح به في مزود OAuth. |
| **Authorization Endpoint** | نعم | الرابط الذي يُوجَّه إليه المستخدمون لتفويض الوصول (مثل `https://auth.example.com/oauth/authorize`). |
| **Token Endpoint** | نعم | الرابط المستخدم لتبادل رمز التفويض برمز وصول (مثل `https://auth.example.com/oauth/token`). |
| **Client ID** | نعم | معرّف عميل OAuth الصادر من مزودك. |
| **Client Secret** | لا | سر عميل OAuth. غير مطلوب للعملاء العامين باستخدام PKCE. |
| **Scopes** | لا | قائمة نطاقات مفصولة بمسافات للطلب (مثل `read write`). |
| **Token Auth Method** | لا | كيفية إرسال بيانات اعتماد العميل عند تبادل الرموز — **Standard (POST body)** أو **Basic Auth (header)**. الافتراضي هو Standard. |
| **PKCE Supported** | لا | فعّل إذا كان مزود OAuth يدعم Proof Key for Code Exchange. موصى به لتحسين الأمان. |
<Info>
**اكتشاف تهيئة OAuth**: إذا كان مزود OAuth يدعم OpenID Connect Discovery، انقر على رابط **Discover OAuth Config** لملء نقاط نهاية التفويض والرمز تلقائياً من رابط `/.well-known/openid-configuration` الخاص بالمزود.
</Info>
#### إعداد OAuth 2.0 خطوة بخطوة
<Steps>
<Step title="تسجيل رابط إعادة التوجيه">
انسخ **Redirect URI** المعروض في النموذج وأضفه كرابط إعادة توجيه مصرّح به في إعدادات تطبيق مزود OAuth.
</Step>
<Step title="إدخال نقاط النهاية وبيانات الاعتماد">
املأ **Authorization Endpoint** و**Token Endpoint** و**Client ID**، واختيارياً **Client Secret** و**Scopes**.
</Step>
<Step title="تهيئة طريقة تبادل الرمز">
اختر **Token Auth Method** المناسبة. معظم المزودين يستخدمون الافتراضي **Standard (POST body)**. بعض المزودين القدامى يتطلبون **Basic Auth (header)**.
</Step>
<Step title="تفعيل PKCE (موصى به)">
حدد **PKCE Supported** إذا كان مزودك يدعمه. يضيف PKCE طبقة أمان إضافية لتدفق رمز التفويض وموصى به لجميع التكاملات الجديدة.
</Step>
<Step title="الإنشاء والتفويض">
انقر على **Create MCP Server**. سيتم توجيهك إلى مزود OAuth لتفويض الوصول. بمجرد التفويض، سيخزن CrewAI الرموز ويحدّثها تلقائياً حسب الحاجة.
</Step>
</Steps>
## استخدام خادم MCP المخصص
بمجرد الاتصال، تظهر أدوات خادم MCP المخصص جنباً إلى جنب مع الاتصالات المدمجة في صفحة **Tools & Integrations**. يمكنك:
- **تعيين الأدوات للوكلاء** في طواقمك تماماً كأي أداة CrewAI أخرى.
- **إدارة الرؤية** للتحكم في أعضاء الفريق الذين يمكنهم استخدام الخادم.
- **تعديل أو إزالة** الاتصال في أي وقت من قائمة الاتصالات.
<Warning>
إذا أصبح خادم MCP غير قابل للوصول أو انتهت صلاحية بيانات الاعتماد، ستفشل استدعاءات الأدوات التي تستخدم ذلك الخادم. تأكد من استقرار رابط الخادم وتحديث بيانات الاعتماد.
</Warning>
<Card title="تحتاج مساعدة؟" icon="headset" href="mailto:support@crewai.com">
تواصل مع فريق الدعم للمساعدة في تهيئة خادم MCP المخصص أو استكشاف الأخطاء.
</Card>

View File

@@ -0,0 +1,280 @@
---
title: "تكامل Datadog"
description: "راقب عمليات نشر CrewAI AMP المُستضافة ذاتيًا في Datadog عبر وكيل Datadog أو استيعاب OTLP من Datadog — يوفر كلا المسارين نفس الواجهات المهيكلة لاستيراد لوحة معلومات العمليات الجاهزة."
icon: "dog"
mode: "wide"
---
<Note>
**الترجمة قيد التقدم** — يتم عرض المحتوى باللغة الإنجليزية.
</Note>
CrewAI ships first-class support for Datadog: two log-ingestion paths, a JSON log schema designed for cheap indexing, and a ready-made operations dashboard you can import in under five minutes.
<Note>
For vendor-neutral observability via any OTLP backend (Grafana, Honeycomb, your own collector), see [OpenTelemetry Export](./capture_telemetry_logs).
</Note>
## Choose a path
CrewAI supports two log-ingestion paths to Datadog — both are first-class and produce the same structured facets that power the dashboard. Pick the one that fits your infrastructure.
<Tabs>
<Tab title="Datadog Agent">
The Datadog Agent runs alongside your CrewAI containers (typically as a DaemonSet on Kubernetes) and tails their stdout. Each log event ships as a single billable line with structured attributes — see the [log schema reference](#log-schema-reference) for the full field contract.
**Setup:**
1. Run the Datadog Agent next to your CrewAI containers — see [Datadog's deployment docs](https://docs.datadoghq.com/agent/) for Kubernetes, ECS, or VM setup. Enable log collection (`logs_enabled: true`) and container log collection (`logs_config.container_collect_all: true`).
2. Confirm logs arrive in Datadog Logs with the JSON fields parsed — see [Verify ingestion](#verify-ingestion).
**Pick this path if** you already operate Datadog Agents (e.g. for infrastructure metrics), or your log volume makes per-event ingestion cost a real concern — collapsing tracebacks into single events keeps Agent ingestion cheap at scale.
</Tab>
<Tab title="Datadog OTLP intake">
CrewAI AMP exports OpenTelemetry traffic directly to Datadog's OTLP endpoint with no Agent required. Logs and traces ride a single export pipeline configured in AMP's UI, using the same protocol you'd use for any other OTLP backend.
**Setup:**
1. In CrewAI AMP, go to **Settings → OpenTelemetry Collectors → Add Collector** and pick **Datadog**.
2. Configure the connection:
- **Datadog Site Domain** — your Datadog site's OTLP host only, no protocol or path. CrewAI builds the full HTTPS OTLP endpoint for you. Use the host that matches your [Datadog site](https://docs.datadoghq.com/getting_started/site/):
- `otlp.datadoghq.com` (US1)
- `otlp.us3.datadoghq.com` (US3)
- `otlp.us5.datadoghq.com` (US5)
- `otlp.datadoghq.eu` (EU1)
- `otlp.ap1.datadoghq.com` (AP1)
- **API Key** — your Datadog API key. See [how to create one](https://docs.datadoghq.com/account_management/api-app-keys/#api-keys).
3. The Datadog template provisions **both signals at once** — when you save, AMP creates a traces collector at `/v1/traces` and a logs collector at `/v1/logs`, both sharing the same Datadog OTLP host and API key. You'll see them as two separate rows in your OTel collectors list.
4. *(optional)* Click **Test Connection** to verify CrewAI can reach the endpoint with the credentials you provided. Then click **Save** — both collectors are created in one step.
<Frame>![Datadog collector configuration](/images/crewai-otel-collector-datadog.png)</Frame>
**Pick this path if** you'd rather not operate a Datadog Agent, you already use OTLP for traces and want one export pipeline, or you may later want to fan out the same telemetry to other backends (Grafana, Honeycomb, etc.) without changing your application setup.
</Tab>
</Tabs>
Either path lands the same structured facets in Datadog (`@automation_id`, `@kickoff_id`, `@execution_id`, `@automation_name`, `@crewai_version`, `@exception.type`, `@gen_ai.*`), so the dashboard works identically with either choice.
## Log schema reference
<Info>
This schema applies to the **Datadog Agent path** — structured stdout JSON logs emitted by every CrewAI worker container. Logs delivered via the **Datadog OTLP intake** use OpenTelemetry attribute names and may differ; see [OpenTelemetry Export](./capture_telemetry_logs).
</Info>
Every log event is emitted as a **single JSON object per line** to stdout, with internal newlines escaped. The format is plain JSON — Datadog parses it natively, and the same payload is also consumable by Splunk, Loki, Elasticsearch, and CloudWatch without custom log pipelines.
### Why JSON output
<CardGroup cols={2}>
<Card title="Lower ingestion cost" icon="dollar-sign">
Most managed log backends bill per event. A Python traceback in text format is counted as one event per line — 30+ events for a single error. JSON output collapses each traceback into a single event with the stack trace as an escaped string field.
</Card>
<Card title="Structured search" icon="magnifying-glass">
Search by `@automation_id`, `@exception.type`, `@kickoff_id` instead of grepping free-text. Build dashboards on typed facets without parser configuration.
</Card>
<Card title="APM ↔ logs correlation" icon="link">
Every event carries `trace_id` and `span_id` when fired inside a recording span, so backends auto-link logs to traces.
</Card>
<Card title="Stable contract" icon="file-shield">
The `schema` field gates compatibility — within `v1`, fields are added but never renamed or removed.
</Card>
</CardGroup>
### Example events
A single info-level log inside an active automation kickoff:
```json
{
"schema": "v1",
"ts": "2026-06-17T16:14:23.482914Z",
"level": "INFO",
"logger": "crewai_enterprise.utilities.pii_redaction",
"crewai_version": "1.14.7",
"msg": "PII tracking state reset (engines preserved)",
"automation_id": "12",
"task_id": "0843a930-b306-464b-89c8-bfafa78cc711",
"kickoff_id": "0843a930-b306-464b-89c8-bfafa78cc711",
"execution_id": "0843a930-b306-464b-89c8-bfafa78cc711",
"automation_name": "research_flow"
}
```
An error with a Python exception is collapsed into a single event with the traceback as a string:
```json
{
"schema": "v1",
"ts": "2026-06-17T16:14:31.218450Z",
"level": "ERROR",
"logger": "api.tasks.flow_run_task",
"crewai_version": "1.14.7",
"msg": "Flow execution failed",
"automation_id": "12",
"kickoff_id": "0843a930-b306-464b-89c8-bfafa78cc711",
"execution_id": "0843a930-b306-464b-89c8-bfafa78cc711",
"automation_name": "research_flow",
"exception": {
"type": "ValueError",
"message": "Topic cannot be empty",
"stacktrace": "Traceback (most recent call last):\n File \"/app/flow.py\", line 42, in summarize\n ...\nValueError: Topic cannot be empty\n"
}
}
```
Without JSON output, that same error would produce ~25 separate log events (one per traceback line) — all of which the backend would bill and index individually.
### Schema v1 fields
Within the `v1` schema, fields are only added, never renamed or removed. New fields will appear as soon as a deployment is upgraded.
| Field | Type | Always present | Source |
|-------|------|----------------|--------|
| `schema` | string | Yes | Constant `"v1"`. Increment indicates a breaking schema change. |
| `ts` | string (ISO-8601 UTC, microseconds) | Yes | Record creation time, e.g. `2026-06-17T16:14:23.482914Z`. |
| `level` | string | Yes | Python log level name: `DEBUG` / `INFO` / `WARNING` / `ERROR` / `CRITICAL`. |
| `logger` | string | Yes | Dotted logger name, e.g. `api.tasks.flow_run_task`. |
| `crewai_version` | string | Yes (when `crewai` package metadata is resolvable) | Installed `crewai` package version, e.g. `"1.14.7"`. |
| `msg` | string | Yes | Rendered log message (after `%`-formatting / `{}`-formatting). |
| `automation_id` | string | When `CREWAI_PLUS_ID` env var is set | Numeric deployment ID (AMP provisions this on every container). |
| `task_id` | string | On Celery worker logs | Celery task UUID, or `"no-task"` for non-task contexts. |
| `kickoff_id` | string | Inside an automation kickoff | UUID of the current kickoff. |
| `execution_id` | string | Inside an automation kickoff | UUID of the current sub-execution. Equal to `kickoff_id` at the top level; differs for nested flow methods that spawn sub-executions. |
| `automation_name` | string | Inside an automation kickoff | Human-readable automation/flow name, e.g. `"research_flow"`. |
| `trace_id` | string (32-hex) | Inside a recording OpenTelemetry span | Hex trace ID. Omitted when no span is active. |
| `span_id` | string (16-hex) | Inside a recording OpenTelemetry span | Hex span ID. Omitted when no span is active. |
| `exception` | object | When the log record has `exc_info` | `{type, message, stacktrace}` — full traceback as a single escaped string. |
<Tip>
Any additional `extra={...}` kwargs passed to a logger call appear as top-level JSON fields verbatim. Reserved field names above always win to keep the schema stable.
</Tip>
### Stability promise
The `schema` field declares the contract. Within `v1`, CrewAI commits to:
- **Never removing a field** that customers may have built queries or dashboards against.
- **Never renaming a field** in place — renames happen via a schema bump (e.g. `v2`), with the old name kept as a deprecated alias for at least one release cycle.
- **Adding new fields** at any time. Consumers should ignore unknown top-level keys.
When a `v2` is introduced, both the `schema` field and the migration guide will be published in advance, and `v1` will continue to be emitted for one release cycle so dashboards and queries have time to migrate.
## Prerequisite: promote facets
Datadog auto-discovers fields the first time it sees them but doesn't make them queryable in widgets until they're promoted to **facets**. This is a one-time setup in your Datadog account.
<Steps>
<Step title="Search for a CrewAI log">
Open [Logs Explorer](https://app.datadoghq.com/logs) and search `service:crewai*`. You should see at least one log event.
</Step>
<Step title="Promote each field">
Click any log entry to open the right-hand details panel. For each field below, hover the field name → click the gear icon → **Create facet**.
- `automation_id`, `automation_name`, `execution_id`, `kickoff_id`, `task_id`
- `crewai_version`, `model_id`
- `exception.type`, `exception.message`
Skip any field that already shows a star icon next to its name — that means it's already a facet. The `gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`, and `gen_ai.request.model` facets are typically promoted automatically by Datadog's LLM Observability auto-discovery, but verify they exist before importing the dashboard.
</Step>
</Steps>
## Import the dashboard
<Steps>
<Step title="Download the dashboard JSON">
Save [`datadog_dashboard.json`](https://raw.githubusercontent.com/crewAIInc/crewAI/main/docs/edge/en/enterprise/guides/datadog_dashboard.json) to your machine.
</Step>
<Step title="Open the import dialog in Datadog">
Navigate to **Dashboards → New Dashboard**. Click the **gear icon** in the top right of the empty dashboard and select **Import Dashboard JSON**.
</Step>
<Step title="Paste or upload the JSON">
Paste the contents of `datadog_dashboard.json` into the import dialog (or drag the file in). Click **Import**.
Datadog creates the dashboard immediately and lands you on it. The first load may show empty widgets for a few seconds while queries execute against the time range.
</Step>
</Steps>
<Tip>
Datadog's [Dashboard API](https://docs.datadoghq.com/api/latest/dashboards/#create-a-new-dashboard) accepts the same JSON via `POST /api/v1/dashboard`. Use it if you manage dashboards through Terraform, Pulumi, or CI.
</Tip>
## What you get
The dashboard is organized into four sections plus a placeholder for a custom drill-down widget:
| Section | Widgets | Useful for |
|---------|---------|------------|
| **Header** | Total Executions · Error Rate (%) · Active Automations · CrewAI Versions in Use | At-a-glance health for the last hour. Error Rate is conditionally formatted (green ≤ 5%, yellow ≤ 10%, red > 10%). |
| **Throughput** | Executions per Hour by Automation (top 10, stacked bars) | Spotting traffic shifts, surfacing busy automations, validating that a rollout didn't change baseline volume. |
| **Errors** | Errors by Exception Type (top 5, stacked bars) · Top Exception Types by Count (toplist) | Triaging failures — which exception types are spiking, which automations they're hitting. |
| **Cost** | Total Tokens per Hour by Model (input + output, stacked area) | Tracking LLM token spend by model. Useful for catching cost regressions when an automation switches model or starts looping. |
| **Drill-Down** | _(empty placeholder)_ | See [Customization](#customize) for adding a recent-errors log stream here. |
Three template variables at the top of the dashboard re-scope every widget at once:
- **`$automation`** — filter to a single automation by name.
- **`$version`** — filter to a single `crewai` SDK version (useful for comparing pre- and post-upgrade behavior).
- **`$service`** — filter to a specific Datadog `service` tag (useful when multiple CrewAI deployments share one Datadog account).
## Verify ingestion
Open [Logs Explorer](https://app.datadoghq.com/logs) and run a query that matches your ingestion path:
<Tabs>
<Tab title="Datadog Agent">
Search `service:crewai* @schema:v1`. You should see structured logs with the JSON fields parsed into Datadog facets. Pick a recent event and verify it has `@automation_id`, `@kickoff_id`, `@execution_id`, `@crewai_version`, and (when running inside a span) `@trace_id` / `@span_id` populated.
If nothing appears, confirm the Datadog Agent is tailing container stdout and that the deployment is running a recent enough CrewAI Enterprise build.
</Tab>
<Tab title="Datadog OTLP intake">
Search `source:otlp service:crewai*`. OTLP attributes land with their OpenTelemetry names (`automation_id`, `crewai.kickoff.id`, etc.) rather than the stdout JSON keys, but they map to the same dashboard facets after [facet promotion](#prerequisite-promote-facets).
If nothing appears, verify the collector endpoint is correct (`/v1/logs` for logs, `/v1/traces` for traces) and **Test Connection** succeeded when the collector was saved.
</Tab>
</Tabs>
## Customize
The dashboard ships with deliberate gaps so you can extend it without uninstalling and re-importing.
### Add a Recent Errors log stream
The **Drill-Down** section is intentionally empty. Add a Log Stream widget to it for an inline view of recent failures:
1. Edit the dashboard and click **+ Add Widgets** inside the Drill-Down group.
2. Drag in a **Log Stream** widget.
3. Set the filter query to `status:error $automation $version $service`.
4. Choose columns: `@timestamp`, `@automation_name`, `@exception.type`, `@exception.message`, `@execution_id`.
5. Sort by most recent, limit to 25 entries.
Clicking any row jumps to Logs Explorer with the same filter pre-applied.
### Add p95 latency
Logs don't include execution duration by default. Two ways to add a latency widget:
- **From APM traces** — if you also export OTLP traces to Datadog, add a Timeseries widget with data source **Traces**, query `service:crewai*`, aggregation `p95 of @duration`. Datadog APM auto-tracks span duration.
- **From metric extraction** — extract a `flow.duration_ms` metric from logs via [Datadog's log-to-metric pipeline](https://docs.datadoghq.com/logs/log_configuration/logs_to_metrics/), then chart it like any other metric. Useful if you don't run APM.
### Re-scope to multiple deployments
The `$service` template variable defaults to `*` and will catch every CrewAI deployment in your Datadog account. Change the default to a specific service name in **Configure → Template Variables** if you want the dashboard to focus on one deployment by default.
## Troubleshooting
| Symptom | Likely cause | Fix |
|---------|--------------|-----|
| All widgets show "No data" | Facets aren't promoted | Re-do the [Promote facets](#prerequisite-promote-facets) step. Datadog won't query against an un-promoted field. |
| Error Rate widget shows `NaN` | No executions in the time window | Either no traffic, or `@execution_id` isn't faceted. Expand the time range and re-check facets. |
| Throughput chart is flat at the same value | Logs aren't reaching Datadog | Search `service:crewai*` in Logs Explorer. If nothing shows, verify the Datadog Agent is running (Agent path) or the OTel collector endpoint is correct (OTLP path). |
| `crewai_version` shows fewer values than expected | Some containers predate the structured-logs work | The `crewai_version` field was added alongside JSON output. Older deployments (pre-structured-logs AMP builds) won't emit it. Upgrade those deployments to pick up the field. See the [log schema reference](#log-schema-reference) for the full field contract. |
| Template variables don't filter widgets | The widget's filter line doesn't reference the template variable | Edit the widget and confirm the search includes `$automation $version $service`. |
## Next steps
<CardGroup cols={2}>
<Card title="OpenTelemetry Export" icon="magnifying-glass-chart" href="./capture_telemetry_logs">
Vendor-neutral observability for non-Datadog stacks (Grafana, Honeycomb, your own collector) — or as a Datadog complement when you want to fan out telemetry to multiple backends.
</Card>
<Card title="Datadog Log Search Syntax" icon="magnifying-glass" href="https://docs.datadoghq.com/logs/explorer/search_syntax/">
Reference for customizing widget queries against the structured facets above.
</Card>
</CardGroup>

Some files were not shown because too many files have changed in this diff Show More