Getting Started with Crew
You need to install CrewAI (more details) and weave to run this example:weave.init() at the beginning of your script. The argument in weave.init() is a project name where the traces will be logged.
CrewAI provides several methods for better control over the kickoff process:
kickoff(), kickoff_for_each(), kickoff_async(), and kickoff_for_each_async(). The integration supports logging traces from all these methods.Track Tools
CrewAI tools empower agents with capabilities ranging from web searching and data analysis to collaboration and delegating tasks among coworkers. The integration can trace them as well. We will improve the quality of the generated report in the above example by giving it access to a tool that can search the internet and return the most relevant results. Let us first install the extra dependency.SerperDevTool to enable our ‘Research Analyst’ agent to search relevant information on the internet. Learn more about this tool and API requirements here.
The integration automatically patches all the tools available in the
crewAI-tools repository.Getting Started with Flow
The integration automatically patches the
Flow.kickoff entry point and all the available decorators — @start, @listen, @router, @or_ and @and_.Crew Guardrail - Track your own ops
Task guardrails provide a way to validate and transform task outputs before they are passed to the next task. We can use a simple python function to validate the agent’s execution on-the-fly. Wrapping this function with@weave.op starts capturing inputs, outputs and app logic so you can debug how data is validated through your agents. This also starts automatically versioning code as you experiment to capture ad-hoc details that haven’t been committed to git.
Let’s take the example of research analyst and writer. We add a guardrail to validate the length of the generated report.
@weave.op we are able to keep track of the input and output to this function along with execution time, token information if an LLM is used under the hood, code version and more.