Skip to content

Commit 08c546c

Browse files
Merge branch 'main' into codeflash/optimize-CrewAgentParser._extract_thought-m61vbkl0
2 parents ab158b4 + 1b488b6 commit 08c546c

File tree

102 files changed

+6084
-2411
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+6084
-2411
lines changed

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
<div align="center">
22

3-
![Logo of CrewAI, two people rowing on a boat](./docs/crewai_logo.png)
3+
![Logo of CrewAI](./docs/crewai_logo.png)
44

55
# **CrewAI**
66

7-
🤖 **CrewAI**: Production-grade framework for orchestrating sophisticated AI agent systems. From simple automations to complex real-world applications, CrewAI provides precise control and deep customization. By fostering collaborative intelligence through flexible, production-ready architecture, CrewAI empowers agents to work together seamlessly, tackling complex business challenges with predictable, consistent results.
7+
**CrewAI**: Production-grade framework for orchestrating sophisticated AI agent systems. From simple automations to complex real-world applications, CrewAI provides precise control and deep customization. By fostering collaborative intelligence through flexible, production-ready architecture, CrewAI empowers agents to work together seamlessly, tackling complex business challenges with predictable, consistent results.
8+
9+
**CrewAI Enterprise**
10+
Want to plan, build (+ no code), deploy, monitor and interare your agents: [CrewAI Enterprise](https://www.crewai.com/enterprise). Designed for complex, real-world applications, our enterprise solution offers:
11+
12+
- **Seamless Integrations**
13+
- **Scalable & Secure Deployment**
14+
- **Actionable Insights**
15+
- **24/7 Support**
816

917
<h3>
1018

@@ -190,7 +198,7 @@ research_task:
190198
description: >
191199
Conduct a thorough research about {topic}
192200
Make sure you find any interesting and relevant information given
193-
the current year is 2024.
201+
the current year is 2025.
194202
expected_output: >
195203
A list with 10 bullet points of the most relevant information about {topic}
196204
agent: researcher
@@ -392,7 +400,7 @@ class AdvancedAnalysisFlow(Flow[MarketState]):
392400
goal="Gather and validate supporting market data",
393401
backstory="You excel at finding and correlating multiple data sources"
394402
)
395-
403+
396404
analysis_task = Task(
397405
description="Analyze {sector} sector data for the past {timeframe}",
398406
expected_output="Detailed market analysis with confidence score",
@@ -403,7 +411,7 @@ class AdvancedAnalysisFlow(Flow[MarketState]):
403411
expected_output="Corroborating evidence and potential contradictions",
404412
agent=researcher
405413
)
406-
414+
407415
# Demonstrate crew autonomy
408416
analysis_crew = Crew(
409417
agents=[analyst, researcher],

docs/concepts/agents.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Think of an agent as a specialized team member with specific skills, expertise,
4343
| **Max Retry Limit** _(optional)_ | `max_retry_limit` | `int` | Maximum number of retries when an error occurs. Default is 2. |
4444
| **Respect Context Window** _(optional)_ | `respect_context_window` | `bool` | Keep messages under context window size by summarizing. Default is True. |
4545
| **Code Execution Mode** _(optional)_ | `code_execution_mode` | `Literal["safe", "unsafe"]` | Mode for code execution: 'safe' (using Docker) or 'unsafe' (direct). Default is 'safe'. |
46-
| **Embedder Config** _(optional)_ | `embedder_config` | `Optional[Dict[str, Any]]` | Configuration for the embedder used by the agent. |
46+
| **Embedder** _(optional)_ | `embedder` | `Optional[Dict[str, Any]]` | Configuration for the embedder used by the agent. |
4747
| **Knowledge Sources** _(optional)_ | `knowledge_sources` | `Optional[List[BaseKnowledgeSource]]` | Knowledge sources available to the agent. |
4848
| **Use System Prompt** _(optional)_ | `use_system_prompt` | `Optional[bool]` | Whether to use system prompt (for o1 model support). Default is True. |
4949

@@ -152,7 +152,7 @@ agent = Agent(
152152
use_system_prompt=True, # Default: True
153153
tools=[SerperDevTool()], # Optional: List of tools
154154
knowledge_sources=None, # Optional: List of knowledge sources
155-
embedder_config=None, # Optional: Custom embedder configuration
155+
embedder=None, # Optional: Custom embedder configuration
156156
system_template=None, # Optional: Custom system prompt template
157157
prompt_template=None, # Optional: Custom prompt template
158158
response_template=None, # Optional: Custom response template

docs/concepts/cli.mdx

Lines changed: 46 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ The CrewAI CLI provides a set of commands to interact with CrewAI, allowing you
1212

1313
To use the CrewAI CLI, make sure you have CrewAI installed:
1414

15-
```shell
15+
```shell Terminal
1616
pip install crewai
1717
```
1818

1919
## Basic Usage
2020

2121
The basic structure of a CrewAI CLI command is:
2222

23-
```shell
23+
```shell Terminal
2424
crewai [COMMAND] [OPTIONS] [ARGUMENTS]
2525
```
2626

@@ -30,15 +30,15 @@ crewai [COMMAND] [OPTIONS] [ARGUMENTS]
3030

3131
Create a new crew or flow.
3232

33-
```shell
33+
```shell Terminal
3434
crewai create [OPTIONS] TYPE NAME
3535
```
3636

3737
- `TYPE`: Choose between "crew" or "flow"
3838
- `NAME`: Name of the crew or flow
3939

4040
Example:
41-
```shell
41+
```shell Terminal
4242
crewai create crew my_new_crew
4343
crewai create flow my_new_flow
4444
```
@@ -47,14 +47,14 @@ crewai create flow my_new_flow
4747

4848
Show the installed version of CrewAI.
4949

50-
```shell
50+
```shell Terminal
5151
crewai version [OPTIONS]
5252
```
5353

5454
- `--tools`: (Optional) Show the installed version of CrewAI tools
5555

5656
Example:
57-
```shell
57+
```shell Terminal
5858
crewai version
5959
crewai version --tools
6060
```
@@ -63,46 +63,46 @@ crewai version --tools
6363

6464
Train the crew for a specified number of iterations.
6565

66-
```shell
66+
```shell Terminal
6767
crewai train [OPTIONS]
6868
```
6969

7070
- `-n, --n_iterations INTEGER`: Number of iterations to train the crew (default: 5)
7171
- `-f, --filename TEXT`: Path to a custom file for training (default: "trained_agents_data.pkl")
7272

7373
Example:
74-
```shell
74+
```shell Terminal
7575
crewai train -n 10 -f my_training_data.pkl
7676
```
7777

7878
### 4. Replay
7979

8080
Replay the crew execution from a specific task.
8181

82-
```shell
82+
```shell Terminal
8383
crewai replay [OPTIONS]
8484
```
8585

8686
- `-t, --task_id TEXT`: Replay the crew from this task ID, including all subsequent tasks
8787

8888
Example:
89-
```shell
89+
```shell Terminal
9090
crewai replay -t task_123456
9191
```
9292

9393
### 5. Log-tasks-outputs
9494

9595
Retrieve your latest crew.kickoff() task outputs.
9696

97-
```shell
97+
```shell Terminal
9898
crewai log-tasks-outputs
9999
```
100100

101101
### 6. Reset-memories
102102

103103
Reset the crew memories (long, short, entity, latest_crew_kickoff_outputs).
104104

105-
```shell
105+
```shell Terminal
106106
crewai reset-memories [OPTIONS]
107107
```
108108

@@ -113,7 +113,7 @@ crewai reset-memories [OPTIONS]
113113
- `-a, --all`: Reset ALL memories
114114

115115
Example:
116-
```shell
116+
```shell Terminal
117117
crewai reset-memories --long --short
118118
crewai reset-memories --all
119119
```
@@ -122,23 +122,23 @@ crewai reset-memories --all
122122

123123
Test the crew and evaluate the results.
124124

125-
```shell
125+
```shell Terminal
126126
crewai test [OPTIONS]
127127
```
128128

129129
- `-n, --n_iterations INTEGER`: Number of iterations to test the crew (default: 3)
130130
- `-m, --model TEXT`: LLM Model to run the tests on the Crew (default: "gpt-4o-mini")
131131

132132
Example:
133-
```shell
133+
```shell Terminal
134134
crewai test -n 5 -m gpt-3.5-turbo
135135
```
136136

137137
### 8. Run
138138

139139
Run the crew.
140140

141-
```shell
141+
```shell Terminal
142142
crewai run
143143
```
144144
<Note>
@@ -147,7 +147,36 @@ Some commands may require additional configuration or setup within your project
147147
</Note>
148148

149149

150-
### 9. API Keys
150+
### 9. Chat
151+
152+
Starting in version `0.98.0`, when you run the `crewai chat` command, you start an interactive session with your crew. The AI assistant will guide you by asking for necessary inputs to execute the crew. Once all inputs are provided, the crew will execute its tasks.
153+
154+
After receiving the results, you can continue interacting with the assistant for further instructions or questions.
155+
156+
```shell Terminal
157+
crewai chat
158+
```
159+
<Note>
160+
Ensure you execute these commands from your CrewAI project's root directory.
161+
</Note>
162+
<Note>
163+
IMPORTANT: Set the `chat_llm` property in your `crew.py` file to enable this command.
164+
165+
```python
166+
@crew
167+
def crew(self) -> Crew:
168+
return Crew(
169+
agents=self.agents,
170+
tasks=self.tasks,
171+
process=Process.sequential,
172+
verbose=True,
173+
chat_llm="gpt-4o", # LLM for chat orchestration
174+
)
175+
```
176+
</Note>
177+
178+
179+
### 10. API Keys
151180

152181
When running ```crewai create crew``` command, the CLI will first show you the top 5 most common LLM providers and ask you to select one.
153182

docs/concepts/crews.mdx

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ A crew in crewAI represents a collaborative group of agents working together to
2323
| **Language** _(optional)_ | `language` | Language used for the crew, defaults to English. |
2424
| **Language File** _(optional)_ | `language_file` | Path to the language file to be used for the crew. |
2525
| **Memory** _(optional)_ | `memory` | Utilized for storing execution memories (short-term, long-term, entity memory). |
26-
| **Memory Config** _(optional)_ | `memory_config` | Configuration for the memory provider to be used by the crew. |
27-
| **Cache** _(optional)_ | `cache` | Specifies whether to use a cache for storing the results of tools' execution. Defaults to `True`. |
28-
| **Embedder** _(optional)_ | `embedder` | Configuration for the embedder to be used by the crew. Mostly used by memory for now. Default is `{"provider": "openai"}`. |
29-
| **Full Output** _(optional)_ | `full_output` | Whether the crew should return the full output with all tasks outputs or just the final output. Defaults to `False`. |
26+
| **Memory Config** _(optional)_ | `memory_config` | Configuration for the memory provider to be used by the crew. |
27+
| **Cache** _(optional)_ | `cache` | Specifies whether to use a cache for storing the results of tools' execution. Defaults to `True`. |
28+
| **Embedder** _(optional)_ | `embedder` | Configuration for the embedder to be used by the crew. Mostly used by memory for now. Default is `{"provider": "openai"}`. |
29+
| **Full Output** _(optional)_ | `full_output` | Whether the crew should return the full output with all tasks outputs or just the final output. Defaults to `False`. |
3030
| **Step Callback** _(optional)_ | `step_callback` | A function that is called after each step of every agent. This can be used to log the agent's actions or to perform other operations; it won't override the agent-specific `step_callback`. |
3131
| **Task Callback** _(optional)_ | `task_callback` | A function that is called after the completion of each task. Useful for monitoring or additional operations post-task execution. |
3232
| **Share Crew** _(optional)_ | `share_crew` | Whether you want to share the complete crew information and execution with the crewAI team to make the library better, and allow us to train models. |
33-
| **Output Log File** _(optional)_ | `output_log_file` | Whether you want to have a file with the complete crew output and execution. You can set it using True and it will default to the folder you are currently in and it will be called logs.txt or passing a string with the full path and name of the file. |
33+
| **Output Log File** _(optional)_ | `output_log_file` | Set to True to save logs as logs.txt in the current directory or provide a file path. Logs will be in JSON format if the filename ends in .json, otherwise .txt. Defautls to `None`. |
3434
| **Manager Agent** _(optional)_ | `manager_agent` | `manager` sets a custom agent that will be used as a manager. |
3535
| **Prompt File** _(optional)_ | `prompt_file` | Path to the prompt JSON file to be used for the crew. |
3636
| **Planning** *(optional)* | `planning` | Adds planning ability to the Crew. When activated before each Crew iteration, all Crew data is sent to an AgentPlanner that will plan the tasks and this plan will be added to each task description. |
@@ -240,6 +240,23 @@ print(f"Tasks Output: {crew_output.tasks_output}")
240240
print(f"Token Usage: {crew_output.token_usage}")
241241
```
242242

243+
## Accessing Crew Logs
244+
245+
You can see real time log of the crew execution, by setting `output_log_file` as a `True(Boolean)` or a `file_name(str)`. Supports logging of events as both `file_name.txt` and `file_name.json`.
246+
In case of `True(Boolean)` will save as `logs.txt`.
247+
248+
In case of `output_log_file` is set as `False(Booelan)` or `None`, the logs will not be populated.
249+
250+
```python Code
251+
# Save crew logs
252+
crew = Crew(output_log_file = True) # Logs will be saved as logs.txt
253+
crew = Crew(output_log_file = file_name) # Logs will be saved as file_name.txt
254+
crew = Crew(output_log_file = file_name.txt) # Logs will be saved as file_name.txt
255+
crew = Crew(output_log_file = file_name.json) # Logs will be saved as file_name.json
256+
```
257+
258+
259+
243260
## Memory Utilization
244261

245262
Crews can utilize memory (short-term, long-term, and entity memory) to enhance their execution and learning over time. This feature allows crews to store and recall execution memories, aiding in decision-making and task execution strategies.
@@ -279,9 +296,9 @@ print(result)
279296
Once your crew is assembled, initiate the workflow with the appropriate kickoff method. CrewAI provides several methods for better control over the kickoff process: `kickoff()`, `kickoff_for_each()`, `kickoff_async()`, and `kickoff_for_each_async()`.
280297

281298
- `kickoff()`: Starts the execution process according to the defined process flow.
282-
- `kickoff_for_each()`: Executes tasks for each agent individually.
299+
- `kickoff_for_each()`: Executes tasks sequentially for each provided input event or item in the collection.
283300
- `kickoff_async()`: Initiates the workflow asynchronously.
284-
- `kickoff_for_each_async()`: Executes tasks for each agent individually in an asynchronous manner.
301+
- `kickoff_for_each_async()`: Executes tasks concurrently for each provided input event or item, leveraging asynchronous processing.
285302

286303
```python Code
287304
# Start the crew's task execution

0 commit comments

Comments
 (0)