chapter two

2 Creating and running a single agent

 

This chapter covers

  • Setting up CrewAI
  • Building your first agent
  • Tool access and structured outputs
  • The agent execution loop

Every agentic system starts with a single augmented LLM: a language model enhanced with retrieval, tools, and memory. In CrewAI, that building block is the agent. Agents can be used inside both crews (an ensemble of specialized agents collaborating on a set of tasks) and flows (deterministic workflows that follow a specific order). Their identity and behavior are shaped by three narrative pillars: the role, goal, & backstory.

An agent can access various tools to achieve its goals and has numerous configuration options to run in any way possible. In this chapter, we’re building a complete and stand-alone project, a market researcher agent that can explore market opportunities, access tools to search the web, scrape the content from websites, and present its findings in a structured form to the user. This way, it could easily be integrated into existing software systems in a company.

2.1 Getting up and running with CrewAI

2.2 Designing the agent

2.3 Adding tools

2.4 Crafting a good prompt

2.5 Use structured outputs

2.6 How CrewAI works under the hood

2.7 Summary