Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add Camel AI integration documentation #573

Merged
merged 9 commits into from
Dec 13, 2024
Merged
61 changes: 60 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ AgentOps helps developers build, evaluate, and monitor AI agents. From prototype
| 💸 **LLM Cost Management** | Track spend with LLM foundation model providers |
| 🧪 **Agent Benchmarking** | Test your agents against 1,000+ evals |
| 🔐 **Compliance and Security** | Detect common prompt injection and data exfiltration exploits |
| 🤝 **Framework Integrations** | Native Integrations with CrewAI, AutoGen, & LangChain |
| 🤝 **Framework Integrations** | Native Integrations with AutoGen, Camel AI, CrewAI, & LangChain |
areibman marked this conversation as resolved.
Show resolved Hide resolved

## Quick Start ⌨️

Expand Down Expand Up @@ -177,6 +177,65 @@ With only two lines of code, add full observability and monitoring to Autogen ag
- [Autogen Observability Example](https://microsoft.github.io/autogen/docs/notebooks/agentchat_agentops)
- [Autogen - AgentOps Documentation](https://microsoft.github.io/autogen/docs/ecosystem/agentops)

### Camel AI 🐪

Track and analyze CAMEL agents with full observability. Set an `AGENTOPS_API_KEY` in your environment and initialize AgentOps to get started.

- [Camel AI](https://www.camel-ai.org/) - Advanced agent communication framework
- [AgentOps integration example](https://docs.agentops.ai/v1/integrations/camel)
- [Official Camel AI documentation](https://docs.camel-ai.org/cookbooks/agents_tracking.html)

<details>
<summary>Installation</summary>

```bash
pip install "camel-ai[all]==0.2.11"
pip install agentops
```

```python
import os
import agentops
from camel.agents import ChatAgent
from camel.messages import BaseMessage
from camel.models import ModelFactory
from camel.types import ModelPlatformType, ModelType

# Initialize AgentOps
agentops.init(os.getenv("AGENTOPS_API_KEY"), default_tags=["CAMEL Example"])

# Import toolkits after AgentOps init for tracking
from camel.toolkits import SearchToolkit

# Set up the agent with search tools
sys_msg = BaseMessage.make_assistant_message(
role_name='Tools calling operator',
content='You are a helpful assistant'
)

# Configure tools and model
tools = [*SearchToolkit().get_tools()]
model = ModelFactory.create(
model_platform=ModelPlatformType.OPENAI,
model_type=ModelType.GPT_4O_MINI,
)

# Create and run the agent
camel_agent = ChatAgent(
system_message=sys_msg,
model=model,
tools=tools,
)

response = camel_agent.step("What is AgentOps?")
print(response)

agentops.end_session("Success")
```

Check out our [Camel integration guide](https://docs.agentops.ai/v1/integrations/camel) for more examples including multi-agent scenarios.
</details>

### Langchain 🦜🔗

AgentOps works seamlessly with applications built using Langchain. To use the handler, install Langchain as an optional dependency:
Expand Down
3 changes: 2 additions & 1 deletion docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"anchors": {
"from": "#D1E5F7",
"to": "#a9bed4"

}
},
"topbarCtaButton": {
Expand Down Expand Up @@ -90,6 +90,7 @@
"v1/integrations/ai21",
"v1/integrations/anthropic",
"v1/integrations/autogen",
"v1/integrations/camel",
"v1/integrations/cohere",
"v1/integrations/crewai",
"v1/integrations/groq",
Expand Down
148 changes: 148 additions & 0 deletions docs/v1/integrations/camel.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
---
title: 'Camel AI'
description: 'Track and analyze CAMEL agents including LLMs and Tools usage with AgentOps'
---

import CodeTooltip from '/snippets/add-code-tooltip.mdx'
import EnvTooltip from '/snippets/add-env-tooltip.mdx'

[CAMEL](https://www.camel-ai.org/) is the first large language model (LLM) multi-agent framework and an open-source community dedicated to finding the scaling law of agents. CAMEL has comprehensive [documentation](https://docs.camel-ai.org/) available as well as a great [quickstart](https://docs.camel-ai.org/getting_started/installation.html) guide.

## Adding AgentOps to CAMEL agents

<Steps>
<Step title="Install the AgentOps SDK">
<CodeGroup>
```bash pip
pip install agentops
```
```bash poetry
poetry add agentops
```
</CodeGroup>
</Step>
<Step title="Install CAMEL">
<CodeGroup>
```bash pip
pip install "camel-ai[all]==0.2.11"
```
```bash poetry
poetry add "camel-ai[all]==0.2.11"
```
</CodeGroup>
</Step>
<Step title="Add 3 lines of code">
<CodeTooltip/>
<CodeGroup>
```python python
import agentops
agentops.init(<INSERT YOUR API KEY HERE>)
...
# MUST END SESSION at end of program
agentops.end_session("Success") # Success|Fail|Indeterminate
```
</CodeGroup>
<EnvTooltip />
<CodeGroup>
```python .env
AGENTOPS_API_KEY=<YOUR API KEY>
```
</CodeGroup>
Read more about environment variables in [Advanced Configuration](/v1/usage/advanced-configuration)
</Step>
<Step title="Run your agent">
Execute your program and visit [app.agentops.ai/drilldown](https://app.agentops.ai/drilldown) to observe your CAMEL Agent! 🕵️
<Tip>
After your run, AgentOps prints a clickable url to console linking directly to your session in the Dashboard
</Tip>
<div/>{/* Intentionally blank div for newline */}
<Frame type="glass" caption="Clickable link to session">
<img height="200" src="https://github.com/AgentOps-AI/agentops/blob/main/docs/images/link-to-session.gif?raw=true" />
</Frame>
</Step>
</Steps>

## Single Agent Example with Tools

Here's a simple example of tracking a CAMEL single agent with tools using AgentOps:

```python
import agentops
import os
from camel.agents import ChatAgent
from camel.messages import BaseMessage
from camel.models import ModelFactory
from camel.types import ModelPlatformType, ModelType

# Initialize AgentOps
agentops.init(os.getenv("AGENTOPS_API_KEY"))

# Import toolkits after AgentOps init for tracking
from camel.toolkits import SearchToolkit

# Set up the agent with search tools
sys_msg = BaseMessage.make_assistant_message(
role_name='Tools calling operator',
content='You are a helpful assistant'
)

# Configure tools and model
tools = [*SearchToolkit().get_tools()]
model = ModelFactory.create(
model_platform=ModelPlatformType.OPENAI,
model_type=ModelType.GPT_4O_MINI,
)

# Create the agent
camel_agent = ChatAgent(
system_message=sys_msg,
model=model,
tools=tools,
)

# Run the agent
user_msg = 'What is CAMEL-AI.org?'
response = camel_agent.step(user_msg)
print(response)

# End the session
agentops.end_session("Success")
```

## Multi-Agent Example

For more complex scenarios, CAMEL supports multi-agent interactions. Here's how to track multiple agents:

```python
import agentops
from typing import List
from camel.agents.chat_agent import FunctionCallingRecord
from camel.societies import RolePlaying
from camel.types import ModelPlatformType, ModelType

# Initialize AgentOps with multi-agent tag
agentops.start_session(tags=["CAMEL X AgentOps Multi-agent"])

# Import toolkits after AgentOps init
from camel.toolkits import SearchToolkit, MathToolkit

# Set up your task
task_prompt = (
"Assume now is 2024 in the Gregorian calendar, "
"estimate the current age of University of Oxford "
"and then add 10 more years to this age, "
"and get the current weather of the city where "
"the University is located."
)

# The rest of your multi-agent implementation...
# See our example notebook for the complete implementation
```

For complete examples including multi-agent setups and advanced configurations, check out our [example notebooks](https://github.com/AgentOps-AI/agentops/tree/main/examples/camel_examples).

<script type="module" src="/scripts/github_stars.js"></script>
<script type="module" src="/scripts/scroll-img-fadein-animation.js"></script>
<script type="module" src="/scripts/button_heartbeat_animation.js"></script>
<script type="css" src="/styles/styles.css"></script>
<script type="module" src="/scripts/adjust_api_dynamically.js"></script>
Loading
Loading