diff --git a/.gitignore b/.gitignore index 7ce28721e..1e4e7bf6c 100644 --- a/.gitignore +++ b/.gitignore @@ -21,7 +21,6 @@ crew_tasks_output.json .mypy_cache .ruff_cache .venv -agentops.log test_flow.html crewairules.mdc plan.md diff --git a/docs/docs.json b/docs/docs.json index 7759a540a..25b4a1db1 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -226,7 +226,6 @@ "group": "Observability", "pages": [ "en/observability/overview", - "en/observability/agentops", "en/observability/arize-phoenix", "en/observability/langdb", "en/observability/langfuse", @@ -566,7 +565,6 @@ "group": "Observabilidade", "pages": [ "pt-BR/observability/overview", - "pt-BR/observability/agentops", "pt-BR/observability/arize-phoenix", "pt-BR/observability/langdb", "pt-BR/observability/langfuse", @@ -914,7 +912,6 @@ "group": "오브저버빌리티", "pages": [ "ko/observability/overview", - "ko/observability/agentops", "ko/observability/arize-phoenix", "ko/observability/langdb", "ko/observability/langfuse", diff --git a/docs/en/concepts/event-listener.mdx b/docs/en/concepts/event-listener.mdx index 6c3e391f2..bd52229dc 100644 --- a/docs/en/concepts/event-listener.mdx +++ b/docs/en/concepts/event-listener.mdx @@ -177,14 +177,7 @@ class MyCustomCrew: # Your crew implementation... ``` -This is exactly how CrewAI's built-in `agentops_listener` is registered. In the CrewAI codebase, you'll find: - -```python -# src/crewai/utilities/events/third_party/__init__.py -from .agentops_listener import agentops_listener -``` - -This ensures the `agentops_listener` is loaded when the `crewai.utilities.events` package is imported. +This is how third-party event listeners are registered in the CrewAI codebase. ## Available Event Types @@ -280,77 +273,6 @@ The structure of the event object depends on the event type, but all events inhe Additional fields vary by event type. For example, `CrewKickoffCompletedEvent` includes `crew_name` and `output` fields. -## Real-World Example: Integration with AgentOps - -CrewAI includes an example of a third-party integration with [AgentOps](https://github.com/AgentOps-AI/agentops), a monitoring and observability platform for AI agents. Here's how it's implemented: - -```python -from typing import Optional - -from crewai.utilities.events import ( - CrewKickoffCompletedEvent, - ToolUsageErrorEvent, - ToolUsageStartedEvent, -) -from crewai.utilities.events.base_event_listener import BaseEventListener -from crewai.utilities.events.crew_events import CrewKickoffStartedEvent -from crewai.utilities.events.task_events import TaskEvaluationEvent - -try: - import agentops - AGENTOPS_INSTALLED = True -except ImportError: - AGENTOPS_INSTALLED = False - -class AgentOpsListener(BaseEventListener): - tool_event: Optional["agentops.ToolEvent"] = None - session: Optional["agentops.Session"] = None - - def __init__(self): - super().__init__() - - def setup_listeners(self, crewai_event_bus): - if not AGENTOPS_INSTALLED: - return - - @crewai_event_bus.on(CrewKickoffStartedEvent) - def on_crew_kickoff_started(source, event: CrewKickoffStartedEvent): - self.session = agentops.init() - for agent in source.agents: - if self.session: - self.session.create_agent( - name=agent.role, - agent_id=str(agent.id), - ) - - @crewai_event_bus.on(CrewKickoffCompletedEvent) - def on_crew_kickoff_completed(source, event: CrewKickoffCompletedEvent): - if self.session: - self.session.end_session( - end_state="Success", - end_state_reason="Finished Execution", - ) - - @crewai_event_bus.on(ToolUsageStartedEvent) - def on_tool_usage_started(source, event: ToolUsageStartedEvent): - self.tool_event = agentops.ToolEvent(name=event.tool_name) - if self.session: - self.session.record(self.tool_event) - - @crewai_event_bus.on(ToolUsageErrorEvent) - def on_tool_usage_error(source, event: ToolUsageErrorEvent): - agentops.ErrorEvent(exception=event.error, trigger_event=self.tool_event) -``` - -This listener initializes an AgentOps session when a Crew starts, registers agents with AgentOps, tracks tool usage, and ends the session when the Crew completes. - -The AgentOps listener is registered in CrewAI's event system through the import in `src/crewai/utilities/events/third_party/__init__.py`: - -```python -from .agentops_listener import agentops_listener -``` - -This ensures the `agentops_listener` is loaded when the `crewai.utilities.events` package is imported. ## Advanced Usage: Scoped Handlers diff --git a/docs/en/observability/agentops.mdx b/docs/en/observability/agentops.mdx deleted file mode 100644 index 199a1de78..000000000 --- a/docs/en/observability/agentops.mdx +++ /dev/null @@ -1,126 +0,0 @@ ---- -title: AgentOps Integration -description: Understanding and logging your agent performance with AgentOps. -icon: paperclip ---- - -# Introduction - -Observability is a key aspect of developing and deploying conversational AI agents. It allows developers to understand how their agents are performing, -how their agents are interacting with users, and how their agents use external tools and APIs. -AgentOps is a product independent of CrewAI that provides a comprehensive observability solution for agents. - -## AgentOps - -[AgentOps](https://agentops.ai/?=crew) provides session replays, metrics, and monitoring for agents. - -At a high level, AgentOps gives you the ability to monitor cost, token usage, latency, agent failures, session-wide statistics, and more. -For more info, check out the [AgentOps Repo](https://github.com/AgentOps-AI/agentops). - -### Overview - -AgentOps provides monitoring for agents in development and production. -It provides a dashboard for tracking agent performance, session replays, and custom reporting. - -Additionally, AgentOps provides session drilldowns for viewing Crew agent interactions, LLM calls, and tool usage in real-time. -This feature is useful for debugging and understanding how agents interact with users as well as other agents. - -![Overview of a select series of agent session runs](/images/agentops-overview.png) -![Overview of session drilldowns for examining agent runs](/images/agentops-session.png) -![Viewing a step-by-step agent replay execution graph](/images/agentops-replay.png) - -### Features - -- **LLM Cost Management and Tracking**: Track spend with foundation model providers. -- **Replay Analytics**: Watch step-by-step agent execution graphs. -- **Recursive Thought Detection**: Identify when agents fall into infinite loops. -- **Custom Reporting**: Create custom analytics on agent performance. -- **Analytics Dashboard**: Monitor high-level statistics about agents in development and production. -- **Public Model Testing**: Test your agents against benchmarks and leaderboards. -- **Custom Tests**: Run your agents against domain-specific tests. -- **Time Travel Debugging**: Restart your sessions from checkpoints. -- **Compliance and Security**: Create audit logs and detect potential threats such as profanity and PII leaks. -- **Prompt Injection Detection**: Identify potential code injection and secret leaks. - -### Using AgentOps - - - - Create a user API key here: [Create API Key](https://app.agentops.ai/account) - - - Add your API key to your environment variables: - ```bash - AGENTOPS_API_KEY= - ``` - - - Install AgentOps with: - ```bash - pip install 'crewai[agentops]' - ``` - or - ```bash - pip install agentops - ``` - - - Before using `Crew` in your script, include these lines: - - ```python - import agentops - agentops.init() - ``` - - This will initiate an AgentOps session as well as automatically track Crew agents. For further info on how to outfit more complex agentic systems, - check out the [AgentOps documentation](https://docs.agentops.ai) or join the [Discord](https://discord.gg/j4f3KbeH). - - - -### Crew + AgentOps Examples - - - - Example of a Crew agent that generates job posts. - - - Example of a Crew agent that validates Markdown files. - - - Example of a Crew agent that generates Instagram posts. - - - -### Further Information - -To get started, create an [AgentOps account](https://agentops.ai/?=crew). - -For feature requests or bug reports, please reach out to the AgentOps team on the [AgentOps Repo](https://github.com/AgentOps-AI/agentops). - -#### Extra links - -🐦 Twitter -  •   -📢 Discord -  •   -🖇️ AgentOps Dashboard -  •   -📙 Documentation diff --git a/docs/en/observability/overview.mdx b/docs/en/observability/overview.mdx index af8454d97..e99858c9e 100644 --- a/docs/en/observability/overview.mdx +++ b/docs/en/observability/overview.mdx @@ -21,9 +21,6 @@ Observability is crucial for understanding how your CrewAI agents perform, ident ### Monitoring & Tracing Platforms - - Session replays, metrics, and monitoring for agent development and production. - End-to-end tracing for CrewAI workflows with automatic agent interaction capture. diff --git a/docs/images/agentops-overview.png b/docs/images/agentops-overview.png deleted file mode 100644 index 640ac2fa4..000000000 Binary files a/docs/images/agentops-overview.png and /dev/null differ diff --git a/docs/images/agentops-replay.png b/docs/images/agentops-replay.png deleted file mode 100644 index 078dc1fed..000000000 Binary files a/docs/images/agentops-replay.png and /dev/null differ diff --git a/docs/images/agentops-session.png b/docs/images/agentops-session.png deleted file mode 100644 index a6af9db86..000000000 Binary files a/docs/images/agentops-session.png and /dev/null differ diff --git a/docs/ko/concepts/event-listener.mdx b/docs/ko/concepts/event-listener.mdx index bda23ff03..39fdb25a1 100644 --- a/docs/ko/concepts/event-listener.mdx +++ b/docs/ko/concepts/event-listener.mdx @@ -177,14 +177,7 @@ class MyCustomCrew: # Your crew implementation... ``` -이것이 바로 CrewAI의 내장 `agentops_listener`가 등록되는 방식과 동일합니다. CrewAI 코드베이스에서는 다음과 같이 되어 있습니다: - -```python -# src/crewai/utilities/events/third_party/__init__.py -from .agentops_listener import agentops_listener -``` - -이렇게 하면 `crewai.utilities.events` 패키지가 임포트될 때 `agentops_listener`가 자동으로 로드됩니다. +이것이 CrewAI 코드베이스에서 서드파티 이벤트 리스너가 등록되는 방식입니다. ## 사용 가능한 이벤트 유형 @@ -280,77 +273,6 @@ CrewAI는 여러분이 청취할 수 있는 다양한 이벤트를 제공합니 추가 필드는 이벤트 타입에 따라 다릅니다. 예를 들어, `CrewKickoffCompletedEvent`에는 `crew_name`과 `output` 필드가 포함됩니다. -## 실제 예시: AgentOps와의 통합 - -CrewAI는 AI 에이전트를 위한 모니터링 및 관찰 플랫폼인 [AgentOps](https://github.com/AgentOps-AI/agentops)와의 서드파티 통합 예시를 포함하고 있습니다. 구현 방식은 다음과 같습니다: - -```python -from typing import Optional - -from crewai.utilities.events import ( - CrewKickoffCompletedEvent, - ToolUsageErrorEvent, - ToolUsageStartedEvent, -) -from crewai.utilities.events.base_event_listener import BaseEventListener -from crewai.utilities.events.crew_events import CrewKickoffStartedEvent -from crewai.utilities.events.task_events import TaskEvaluationEvent - -try: - import agentops - AGENTOPS_INSTALLED = True -except ImportError: - AGENTOPS_INSTALLED = False - -class AgentOpsListener(BaseEventListener): - tool_event: Optional["agentops.ToolEvent"] = None - session: Optional["agentops.Session"] = None - - def __init__(self): - super().__init__() - - def setup_listeners(self, crewai_event_bus): - if not AGENTOPS_INSTALLED: - return - - @crewai_event_bus.on(CrewKickoffStartedEvent) - def on_crew_kickoff_started(source, event: CrewKickoffStartedEvent): - self.session = agentops.init() - for agent in source.agents: - if self.session: - self.session.create_agent( - name=agent.role, - agent_id=str(agent.id), - ) - - @crewai_event_bus.on(CrewKickoffCompletedEvent) - def on_crew_kickoff_completed(source, event: CrewKickoffCompletedEvent): - if self.session: - self.session.end_session( - end_state="Success", - end_state_reason="Finished Execution", - ) - - @crewai_event_bus.on(ToolUsageStartedEvent) - def on_tool_usage_started(source, event: ToolUsageStartedEvent): - self.tool_event = agentops.ToolEvent(name=event.tool_name) - if self.session: - self.session.record(self.tool_event) - - @crewai_event_bus.on(ToolUsageErrorEvent) - def on_tool_usage_error(source, event: ToolUsageErrorEvent): - agentops.ErrorEvent(exception=event.error, trigger_event=self.tool_event) -``` - -이 listener는 crew가 시작될 때 AgentOps 세션을 초기화하고, agent를 AgentOps에 등록하며, 도구 사용을 추적하고, crew가 완료되면 세션을 종료합니다. - -AgentOps listener는 `src/crewai/utilities/events/third_party/__init__.py` 파일의 import를 통해 CrewAI 이벤트 시스템에 등록됩니다: - -```python -from .agentops_listener import agentops_listener -``` - -이렇게 하면 `crewai.utilities.events` 패키지가 import될 때 `agentops_listener`가 로드되는 것이 보장됩니다. ## 고급 사용법: Scoped Handlers diff --git a/docs/ko/observability/agentops.mdx b/docs/ko/observability/agentops.mdx deleted file mode 100644 index dcc5a239e..000000000 --- a/docs/ko/observability/agentops.mdx +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: AgentOps 통합 -description: AgentOps를 사용하여 에이전트 성능을 이해하고 로깅하기 -icon: paperclip ---- - -# 소개 - -Observability는 대화형 AI 에이전트를 개발하고 배포하는 데 있어 핵심적인 요소입니다. 이는 개발자가 에이전트의 성능을 이해하고, 에이전트가 사용자와 어떻게 상호작용하는지, 그리고 에이전트가 외부 도구와 API를 어떻게 사용하는지를 파악할 수 있게 해줍니다. -AgentOps는 CrewAI와 독립적인 제품으로, 에이전트를 위한 종합적인 observability 솔루션을 제공합니다. - -## AgentOps - -[AgentOps](https://agentops.ai/?=crew)은 에이전트에 대한 세션 리플레이, 메트릭, 모니터링을 제공합니다. - -AgentOps는 높은 수준에서 비용, 토큰 사용량, 대기 시간, 에이전트 실패, 세션 전체 통계 등 다양한 항목을 모니터링할 수 있는 기능을 제공합니다. -더 자세한 내용은 [AgentOps Repo](https://github.com/AgentOps-AI/agentops)를 확인하세요. - -### 개요 - -AgentOps는 개발 및 프로덕션 환경에서 에이전트에 대한 모니터링을 제공합니다. -에이전트 성능, 세션 리플레이, 맞춤형 리포팅을 추적할 수 있는 대시보드를 제공합니다. - -또한, AgentOps는 Crew 에이전트 상호작용, LLM 호출, 툴 사용을 실시간으로 볼 수 있는 세션 드릴다운 기능을 제공합니다. -이 기능은 에이전트가 사용자 및 다른 에이전트와 어떻게 상호작용하는지 디버깅하고 이해하는 데 유용합니다. - -![선택된 에이전트 세션 실행 시리즈의 개요](/images/agentops-overview.png) -![에이전트 실행을 조사하기 위한 세션 드릴다운 개요](/images/agentops-session.png) -![단계별 에이전트 리플레이 실행 그래프 보기](/images/agentops-replay.png) - -### 특징 - -- **LLM 비용 관리 및 추적**: 기반 모델 공급자와의 지출을 추적합니다. -- **재생 분석**: 단계별 에이전트 실행 그래프를 시청할 수 있습니다. -- **재귀적 사고 감지**: 에이전트가 무한 루프에 빠졌는지 식별합니다. -- **맞춤형 보고서**: 에이전트 성능에 대한 맞춤형 분석을 생성합니다. -- **분석 대시보드**: 개발 및 운영 중인 에이전트에 대한 상위 수준 통계를 모니터링합니다. -- **공개 모델 테스트**: 벤치마크 및 리더보드를 통해 에이전트를 테스트할 수 있습니다. -- **맞춤형 테스트**: 도메인별 테스트로 에이전트를 실행합니다. -- **타임 트래블 디버깅**: 체크포인트에서 세션을 재시작합니다. -- **컴플라이언스 및 보안**: 감사 로그를 생성하고 욕설 및 PII 유출과 같은 잠재적 위협을 감지합니다. -- **프롬프트 인젝션 감지**: 잠재적 코드 인젝션 및 시크릿 유출을 식별합니다. - -### AgentOps 사용하기 - - - - 사용자 API 키를 여기서 생성하세요: [API 키 생성](https://app.agentops.ai/account) - - - API 키를 환경 변수에 추가하세요: - ```bash - AGENTOPS_API_KEY= - ``` - - - 다음 명령어로 AgentOps를 설치하세요: - ```bash - pip install 'crewai[agentops]' - ``` - 또는 - ```bash - pip install agentops - ``` - - - 스크립트에서 `Crew`를 사용하기 전에 다음 코드를 포함하세요: - - ```python - import agentops - agentops.init() - ``` - - 이렇게 하면 AgentOps 세션이 시작되고 Crew 에이전트가 자동으로 추적됩니다. 더 복잡한 agentic 시스템을 구성하는 방법에 대한 자세한 정보는 [AgentOps 문서](https://docs.agentops.ai) 또는 [Discord](https://discord.gg/j4f3KbeH)를 참조하세요. - - - -### Crew + AgentOps 예시 - - - - 채용 공고를 생성하는 Crew agent의 예시입니다. - - - Markdown 파일을 검증하는 Crew agent의 예시입니다. - - - Instagram 게시물을 생성하는 Crew agent의 예시입니다. - - - -### 추가 정보 - -시작하려면 [AgentOps 계정](https://agentops.ai/?=crew)을 생성하세요. - -기능 요청이나 버그 보고가 필요하시면 [AgentOps Repo](https://github.com/AgentOps-AI/agentops)에서 AgentOps 팀에 문의해 주세요. - -#### 추가 링크 - -🐦 트위터 -  •   -📢 디스코드 -  •   -🖇️ AgentOps 대시보드 -  •   -📙 문서화 \ No newline at end of file diff --git a/docs/ko/observability/overview.mdx b/docs/ko/observability/overview.mdx index 7f065e121..847348c8b 100644 --- a/docs/ko/observability/overview.mdx +++ b/docs/ko/observability/overview.mdx @@ -21,9 +21,6 @@ icon: "face-smile" ### 모니터링 & 트레이싱 플랫폼 - - 에이전트 개발 및 운영을 위한 세션 리플레이, 메트릭, 모니터링 제공. - 자동 에이전트 상호작용 캡처를 포함한 CrewAI 워크플로의 엔드-투-엔드 트레이싱. diff --git a/docs/pt-BR/concepts/event-listener.mdx b/docs/pt-BR/concepts/event-listener.mdx index b925ac995..f2d4fa885 100644 --- a/docs/pt-BR/concepts/event-listener.mdx +++ b/docs/pt-BR/concepts/event-listener.mdx @@ -177,14 +177,7 @@ class MyCustomCrew: # Sua implementação do crew... ``` -É exatamente assim que o `agentops_listener` integrado do CrewAI é registrado. No código-fonte do CrewAI, você encontrará: - -```python -# src/crewai/utilities/events/third_party/__init__.py -from .agentops_listener import agentops_listener -``` - -Isso garante que o `agentops_listener` seja carregado quando o pacote `crewai.utilities.events` for importado. +É assim que listeners de eventos de terceiros são registrados no código do CrewAI. ## Tipos de Eventos Disponíveis @@ -269,77 +262,6 @@ A estrutura do objeto de evento depende do tipo do evento, mas todos herdam de ` Campos adicionais variam pelo tipo de evento. Por exemplo, `CrewKickoffCompletedEvent` inclui os campos `crew_name` e `output`. -## Exemplo Real: Integração com AgentOps - -O CrewAI inclui um exemplo de integração com [AgentOps](https://github.com/AgentOps-AI/agentops), uma plataforma de monitoramento e observabilidade para agentes de IA. Veja como é implementado: - -```python -from typing import Optional - -from crewai.utilities.events import ( - CrewKickoffCompletedEvent, - ToolUsageErrorEvent, - ToolUsageStartedEvent, -) -from crewai.utilities.events.base_event_listener import BaseEventListener -from crewai.utilities.events.crew_events import CrewKickoffStartedEvent -from crewai.utilities.events.task_events import TaskEvaluationEvent - -try: - import agentops - AGENTOPS_INSTALLED = True -except ImportError: - AGENTOPS_INSTALLED = False - -class AgentOpsListener(BaseEventListener): - tool_event: Optional["agentops.ToolEvent"] = None - session: Optional["agentops.Session"] = None - - def __init__(self): - super().__init__() - - def setup_listeners(self, crewai_event_bus): - if not AGENTOPS_INSTALLED: - return - - @crewai_event_bus.on(CrewKickoffStartedEvent) - def on_crew_kickoff_started(source, event: CrewKickoffStartedEvent): - self.session = agentops.init() - for agent in source.agents: - if self.session: - self.session.create_agent( - name=agent.role, - agent_id=str(agent.id), - ) - - @crewai_event_bus.on(CrewKickoffCompletedEvent) - def on_crew_kickoff_completed(source, event: CrewKickoffCompletedEvent): - if self.session: - self.session.end_session( - end_state="Success", - end_state_reason="Finished Execution", - ) - - @crewai_event_bus.on(ToolUsageStartedEvent) - def on_tool_usage_started(source, event: ToolUsageStartedEvent): - self.tool_event = agentops.ToolEvent(name=event.tool_name) - if self.session: - self.session.record(self.tool_event) - - @crewai_event_bus.on(ToolUsageErrorEvent) - def on_tool_usage_error(source, event: ToolUsageErrorEvent): - agentops.ErrorEvent(exception=event.error, trigger_event=self.tool_event) -``` - -Esse listener inicializa uma sessão do AgentOps quando um Crew inicia, cadastra agentes no AgentOps, rastreia o uso de ferramentas e finaliza a sessão quando o Crew é concluído. - -O listener AgentOps é registrado no sistema de eventos do CrewAI via importação em `src/crewai/utilities/events/third_party/__init__.py`: - -```python -from .agentops_listener import agentops_listener -``` - -Isso garante que o `agentops_listener` seja carregado quando o pacote `crewai.utilities.events` for importado. ## Uso Avançado: Handlers Escopados diff --git a/docs/pt-BR/observability/agentops.mdx b/docs/pt-BR/observability/agentops.mdx deleted file mode 100644 index e7f13925f..000000000 --- a/docs/pt-BR/observability/agentops.mdx +++ /dev/null @@ -1,126 +0,0 @@ ---- -title: Integração com AgentOps -description: Entendendo e registrando a performance do seu agente com AgentOps. -icon: paperclip ---- - -# Introdução - -Observabilidade é um aspecto fundamental no desenvolvimento e implantação de agentes de IA conversacional. Ela permite que desenvolvedores compreendam como seus agentes estão performando, -como eles estão interagindo com os usuários e como utilizam ferramentas externas e APIs. -AgentOps é um produto independente do CrewAI que fornece uma solução completa de observabilidade para agentes. - -## AgentOps - -[AgentOps](https://agentops.ai/?=crew) oferece replay de sessões, métricas e monitoramento para agentes. - -Em um alto nível, o AgentOps oferece a capacidade de monitorar custos, uso de tokens, latência, falhas do agente, estatísticas de sessão e muito mais. -Para mais informações, confira o [Repositório do AgentOps](https://github.com/AgentOps-AI/agentops). - -### Visão Geral - -AgentOps fornece monitoramento para agentes em desenvolvimento e produção. -Disponibiliza um dashboard para acompanhamento de performance dos agentes, replay de sessões e relatórios personalizados. - -Além disso, o AgentOps traz análises detalhadas das sessões para visualizar interações do agente Crew, chamadas LLM e uso de ferramentas em tempo real. -Esse recurso é útil para depuração e entendimento de como os agentes interagem com usuários e entre si. - -![Visão geral de uma série selecionada de execuções de sessões do agente](/images/agentops-overview.png) -![Visão geral das análises detalhadas de sessões para examinar execuções de agentes](/images/agentops-session.png) -![Visualizando um gráfico de execução passo a passo do replay do agente](/images/agentops-replay.png) - -### Funcionalidades - -- **Gerenciamento e Rastreamento de Custos de LLM**: Acompanhe gastos com provedores de modelos fundamentais. -- **Análises de Replay**: Assista gráficos de execução do agente, passo a passo. -- **Detecção de Pensamento Recursivo**: Identifique quando agentes entram em loops infinitos. -- **Relatórios Personalizados**: Crie análises customizadas sobre a performance dos agentes. -- **Dashboard Analítico**: Monitore estatísticas gerais de agentes em desenvolvimento e produção. -- **Teste de Modelos Públicos**: Teste seus agentes em benchmarks e rankings. -- **Testes Personalizados**: Execute seus agentes em testes específicos de domínio. -- **Depuração com Viagem no Tempo**: Reinicie suas sessões a partir de checkpoints. -- **Conformidade e Segurança**: Crie registros de auditoria e detecte possíveis ameaças como uso de palavrões e vazamento de dados pessoais. -- **Detecção de Prompt Injection**: Identifique possíveis injeções de código e vazamentos de segredos. - -### Utilizando o AgentOps - - - - Crie uma chave de API de usuário aqui: [Create API Key](https://app.agentops.ai/account) - - - Adicione sua chave API nas variáveis de ambiente: - ```bash - AGENTOPS_API_KEY= - ``` - - - Instale o AgentOps com: - ```bash - pip install 'crewai[agentops]' - ``` - ou - ```bash - pip install agentops - ``` - - - Antes de utilizar o `Crew` no seu script, inclua estas linhas: - - ```python - import agentops - agentops.init() - ``` - - Isso irá iniciar uma sessão do AgentOps e também rastrear automaticamente os agentes Crew. Para mais detalhes sobre como adaptar sistemas de agentes mais complexos, - confira a [documentação do AgentOps](https://docs.agentops.ai) ou participe do [Discord](https://discord.gg/j4f3KbeH). - - - -### Exemplos de Crew + AgentOps - - - - Exemplo de um agente Crew que gera vagas de emprego. - - - Exemplo de um agente Crew que valida arquivos Markdown. - - - Exemplo de um agente Crew que gera posts para Instagram. - - - -### Mais Informações - -Para começar, crie uma [conta AgentOps](https://agentops.ai/?=crew). - -Para sugestões de funcionalidades ou relatos de bugs, entre em contato com o time do AgentOps pelo [Repositório do AgentOps](https://github.com/AgentOps-AI/agentops). - -#### Links Extras - -🐦 Twitter -  •   -📢 Discord -  •   -🖇️ Dashboard AgentOps -  •   -📙 Documentação \ No newline at end of file diff --git a/docs/pt-BR/observability/overview.mdx b/docs/pt-BR/observability/overview.mdx index 357c0d709..ff33a4400 100644 --- a/docs/pt-BR/observability/overview.mdx +++ b/docs/pt-BR/observability/overview.mdx @@ -21,9 +21,6 @@ A observabilidade é fundamental para entender como seus agentes CrewAI estão d ### Plataformas de Monitoramento e Rastreamento - - Replays de sessões, métricas e monitoramento para desenvolvimento e produção de agentes. - Rastreamento ponta a ponta para fluxos de trabalho CrewAI com captura automática de interações de agentes. diff --git a/pyproject.toml b/pyproject.toml index f71ba1fec..e19ec38e6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,7 +52,6 @@ tools = ["crewai-tools~=0.62.0"] embeddings = [ "tiktoken~=0.8.0" ] -agentops = ["agentops==0.3.18"] pdfplumber = [ "pdfplumber>=0.11.4", ] diff --git a/src/crewai/utilities/events/__init__.py b/src/crewai/utilities/events/__init__.py index 3a9900450..b5269959b 100644 --- a/src/crewai/utilities/events/__init__.py +++ b/src/crewai/utilities/events/__init__.py @@ -67,11 +67,9 @@ from .memory_events import ( # events from .event_listener import EventListener -from .third_party.agentops_listener import agentops_listener __all__ = [ "EventListener", - "agentops_listener", "CrewAIEventsBus", "crewai_event_bus", "AgentExecutionStartedEvent", @@ -105,7 +103,6 @@ __all__ = [ "MemoryRetrievalStartedEvent", "MemoryRetrievalCompletedEvent", "EventListener", - "agentops_listener", "CrewKickoffStartedEvent", "CrewKickoffCompletedEvent", "CrewKickoffFailedEvent", diff --git a/src/crewai/utilities/events/third_party/__init__.py b/src/crewai/utilities/events/third_party/__init__.py index e9de52477..e69de29bb 100644 --- a/src/crewai/utilities/events/third_party/__init__.py +++ b/src/crewai/utilities/events/third_party/__init__.py @@ -1 +0,0 @@ -from .agentops_listener import agentops_listener diff --git a/src/crewai/utilities/events/third_party/agentops_listener.py b/src/crewai/utilities/events/third_party/agentops_listener.py deleted file mode 100644 index 294a820ee..000000000 --- a/src/crewai/utilities/events/third_party/agentops_listener.py +++ /dev/null @@ -1,67 +0,0 @@ -from typing import Optional - -from crewai.utilities.events import ( - CrewKickoffCompletedEvent, - ToolUsageErrorEvent, - ToolUsageStartedEvent, -) -from crewai.utilities.events.base_event_listener import BaseEventListener -from crewai.utilities.events.crew_events import CrewKickoffStartedEvent -from crewai.utilities.events.task_events import TaskEvaluationEvent - -try: - import agentops - - AGENTOPS_INSTALLED = True -except ImportError: - AGENTOPS_INSTALLED = False - - -class AgentOpsListener(BaseEventListener): - tool_event: Optional["agentops.ToolEvent"] = None - session: Optional["agentops.Session"] = None - - def __init__(self): - super().__init__() - - def setup_listeners(self, crewai_event_bus): - if not AGENTOPS_INSTALLED: - return - - @crewai_event_bus.on(CrewKickoffStartedEvent) - def on_crew_kickoff_started(source, event: CrewKickoffStartedEvent): - self.session = agentops.init() - for agent in source.agents: - if self.session: - self.session.create_agent( - name=agent.role, - agent_id=str(agent.id), - ) - - @crewai_event_bus.on(CrewKickoffCompletedEvent) - def on_crew_kickoff_completed(source, event: CrewKickoffCompletedEvent): - if self.session: - self.session.end_session( - end_state="Success", - end_state_reason="Finished Execution", - ) - - @crewai_event_bus.on(ToolUsageStartedEvent) - def on_tool_usage_started(source, event: ToolUsageStartedEvent): - self.tool_event = agentops.ToolEvent(name=event.tool_name) - if self.session: - self.session.record(self.tool_event) - - @crewai_event_bus.on(ToolUsageErrorEvent) - def on_tool_usage_error(source, event: ToolUsageErrorEvent): - agentops.ErrorEvent(exception=event.error, trigger_event=self.tool_event) - - @crewai_event_bus.on(TaskEvaluationEvent) - def on_task_evaluation(source, event: TaskEvaluationEvent): - if self.session: - self.session.create_agent( - name="Task Evaluator", agent_id=str(source.original_agent.id) - ) - - -agentops_listener = AgentOpsListener() diff --git a/uv.lock b/uv.lock index 449f09d99..08ce9edc6 100644 --- a/uv.lock +++ b/uv.lock @@ -34,22 +34,6 @@ resolution-markers = [ "(python_full_version < '3.11' and platform_machine != 'aarch64' and platform_python_implementation == 'PyPy' and sys_platform == 'linux') or (python_full_version < '3.11' and platform_python_implementation == 'PyPy' and sys_platform != 'darwin' and sys_platform != 'linux')", ] -[[package]] -name = "agentops" -version = "0.3.18" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "packaging" }, - { name = "psutil" }, - { name = "pyyaml" }, - { name = "requests" }, - { name = "termcolor" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/c5/52/46bb2f29b9e5f2e1d8b124296b7794934a9048de635d9e7d6a95e791ad7b/agentops-0.3.18.tar.gz", hash = "sha256:4d509754df7be52579597cc9f53939c5218131a0379463e0ff6f6f40cde9fcc4", size = 55394, upload-time = "2024-11-19T19:06:21.306Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/97/8d/bd4cad95dad722dc2d3e4179feab1058ef846828c0e15e51e8bfaea373ee/agentops-0.3.18-py3-none-any.whl", hash = "sha256:8b48d8a1662f276653430fd541c77fa4f9a15a43e881b518ff88ea56925afcf7", size = 58032, upload-time = "2024-11-19T19:06:19.068Z" }, -] - [[package]] name = "aiohappyeyeballs" version = "2.6.1" @@ -744,9 +728,6 @@ dependencies = [ ] [package.optional-dependencies] -agentops = [ - { name = "agentops" }, -] aisuite = [ { name = "aisuite" }, ] @@ -792,7 +773,6 @@ dev = [ [package.metadata] requires-dist = [ - { name = "agentops", marker = "extra == 'agentops'", specifier = "==0.3.18" }, { name = "aisuite", marker = "extra == 'aisuite'", specifier = ">=0.1.10" }, { name = "appdirs", specifier = ">=1.4.4" }, { name = "blinker", specifier = ">=1.9.0" }, @@ -828,7 +808,7 @@ requires-dist = [ { name = "tomli-w", specifier = ">=1.1.0" }, { name = "uv", specifier = ">=0.4.25" }, ] -provides-extras = ["agentops", "aisuite", "docling", "embeddings", "mem0", "openpyxl", "pandas", "pdfplumber", "tools"] +provides-extras = ["aisuite", "docling", "embeddings", "mem0", "openpyxl", "pandas", "pdfplumber", "tools"] [package.metadata.requires-dev] dev = [ @@ -4013,20 +3993,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/7e/cc/7e77861000a0691aeea8f4566e5d3aa716f2b1dece4a24439437e41d3d25/protobuf-5.29.5-py3-none-any.whl", hash = "sha256:6cf42630262c59b2d8de33954443d94b746c952b01434fc58a417fdbd2e84bd5", size = 172823, upload-time = "2025-05-28T23:51:58.157Z" }, ] -[[package]] -name = "psutil" -version = "5.9.8" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/90/c7/6dc0a455d111f68ee43f27793971cf03fe29b6ef972042549db29eec39a2/psutil-5.9.8.tar.gz", hash = "sha256:6be126e3225486dff286a8fb9a06246a5253f4c7c53b475ea5f5ac934e64194c", size = 503247, upload-time = "2024-01-19T20:47:09.517Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/e7/e3/07ae864a636d70a8a6f58da27cb1179192f1140d5d1da10886ade9405797/psutil-5.9.8-cp36-abi3-macosx_10_9_x86_64.whl", hash = "sha256:aee678c8720623dc456fa20659af736241f575d79429a0e5e9cf88ae0605cc81", size = 248702, upload-time = "2024-01-19T20:47:36.303Z" }, - { url = "https://files.pythonhosted.org/packages/b3/bd/28c5f553667116b2598b9cc55908ec435cb7f77a34f2bff3e3ca765b0f78/psutil-5.9.8-cp36-abi3-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8cb6403ce6d8e047495a701dc7c5bd788add903f8986d523e3e20b98b733e421", size = 285242, upload-time = "2024-01-19T20:47:39.65Z" }, - { url = "https://files.pythonhosted.org/packages/c5/4f/0e22aaa246f96d6ac87fe5ebb9c5a693fbe8877f537a1022527c47ca43c5/psutil-5.9.8-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d06016f7f8625a1825ba3732081d77c94589dca78b7a3fc072194851e88461a4", size = 288191, upload-time = "2024-01-19T20:47:43.078Z" }, - { url = "https://files.pythonhosted.org/packages/6e/f5/2aa3a4acdc1e5940b59d421742356f133185667dd190b166dbcfcf5d7b43/psutil-5.9.8-cp37-abi3-win32.whl", hash = "sha256:bc56c2a1b0d15aa3eaa5a60c9f3f8e3e565303b465dbf57a1b730e7a2b9844e0", size = 251252, upload-time = "2024-01-19T20:47:52.88Z" }, - { url = "https://files.pythonhosted.org/packages/93/52/3e39d26feae7df0aa0fd510b14012c3678b36ed068f7d78b8d8784d61f0e/psutil-5.9.8-cp37-abi3-win_amd64.whl", hash = "sha256:8db4c1b57507eef143a15a6884ca10f7c73876cdf5d51e713151c1236a0e68cf", size = 255090, upload-time = "2024-01-19T20:47:56.019Z" }, - { url = "https://files.pythonhosted.org/packages/05/33/2d74d588408caedd065c2497bdb5ef83ce6082db01289a1e1147f6639802/psutil-5.9.8-cp38-abi3-macosx_11_0_arm64.whl", hash = "sha256:d16bbddf0693323b8c6123dd804100241da461e41d6e332fb0ba6058f630f8c8", size = 249898, upload-time = "2024-01-19T20:47:59.238Z" }, -] - [[package]] name = "ptyprocess" version = "0.7.0" @@ -5502,15 +5468,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/e5/30/643397144bfbfec6f6ef821f36f33e57d35946c44a2352d3c9f0ae847619/tenacity-9.1.2-py3-none-any.whl", hash = "sha256:f77bf36710d8b73a50b2dd155c97b870017ad21afe6ab300326b0371b3b05138", size = 28248, upload-time = "2025-04-02T08:25:07.678Z" }, ] -[[package]] -name = "termcolor" -version = "2.4.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/10/56/d7d66a84f96d804155f6ff2873d065368b25a07222a6fd51c4f24ef6d764/termcolor-2.4.0.tar.gz", hash = "sha256:aab9e56047c8ac41ed798fa36d892a37aca6b3e9159f3e0c24bc64a9b3ac7b7a", size = 12664, upload-time = "2023-12-01T11:04:51.66Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/d9/5f/8c716e47b3a50cbd7c146f45881e11d9414def768b7cd9c5e6650ec2a80a/termcolor-2.4.0-py3-none-any.whl", hash = "sha256:9297c0df9c99445c2412e832e882a7884038a25617c60cea2ad69488d4040d63", size = 7719, upload-time = "2023-12-01T11:04:50.019Z" }, -] - [[package]] name = "tifffile" version = "2025.5.10"