Skip to content

Commit

Permalink
adding new docs
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomdmoura committed Jul 8, 2024
1 parent 68e9e54 commit 691b094
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
31 changes: 31 additions & 0 deletions docs/how-to/Force-Tool-Ouput-as-Result.md
Original file line number Diff line number Diff line change
@@ -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.
5 changes: 5 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ Cutting-edge framework for orchestrating role-playing, autonomous AI agents. By
Coding Agents
</a>
</li>
<li>
<a href="./how-to/Force-Tool-Ouput-as-Result">
Forcing Tool Output as Result
</a>
</li>
<li>
<a href="./how-to/Human-Input-on-Execution">
Human Input on Execution
Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 691b094

Please sign in to comment.