From ca22a91b8af8545685a722f3c07b7630f8e6a4f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Moura?= Date: Mon, 8 Jul 2024 03:15:03 -0400 Subject: [PATCH] adding new docs --- docs/how-to/Force-Tool-Ouput-as-Result.md | 31 +++++++++++++++++++++++ docs/index.md | 5 ++++ mkdocs.yml | 1 + 3 files changed, 37 insertions(+) create mode 100644 docs/how-to/Force-Tool-Ouput-as-Result.md diff --git a/docs/how-to/Force-Tool-Ouput-as-Result.md b/docs/how-to/Force-Tool-Ouput-as-Result.md new file mode 100644 index 000000000..c40d0af29 --- /dev/null +++ b/docs/how-to/Force-Tool-Ouput-as-Result.md @@ -0,0 +1,31 @@ +--- +title: Forcing Tool Output as Result +description: Learn how to force tool output as the result in of an Agent's task in crewAI. +--- + +## Introduction +In CrewAI, you can force the output of a tool as the result of an agent's task. This feature is useful when you want to ensure that the tool output is captured and returned as the task result, and avoid the agent modifying the output during the task execution. + +## Forcing Tool Output as Result +To force the tool output as the result of an agent's task, you can set the `force_tool_output` parameter to `True` when creating the task. This parameter ensures that the tool output is captured and returned as the task result, without any modifications by the agent. + +Here's an example of how to force the tool output as the result of an agent's task: + +```python +# ... +# Define a custom tool that returns the result as the answer +coding_agent =Agent( + role="Data Scientist", + goal="Product amazing resports on AI", + backstory="You work with data and AI", + tools=[MyCustomTool(result_as_answer=True)], + ) +# ... +``` + +### Workflow in Action + +1. **Task Execution**: The agent executes the task using the tool provided. +2. **Tool Output**: The tool generates the output, which is captured as the task result. +3. **Agent Interaction**: The agent my reflect and take learnings from the tool but the output is not modified. +4. **Result Return**: The tool output is returned as the task result without any modifications. diff --git a/docs/index.md b/docs/index.md index 301ad11e6..66b4a7a37 100644 --- a/docs/index.md +++ b/docs/index.md @@ -93,6 +93,11 @@ Cutting-edge framework for orchestrating role-playing, autonomous AI agents. By Coding Agents +
  • + + Forcing Tool Output as Result + +
  • Human Input on Execution diff --git a/mkdocs.yml b/mkdocs.yml index 2ac81ee86..d609c2547 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -141,6 +141,7 @@ nav: - Connecting to any LLM: 'how-to/LLM-Connections.md' - Customizing Agents: 'how-to/Customizing-Agents.md' - Coding Agents: 'how-to/Coding-Agents.md' + - Forcing Tool Output as Result: 'how-to/Force-Tool-Ouput-as-Result.md' - Human Input on Execution: 'how-to/Human-Input-on-Execution.md' - Kickoff a Crew Asynchronously: 'how-to/Kickoff-async.md' - Kickoff a Crew for a List: 'how-to/Kickoff-for-each.md'