mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-07-02 13:48:09 +00:00
* feat: adopt directory-based docs versioning with Edge channel Switch docs.crewai.com from navigation-only versioning (every version selector entry rendered the same docs/<lang>/* source files) to Mintlify's directory-based versioning so each version selector entry renders its own snapshot. Add an "Edge" channel under docs/edge/<lang>/* that always reflects main HEAD for unreleased work, eliminating pre-release leakage onto frozen release labels. External links to canonical /<lang>/* URLs are preserved via wildcard redirects that always land on the current default version. Layout: - docs/edge/<lang>/* rolling source (you edit here) - docs/edge/enterprise-api.*.yaml - docs/v<X.Y.Z>/<lang>/* frozen, immutable snapshots - docs/v<X.Y.Z>/enterprise-api.*.yaml - docs/images/ shared, append-only - docs/docs.json nav + redirects URLs follow the Mintlify-idiomatic shape: /edge/<lang>/<page> for Edge, /v<X.Y.Z>/<lang>/<page> for every frozen snapshot. The wildcard redirects /<lang>/:slug* -> /<default>/<lang>/:slug* keep stale links working, and every freeze rewrites them (plus all per-section/per-page redirects) so destinations always resolve to the current default without depending on a second redirect hop. Release flow integration (devtools release): - New module crewai_devtools.docs_versioning.freeze() materialises docs/v<X.Y.Z>/ from docs/edge/, rewrites openapi: refs inside the snapshot, inserts the version into every language block in docs.json, and refreshes all redirect destinations. - _update_docs_and_create_pr() in cli.py now calls that freeze during Phase 2 of devtools release. Edge changelogs are updated first (so the snapshot freeze picks them up), then the snapshot is staged alongside docs.json, branched as docs/freeze-v<X.Y.Z>, and the PR is titled [docs-freeze] docs: snapshot and changelog for v<X.Y.Z> — the title prefix the new CI guard reads. - The PR still gates tag, GitHub release, PyPI publish, and the enterprise release as before; no new PRs are added. - Pre-releases (1.X.YaN, 1.X.YbN, ...) skip the snapshot — they ride Edge — and the docs PR title omits the [docs-freeze] prefix. - docs_check (AI-generated docs scaffolding) writes to docs/edge/<lang>/* so newly-generated unreleased docs land in Edge and never accidentally touch a frozen snapshot. Migration scripts (one-shot): - scripts/docs/freeze_historical_versions.py reconstructs all 16 historical snapshots (v1.10.0 .. v1.14.7) from git tags via git archive | tar, rewriting openapi: MDX refs so each snapshot reads its own enterprise-api YAML rather than the live one. - scripts/docs/prefix_version_paths.py one-shot-migrates docs.json: rewrites every page path in 16 versioned blocks to point under docs/v<X.Y.Z>/, inserts a new Edge entry per language, tags v1.14.7 as Latest (default), prunes pages whose target file doesn't exist in the snapshot (e.g. docs/ar/ didn't exist before v1.12.0), and writes the wildcard + per-section redirects. - scripts/docs/freeze_current_edge.py is now a thin CLI wrapper around docs_versioning.freeze for manual one-off freezes (e.g. retroactively snapshotting a forgotten release). CI guards (.github/workflows/docs-snapshots.yml): - Frozen snapshots under docs/v[0-9]*/ are immutable; only PRs whose title contains [docs-freeze] (i.e. release-cut PRs generated by devtools release or the manual wrapper) may modify them. - Images under docs/images/ are append-only since snapshots share a single image directory. Deleting or renaming an image breaks every historical snapshot that still references it. Restored docs/images/crewai-otel-export.png from PR #3673; it was deleted in PR #4908 but v1.10.0 / v1.10.1 snapshots still reference it. Restoring instead of editing the snapshots preserves historical rendering fidelity and validates the new append-only rule retroactively. Tests: - lib/devtools/tests/test_docs_versioning.py covers the freeze: file copy, openapi rewrite, version insertion, default demotion, redirect upserts, per-section redirect rewriting, idempotency, and invalid inputs. Verified locally with mintlify broken-links: 0 broken links across the full site (Edge + 16 frozen versions, 4 locales). AGENTS.md (repo root) is the contributor guide for the new model; RELEASING.md is the release-cut runbook; README's Contribution section links to both. Co-authored-by: Cursor <cursoragent@cursor.com> * style: resolve linter issues --------- Co-authored-by: Cursor <cursoragent@cursor.com>
125 lines
5.8 KiB
Plaintext
125 lines
5.8 KiB
Plaintext
---
|
|
title: Integração com Weave
|
|
description: Saiba como usar o Weights & Biases (W&B) Weave para rastrear, experimentar, avaliar e melhorar suas aplicações CrewAI.
|
|
icon: radar
|
|
mode: "wide"
|
|
---
|
|
|
|
# Visão Geral do Weave
|
|
|
|
[Weights & Biases (W&B) Weave](https://weave-docs.wandb.ai/) é um framework para rastreamento, experimentação, avaliação, implementação e aprimoramento de aplicações baseadas em LLM.
|
|
|
|

|
|
|
|
O Weave oferece suporte completo para todas as etapas do desenvolvimento da sua aplicação CrewAI:
|
|
|
|
- **Rastreamento e Monitoramento**: Acompanhe automaticamente chamadas LLM e a lógica da aplicação para depuração e análise de sistemas em produção
|
|
- **Iteração Sistemática**: Aperfeiçoe e itere em prompts, conjuntos de dados e modelos
|
|
- **Avaliação**: Utilize avaliadores personalizados ou pré-construídos para avaliar e aprimorar sistematicamente o desempenho dos agentes
|
|
- **Guardrails**: Proteja seus agentes com salvaguardas pré e pós-execução para moderação de conteúdo e segurança de prompts
|
|
|
|
O Weave captura automaticamente rastreamentos (traces) de suas aplicações CrewAI, permitindo monitorar e analisar o desempenho, as interações e o fluxo de execução dos seus agentes. Isso te ajuda a construir melhores conjuntos de dados para avaliação e a otimizar os fluxos de trabalho dos agentes.
|
|
|
|
## Instruções de Configuração
|
|
|
|
<Steps>
|
|
<Step title="Instale os pacotes necessários">
|
|
```shell
|
|
pip install crewai weave
|
|
```
|
|
</Step>
|
|
<Step title="Crie uma conta no W&B">
|
|
Cadastre-se em uma [conta Weights & Biases](https://wandb.ai) caso ainda não tenha uma. Você precisará dela para visualizar rastreamentos e métricas.
|
|
</Step>
|
|
<Step title="Inicialize o Weave na sua aplicação">
|
|
Adicione o seguinte código à sua aplicação:
|
|
|
|
```python
|
|
import weave
|
|
|
|
# Inicialize o Weave com o nome do seu projeto
|
|
weave.init(project_name="crewai_demo")
|
|
```
|
|
|
|
Após a inicialização, o Weave fornecerá uma URL onde você poderá visualizar seus rastreamentos e métricas.
|
|
</Step>
|
|
<Step title="Crie seus Crews/Flows">
|
|
```python
|
|
from crewai import Agent, Task, Crew, LLM, Process
|
|
|
|
# Crie um LLM com temperatura 0 para garantir saídas determinísticas
|
|
llm = LLM(model="gpt-4o", temperature=0)
|
|
|
|
# Crie os agentes
|
|
pesquisador = Agent(
|
|
role='Analista de Pesquisa',
|
|
goal='Encontrar e analisar as melhores oportunidades de investimento',
|
|
backstory='Especialista em análise financeira e pesquisa de mercado',
|
|
llm=llm,
|
|
verbose=True,
|
|
allow_delegation=False,
|
|
)
|
|
|
|
redator = Agent(
|
|
role='Redator de Relatórios',
|
|
goal='Escrever relatórios de investimento claros e concisos',
|
|
backstory='Experiente na criação de relatórios financeiros detalhados',
|
|
llm=llm,
|
|
verbose=True,
|
|
allow_delegation=False,
|
|
)
|
|
|
|
# Crie as tarefas
|
|
pesquisa = Task(
|
|
description='Pesquisa aprofundada sobre o {tema}',
|
|
expected_output='Dados de mercado abrangentes incluindo principais players, tamanho de mercado e tendências de crescimento.',
|
|
agent=pesquisador
|
|
)
|
|
|
|
redacao = Task(
|
|
description='Escreva um relatório detalhado com base na pesquisa',
|
|
expected_output='O relatório deve ser fácil de ler e entender. Use tópicos quando aplicável.',
|
|
agent=redator
|
|
)
|
|
|
|
# Crie o crew
|
|
equipe = Crew(
|
|
agents=[pesquisador, redator],
|
|
tasks=[pesquisa, redacao],
|
|
verbose=True,
|
|
process=Process.sequential,
|
|
)
|
|
|
|
# Execute o crew
|
|
resultado = equipe.kickoff(inputs={"tema": "IA em ciência dos materiais"})
|
|
print(resultado)
|
|
```
|
|
</Step>
|
|
<Step title="Visualize rastreamentos no Weave">
|
|
Após executar sua aplicação CrewAI, acesse a URL do Weave fornecida durante a inicialização para visualizar:
|
|
- Chamadas LLM e seus metadados
|
|
- Interações dos agentes e fluxo de execução das tarefas
|
|
- Métricas de desempenho como latência e uso de tokens
|
|
- Quaisquer erros ou problemas ocorridos durante a execução
|
|
|
|
<Frame caption="Painel de Rastreamento do Weave">
|
|
<img src="/images/weave-tracing.png" alt="Exemplo de rastreamento do Weave com CrewAI" />
|
|
</Frame>
|
|
</Step>
|
|
</Steps>
|
|
|
|
## Funcionalidades
|
|
|
|
- O Weave captura automaticamente todas as operações do CrewAI: interações dos agentes e execuções das tarefas; chamadas LLM com metadados e uso de tokens; uso de ferramentas e resultados.
|
|
- A integração suporta todos os métodos de execução do CrewAI: `kickoff()`, `kickoff_for_each()`, `kickoff_async()` e `kickoff_for_each_async()`.
|
|
- Rastreamento automático de todas as [crewAI-tools](https://github.com/crewAIInc/crewAI-tools).
|
|
- Suporte ao recurso flow com patching por decorador (`@start`, `@listen`, `@router`, `@or_`, `@and_`).
|
|
- Rastreie guardrails personalizados passados para o `Task` do CrewAI com `@weave.op()`.
|
|
|
|
Para informações detalhadas sobre o que é suportado, acesse a [documentação do Weave CrewAI](https://weave-docs.wandb.ai/guides/integrations/crewai/#getting-started-with-flow).
|
|
|
|
## Recursos
|
|
|
|
- [📘 Documentação do Weave](https://weave-docs.wandb.ai)
|
|
- [📊 Exemplo de dashboard Weave x CrewAI](https://wandb.ai/ayut/crewai_demo/weave/traces?cols=%7B%22wb_run_id%22%3Afalse%2C%22attributes.weave.client_version%22%3Afalse%2C%22attributes.weave.os_name%22%3Afalse%2C%22attributes.weave.os_release%22%3Afalse%2C%22attributes.weave.os_version%22%3Afalse%2C%22attributes.weave.source%22%3Afalse%2C%22attributes.weave.sys_version%22%3Afalse%7D&peekPath=%2Fayut%2Fcrewai_demo%2Fcalls%2F0195c838-38cb-71a2-8a15-651ecddf9d89)
|
|
- [🐦 X](https://x.com/weave_wb) |