Skip to content

Commit

Permalink
Update quickstart docs
Browse files Browse the repository at this point in the history
  • Loading branch information
whimo committed Sep 11, 2024
1 parent 1dadd35 commit 0e366ee
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion examples/Quickstart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,32 @@
"\n",
"MotleyCrew also supports **forced output handlers**. This means that the agent will only be able to return output via an output handler, and not directly. This is useful if you want to ensure that the agent only returns output in a specific format.\n",
"\n",
"See our usage examples with a [simple validator](examples/validating_agent_output.html) and an [advanced output handler with multiple fields](examples/advanced_output_handling.html).\n"
"See our usage examples with a [simple validator](examples/validating_agent_output.html) and an [advanced output handler with multiple fields](examples/advanced_output_handling.html).\n",
"\n",
"\n",
"### MotleyTool\n",
"\n",
"A tool in motleycrew, like in other frameworks, is basically a function that takes an input and returns an output.\n",
"It is called a tool in the sense that it is usually used by an agent to perform a specific action.\n",
"Besides the function itself, a tool also contains an input schema which describes the input format to the LLM.\n",
"\n",
"`MotleyTool` is the base class for all tools in motleycrew. It is a subclass of `Runnable` that adds some additional features to the tool, along with necessary adapters and converters.\n",
"\n",
"If you pass a tool from a supported framework (currently Langchain, LlamaIndex, and CrewAI) to a motleycrew agent, it will be automatically converted. If you want to have control over this, e.g. to customize tool params, you can do it manually.\n",
"\n",
"```python\n",
"motley_tool = MotleyTool.from_supported_tool(my_tool)\n",
"```\n",
"\n",
"It is also possible to define a custom tool using the `MotleyTool` base class, overriding the `run` method. This is especially useful if you want to access context such as the caller agent or its last input, which can be useful for validation.\n",
"\n",
"```python\n",
"class MyTool(MotleyTool):\n",
" def run(self, some_input: str) -> str:\n",
" return f\"Received {some_input} from agent {self.agent} with last input {self.agent_input}\"\n",
"```\n",
"\n",
"MotleyTool can reflect exceptions that are raised inside it back to the agent, which can then retry the tool call. You can pass a list of exception classes to the `exceptions_to_reflect` argument in the constructor (or even pass the `Exception` class to reflect everything)."
]
},
{
Expand Down

0 comments on commit 0e366ee

Please sign in to comment.