### Quick Start with Free Tier Source: https://docs.crewai.com/en/tools/search-research/youai-search Example of initializing an Agent with the MCPServerHTTP client using the free tier endpoint. ```python from crewai import Agent, Task, Crew from crewai.mcp import MCPServerHTTP # Free tier — no API key needed, 100 queries/day researcher = Agent( role= ``` -------------------------------- ### Quick Start with Structured Configurations Source: https://docs.crewai.com/en/mcp/overview Demonstrates how to import MCP server classes and initialize an Agent with structured MCP configurations. ```python from crewai import Agent, Task, Crew from crewai.mcp import MCPServerStdio, MCPServerHTTP, MCPServerSSE # Create agent with structured MCP configurations research_agent = Agent( role="Research Analyst", goal="Find and analyze information using advanced search tools", ``` -------------------------------- ### Agent Setup Prompt Source: https://docs.crewai.com/datadog A shell script prompt designed to guide an AI agent through the installation and configuration of a CrewAI development environment. ```bash npx skills add crewaiinc/skills # Setup steps: 1. Check python3 --version. CrewAI requires Python >=3.10 and <3.14. 2. Install uv if missing: curl -LsSf https://astral.sh/uv/install.sh | sh 3. Source the uv environment if needed: source "$HOME/.local/bin/env" 4. Install the CrewAI CLI: uv tool install crewai 5. Verify the CLI: crewai version crewai create --help 6. Create a project: CREWAI_DMN=true crewai create 7. After project creation, inspect the generated files before editing. 8. Run: crewai install crewai run ``` -------------------------------- ### Define a Before Kickoff Hook Source: https://docs.crewai.com/learn/before-and-after-kickoff-hooks Example of defining a function to be executed before the crew starts its tasks, typically used for input preprocessing or environment setup. ```python from crewai import Crew, Agent, Task def before_kickoff(inputs): print(f"Preprocessing inputs: {inputs}") inputs['extra_data'] = 'added_value' return inputs crew = Crew( agents=[...], tasks=[...], before_kickoff=before_kickoff ) ``` -------------------------------- ### Example Output of Installed CrewAI Source: https://docs.crewai.com/en/installation This shows the expected output format when listing installed tools. ```shellscript crewai v0.102.0 - crewai ``` -------------------------------- ### Initialize Agent with File Support Source: https://docs.crewai.com/en/concepts/files Demonstrates how to import Agent and ImageFile classes to configure an agent for visual analysis tasks. ```python from crewai import Agent from crewai_files import ImageFile agent = Agent( role="Image Analyst", goal="Analyze images", backstory="Expert at visual analysis", llm= ``` -------------------------------- ### Initialize Agent with Tools Source: https://docs.crewai.com/en/concepts/agents Demonstrates how to import the Agent class and tools, instantiate the tools, and assign them to an agent. ```python from crewai import Agent from crewai_tools import SerperDevTool, WikipediaTools # Create tools search_tool = SerperDevTool() wiki_tool = WikipediaTools() # Add tools to agent researcher = Agent( role="AI Technology Researcher", goal="Research the latest AI developments", tools=[ ``` -------------------------------- ### Installing and using a CrewAI tool Source: https://docs.crewai.com/llms-full.txt Commands to install a tool and an example of how to import it into a CrewAI agent. ```bash pip install crewai-geolocate ``` ```bash uv add crewai-geolocate ``` ```python from crewai_geolocate import GeolocateTool agent = Agent( role="Location Analyst", tools=[GeolocateTool()], # ... ) ``` -------------------------------- ### Declare Flow Start Decorators Source: https://docs.crewai.com/concepts/flows Examples of how to use the @start decorator to define entry points for a flow. ```python @start() ``` ```python @start("method_or_label") ``` -------------------------------- ### Assigning Tools to Agents Source: https://docs.crewai.com/en/concepts/tools Example showing how to initialize an agent with specific tools and verbose logging enabled. ```python writer = Agent( role='Content Writer', goal='Craft engaging blog posts about the AI industry', backstory='A skilled writer with a passion for technology.', tools=[docs_tool, file_tool], verbose=True ) ``` -------------------------------- ### Streaming Flow Execution Example Source: https://docs.crewai.com/edge/en/learn/streaming-flow-execution Example demonstrating the setup of a task, crew, and the kickoff process for streaming flow execution. ```python topic = "..." expected_output = "Research findings", agent = researcher, ) crew = Crew(agents=[researcher], tasks=[task]) result = crew.kickoff() self.state.research = result.raw return ``` -------------------------------- ### Configuring a Multi-Capability Agent Source: https://docs.crewai.com/en/concepts/agent-capabilities This example demonstrates how to initialize an Agent with multiple tools including SerperDevTool, FileReadTool, and CodeInterpreterTool. ```python from crewai import Agent from crewai_tools import SerperDevTool, FileReadTool, CodeInterpreterTool # A fully-equipped research agent researcher = Agent( role="Senior Research Analyst", goal="Produce comprehensive market analysis reports", backstory="Expert analyst with deep industry knowledge", ) ``` -------------------------------- ### Agent Setup Prompt Generation Source: https://docs.crewai.com/security.mdx A JavaScript snippet used to copy a comprehensive environment setup prompt to the clipboard, including instructions for installing CrewAI and its dependencies. ```javascript onClick: async event => { const prompt = `Set up this environment so I can build with CrewAI. First install the official CrewAI coding-agent skills if this environment supports npx: npx skills add crewaiinc/skills If npx is missing or the current agent cannot load skills, do not fail the whole setup. Report the exact issue and continue using the CrewAI docs directly. Use these CrewAI docs as source of truth before making assumptions: - https://skills.crewai.com - https://docs.crewai.com/llms.txt - https://docs.crewai.com/en/installation - https://docs.crewai.com/en/guides/coding-tools/build-with-ai Setup steps: 1. Check python3 --version. CrewAI requires Python >=3.10 and <3.14. 2. Install uv if missing: curl -LsSf https://astral.sh/uv/install.sh | sh 3. Source the uv environment if needed: source "$HOME/.local/bin/env" 4. Install the CrewAI CLI: uv tool install crewai 5. Verify the CLI: crewai version crewai create --help 6. Create a project: CREWAI_DMN=true crewai create 7. After project creation, inspect the generated files before editing. 8. Run: crewai install crewai run Do not hardcode API keys. Use .env. Do not invent CLI flags. Validate with crewai --help or crewai create --help. If a command fails, show the exact command and error, explain the likely cause, fix what you can safely fix, and retry once.`; const button = event.currentTarget; const resetTimeout = button.dataset.resetTimeout; if (resetTimeout) { window.clearTimeout(Number(resetTimeout)); } try { await navigator.clipboard.writeText(prompt); button.textContent = "Copied"; } catch { button.textContent = "Copy failed"; } finally { button.dataset.resetTimeout = String(window.setTimeout(() => { button.textContent = "Copy agent setup prompt"; delete button.dataset.resetTimeout; }, 1600)); } } ``` -------------------------------- ### Configuring Agent and Task for Human Input Source: https://docs.crewai.com/en/learn/human-input-on-execution Example of setting up an agent with delegation and cache settings, followed by task initialization. ```python "With a deep understanding of the tech industry, you transform complex concepts into compelling narratives." ), verbose=True, allow_delegation=True, tools=[search_tool], cache=False, # Disable cache for this agent ) # Create tasks for your agents task1 = Task( description=( ``` -------------------------------- ### Quick Setup Summary Source: https://docs.crewai.com/llms-full.txt A combined snippet showing the installation and initialization process for Neatlogs. ```bash pip install neatlogs import neatlogs neatlogs.init("YOUR_API_KEY") ```