Building an API-Ready Agent with CrewAI: A Local HTTP Automation Example
When integrating agents with external APIs, dealing with connectivity errors (like Tunnel connection failed: 404 Not Found
) is common, especially in environments with strict proxy configurations.
However, using CrewAI, you can create a local and modular agent system that programmatically interacts with REST APIs using structured tools and workflows.
In this blog, we’ll walk you through how to build a CrewAI-based agent that can perform HTTP GET
, POST
, and PUT
requests using a custom tool and simple YAML-based task-agent configurations.
Project Overview
We’ll create:
- A custom tool for handling REST API requests
- An agent that uses this tool
- Task definitions for
GET
,POST
, andPUT
operations - A Crew that runs these tasks in sequence
- A CLI runner for user input and agent execution
Create a folder with name simple-crewai-restapi
and execute below command to create env for this project
python -m venv env
.\env\Scripts\activate
Prepare requirements.txt with for the give module to install
pip install -r requirements.txt
crewai
requests
dotenv
crewai[tools]
execute command (env) C:\vscode-python-workspace\simple-crewai>crewai
Note:- if you get this error ValueError: The onnxruntime python package is not installed. Please install it with pip install onnxruntime
install following old packages
pip install onnxruntime==1.20.0
and reconfirm you are able to execute crewai commmand properly
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | (env) C:\vscode-python-workspace\simple-crewai>crewai Usage: crewai [OPTIONS] COMMAND [ARGS]... Top-level command group for crewai. Options: --version Show the version and exit. --help Show this message and exit. Commands: chat Start a conversation with the Crew, collecting... create Create a new crew, or flow. deploy Deploy the Crew CLI group. flow Flow related commands. install Install the Crew. log-tasks-outputs Retrieve your latest crew.kickoff() task outputs. login Sign Up/Login to CrewAI+. org Organization management commands. replay Replay the crew execution from a specific task. reset-memories Reset the crew memories (long, short, entity,... run Run the Crew. signup Sign Up/Login to CrewAI+. test Test the crew and evaluate the results. tool Tool Repository related commands. train Train the crew. update Update the pyproject.toml of the Crew project to use... version Show the installed version of crewai. (env) C:\vscode-python-workspace\simple-crewai> |
Step 1: Create a Custom HTTP Tool
Create a new file at src/my_project/tools/HttpAgentTool.py
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | # src/my_project/tools/HttpAgentTool.py from typing import ClassVar, Dict, Any import requests import json from crewai.tools import BaseTool class HttpAgentTool(BaseTool): inputs: ClassVar[Dict[str, Any]] = {'method': '', 'url': '', 'data': {}} def __init__(self,input_data): super().__init__() HttpAgentTool.inputs = input_data print("self.input_data",self.inputs) name: str = "REST API Tool" # The name of the tool description: str = "A tool for executing REST API requests (GET, POST, PUT). Expects 'method' (string, e.g., 'GET', 'POST', 'PUT'), 'url' (string), and optionally 'data' (dictionary for POST/PUT)." def _run(self): method = HttpAgentTool.inputs.get("method") url = HttpAgentTool.inputs.get("url") data = HttpAgentTool.inputs.get("data", {}) headers = {"Content-Type": "application/json"} try: method = method.upper() if method == "POST": response = requests.post(url, json=data, headers=headers) elif method == "PUT": response = requests.put(url, json=data, headers=headers) elif method == "GET": response = requests.get(url, headers=headers) else: return {"error": f"Unsupported method: {method}"} response.raise_for_status() return response.json() except requests.exceptions.RequestException as e: return f"Error during request to {url}: {e}" except json.JSONDecodeError: return f"Failed to decode JSON from response. Text: {response.text}" |
Step 2: Define the Agent agents.yaml
in side config folder.
Create your agent configuration in agents.yaml
:
1 2 3 4 5 6 7 | simple_api_agent: role: 'API Interaction Specialist' goal: 'Interact with APIs by making GET, POST, and PUT requests as instructed.' backstory: > An expert in handling API requests, you can understand user requirements for interacting with web services. You formulate and execute the necessary HTTP requests to fetch or send data, ensuring every request is sent correctly. |
Step 3: Define the Tasks mytasks.yaml
in side config folder.
In tasks.yaml
, define your REST API operation tasks:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | http_get_task: description: > Execute an HTTP GET request to the URL: {url}. The method for the request is {method}. expected_output: > The JSON response from the API. If the request fails, provide a detailed error message. http_post_task: description: > Execute an HTTP POST request to the URL: {url}. The method for the request is {method}. The JSON data for the request body is: {data} expected_output: > The JSON response from the API after the POST operation. If the request fails, provide a detailed error message. http_put_task: description: > Execute an HTTP PUT request to the URL: {url}. The method for the request is {method}. The JSON data for the request body is: {data} expected_output: > The JSON response from the API after the PUT operation. If the request fails, provide a detailed error message. |
Step 4: Assemble the Crew
In ApiInteractionCrew.py
, define the agents and tasks using CrewAI’s project base class:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | # ApiInteractionCrew.py from crewai import Agent, Crew, Task, Process from crewai.project import CrewBase, agent, task, crew from HttpAgentTool import HttpAgentTool @CrewBase class ApiInteractionCrew: def __init__(self, input_data): self.input_data = input_data @agent def simple_api_agent(self, gemini_llm) -> Agent: return Agent( config=self.agents_config['simple_api_agent'], tools=[HttpAgentTool(self.input_data)], llm=gemini_llm, verbose=True, ) @task def http_get_task(self, agent: Agent) -> Task: return Task( config=self.tasks_config['http_get_task'], agent=agent ) @task def http_post_task(self, agent: Agent) -> Task: return Task( config=self.tasks_config['http_post_task'], agent=agent ) @task def http_put_task(self, agent: Agent) -> Task: return Task( config=self.tasks_config['http_put_task'], agent=agent ) |
Step 5: Create a Main Script and Run the Agent via CLI
Create a main.py
script in your project root to launch the crew with dynamic input:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | # main.py import json from ApiInteractionCrew import ApiInteractionCrew from crewai import Crew import os from crewai import Agent, Task, Crew, Process, LLM from dotenv import load_dotenv load_dotenv() # Load environment variables from .env # Read your API key from the environment variable GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY") #print("\n--- gemini_api_key:", GOOGLE_API_KEY) # Use Gemini 1.5 Pro or other Gemini models # Note the format: 'gemini/model-name' gemini_llm = LLM( model='gemini/gemini-2.5-flash-preview-05-20', # Or 'gemini/gemini-1.5-flash', etc. api_key=GOOGLE_API_KEY, temperature=0.7, # Adjust temperature for creativity (0.0 to 1.0) # Add other parameters as needed, e.g., max_tokens, top_p, etc. ) def run(): method = input("Enter HTTP method (GET, POST, PUT): ").strip().upper() url = input("Enter the API URL: ").strip() data = {} if method in ["POST", "PUT"]: json_input = input("Enter JSON request data: ").strip() try: data = json.loads(json_input) except json.JSONDecodeError: print("Invalid JSON format. Exiting.") return inputs = { "method": method, "url": url, "data": data } crew_factory = ApiInteractionCrew(inputs) agent = crew_factory.simple_api_agent(gemini_llm) task_description = "" expected_output_description = "" if method == "GET": task_description = f"Perform a GET request to the URL: {url}. Use the 'REST API Tool' with method='GET' and url='{url}'." expected_output_description = "The JSON response from the GET request." elif method == "POST": task_description = f"Perform a POST request to the URL: {url} with the following JSON data: {json.dumps(data)}. Use the 'REST API Tool' with method='POST', url='{url}', and data={json.dumps(data)}." expected_output_description = "The JSON response from the POST request." elif method == "PUT": task_description = f"Perform a PUT request to the URL: {url} with the following JSON data: {json.dumps(data)}. Use the 'REST API Tool' with method='PUT', url='{url}', and data={json.dumps(data)}." expected_output_description = "The JSON response from the PUT request." if not task_description: task = None # Ensure task is None if method is unsupported else: task = Task( description=task_description, agent=agent, expected_output=expected_output_description ) if task is None: # Check if task was successfully created print(f"Unsupported method '{method}'. Exiting.") return crew = Crew( agents=[agent], tasks=[task], verbose=True ) crew.kickoff(inputs=inputs) if __name__ == "__main__": run() |
Step 6: Run the Program and Test It Out
From your terminal, run:
1 | python main.py |
You’ll be prompted to enter:
- HTTP Method (
GET
,POST
, orPUT
) - API Endpoint (e.g.,
https://api.restful-api.dev/objects/7
) - JSON Body (for
POST
orPUT
)
The crew will then sequentially run the tasks using your input and print the output for each REST operation.
Conclusion
With HttpAgentTool
and CrewAI, you can quickly prototype intelligent agents that automate API interactions. This modular setup keeps things clean, scalable, and easy to maintain — perfect for backend automations, API testing, or bot development.
Need to expand it? Add error handling, support for DELETE
, authentication headers, or even multiple agents for parallel tasks!
Code available on https://github.com/shdhumale/simple-crewai-restapi.git
Get Output:-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | (env) C:\vscode-python-workspace\simple-crewai-restapi>python main.py Enter HTTP method (GET, POST, PUT): get Enter the API URL: https://api.restful-api.dev/objects/7 self.input_data {'method': 'GET', 'url': 'https://api.restful-api.dev/objects/7', 'data': {}} ╭───────────────────────────────────────────────────────── Crew Execution Started ──────────────────────────────────────────────────────────╮ │ │ │ Crew Execution Started │ │ Name: crew │ │ ID: ee6a5d1d-933c-4cf9-aec0-563f5602f018 │ │ Tool Args: │ │ │ │ │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ � Crew: crew └── � Task: a55dd394-9d6e-405f-8fd1-aa266b08089a Status: Executing Task... ╭──────────────────────────────────────────────────────────── � Agent Started ─────────────────────────────────────────────────────────────╮ │ │ │ Agent: API Interaction Specialist │ │ │ │ Task: Perform a GET request to the URL: https://api.restful-api.dev/objects/7. Use the 'REST API Tool' with method='GET' and │ │ url='https://api.restful-api.dev/objects/7'. │ │ │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ � Crew: crew └── � Task: a55dd394-9d6e-405f-8fd1-aa266b08089a Status: Executing Task... └── � Used REST API Tool (1) ╭───────────────────────────────────────────────────────── � Agent Tool Execution ─────────────────────────────────────────────────────────╮ │ │ │ Agent: API Interaction Specialist │ │ │ │ Thought: Action: REST API Tool │ │ │ │ Using Tool: REST API Tool │ │ │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────── Tool Input ────────────────────────────────────────────────────────────────╮ │ │ │ "{\"method\": \"GET\", \"url\": \"https://api.restful-api.dev/objects/7\"}" │ │ │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────── Tool Output ───────────────────────────────────────────────────────────────╮ │ │ │ {'id': '7', 'name': 'Apple MacBook Pro 16', 'data': {'year': 2019, 'price': 1849.99, 'CPU model': 'Intel Core i9', 'Hard disk size': '1 │ │ TB'}} │ │ │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ � Crew: crew └── � Task: a55dd394-9d6e-405f-8fd1-aa266b08089a Status: Executing Task... └── � Used REST API Tool (1) ╭────────────────────────────────────────────────────────── <img draggable="false" role="img" class="emoji" alt=" │ │ │ Agent: API Interaction Specialist │ │ │ │ Final Answer: │ │ {"id": "7", "name": "Apple MacBook Pro 16", "data": {"year": 2019, "price": 1849.99, "CPU model": "Intel Core i9", "Hard disk size": "1 │ │ TB"}} │ │ │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ � Crew: crew └── � Task: a55dd394-9d6e-405f-8fd1-aa266b08089a Assigned to: API Interaction Specialist Status: <img draggable="false" role="img" class="emoji" alt=" └── � Used REST API Tool (1) ╭───────────────────────────────────────────────────────────── Task Completion ─────────────────────────────────────────────────────────────╮ │ │ │ Task Completed │ │ Name: a55dd394-9d6e-405f-8fd1-aa266b08089a │ │ Agent: API Interaction Specialist │ │ Tool Args: │ │ │ │ │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────── Crew Completion ─────────────────────────────────────────────────────────────╮ │ │ │ Crew Execution Completed │ │ Name: crew │ │ ID: ee6a5d1d-933c-4cf9-aec0-563f5602f018 │ │ Tool Args: │ │ Final Output: {"id": "7", "name": "Apple MacBook Pro 16", "data": {"year": 2019, "price": 1849.99, "CPU model": "Intel Core i9", "Hard │ │ disk size": "1 TB"}} │ │ │ │ │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ |
Output for POST:-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | (env) C:\vscode-python-workspace\simple-crewai-restapi>python main.py Enter HTTP method (GET, POST, PUT): post Enter the API URL: https://api.restful-api.dev/objects Enter JSON request data: {"name": "Apple MacBook Pro 16","data": {"year": 2019,"price": 1849.99,"CPU model": "Intel Core i9","Hard disk size" : "1 TB"}} self.input_data {'method': 'POST', 'url': 'https://api.restful-api.dev/objects', 'data': {'name': 'Apple MacBook Pro 16', 'data': {'year': 20 19, 'price': 1849.99, 'CPU model': 'Intel Core i9', 'Hard disk size': '1 TB'}}} ╭───────────────────────────────────────────────────────── Crew Execution Started ──────────────────────────────────────────────────────────╮ │ │ │ Crew Execution Started │ │ Name: crew │ │ ID: 69a85079-4d09-4097-853e-6b0d40e8eca7 │ │ Tool Args: │ │ │ │ │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ � Crew: crew └── � Task: 065cc2b1-c7c9-40ce-b997-cba03c0aed70 Status: Executing Task... ╭──────────────────────────────────────────────────────────── � Agent Started ─────────────────────────────────────────────────────────────╮ │ │ │ Agent: API Interaction Specialist │ │ │ │ Task: Perform a POST request to the URL: https://api.restful-api.dev/objects with the following JSON data: {"name": "Apple MacBook Pro │ │ 16", "data": {"year": 2019, "price": 1849.99, "CPU model": "Intel Core i9", "Hard disk size": "1 TB"}}. Use the 'REST API Tool' with │ │ method='POST', url='https://api.restful-api.dev/objects', and data={"name": "Apple MacBook Pro 16", "data": {"year": 2019, "price": │ │ 1849.99, "CPU model": "Intel Core i9", "Hard disk size": "1 TB"}}. │ │ │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ � Crew: crew └── � Task: 065cc2b1-c7c9-40ce-b997-cba03c0aed70 Status: Executing Task... └── � Used REST API Tool (1) ╭───────────────────────────────────────────────────────── � Agent Tool Execution ─────────────────────────────────────────────────────────╮ │ │ │ Agent: API Interaction Specialist │ │ │ │ Thought: Action: REST API Tool │ │ │ │ Using Tool: REST API Tool │ │ │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────── Tool Input ────────────────────────────────────────────────────────────────╮ │ │ │ "{\"method\": \"POST\", \"url\": \"https://api.restful-api.dev/objects\", \"data\": {\"name\": \"Apple MacBook Pro 16\", \"data\": {\"y │ │ │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────── Tool Output ───────────────────────────────────────────────────────────────╮ │ │ │ {'id': 'ff8081819782e69e0197c10d23b92a69', 'name': 'Apple MacBook Pro 16', 'createdAt': '2025-06-30T13:35:53.273+00:00', 'data': │ │ {'year': 2019, 'price': 1849.99, 'CPU model': 'Intel Core i9', 'Hard disk size': '1 TB'}} │ │ │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ � Crew: crew └── � Task: 065cc2b1-c7c9-40ce-b997-cba03c0aed70 Status: Executing Task... └── � Used REST API Tool (1) ╭────────────────────────────────────────────────────────── <img draggable="false" role="img" class="emoji" alt=" │ │ │ Agent: API Interaction Specialist │ │ │ │ Final Answer: │ │ {"id": "ff8081819782e69e0197c10d23b92a69", "name": "Apple MacBook Pro 16", "createdAt": "2025-06-30T13:35:53.273+00:00", "data": │ │ {"year": 2019, "price": 1849.99, "CPU model": "Intel Core i9", "Hard disk size": "1 TB"}} │ │ │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ � Crew: crew └── � Task: 065cc2b1-c7c9-40ce-b997-cba03c0aed70 Assigned to: API Interaction Specialist Status: <img draggable="false" role="img" class="emoji" alt=" └── � Used REST API Tool (1) ╭───────────────────────────────────────────────────────────── Task Completion ─────────────────────────────────────────────────────────────╮ │ │ │ Task Completed │ │ Name: 065cc2b1-c7c9-40ce-b997-cba03c0aed70 │ │ Agent: API Interaction Specialist │ │ Tool Args: │ │ │ │ │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────── Crew Completion ─────────────────────────────────────────────────────────────╮ │ │ │ Crew Execution Completed │ │ Name: crew │ │ ID: 69a85079-4d09-4097-853e-6b0d40e8eca7 │ │ Tool Args: │ │ Final Output: {"id": "ff8081819782e69e0197c10d23b92a69", "name": "Apple MacBook Pro 16", "createdAt": "2025-06-30T13:35:53.273+00:00", │ │ "data": {"year": 2019, "price": 1849.99, "CPU model": "Intel Core i9", "Hard disk size": "1 TB"}} │ │ │ │ │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ |
Output for PUT:-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | (env) C:\vscode-python-workspace\simple-crewai-restapi>python main.py Enter HTTP method (GET, POST, PUT): post Enter the API URL: https://api.restful-api.dev/objects Enter JSON request data: {"name": "Apple MacBook Pro 16","data": {"year": 2019,"price": 1849.99,"CPU model": "Intel Co re i9","Hard disk size": "1 TB"}} self.input_data {'method': 'POST', 'url': 'https://api.restful-api.dev/objects', 'data': {'name': 'Apple MacBook Pro 1 6', 'data': {'year': 2019, 'price': 1849.99, 'CPU model': 'Intel Core i9', 'Hard disk size': '1 TB'}}} ╭────────────────────────────────────────────── Crew Execution Started ──────────────────────────────────────────────╮ │ │ │ Crew Execution Started │ │ Name: crew │ │ ID: d1f9d61b-56b0-4b41-a5c4-d83c6a87f94b │ │ Tool Args: │ │ │ │ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ � Crew: crew └── � Task: 38dcdcd3-e4de-4003-9088-68b6b582c065 Status: Executing Task... ╭───────────────────────────────────────────────── � Agent Started ─────────────────────────────────────────────────╮ │ │ │ Agent: API Interaction Specialist │ │ │ │ Task: Perform a POST request to the URL: https://api.restful-api.dev/objects with the following JSON data: │ │ {"name": "Apple MacBook Pro 16", "data": {"year": 2019, "price": 1849.99, "CPU model": "Intel Core i9", "Hard │ │ disk size": "1 TB"}}. Use the 'REST API Tool' with method='POST', url='https://api.restful-api.dev/objects', and │ │ data={"name": "Apple MacBook Pro 16", "data": {"year": 2019, "price": 1849.99, "CPU model": "Intel Core i9", │ │ "Hard disk size": "1 TB"}}. │ │ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ � Crew: crew └── � Task: 38dcdcd3-e4de-4003-9088-68b6b582c065 Status: Executing Task... └── � Used REST API Tool (1) ╭───────────────────────────────────────────── � Agent Tool Execution ──────────────────────────────────────────────╮ │ │ │ Agent: API Interaction Specialist │ │ │ │ Thought: Action: REST API Tool │ │ │ │ Using Tool: REST API Tool │ │ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────── Tool Input ────────────────────────────────────────────────────╮ │ │ │ "{\"method\": \"POST\", \"url\": \"https://api.restful-api.dev/objects\", \"data\": {\"name\": \"Apple MacBook P │ │ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────── Tool Output ────────────────────────────────────────────────────╮ │ │ │ {'id': 'ff8081819782e69e0197c11916ee2a86', 'name': 'Apple MacBook Pro 16', 'createdAt': │ │ '2025-06-30T13:48:56.431+00:00', 'data': {'year': 2019, 'price': 1849.99, 'CPU model': 'Intel Core i9', 'Hard │ │ disk size': '1 TB'}} │ │ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ � Crew: crew └── � Task: 38dcdcd3-e4de-4003-9088-68b6b582c065 Status: Executing Task... └── � Used REST API Tool (1) ╭────────────────────────────────────────────── <img draggable="false" role="img" class="emoji" alt=" │ │ │ Agent: API Interaction Specialist │ │ │ │ Final Answer: │ │ {'id': 'ff8081819782e69e0197c11916ee2a86', 'name': 'Apple MacBook Pro 16', 'createdAt': │ │ '2025-06-30T13:48:56.431+00:00', 'data': {'year': 2019, 'price': 1849.99, 'CPU model': 'Intel Core i9', 'Hard │ │ disk size': '1 TB'}} │ │ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ � Crew: crew └── � Task: 38dcdcd3-e4de-4003-9088-68b6b582c065 Assigned to: API Interaction Specialist Status: <img draggable="false" role="img" class="emoji" alt=" └── � Used REST API Tool (1) ╭───────────────────────────────────────────────── Task Completion ──────────────────────────────────────────────────╮ │ │ │ Task Completed │ │ Name: 38dcdcd3-e4de-4003-9088-68b6b582c065 │ │ Agent: API Interaction Specialist │ │ Tool Args: │ │ │ │ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────── Crew Completion ──────────────────────────────────────────────────╮ (env) C:\vscode-python-workspace\simple-crewai-restapi>python main.py Enter HTTP method (GET, POST, PUT): put Enter the API URL: https://api.restful-api.dev/objects/ff8081819782e69e0197c11916ee2a86 Enter JSON request data: {"name": "Apple MacBook Pro 16","data": {"year": 2019,"price": 2049.99,"CPU model": "Intel Co re i9","Hard disk size": "1 TB","color": "silver"}} self.input_data {'method': 'PUT', 'url': 'https://api.restful-api.dev/objects/ff8081819782e69e0197c11916ee2a86', 'data ': {'name': 'Apple MacBook Pro 16', 'data': {'year': 2019, 'price': 2049.99, 'CPU model': 'Intel Core i9', 'Hard disk size': '1 TB', 'color': 'silver'}}} ╭────────────────────────────────────────────── Crew Execution Started ──────────────────────────────────────────────╮ │ │ │ Crew Execution Started │ │ Name: crew │ │ ID: 8aec4ca2-d8d2-49dd-b5bb-f253269cadbf │ │ Tool Args: │ │ │ │ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ � Crew: crew └── � Task: a7e7a426-fb2e-442c-9fa2-ae68f5e8d0ce Status: Executing Task... ╭───────────────────────────────────────────────── � Agent Started ─────────────────────────────────────────────────╮ │ │ │ Agent: API Interaction Specialist │ │ │ │ Task: Perform a PUT request to the URL: https://api.restful-api.dev/objects/ff8081819782e69e0197c11916ee2a86 │ │ with the following JSON data: {"name": "Apple MacBook Pro 16", "data": {"year": 2019, "price": 2049.99, "CPU │ │ model": "Intel Core i9", "Hard disk size": "1 TB", "color": "silver"}}. Use the 'REST API Tool' with │ │ method='PUT', url='https://api.restful-api.dev/objects/ff8081819782e69e0197c11916ee2a86', and data={"name": │ │ "Apple MacBook Pro 16", "data": {"year": 2019, "price": 2049.99, "CPU model": "Intel Core i9", "Hard disk size": │ │ "1 TB", "color": "silver"}}. │ │ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ � Crew: crew └── � Task: a7e7a426-fb2e-442c-9fa2-ae68f5e8d0ce Status: Executing Task... └── � Used REST API Tool (1) ╭───────────────────────────────────────────── � Agent Tool Execution ──────────────────────────────────────────────╮ │ │ │ Agent: API Interaction Specialist │ │ │ │ Thought: Action: REST API Tool │ │ │ │ Using Tool: REST API Tool │ │ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────── Tool Input ────────────────────────────────────────────────────╮ │ │ │ "{\"method\": \"PUT\", \"url\": \"https://api.restful-api.dev/objects/ff8081819782e69e0197c11916ee2a86\", \"data │ │ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────── Tool Output ────────────────────────────────────────────────────╮ │ │ │ {'id': 'ff8081819782e69e0197c11916ee2a86', 'name': 'Apple MacBook Pro 16', 'updatedAt': │ │ '2025-06-30T13:50:01.065+00:00', 'data': {'year': 2019, 'price': 2049.99, 'CPU model': 'Intel Core i9', 'Hard │ │ disk size': '1 TB', 'color': 'silver'}} │ │ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ � Crew: crew └── � Task: a7e7a426-fb2e-442c-9fa2-ae68f5e8d0ce Status: Executing Task... └── � Used REST API Tool (1) ╭────────────────────────────────────────────── <img draggable="false" role="img" class="emoji" alt=" │ │ │ Agent: API Interaction Specialist │ │ │ │ Final Answer: │ │ {'id': 'ff8081819782e69e0197c11916ee2a86', 'name': 'Apple MacBook Pro 16', 'updatedAt': │ │ '2025-06-30T13:50:01.065+00:00', 'data': {'year': 2019, 'price': 2049.99, 'CPU model': 'Intel Core i9', 'Hard │ │ disk size': '1 TB', 'color': 'silver'}} │ │ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ � Crew: crew └── � Task: a7e7a426-fb2e-442c-9fa2-ae68f5e8d0ce Assigned to: API Interaction Specialist Status: <img draggable="false" role="img" class="emoji" alt=" └── � Used REST API Tool (1) ╭───────────────────────────────────────────────── Task Completion ──────────────────────────────────────────────────╮ │ │ │ Task Completed │ │ Name: a7e7a426-fb2e-442c-9fa2-ae68f5e8d0ce │ │ Agent: API Interaction Specialist │ │ Tool Args: │ │ │ │ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────── Crew Completion ──────────────────────────────────────────────────╮ │ │ │ Crew Execution Completed │ │ Name: crew │ │ ID: 8aec4ca2-d8d2-49dd-b5bb-f253269cadbf │ │ Tool Args: │ │ Final Output: {'id': 'ff8081819782e69e0197c11916ee2a86', 'name': 'Apple MacBook Pro 16', 'updatedAt': │ │ '2025-06-30T13:50:01.065+00:00', 'data': {'year': 2019, 'price': 2049.99, 'CPU model': 'Intel Core i9', 'Hard │ │ disk size': '1 TB', 'color': 'silver'}} │ │ │ │ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ |