mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-07-02 21:58:11 +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>
215 lines
7.5 KiB
Plaintext
215 lines
7.5 KiB
Plaintext
---
|
|
title: CrewAI Tracing
|
|
description: Rastreamento integrado para Crews e Flows do CrewAI com a plataforma CrewAI AMP
|
|
icon: magnifying-glass-chart
|
|
mode: "wide"
|
|
---
|
|
|
|
# Rastreamento Integrado do CrewAI
|
|
|
|
O CrewAI fornece recursos de rastreamento integrados que permitem monitorar e depurar seus Crews e Flows em tempo real. Este guia demonstra como habilitar o rastreamento para **Crews** e **Flows** usando a plataforma de observabilidade integrada do CrewAI.
|
|
|
|
> **O que é o CrewAI Tracing?** O rastreamento integrado do CrewAI fornece observabilidade abrangente para seus agentes de IA, incluindo decisões de agentes, cronogramas de execução de tarefas, uso de ferramentas e chamadas de LLM - tudo acessível através da [plataforma CrewAI AMP](https://app.crewai.com).
|
|
|
|

|
|
|
|
## Pré-requisitos
|
|
|
|
Antes de usar o rastreamento do CrewAI, você precisa:
|
|
|
|
1. **Conta CrewAI AMP**: Cadastre-se para uma conta gratuita em [app.crewai.com](https://app.crewai.com)
|
|
2. **Autenticação CLI**: Use a CLI do CrewAI para autenticar seu ambiente local
|
|
|
|
```bash
|
|
crewai login
|
|
```
|
|
|
|
## Instruções de Configuração
|
|
|
|
### Passo 1: Crie sua Conta CrewAI AMP
|
|
|
|
Visite [app.crewai.com](https://app.crewai.com) e crie sua conta gratuita. Isso lhe dará acesso à plataforma CrewAI AMP, onde você pode visualizar rastreamentos, métricas e gerenciar seus crews.
|
|
|
|
### Passo 2: Instale a CLI do CrewAI e Autentique
|
|
|
|
Se você ainda não o fez, instale o CrewAI com as ferramentas CLI:
|
|
|
|
```bash
|
|
uv add crewai[tools]
|
|
```
|
|
|
|
Em seguida, autentique sua CLI com sua conta CrewAI AMP:
|
|
|
|
```bash
|
|
crewai login
|
|
```
|
|
|
|
Este comando irá:
|
|
|
|
1. Abrir seu navegador na página de autenticação
|
|
2. Solicitar que você insira um código de dispositivo
|
|
3. Autenticar seu ambiente local com sua conta CrewAI AMP
|
|
4. Habilitar recursos de rastreamento para seu desenvolvimento local
|
|
|
|
### Passo 3: Habilite o Rastreamento em seu Crew
|
|
|
|
Você pode habilitar o rastreamento para seu Crew definindo o parâmetro `tracing` como `True`:
|
|
|
|
```python
|
|
from crewai import Agent, Crew, Process, Task
|
|
from crewai_tools import SerperDevTool
|
|
|
|
# Define your agents
|
|
researcher = Agent(
|
|
role="Senior Research Analyst",
|
|
goal="Uncover cutting-edge developments in AI and data science",
|
|
backstory=\"\"\"You work at a leading tech think tank.
|
|
Your expertise lies in identifying emerging trends.
|
|
You have a knack for dissecting complex data and presenting actionable insights.\"\"\",
|
|
verbose=True,
|
|
tools=[SerperDevTool()],
|
|
)
|
|
|
|
writer = Agent(
|
|
role="Tech Content Strategist",
|
|
goal="Craft compelling content on tech advancements",
|
|
backstory=\"\"\"You are a renowned Content Strategist, known for your insightful and engaging articles.
|
|
You transform complex concepts into compelling narratives.\"\"\",
|
|
verbose=True,
|
|
)
|
|
|
|
# Create tasks for your agents
|
|
research_task = Task(
|
|
description=\"\"\"Conduct a comprehensive analysis of the latest advancements in AI in 2024.
|
|
Identify key trends, breakthrough technologies, and potential industry impacts.\"\"\",
|
|
expected_output="Full analysis report in bullet points",
|
|
agent=researcher,
|
|
)
|
|
|
|
writing_task = Task(
|
|
description=\"\"\"Using the insights provided, develop an engaging blog
|
|
post that highlights the most significant AI advancements.
|
|
Your post should be informative yet accessible, catering to a tech-savvy audience.\"\"\",
|
|
expected_output="Full blog post of at least 4 paragraphs",
|
|
agent=writer,
|
|
)
|
|
|
|
# Enable tracing in your crew
|
|
crew = Crew(
|
|
agents=[researcher, writer],
|
|
tasks=[research_task, writing_task],
|
|
process=Process.sequential,
|
|
tracing=True, # Enable built-in tracing
|
|
verbose=True
|
|
)
|
|
|
|
# Execute your crew
|
|
result = crew.kickoff()
|
|
```
|
|
|
|
### Passo 4: Habilite o Rastreamento em seu Flow
|
|
|
|
Da mesma forma, você pode habilitar o rastreamento para Flows do CrewAI:
|
|
|
|
```python
|
|
from crewai.flow.flow import Flow, listen, start
|
|
from pydantic import BaseModel
|
|
|
|
class ExampleState(BaseModel):
|
|
counter: int = 0
|
|
message: str = ""
|
|
|
|
class ExampleFlow(Flow[ExampleState]):
|
|
def __init__(self):
|
|
super().__init__(tracing=True) # Enable tracing for the flow
|
|
|
|
@start()
|
|
def first_method(self):
|
|
print("Starting the flow")
|
|
self.state.counter = 1
|
|
self.state.message = "Flow started"
|
|
return "continue"
|
|
|
|
@listen("continue")
|
|
def second_method(self):
|
|
print("Continuing the flow")
|
|
self.state.counter += 1
|
|
self.state.message = "Flow continued"
|
|
return "finish"
|
|
|
|
@listen("finish")
|
|
def final_method(self):
|
|
print("Finishing the flow")
|
|
self.state.counter += 1
|
|
self.state.message = "Flow completed"
|
|
|
|
# Create and run the flow with tracing enabled
|
|
flow = ExampleFlow(tracing=True)
|
|
result = flow.kickoff()
|
|
```
|
|
|
|
### Passo 5: Visualize os Rastreamentos no Painel CrewAI AMP
|
|
|
|
Após executar o crew ou flow, você pode visualizar os rastreamentos gerados pela sua aplicação CrewAI no painel CrewAI AMP. Você verá etapas detalhadas das interações dos agentes, usos de ferramentas e chamadas de LLM.
|
|
Basta clicar no link abaixo para visualizar os rastreamentos ou ir para a aba de rastreamentos no painel [aqui](https://app.crewai.com/crewai_plus/trace_batches)
|
|

|
|
|
|
### Alternativa: Configuração de Variável de Ambiente
|
|
|
|
Você também pode habilitar o rastreamento globalmente definindo uma variável de ambiente:
|
|
|
|
```bash
|
|
export CREWAI_TRACING_ENABLED=true
|
|
```
|
|
|
|
Ou adicione-a ao seu arquivo `.env`:
|
|
|
|
```env
|
|
CREWAI_TRACING_ENABLED=true
|
|
```
|
|
|
|
Quando esta variável de ambiente estiver definida, todos os Crews e Flows terão automaticamente o rastreamento habilitado, mesmo sem definir explicitamente `tracing=True`.
|
|
|
|
## Visualizando seus Rastreamentos
|
|
|
|
### Acesse o Painel CrewAI AMP
|
|
|
|
1. Visite [app.crewai.com](https://app.crewai.com) e faça login em sua conta
|
|
2. Navegue até o painel do seu projeto
|
|
3. Clique na aba **Traces** para visualizar os detalhes de execução
|
|
|
|
### O que Você Verá nos Rastreamentos
|
|
|
|
O rastreamento do CrewAI fornece visibilidade abrangente sobre:
|
|
|
|
- **Decisões dos Agentes**: Veja como os agentes raciocinam através das tarefas e tomam decisões
|
|
- **Cronograma de Execução de Tarefas**: Representação visual de sequências e dependências de tarefas
|
|
- **Uso de Ferramentas**: Monitore quais ferramentas são chamadas e seus resultados
|
|
- **Chamadas de LLM**: Rastreie todas as interações do modelo de linguagem, incluindo prompts e respostas
|
|
- **Métricas de Desempenho**: Tempos de execução, uso de tokens e custos
|
|
- **Rastreamento de Erros**: Informações detalhadas de erros e rastreamentos de pilha
|
|
|
|
### Recursos de Rastreamento
|
|
|
|
- **Cronograma de Execução**: Clique através de diferentes estágios de execução
|
|
- **Logs Detalhados**: Acesse logs abrangentes para depuração
|
|
- **Análise de Desempenho**: Analise padrões de execução e otimize o desempenho
|
|
- **Capacidades de Exportação**: Baixe rastreamentos para análise adicional
|
|
|
|
### Problemas de Autenticação
|
|
|
|
Se você encontrar problemas de autenticação:
|
|
|
|
1. Certifique-se de estar logado: `crewai login`
|
|
2. Verifique sua conexão com a internet
|
|
3. Verifique sua conta em [app.crewai.com](https://app.crewai.com)
|
|
|
|
### Rastreamentos Não Aparecem
|
|
|
|
Se os rastreamentos não estiverem aparecendo no painel:
|
|
|
|
1. Confirme que `tracing=True` está definido em seu Crew/Flow
|
|
2. Verifique se `CREWAI_TRACING_ENABLED=true` se estiver usando variáveis de ambiente
|
|
3. Certifique-se de estar autenticado com `crewai login`
|
|
4. Verifique se seu crew/flow está realmente executando
|