diff --git a/docs/concepts/flows.mdx b/docs/concepts/flows.mdx index b0bb07648..b7793c60c 100644 --- a/docs/concepts/flows.mdx +++ b/docs/concepts/flows.mdx @@ -545,16 +545,20 @@ The `third_method` and `fourth_method` listen to the output of the `second_metho When you run this Flow, the output will change based on the random boolean value generated by the `start_method`. -## Adding LiteAgent to Flows +## Adding Agents to Flows -LiteAgents can be seamlessly integrated into your flows, providing a lightweight alternative to full Crews when you need simpler, focused task execution. Here's an example of how to use a LiteAgent within a flow to perform market research: +Agents can be seamlessly integrated into your flows, providing a lightweight alternative to full Crews when you need simpler, focused task execution. Here's an example of how to use an Agent within a flow to perform market research: ```python -from typing import List, cast -from crewai_tools.tools.website_search.website_search_tool import WebsiteSearchTool +import asyncio +from typing import Any, Dict, List + +from crewai_tools import SerperDevTool from pydantic import BaseModel, Field + +from crewai.agent import Agent from crewai.flow.flow import Flow, listen, start -from crewai.lite_agent import LiteAgent + # Define a structured output format class MarketAnalysis(BaseModel): @@ -562,28 +566,30 @@ class MarketAnalysis(BaseModel): market_size: str = Field(description="Estimated market size") competitors: List[str] = Field(description="Major competitors in the space") + # Define flow state class MarketResearchState(BaseModel): product: str = "" analysis: MarketAnalysis | None = None + +# Create a flow class class MarketResearchFlow(Flow[MarketResearchState]): @start() - def initialize_research(self): + def initialize_research(self) -> Dict[str, Any]: print(f"Starting market research for {self.state.product}") + return {"product": self.state.product} @listen(initialize_research) - def analyze_market(self): - # Create a LiteAgent for market research - analyst = LiteAgent( + async def analyze_market(self) -> Dict[str, Any]: + # Create an Agent for market research + analyst = Agent( role="Market Research Analyst", goal=f"Analyze the market for {self.state.product}", backstory="You are an experienced market analyst with expertise in " "identifying market trends and opportunities.", - llm="gpt-4o", - tools=[WebsiteSearchTool()], + tools=[SerperDevTool()], verbose=True, - response_format=MarketAnalysis, ) # Define the research query @@ -592,49 +598,65 @@ class MarketResearchFlow(Flow[MarketResearchState]): 1. Key market trends 2. Market size 3. Major competitors - + Format your response according to the specified structure. """ - # Execute the analysis - result = analyst.kickoff(query) - self.state.analysis = cast(MarketAnalysis, result.pydantic) - return result.pydantic + # Execute the analysis with structured output format + result = await analyst.kickoff_async(query, response_format=MarketAnalysis) + if result.pydantic: + print("result", result.pydantic) + else: + print("result", result) + + # Return the analysis to update the state + return {"analysis": result.pydantic} @listen(analyze_market) - def present_results(self): - analysis = self.state.analysis - if analysis is None: - print("No analysis results available") - return - + def present_results(self, analysis) -> None: print("\nMarket Analysis Results") print("=====================") - print("\nKey Market Trends:") - for trend in analysis.key_trends: - print(f"- {trend}") + if isinstance(analysis, dict): + # If we got a dict with 'analysis' key, extract the actual analysis object + market_analysis = analysis.get("analysis") + else: + market_analysis = analysis - print(f"\nMarket Size: {analysis.market_size}") + if market_analysis and isinstance(market_analysis, MarketAnalysis): + print("\nKey Market Trends:") + for trend in market_analysis.key_trends: + print(f"- {trend}") + + print(f"\nMarket Size: {market_analysis.market_size}") + + print("\nMajor Competitors:") + for competitor in market_analysis.competitors: + print(f"- {competitor}") + else: + print("No structured analysis data available.") + print("Raw analysis:", analysis) - print("\nMajor Competitors:") - for competitor in analysis.competitors: - print(f"- {competitor}") # Usage example -flow = MarketResearchFlow() -result = flow.kickoff(inputs={"product": "AI-powered chatbots"}) +async def run_flow(): + flow = MarketResearchFlow() + result = await flow.kickoff_async(inputs={"product": "AI-powered chatbots"}) + return result + + +# Run the flow +if __name__ == "__main__": + asyncio.run(run_flow()) ``` -This example demonstrates several key features of using LiteAgents in flows: +This example demonstrates several key features of using Agents in flows: 1. **Structured Output**: Using Pydantic models to define the expected output format (`MarketAnalysis`) ensures type safety and structured data throughout the flow. 2. **State Management**: The flow state (`MarketResearchState`) maintains context between steps and stores both inputs and outputs. -3. **Tool Integration**: LiteAgents can use tools (like `WebsiteSearchTool`) to enhance their capabilities. - -If you want to learn more about LiteAgents, check out the [LiteAgent](/concepts/lite-agent) page. +3. **Tool Integration**: Agents can use tools (like `WebsiteSearchTool`) to enhance their capabilities. ## Adding Crews to Flows diff --git a/docs/concepts/lite-agent.mdx b/docs/concepts/lite-agent.mdx index e7208dae6..974bb900a 100644 --- a/docs/concepts/lite-agent.mdx +++ b/docs/concepts/lite-agent.mdx @@ -93,11 +93,15 @@ This example demonstrates the core features of a LiteAgent: For more complex scenarios, you can integrate LiteAgents into a Flow. Here's an example of a market research flow: ````python -from typing import List +import asyncio +from typing import Any, Dict, List + +from crewai_tools import SerperDevTool from pydantic import BaseModel, Field -from crewai.flow.flow import Flow, start, listen -from crewai.lite_agent import LiteAgent -from crewai.tools import WebSearchTool + +from crewai.agent import Agent +from crewai.flow.flow import Flow, listen, start + # Define a structured output format class MarketAnalysis(BaseModel): @@ -105,29 +109,30 @@ class MarketAnalysis(BaseModel): market_size: str = Field(description="Estimated market size") competitors: List[str] = Field(description="Major competitors in the space") + # Define flow state class MarketResearchState(BaseModel): product: str = "" - analysis: MarketAnalysis = None + analysis: MarketAnalysis | None = None + # Create a flow class class MarketResearchFlow(Flow[MarketResearchState]): @start() - def initialize_research(self, product: str): - print(f"Starting market research for {product}") - self.state.product = product + def initialize_research(self) -> Dict[str, Any]: + print(f"Starting market research for {self.state.product}") + return {"product": self.state.product} @listen(initialize_research) - async def analyze_market(self): - # Create a LiteAgent for market research - analyst = LiteAgent( + async def analyze_market(self) -> Dict[str, Any]: + # Create an Agent for market research + analyst = Agent( role="Market Research Analyst", goal=f"Analyze the market for {self.state.product}", backstory="You are an experienced market analyst with expertise in " - "identifying market trends and opportunities.", - tools=[WebSearchTool()], + "identifying market trends and opportunities.", + tools=[SerperDevTool()], verbose=True, - response_format=MarketAnalysis ) # Define the research query @@ -140,58 +145,53 @@ class MarketResearchFlow(Flow[MarketResearchState]): Format your response according to the specified structure. """ - # Execute the analysis - result = await analyst.kickoff_async(query) - self.state.analysis = result.pydantic - return result.pydantic + # Execute the analysis with structured output format + result = await analyst.kickoff_async(query, response_format=MarketAnalysis) + if result.pydantic: + print("result", result.pydantic) + else: + print("result", result) + + # Return the analysis to update the state + return {"analysis": result.pydantic} @listen(analyze_market) - def present_results(self): - analysis = self.state.analysis + def present_results(self, analysis) -> None: print("\nMarket Analysis Results") print("=====================") - print("\nKey Market Trends:") - for trend in analysis.key_trends: - print(f"- {trend}") + if isinstance(analysis, dict): + # If we got a dict with 'analysis' key, extract the actual analysis object + market_analysis = analysis.get("analysis") + else: + market_analysis = analysis - print(f"\nMarket Size: {analysis.market_size}") + if market_analysis and isinstance(market_analysis, MarketAnalysis): + print("\nKey Market Trends:") + for trend in market_analysis.key_trends: + print(f"- {trend}") + + print(f"\nMarket Size: {market_analysis.market_size}") + + print("\nMajor Competitors:") + for competitor in market_analysis.competitors: + print(f"- {competitor}") + else: + print("No structured analysis data available.") + print("Raw analysis:", analysis) - print("\nMajor Competitors:") - for competitor in analysis.competitors: - print(f"- {competitor}") # Usage example -import asyncio - async def run_flow(): flow = MarketResearchFlow() - result = await flow.kickoff(inputs={"product": "AI-powered chatbots"}) + result = await flow.kickoff_async(inputs={"product": "AI-powered chatbots"}) return result + # Run the flow if __name__ == "__main__": + # Use asyncio.run at the top level only asyncio.run(run_flow()) - -## Key Features - -### 1. Simplified Setup -Unlike regular Agents, LiteAgents are designed for quick setup and standalone operation. They don't require crew configuration or task management. - -### 2. Structured Output -LiteAgents support Pydantic models for response formatting, making it easy to get structured, type-safe data from your agent's operations. - -### 3. Tool Integration -Just like regular Agents, LiteAgents can use tools to enhance their capabilities: -```python -from crewai.tools import SerperDevTool, CalculatorTool - -agent = LiteAgent( - role="Research Assistant", - goal="Find and analyze information", - tools=[SerperDevTool(), CalculatorTool()], - verbose=True -) ```` ### 4. Async Support diff --git a/src/crewai/agent.py b/src/crewai/agent.py index 14c6d7bad..f6f2469b6 100644 --- a/src/crewai/agent.py +++ b/src/crewai/agent.py @@ -1,7 +1,6 @@ -import re import shutil import subprocess -from typing import Any, Dict, List, Literal, Optional, Sequence, Union +from typing import Any, Dict, List, Literal, Optional, Sequence, Type, Union from pydantic import Field, InstanceOf, PrivateAttr, model_validator @@ -12,6 +11,7 @@ from crewai.knowledge.knowledge import Knowledge from crewai.knowledge.source.base_knowledge_source import BaseKnowledgeSource from crewai.knowledge.utils.knowledge_utils import extract_knowledge_context from crewai.llm import BaseLLM +from crewai.lite_agent import LiteAgent, LiteAgentOutput from crewai.memory.contextual.contextual_memory import ContextualMemory from crewai.security import Fingerprint from crewai.task import Task @@ -449,3 +449,74 @@ class Agent(BaseAgent): def set_fingerprint(self, fingerprint: Fingerprint): self.security_config.fingerprint = fingerprint + + def kickoff( + self, + messages: Union[str, List[Dict[str, str]]], + response_format: Optional[Type[Any]] = None, + ) -> LiteAgentOutput: + """ + Execute the agent with the given messages using a LiteAgent instance. + + This method is useful when you want to use the Agent configuration but + with the simpler and more direct execution flow of LiteAgent. + + Args: + messages: Either a string query or a list of message dictionaries. + If a string is provided, it will be converted to a user message. + If a list is provided, each dict should have 'role' and 'content' keys. + response_format: Optional Pydantic model for structured output. + + Returns: + LiteAgentOutput: The result of the agent execution. + """ + lite_agent = LiteAgent( + role=self.role, + goal=self.goal, + backstory=self.backstory, + llm=self.llm, + tools=self.tools or [], + max_iterations=self.max_iter, + max_execution_time=self.max_execution_time, + respect_context_window=self.respect_context_window, + verbose=self.verbose, + response_format=response_format, + i18n=self.i18n, + ) + + return lite_agent.kickoff(messages) + + async def kickoff_async( + self, + messages: Union[str, List[Dict[str, str]]], + response_format: Optional[Type[Any]] = None, + ) -> LiteAgentOutput: + """ + Execute the agent asynchronously with the given messages using a LiteAgent instance. + + This is the async version of the kickoff method. + + Args: + messages: Either a string query or a list of message dictionaries. + If a string is provided, it will be converted to a user message. + If a list is provided, each dict should have 'role' and 'content' keys. + response_format: Optional Pydantic model for structured output. + + Returns: + LiteAgentOutput: The result of the agent execution. + """ + lite_agent = LiteAgent( + role=self.role, + goal=self.goal, + backstory=self.backstory, + llm=self.llm, + tools=self.tools or [], + max_iterations=self.max_iter, + max_execution_time=self.max_execution_time, + respect_context_window=self.respect_context_window, + verbose=self.verbose, + response_format=response_format, + i18n=self.i18n, + ) + + return await lite_agent.kickoff_async(messages) diff --git a/src/crewai/lite_agent.py b/src/crewai/lite_agent.py index ede0f8d72..e63a2320d 100644 --- a/src/crewai/lite_agent.py +++ b/src/crewai/lite_agent.py @@ -1,6 +1,4 @@ import asyncio -import json -import re import uuid from datetime import datetime from typing import Any, Callable, Dict, List, Optional, Type, Union, cast diff --git a/tests/cassettes/test_lite_agent_created_with_correct_parameters[False].yaml b/tests/cassettes/test_lite_agent_created_with_correct_parameters[False].yaml new file mode 100644 index 000000000..0ce469b9a --- /dev/null +++ b/tests/cassettes/test_lite_agent_created_with_correct_parameters[False].yaml @@ -0,0 +1,486 @@ +interactions: +- request: + body: '{"messages": [{"role": "system", "content": "You are Test Agent. Test Backstory\nYour + personal goal is: Test Goal\n\nYou ONLY have access to the following tools, + and should NEVER make up tools that are not listed here:\n\nTool Name: search_web\nTool + Arguments: {''query'': {''description'': None, ''type'': ''str''}}\nTool Description: + Search the web for information about a topic.\nTool Name: calculate\nTool Arguments: + {''expression'': {''description'': None, ''type'': ''str''}}\nTool Description: + Calculate the result of a mathematical expression.\n\nIMPORTANT: Use the following + format in your response:\n\n```\nThought: you should always think about what + to do\nAction: the action to take, only one name of [search_web, calculate], + just the name, exactly as it''s written.\nAction Input: the input to the action, + just a simple JSON object, enclosed in curly braces, using \" to wrap keys and + values.\nObservation: the result of the action\n```\n\nOnce all necessary information + is gathered, return the following format:\n\n```\nThought: I now know the final + answer\nFinal Answer: the final answer to the original input question\n```"}, + {"role": "user", "content": "Test query"}], "model": "gpt-4o-mini", "stop": + ["\nObservation:"]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate, zstd + connection: + - keep-alive + content-length: + - '1220' + content-type: + - application/json + cookie: + - __cf_bm=skEg5DBE_nQ5gLAsfGzhjTetiNUJ_Y2bXWLMsvjIi7s-1744222695-1.0.1.1-qyjwnTgJKwF54pRhf0YHxW_BUw6p7SC60kwFsF9XTq4i2u2mnFKVq4WbsgvQDeuDEIxyaNb.ngWUVOU1GIX1O2Hcxcdn6TSaJ8NXTQw28F8; + _cfuvid=Hwvd7n4RVfOZLGiOKPaHmYJC7h8rCQmlmnBgBsKqy4Y-1744222695443-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.68.2 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.68.2 + x-stainless-raw-response: + - 'true' + x-stainless-read-timeout: + - '600.0' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.9 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-BKUIMCbxAr4MO0Ku8tDYBgJ30LGXi\",\n \"object\": + \"chat.completion\",\n \"created\": 1744222714,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"```\\nThought: I need more information + to understand what specific query to search for.\\nAction: search_web\\nAction + Input: {\\\"query\\\":\\\"Test query\\\"}\",\n \"refusal\": null,\n \"annotations\": + []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n + \ }\n ],\n \"usage\": {\n \"prompt_tokens\": 242,\n \"completion_tokens\": + 31,\n \"total_tokens\": 273,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n + \ \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": + \"default\",\n \"system_fingerprint\": \"fp_b376dfbbd5\"\n}\n" + headers: + CF-RAY: + - 92dc01f9bd96cf41-SJC + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Wed, 09 Apr 2025 18:18:34 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '749' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149999732' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_99e3ad4ee98371cc1c55a2f5c6ae3962 + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '{"messages": [{"role": "system", "content": "You are Test Agent. Test Backstory\nYour + personal goal is: Test Goal\n\nYou ONLY have access to the following tools, + and should NEVER make up tools that are not listed here:\n\nTool Name: search_web\nTool + Arguments: {''query'': {''description'': None, ''type'': ''str''}}\nTool Description: + Search the web for information about a topic.\nTool Name: calculate\nTool Arguments: + {''expression'': {''description'': None, ''type'': ''str''}}\nTool Description: + Calculate the result of a mathematical expression.\n\nIMPORTANT: Use the following + format in your response:\n\n```\nThought: you should always think about what + to do\nAction: the action to take, only one name of [search_web, calculate], + just the name, exactly as it''s written.\nAction Input: the input to the action, + just a simple JSON object, enclosed in curly braces, using \" to wrap keys and + values.\nObservation: the result of the action\n```\n\nOnce all necessary information + is gathered, return the following format:\n\n```\nThought: I now know the final + answer\nFinal Answer: the final answer to the original input question\n```"}, + {"role": "user", "content": "Test query"}, {"role": "assistant", "content": + "```\nThought: I need more information to understand what specific query to + search for.\nAction: search_web\nAction Input: {\"query\":\"Test query\"}\nObservation: + Found information about Test query: This is a simulated search result for demonstration + purposes."}], "model": "gpt-4o-mini", "stop": ["\nObservation:"]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate, zstd + connection: + - keep-alive + content-length: + - '1518' + content-type: + - application/json + cookie: + - __cf_bm=skEg5DBE_nQ5gLAsfGzhjTetiNUJ_Y2bXWLMsvjIi7s-1744222695-1.0.1.1-qyjwnTgJKwF54pRhf0YHxW_BUw6p7SC60kwFsF9XTq4i2u2mnFKVq4WbsgvQDeuDEIxyaNb.ngWUVOU1GIX1O2Hcxcdn6TSaJ8NXTQw28F8; + _cfuvid=Hwvd7n4RVfOZLGiOKPaHmYJC7h8rCQmlmnBgBsKqy4Y-1744222695443-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.68.2 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.68.2 + x-stainless-raw-response: + - 'true' + x-stainless-read-timeout: + - '600.0' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.9 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-BKUINDYiGwrVyJU7wUoXCw3hft7yF\",\n \"object\": + \"chat.completion\",\n \"created\": 1744222715,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"```\\nThought: I now know the final answer\\nFinal + Answer: This is a simulated search result for demonstration purposes.\\n```\",\n + \ \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": + null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": + 295,\n \"completion_tokens\": 26,\n \"total_tokens\": 321,\n \"prompt_tokens_details\": + {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": + {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": + \"default\",\n \"system_fingerprint\": \"fp_b376dfbbd5\"\n}\n" + headers: + CF-RAY: + - 92dc02003c9ecf41-SJC + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Wed, 09 Apr 2025 18:18:35 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '531' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149999667' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_dd9052c40d5d61ecc5eb141f49df3abe + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '{"messages": [{"role": "system", "content": "You are Test Agent. Test Backstory\nYour + personal goal is: Test Goal\n\nYou ONLY have access to the following tools, + and should NEVER make up tools that are not listed here:\n\nTool Name: search_web\nTool + Arguments: {''query'': {''description'': None, ''type'': ''str''}}\nTool Description: + Search the web for information about a topic.\nTool Name: calculate\nTool Arguments: + {''expression'': {''description'': None, ''type'': ''str''}}\nTool Description: + Calculate the result of a mathematical expression.\n\nIMPORTANT: Use the following + format in your response:\n\n```\nThought: you should always think about what + to do\nAction: the action to take, only one name of [search_web, calculate], + just the name, exactly as it''s written.\nAction Input: the input to the action, + just a simple JSON object, enclosed in curly braces, using \" to wrap keys and + values.\nObservation: the result of the action\n```\n\nOnce all necessary information + is gathered, return the following format:\n\n```\nThought: I now know the final + answer\nFinal Answer: the final answer to the original input question\n```\nIMPORTANT: + Your final answer MUST contain all the information requested in the following + format: {\n \"test_field\": str\n}\n\nIMPORTANT: Ensure the final output does + not include any code block markers like ```json or ```python."}, {"role": "user", + "content": "Test query"}], "model": "gpt-4o-mini", "stop": ["\nObservation:"]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate, zstd + connection: + - keep-alive + content-length: + - '1451' + content-type: + - application/json + cookie: + - __cf_bm=skEg5DBE_nQ5gLAsfGzhjTetiNUJ_Y2bXWLMsvjIi7s-1744222695-1.0.1.1-qyjwnTgJKwF54pRhf0YHxW_BUw6p7SC60kwFsF9XTq4i2u2mnFKVq4WbsgvQDeuDEIxyaNb.ngWUVOU1GIX1O2Hcxcdn6TSaJ8NXTQw28F8; + _cfuvid=Hwvd7n4RVfOZLGiOKPaHmYJC7h8rCQmlmnBgBsKqy4Y-1744222695443-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.68.2 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.68.2 + x-stainless-raw-response: + - 'true' + x-stainless-read-timeout: + - '600.0' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.9 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-BKUIN3xeM6JBgLjV5HQA8MTI2Uuem\",\n \"object\": + \"chat.completion\",\n \"created\": 1744222715,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"```\\nThought: I need to clarify what + specific information or topic the test query is targeting.\\nAction: search_web\\nAction + Input: {\\\"query\\\":\\\"What is the purpose of a test query in data retrieval?\\\"}\",\n + \ \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": + null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": + 288,\n \"completion_tokens\": 43,\n \"total_tokens\": 331,\n \"prompt_tokens_details\": + {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": + {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": + \"default\",\n \"system_fingerprint\": \"fp_b376dfbbd5\"\n}\n" + headers: + CF-RAY: + - 92dc0204d91ccf41-SJC + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Wed, 09 Apr 2025 18:18:36 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '728' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149999675' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_e792e993009ddfe84cfbb503560d88cf + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '{"messages": [{"role": "system", "content": "You are Test Agent. Test Backstory\nYour + personal goal is: Test Goal\n\nYou ONLY have access to the following tools, + and should NEVER make up tools that are not listed here:\n\nTool Name: search_web\nTool + Arguments: {''query'': {''description'': None, ''type'': ''str''}}\nTool Description: + Search the web for information about a topic.\nTool Name: calculate\nTool Arguments: + {''expression'': {''description'': None, ''type'': ''str''}}\nTool Description: + Calculate the result of a mathematical expression.\n\nIMPORTANT: Use the following + format in your response:\n\n```\nThought: you should always think about what + to do\nAction: the action to take, only one name of [search_web, calculate], + just the name, exactly as it''s written.\nAction Input: the input to the action, + just a simple JSON object, enclosed in curly braces, using \" to wrap keys and + values.\nObservation: the result of the action\n```\n\nOnce all necessary information + is gathered, return the following format:\n\n```\nThought: I now know the final + answer\nFinal Answer: the final answer to the original input question\n```\nIMPORTANT: + Your final answer MUST contain all the information requested in the following + format: {\n \"test_field\": str\n}\n\nIMPORTANT: Ensure the final output does + not include any code block markers like ```json or ```python."}, {"role": "user", + "content": "Test query"}, {"role": "assistant", "content": "```\nThought: I + need to clarify what specific information or topic the test query is targeting.\nAction: + search_web\nAction Input: {\"query\":\"What is the purpose of a test query in + data retrieval?\"}\nObservation: Found information about What is the purpose + of a test query in data retrieval?: This is a simulated search result for demonstration + purposes."}], "model": "gpt-4o-mini", "stop": ["\nObservation:"]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate, zstd + connection: + - keep-alive + content-length: + - '1846' + content-type: + - application/json + cookie: + - __cf_bm=skEg5DBE_nQ5gLAsfGzhjTetiNUJ_Y2bXWLMsvjIi7s-1744222695-1.0.1.1-qyjwnTgJKwF54pRhf0YHxW_BUw6p7SC60kwFsF9XTq4i2u2mnFKVq4WbsgvQDeuDEIxyaNb.ngWUVOU1GIX1O2Hcxcdn6TSaJ8NXTQw28F8; + _cfuvid=Hwvd7n4RVfOZLGiOKPaHmYJC7h8rCQmlmnBgBsKqy4Y-1744222695443-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.68.2 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.68.2 + x-stainless-raw-response: + - 'true' + x-stainless-read-timeout: + - '600.0' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.9 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-BKUIOqyLDCIZv6YIz1hlaW479SIzg\",\n \"object\": + \"chat.completion\",\n \"created\": 1744222716,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"```\\nThought: I now know the final answer\\nFinal + Answer: {\\n \\\"test_field\\\": \\\"A test query is utilized to evaluate the + functionality, performance, and accuracy of data retrieval systems, ensuring + they return expected results.\\\"\\n}\\n```\",\n \"refusal\": null,\n + \ \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": + \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 362,\n \"completion_tokens\": + 49,\n \"total_tokens\": 411,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n + \ \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": + \"default\",\n \"system_fingerprint\": \"fp_b376dfbbd5\"\n}\n" + headers: + CF-RAY: + - 92dc020a3defcf41-SJC + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Wed, 09 Apr 2025 18:18:37 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '805' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149999588' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_3b6c80fd3066b9e0054d0d2280bc4c98 + http_version: HTTP/1.1 + status_code: 200 +version: 1 diff --git a/tests/cassettes/test_lite_agent_created_with_correct_parameters[True].yaml b/tests/cassettes/test_lite_agent_created_with_correct_parameters[True].yaml new file mode 100644 index 000000000..1c395e4e2 --- /dev/null +++ b/tests/cassettes/test_lite_agent_created_with_correct_parameters[True].yaml @@ -0,0 +1,2199 @@ +interactions: +- request: + body: '{"messages": [{"role": "system", "content": "You are Test Agent. Test Backstory\nYour + personal goal is: Test Goal\n\nYou ONLY have access to the following tools, + and should NEVER make up tools that are not listed here:\n\nTool Name: search_web\nTool + Arguments: {''query'': {''description'': None, ''type'': ''str''}}\nTool Description: + Search the web for information about a topic.\nTool Name: calculate\nTool Arguments: + {''expression'': {''description'': None, ''type'': ''str''}}\nTool Description: + Calculate the result of a mathematical expression.\n\nIMPORTANT: Use the following + format in your response:\n\n```\nThought: you should always think about what + to do\nAction: the action to take, only one name of [search_web, calculate], + just the name, exactly as it''s written.\nAction Input: the input to the action, + just a simple JSON object, enclosed in curly braces, using \" to wrap keys and + values.\nObservation: the result of the action\n```\n\nOnce all necessary information + is gathered, return the following format:\n\n```\nThought: I now know the final + answer\nFinal Answer: the final answer to the original input question\n```"}, + {"role": "user", "content": "Test query"}], "model": "gpt-4o-mini", "stop": + ["\nObservation:"]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate, zstd + connection: + - keep-alive + content-length: + - '1220' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.68.2 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.68.2 + x-stainless-raw-response: + - 'true' + x-stainless-read-timeout: + - '600.0' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.9 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-BKUI2djjAEPBitxovNZdlibsOnAh6\",\n \"object\": + \"chat.completion\",\n \"created\": 1744222694,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"```\\nThought: I need to understand what + specific information or topic to search for.\\nAction: search_web\\nAction Input: + {\\\"query\\\":\\\"Test query\\\"}\",\n \"refusal\": null,\n \"annotations\": + []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n + \ }\n ],\n \"usage\": {\n \"prompt_tokens\": 242,\n \"completion_tokens\": + 31,\n \"total_tokens\": 273,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n + \ \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": + \"default\",\n \"system_fingerprint\": \"fp_b376dfbbd5\"\n}\n" + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 92dc017dde78cf41-SJC + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Wed, 09 Apr 2025 18:18:15 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=skEg5DBE_nQ5gLAsfGzhjTetiNUJ_Y2bXWLMsvjIi7s-1744222695-1.0.1.1-qyjwnTgJKwF54pRhf0YHxW_BUw6p7SC60kwFsF9XTq4i2u2mnFKVq4WbsgvQDeuDEIxyaNb.ngWUVOU1GIX1O2Hcxcdn6TSaJ8NXTQw28F8; + path=/; expires=Wed, 09-Apr-25 18:48:15 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=Hwvd7n4RVfOZLGiOKPaHmYJC7h8rCQmlmnBgBsKqy4Y-1744222695443-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '992' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149999732' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_3edd4db0325fb674bada6768e82b8dc6 + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '{"messages": [{"role": "system", "content": "You are Test Agent. Test Backstory\nYour + personal goal is: Test Goal\n\nYou ONLY have access to the following tools, + and should NEVER make up tools that are not listed here:\n\nTool Name: search_web\nTool + Arguments: {''query'': {''description'': None, ''type'': ''str''}}\nTool Description: + Search the web for information about a topic.\nTool Name: calculate\nTool Arguments: + {''expression'': {''description'': None, ''type'': ''str''}}\nTool Description: + Calculate the result of a mathematical expression.\n\nIMPORTANT: Use the following + format in your response:\n\n```\nThought: you should always think about what + to do\nAction: the action to take, only one name of [search_web, calculate], + just the name, exactly as it''s written.\nAction Input: the input to the action, + just a simple JSON object, enclosed in curly braces, using \" to wrap keys and + values.\nObservation: the result of the action\n```\n\nOnce all necessary information + is gathered, return the following format:\n\n```\nThought: I now know the final + answer\nFinal Answer: the final answer to the original input question\n```"}, + {"role": "user", "content": "Test query"}, {"role": "assistant", "content": + "```\nThought: I need to understand what specific information or topic to search + for.\nAction: search_web\nAction Input: {\"query\":\"Test query\"}\nObservation: + Found information about Test query: This is a simulated search result for demonstration + purposes."}], "model": "gpt-4o-mini", "stop": ["\nObservation:"]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate, zstd + connection: + - keep-alive + content-length: + - '1516' + content-type: + - application/json + cookie: + - __cf_bm=skEg5DBE_nQ5gLAsfGzhjTetiNUJ_Y2bXWLMsvjIi7s-1744222695-1.0.1.1-qyjwnTgJKwF54pRhf0YHxW_BUw6p7SC60kwFsF9XTq4i2u2mnFKVq4WbsgvQDeuDEIxyaNb.ngWUVOU1GIX1O2Hcxcdn6TSaJ8NXTQw28F8; + _cfuvid=Hwvd7n4RVfOZLGiOKPaHmYJC7h8rCQmlmnBgBsKqy4Y-1744222695443-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.68.2 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.68.2 + x-stainless-raw-response: + - 'true' + x-stainless-read-timeout: + - '600.0' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.9 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-BKUI3cMLea2cs1wZznSDwEKIlNszH\",\n \"object\": + \"chat.completion\",\n \"created\": 1744222695,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"```\\nThought: I have simulated search + results related to a test query. However, I need to clarify the specific topic + or question to provide a more accurate answer.\\nAction: search_web\\nAction + Input: {\\\"query\\\":\\\"What is the purpose and significance of a test query?\\\"}\",\n + \ \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": + null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": + 295,\n \"completion_tokens\": 56,\n \"total_tokens\": 351,\n \"prompt_tokens_details\": + {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": + {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": + \"default\",\n \"system_fingerprint\": \"fp_b376dfbbd5\"\n}\n" + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 92dc0186def5cf41-SJC + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Wed, 09 Apr 2025 18:18:17 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '1515' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149999667' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_a2022ae3f8c0553cd9c9f0ca3de3eea7 + http_version: HTTP/1.1 + status_code: 200 +- request: + body: !!binary | + Ct8CCiQKIgoMc2VydmljZS5uYW1lEhIKEGNyZXdBSS10ZWxlbWV0cnkStgIKEgoQY3Jld2FpLnRl + bGVtZXRyeRKOAQoQBTyQaj+q6ZGCzTcLGw67XxIIJgYnCR39BXMqClRvb2wgVXNhZ2UwATlA3kzd + TLk0GEGIB1ndTLk0GEobCg5jcmV3YWlfdmVyc2lvbhIJCgcwLjEwOC4wShkKCXRvb2xfbmFtZRIM + CgpzZWFyY2hfd2ViSg4KCGF0dGVtcHRzEgIYAXoCGAGFAQABAAASjgEKECU1z25kSLX8hgTGG4t7 + HHoSCCGolihCcYh2KgpUb29sIFVzYWdlMAE5UPwWRE25NBhBQJ8fRE25NBhKGwoOY3Jld2FpX3Zl + cnNpb24SCQoHMC4xMDguMEoZCgl0b29sX25hbWUSDAoKc2VhcmNoX3dlYkoOCghhdHRlbXB0cxIC + GAF6AhgBhQEAAQAA + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate, zstd + Connection: + - keep-alive + Content-Length: + - '354' + Content-Type: + - application/x-protobuf + User-Agent: + - OTel-OTLP-Exporter-Python/1.31.1 + method: POST + uri: https://telemetry.crewai.com:4319/v1/traces + response: + body: + string: "\n\0" + headers: + Content-Length: + - '2' + Content-Type: + - application/x-protobuf + Date: + - Wed, 09 Apr 2025 18:18:17 GMT + status: + code: 200 + message: OK +- request: + body: '{"messages": [{"role": "system", "content": "You are Test Agent. Test Backstory\nYour + personal goal is: Test Goal\n\nYou ONLY have access to the following tools, + and should NEVER make up tools that are not listed here:\n\nTool Name: search_web\nTool + Arguments: {''query'': {''description'': None, ''type'': ''str''}}\nTool Description: + Search the web for information about a topic.\nTool Name: calculate\nTool Arguments: + {''expression'': {''description'': None, ''type'': ''str''}}\nTool Description: + Calculate the result of a mathematical expression.\n\nIMPORTANT: Use the following + format in your response:\n\n```\nThought: you should always think about what + to do\nAction: the action to take, only one name of [search_web, calculate], + just the name, exactly as it''s written.\nAction Input: the input to the action, + just a simple JSON object, enclosed in curly braces, using \" to wrap keys and + values.\nObservation: the result of the action\n```\n\nOnce all necessary information + is gathered, return the following format:\n\n```\nThought: I now know the final + answer\nFinal Answer: the final answer to the original input question\n```"}, + {"role": "user", "content": "Test query"}, {"role": "assistant", "content": + "```\nThought: I need to understand what specific information or topic to search + for.\nAction: search_web\nAction Input: {\"query\":\"Test query\"}\nObservation: + Found information about Test query: This is a simulated search result for demonstration + purposes."}, {"role": "assistant", "content": "```\nThought: I have simulated + search results related to a test query. However, I need to clarify the specific + topic or question to provide a more accurate answer.\nAction: search_web\nAction + Input: {\"query\":\"What is the purpose and significance of a test query?\"}\nObservation: + Found information about What is the purpose and significance of a test query?: + This is a simulated search result for demonstration purposes."}], "model": "gpt-4o-mini", + "stop": ["\nObservation:"]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate, zstd + connection: + - keep-alive + content-length: + - '1977' + content-type: + - application/json + cookie: + - __cf_bm=skEg5DBE_nQ5gLAsfGzhjTetiNUJ_Y2bXWLMsvjIi7s-1744222695-1.0.1.1-qyjwnTgJKwF54pRhf0YHxW_BUw6p7SC60kwFsF9XTq4i2u2mnFKVq4WbsgvQDeuDEIxyaNb.ngWUVOU1GIX1O2Hcxcdn6TSaJ8NXTQw28F8; + _cfuvid=Hwvd7n4RVfOZLGiOKPaHmYJC7h8rCQmlmnBgBsKqy4Y-1744222695443-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.68.2 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.68.2 + x-stainless-raw-response: + - 'true' + x-stainless-read-timeout: + - '600.0' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.9 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-BKUI5apzxz891mmkVpae1FIcj5bog\",\n \"object\": + \"chat.completion\",\n \"created\": 1744222697,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"```\\nThought: I have some simulated + search results regarding the purpose and significance of a test query but still + need clearer context to provide a meaningful answer.\\nAction: search_web\\nAction + Input: {\\\"query\\\":\\\"examples of test queries in various contexts\\\"}\",\n + \ \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": + null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": + 381,\n \"completion_tokens\": 49,\n \"total_tokens\": 430,\n \"prompt_tokens_details\": + {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": + {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": + \"default\",\n \"system_fingerprint\": \"fp_44added55e\"\n}\n" + headers: + CF-RAY: + - 92dc01919a73cf41-SJC + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Wed, 09 Apr 2025 18:18:18 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '817' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149999564' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_e9af3cd9a5cb0440a452c95861ab82d0 + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '{"messages": [{"role": "system", "content": "You are Test Agent. Test Backstory\nYour + personal goal is: Test Goal\n\nYou ONLY have access to the following tools, + and should NEVER make up tools that are not listed here:\n\nTool Name: search_web\nTool + Arguments: {''query'': {''description'': None, ''type'': ''str''}}\nTool Description: + Search the web for information about a topic.\nTool Name: calculate\nTool Arguments: + {''expression'': {''description'': None, ''type'': ''str''}}\nTool Description: + Calculate the result of a mathematical expression.\n\nIMPORTANT: Use the following + format in your response:\n\n```\nThought: you should always think about what + to do\nAction: the action to take, only one name of [search_web, calculate], + just the name, exactly as it''s written.\nAction Input: the input to the action, + just a simple JSON object, enclosed in curly braces, using \" to wrap keys and + values.\nObservation: the result of the action\n```\n\nOnce all necessary information + is gathered, return the following format:\n\n```\nThought: I now know the final + answer\nFinal Answer: the final answer to the original input question\n```"}, + {"role": "user", "content": "Test query"}, {"role": "assistant", "content": + "```\nThought: I need to understand what specific information or topic to search + for.\nAction: search_web\nAction Input: {\"query\":\"Test query\"}\nObservation: + Found information about Test query: This is a simulated search result for demonstration + purposes."}, {"role": "assistant", "content": "```\nThought: I have simulated + search results related to a test query. However, I need to clarify the specific + topic or question to provide a more accurate answer.\nAction: search_web\nAction + Input: {\"query\":\"What is the purpose and significance of a test query?\"}\nObservation: + Found information about What is the purpose and significance of a test query?: + This is a simulated search result for demonstration purposes."}, {"role": "assistant", + "content": "```\nThought: I have some simulated search results regarding the + purpose and significance of a test query but still need clearer context to provide + a meaningful answer.\nAction: search_web\nAction Input: {\"query\":\"examples + of test queries in various contexts\"}\nObservation: Found information about + examples of test queries in various contexts: This is a simulated search result + for demonstration purposes."}], "model": "gpt-4o-mini", "stop": ["\nObservation:"]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate, zstd + connection: + - keep-alive + content-length: + - '2425' + content-type: + - application/json + cookie: + - __cf_bm=skEg5DBE_nQ5gLAsfGzhjTetiNUJ_Y2bXWLMsvjIi7s-1744222695-1.0.1.1-qyjwnTgJKwF54pRhf0YHxW_BUw6p7SC60kwFsF9XTq4i2u2mnFKVq4WbsgvQDeuDEIxyaNb.ngWUVOU1GIX1O2Hcxcdn6TSaJ8NXTQw28F8; + _cfuvid=Hwvd7n4RVfOZLGiOKPaHmYJC7h8rCQmlmnBgBsKqy4Y-1744222695443-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.68.2 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.68.2 + x-stainless-raw-response: + - 'true' + x-stainless-read-timeout: + - '600.0' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.9 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-BKUI6HbKAVI6BU8OX4Zh6yr7BXwRo\",\n \"object\": + \"chat.completion\",\n \"created\": 1744222698,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"```\\nThought: I still have only simulated + results and not specific information that can lead to a final answer. I need + to refine the search for more relevant information.\\nAction: search_web\\nAction + Input: {\\\"query\\\":\\\"test query examples in technology and software development\\\"}\",\n + \ \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": + null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": + 457,\n \"completion_tokens\": 53,\n \"total_tokens\": 510,\n \"prompt_tokens_details\": + {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": + {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": + \"default\",\n \"system_fingerprint\": \"fp_b376dfbbd5\"\n}\n" + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 92dc0198090fcf41-SJC + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Wed, 09 Apr 2025 18:18:19 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '922' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149999462' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_aab13cf3c930591d23ce6990b0bcd5c8 + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '{"messages": [{"role": "system", "content": "You are Test Agent. Test Backstory\nYour + personal goal is: Test Goal\n\nYou ONLY have access to the following tools, + and should NEVER make up tools that are not listed here:\n\nTool Name: search_web\nTool + Arguments: {''query'': {''description'': None, ''type'': ''str''}}\nTool Description: + Search the web for information about a topic.\nTool Name: calculate\nTool Arguments: + {''expression'': {''description'': None, ''type'': ''str''}}\nTool Description: + Calculate the result of a mathematical expression.\n\nIMPORTANT: Use the following + format in your response:\n\n```\nThought: you should always think about what + to do\nAction: the action to take, only one name of [search_web, calculate], + just the name, exactly as it''s written.\nAction Input: the input to the action, + just a simple JSON object, enclosed in curly braces, using \" to wrap keys and + values.\nObservation: the result of the action\n```\n\nOnce all necessary information + is gathered, return the following format:\n\n```\nThought: I now know the final + answer\nFinal Answer: the final answer to the original input question\n```"}, + {"role": "user", "content": "Test query"}, {"role": "assistant", "content": + "```\nThought: I need to understand what specific information or topic to search + for.\nAction: search_web\nAction Input: {\"query\":\"Test query\"}\nObservation: + Found information about Test query: This is a simulated search result for demonstration + purposes."}, {"role": "assistant", "content": "```\nThought: I have simulated + search results related to a test query. However, I need to clarify the specific + topic or question to provide a more accurate answer.\nAction: search_web\nAction + Input: {\"query\":\"What is the purpose and significance of a test query?\"}\nObservation: + Found information about What is the purpose and significance of a test query?: + This is a simulated search result for demonstration purposes."}, {"role": "assistant", + "content": "```\nThought: I have some simulated search results regarding the + purpose and significance of a test query but still need clearer context to provide + a meaningful answer.\nAction: search_web\nAction Input: {\"query\":\"examples + of test queries in various contexts\"}\nObservation: Found information about + examples of test queries in various contexts: This is a simulated search result + for demonstration purposes."}, {"role": "assistant", "content": "```\nThought: + I still have only simulated results and not specific information that can lead + to a final answer. I need to refine the search for more relevant information.\nAction: + search_web\nAction Input: {\"query\":\"test query examples in technology and + software development\"}\nObservation: Found information about test query examples + in technology and software development: This is a simulated search result for + demonstration purposes."}], "model": "gpt-4o-mini", "stop": ["\nObservation:"]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate, zstd + connection: + - keep-alive + content-length: + - '2903' + content-type: + - application/json + cookie: + - __cf_bm=skEg5DBE_nQ5gLAsfGzhjTetiNUJ_Y2bXWLMsvjIi7s-1744222695-1.0.1.1-qyjwnTgJKwF54pRhf0YHxW_BUw6p7SC60kwFsF9XTq4i2u2mnFKVq4WbsgvQDeuDEIxyaNb.ngWUVOU1GIX1O2Hcxcdn6TSaJ8NXTQw28F8; + _cfuvid=Hwvd7n4RVfOZLGiOKPaHmYJC7h8rCQmlmnBgBsKqy4Y-1744222695443-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.68.2 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.68.2 + x-stainless-raw-response: + - 'true' + x-stainless-read-timeout: + - '600.0' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.9 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-BKUI8M2rjDrol5uVG9EQz1OGXUC8H\",\n \"object\": + \"chat.completion\",\n \"created\": 1744222700,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"```\\nThought: I have gathered simulated + search results about test query examples in technology and software development, + but they are not precise enough to formulate a final answer.\\nAction: search_web\\nAction + Input: {\\\"query\\\":\\\"importance of test queries in software testing\\\"} + \",\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": + null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": + 538,\n \"completion_tokens\": 52,\n \"total_tokens\": 590,\n \"prompt_tokens_details\": + {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": + {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": + \"default\",\n \"system_fingerprint\": \"fp_b376dfbbd5\"\n}\n" + headers: + CF-RAY: + - 92dc019f0893cf41-SJC + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Wed, 09 Apr 2025 18:18:21 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '1244' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149999353' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_c8f2ae1b33dff9b6f88c9ab541c16c91 + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '{"messages": [{"role": "system", "content": "You are Test Agent. Test Backstory\nYour + personal goal is: Test Goal\n\nYou ONLY have access to the following tools, + and should NEVER make up tools that are not listed here:\n\nTool Name: search_web\nTool + Arguments: {''query'': {''description'': None, ''type'': ''str''}}\nTool Description: + Search the web for information about a topic.\nTool Name: calculate\nTool Arguments: + {''expression'': {''description'': None, ''type'': ''str''}}\nTool Description: + Calculate the result of a mathematical expression.\n\nIMPORTANT: Use the following + format in your response:\n\n```\nThought: you should always think about what + to do\nAction: the action to take, only one name of [search_web, calculate], + just the name, exactly as it''s written.\nAction Input: the input to the action, + just a simple JSON object, enclosed in curly braces, using \" to wrap keys and + values.\nObservation: the result of the action\n```\n\nOnce all necessary information + is gathered, return the following format:\n\n```\nThought: I now know the final + answer\nFinal Answer: the final answer to the original input question\n```"}, + {"role": "user", "content": "Test query"}, {"role": "assistant", "content": + "```\nThought: I need to understand what specific information or topic to search + for.\nAction: search_web\nAction Input: {\"query\":\"Test query\"}\nObservation: + Found information about Test query: This is a simulated search result for demonstration + purposes."}, {"role": "assistant", "content": "```\nThought: I have simulated + search results related to a test query. However, I need to clarify the specific + topic or question to provide a more accurate answer.\nAction: search_web\nAction + Input: {\"query\":\"What is the purpose and significance of a test query?\"}\nObservation: + Found information about What is the purpose and significance of a test query?: + This is a simulated search result for demonstration purposes."}, {"role": "assistant", + "content": "```\nThought: I have some simulated search results regarding the + purpose and significance of a test query but still need clearer context to provide + a meaningful answer.\nAction: search_web\nAction Input: {\"query\":\"examples + of test queries in various contexts\"}\nObservation: Found information about + examples of test queries in various contexts: This is a simulated search result + for demonstration purposes."}, {"role": "assistant", "content": "```\nThought: + I still have only simulated results and not specific information that can lead + to a final answer. I need to refine the search for more relevant information.\nAction: + search_web\nAction Input: {\"query\":\"test query examples in technology and + software development\"}\nObservation: Found information about test query examples + in technology and software development: This is a simulated search result for + demonstration purposes."}, {"role": "assistant", "content": "```\nThought: I + have gathered simulated search results about test query examples in technology + and software development, but they are not precise enough to formulate a final + answer.\nAction: search_web\nAction Input: {\"query\":\"importance of test queries + in software testing\"} \nObservation: Found information about importance of + test queries in software testing: This is a simulated search result for demonstration + purposes."}], "model": "gpt-4o-mini", "stop": ["\nObservation:"]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate, zstd + connection: + - keep-alive + content-length: + - '3369' + content-type: + - application/json + cookie: + - __cf_bm=skEg5DBE_nQ5gLAsfGzhjTetiNUJ_Y2bXWLMsvjIi7s-1744222695-1.0.1.1-qyjwnTgJKwF54pRhf0YHxW_BUw6p7SC60kwFsF9XTq4i2u2mnFKVq4WbsgvQDeuDEIxyaNb.ngWUVOU1GIX1O2Hcxcdn6TSaJ8NXTQw28F8; + _cfuvid=Hwvd7n4RVfOZLGiOKPaHmYJC7h8rCQmlmnBgBsKqy4Y-1744222695443-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.68.2 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.68.2 + x-stainless-raw-response: + - 'true' + x-stainless-read-timeout: + - '600.0' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.9 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-BKUI9HXHFAlkT7hKyE5JAuzg4KlWY\",\n \"object\": + \"chat.completion\",\n \"created\": 1744222701,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"```\\nThought: I have gathered simulated + search results regarding the importance of test queries in software testing, + but I still need a concrete answer about test queries.\\nAction: search_web\\nAction + Input: {\\\"query\\\":\\\"how to create effective test queries\\\"} \",\n \"refusal\": + null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": + \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 617,\n \"completion_tokens\": + 50,\n \"total_tokens\": 667,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n + \ \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": + \"default\",\n \"system_fingerprint\": \"fp_b376dfbbd5\"\n}\n" + headers: + CF-RAY: + - 92dc01abdf49cf41-SJC + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Wed, 09 Apr 2025 18:18:22 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '986' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149999246' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_62026ef4db09d92b72d81dd96115b3e8 + http_version: HTTP/1.1 + status_code: 200 +- request: + body: !!binary | + CoEFCiQKIgoMc2VydmljZS5uYW1lEhIKEGNyZXdBSS10ZWxlbWV0cnkS2AQKEgoQY3Jld2FpLnRl + bGVtZXRyeRKOAQoQbPuDq8+BQBIonzRzVqwZOhIInjz0CfqpO68qClRvb2wgVXNhZ2UwATlgNR2B + Tbk0GEHIyiSBTbk0GEobCg5jcmV3YWlfdmVyc2lvbhIJCgcwLjEwOC4wShkKCXRvb2xfbmFtZRIM + CgpzZWFyY2hfd2ViSg4KCGF0dGVtcHRzEgIYAXoCGAGFAQABAAASjgEKEG6vN54Ymb+HsfFP9iLm + 6lgSCOjv4UfWOGMjKgpUb29sIFVzYWdlMAE5WI05xE25NBhB8JFCxE25NBhKGwoOY3Jld2FpX3Zl + cnNpb24SCQoHMC4xMDguMEoZCgl0b29sX25hbWUSDAoKc2VhcmNoX3dlYkoOCghhdHRlbXB0cxIC + GAF6AhgBhQEAAQAAEo4BChCgRbDYdXh1Jd9og8nqd/95Eggl3NixO1uJUSoKVG9vbCBVc2FnZTAB + OWj/AD5OuTQYQej7Cz5OuTQYShsKDmNyZXdhaV92ZXJzaW9uEgkKBzAuMTA4LjBKGQoJdG9vbF9u + YW1lEgwKCnNlYXJjaF93ZWJKDgoIYXR0ZW1wdHMSAhgBegIYAYUBAAEAABKOAQoQ/txjBAixQWts + XN1y4WMuyRIIgjoGzJjYPqgqClRvb2wgVXNhZ2UwATkYtKeHTrk0GEHgtq+HTrk0GEobCg5jcmV3 + YWlfdmVyc2lvbhIJCgcwLjEwOC4wShkKCXRvb2xfbmFtZRIMCgpzZWFyY2hfd2ViSg4KCGF0dGVt + cHRzEgIYAXoCGAGFAQABAAA= + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate, zstd + Connection: + - keep-alive + Content-Length: + - '644' + Content-Type: + - application/x-protobuf + User-Agent: + - OTel-OTLP-Exporter-Python/1.31.1 + method: POST + uri: https://telemetry.crewai.com:4319/v1/traces + response: + body: + string: "\n\0" + headers: + Content-Length: + - '2' + Content-Type: + - application/x-protobuf + Date: + - Wed, 09 Apr 2025 18:18:22 GMT + status: + code: 200 + message: OK +- request: + body: '{"messages": [{"role": "system", "content": "You are Test Agent. Test Backstory\nYour + personal goal is: Test Goal\n\nYou ONLY have access to the following tools, + and should NEVER make up tools that are not listed here:\n\nTool Name: search_web\nTool + Arguments: {''query'': {''description'': None, ''type'': ''str''}}\nTool Description: + Search the web for information about a topic.\nTool Name: calculate\nTool Arguments: + {''expression'': {''description'': None, ''type'': ''str''}}\nTool Description: + Calculate the result of a mathematical expression.\n\nIMPORTANT: Use the following + format in your response:\n\n```\nThought: you should always think about what + to do\nAction: the action to take, only one name of [search_web, calculate], + just the name, exactly as it''s written.\nAction Input: the input to the action, + just a simple JSON object, enclosed in curly braces, using \" to wrap keys and + values.\nObservation: the result of the action\n```\n\nOnce all necessary information + is gathered, return the following format:\n\n```\nThought: I now know the final + answer\nFinal Answer: the final answer to the original input question\n```"}, + {"role": "user", "content": "Test query"}, {"role": "assistant", "content": + "```\nThought: I need to understand what specific information or topic to search + for.\nAction: search_web\nAction Input: {\"query\":\"Test query\"}\nObservation: + Found information about Test query: This is a simulated search result for demonstration + purposes."}, {"role": "assistant", "content": "```\nThought: I have simulated + search results related to a test query. However, I need to clarify the specific + topic or question to provide a more accurate answer.\nAction: search_web\nAction + Input: {\"query\":\"What is the purpose and significance of a test query?\"}\nObservation: + Found information about What is the purpose and significance of a test query?: + This is a simulated search result for demonstration purposes."}, {"role": "assistant", + "content": "```\nThought: I have some simulated search results regarding the + purpose and significance of a test query but still need clearer context to provide + a meaningful answer.\nAction: search_web\nAction Input: {\"query\":\"examples + of test queries in various contexts\"}\nObservation: Found information about + examples of test queries in various contexts: This is a simulated search result + for demonstration purposes."}, {"role": "assistant", "content": "```\nThought: + I still have only simulated results and not specific information that can lead + to a final answer. I need to refine the search for more relevant information.\nAction: + search_web\nAction Input: {\"query\":\"test query examples in technology and + software development\"}\nObservation: Found information about test query examples + in technology and software development: This is a simulated search result for + demonstration purposes."}, {"role": "assistant", "content": "```\nThought: I + have gathered simulated search results about test query examples in technology + and software development, but they are not precise enough to formulate a final + answer.\nAction: search_web\nAction Input: {\"query\":\"importance of test queries + in software testing\"} \nObservation: Found information about importance of + test queries in software testing: This is a simulated search result for demonstration + purposes."}, {"role": "assistant", "content": "```\nThought: I have gathered + simulated search results regarding the importance of test queries in software + testing, but I still need a concrete answer about test queries.\nAction: search_web\nAction + Input: {\"query\":\"how to create effective test queries\"} \nObservation: Found + information about how to create effective test queries: This is a simulated + search result for demonstration purposes."}], "model": "gpt-4o-mini", "stop": + ["\nObservation:"]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate, zstd + connection: + - keep-alive + content-length: + - '3805' + content-type: + - application/json + cookie: + - __cf_bm=skEg5DBE_nQ5gLAsfGzhjTetiNUJ_Y2bXWLMsvjIi7s-1744222695-1.0.1.1-qyjwnTgJKwF54pRhf0YHxW_BUw6p7SC60kwFsF9XTq4i2u2mnFKVq4WbsgvQDeuDEIxyaNb.ngWUVOU1GIX1O2Hcxcdn6TSaJ8NXTQw28F8; + _cfuvid=Hwvd7n4RVfOZLGiOKPaHmYJC7h8rCQmlmnBgBsKqy4Y-1744222695443-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.68.2 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.68.2 + x-stainless-raw-response: + - 'true' + x-stainless-read-timeout: + - '600.0' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.9 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-BKUIB21skPx3AsqMYyDsUC4tQcJFG\",\n \"object\": + \"chat.completion\",\n \"created\": 1744222703,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"```\\nThought: I have gathered simulated + search results on how to create effective test queries, but I am still not reaching + a definitive conclusion that addresses a specific question about test queries.\\nAction: + search_web\\nAction Input: {\\\"query\\\":\\\"common practices for test queries + in software development\\\"}\",\n \"refusal\": null,\n \"annotations\": + []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n + \ }\n ],\n \"usage\": {\n \"prompt_tokens\": 693,\n \"completion_tokens\": + 56,\n \"total_tokens\": 749,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n + \ \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": + \"default\",\n \"system_fingerprint\": \"fp_44added55e\"\n}\n" + headers: + CF-RAY: + - 92dc01b38829cf41-SJC + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Wed, 09 Apr 2025 18:18:24 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '1513' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149999149' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_23f7394cdd9e642f926101c1b3c4ce4c + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '{"messages": [{"role": "system", "content": "You are Test Agent. Test Backstory\nYour + personal goal is: Test Goal\n\nYou ONLY have access to the following tools, + and should NEVER make up tools that are not listed here:\n\nTool Name: search_web\nTool + Arguments: {''query'': {''description'': None, ''type'': ''str''}}\nTool Description: + Search the web for information about a topic.\nTool Name: calculate\nTool Arguments: + {''expression'': {''description'': None, ''type'': ''str''}}\nTool Description: + Calculate the result of a mathematical expression.\n\nIMPORTANT: Use the following + format in your response:\n\n```\nThought: you should always think about what + to do\nAction: the action to take, only one name of [search_web, calculate], + just the name, exactly as it''s written.\nAction Input: the input to the action, + just a simple JSON object, enclosed in curly braces, using \" to wrap keys and + values.\nObservation: the result of the action\n```\n\nOnce all necessary information + is gathered, return the following format:\n\n```\nThought: I now know the final + answer\nFinal Answer: the final answer to the original input question\n```"}, + {"role": "user", "content": "Test query"}, {"role": "assistant", "content": + "```\nThought: I need to understand what specific information or topic to search + for.\nAction: search_web\nAction Input: {\"query\":\"Test query\"}\nObservation: + Found information about Test query: This is a simulated search result for demonstration + purposes."}, {"role": "assistant", "content": "```\nThought: I have simulated + search results related to a test query. However, I need to clarify the specific + topic or question to provide a more accurate answer.\nAction: search_web\nAction + Input: {\"query\":\"What is the purpose and significance of a test query?\"}\nObservation: + Found information about What is the purpose and significance of a test query?: + This is a simulated search result for demonstration purposes."}, {"role": "assistant", + "content": "```\nThought: I have some simulated search results regarding the + purpose and significance of a test query but still need clearer context to provide + a meaningful answer.\nAction: search_web\nAction Input: {\"query\":\"examples + of test queries in various contexts\"}\nObservation: Found information about + examples of test queries in various contexts: This is a simulated search result + for demonstration purposes."}, {"role": "assistant", "content": "```\nThought: + I still have only simulated results and not specific information that can lead + to a final answer. I need to refine the search for more relevant information.\nAction: + search_web\nAction Input: {\"query\":\"test query examples in technology and + software development\"}\nObservation: Found information about test query examples + in technology and software development: This is a simulated search result for + demonstration purposes."}, {"role": "assistant", "content": "```\nThought: I + have gathered simulated search results about test query examples in technology + and software development, but they are not precise enough to formulate a final + answer.\nAction: search_web\nAction Input: {\"query\":\"importance of test queries + in software testing\"} \nObservation: Found information about importance of + test queries in software testing: This is a simulated search result for demonstration + purposes."}, {"role": "assistant", "content": "```\nThought: I have gathered + simulated search results regarding the importance of test queries in software + testing, but I still need a concrete answer about test queries.\nAction: search_web\nAction + Input: {\"query\":\"how to create effective test queries\"} \nObservation: Found + information about how to create effective test queries: This is a simulated + search result for demonstration purposes."}, {"role": "assistant", "content": + "```\nThought: I have gathered simulated search results on how to create effective + test queries, but I am still not reaching a definitive conclusion that addresses + a specific question about test queries.\nAction: search_web\nAction Input: {\"query\":\"common + practices for test queries in software development\"}\nObservation: Found information + about common practices for test queries in software development: This is a simulated + search result for demonstration purposes."}], "model": "gpt-4o-mini", "stop": + ["\nObservation:"]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate, zstd + connection: + - keep-alive + content-length: + - '4313' + content-type: + - application/json + cookie: + - __cf_bm=skEg5DBE_nQ5gLAsfGzhjTetiNUJ_Y2bXWLMsvjIi7s-1744222695-1.0.1.1-qyjwnTgJKwF54pRhf0YHxW_BUw6p7SC60kwFsF9XTq4i2u2mnFKVq4WbsgvQDeuDEIxyaNb.ngWUVOU1GIX1O2Hcxcdn6TSaJ8NXTQw28F8; + _cfuvid=Hwvd7n4RVfOZLGiOKPaHmYJC7h8rCQmlmnBgBsKqy4Y-1744222695443-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.68.2 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.68.2 + x-stainless-raw-response: + - 'true' + x-stainless-read-timeout: + - '600.0' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.9 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-BKUICFEqtNDypc1b9oOWmYRc7AsD8\",\n \"object\": + \"chat.completion\",\n \"created\": 1744222704,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"```\\nThought: I have retrieved simulated + search results about common practices for test queries in software development, + but they still do not lead to a clear understanding or conclusion.\\nAction: + search_web\\nAction Input: {\\\"query\\\":\\\"test queries definition and purpose + in software testing\\\"}\",\n \"refusal\": null,\n \"annotations\": + []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n + \ }\n ],\n \"usage\": {\n \"prompt_tokens\": 777,\n \"completion_tokens\": + 53,\n \"total_tokens\": 830,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n + \ \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": + \"default\",\n \"system_fingerprint\": \"fp_44added55e\"\n}\n" + headers: + CF-RAY: + - 92dc01bfbe03cf41-SJC + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Wed, 09 Apr 2025 18:18:25 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '855' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149999031' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_3eb046791b1255574c32dcf8798618c3 + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '{"messages": [{"role": "system", "content": "You are Test Agent. Test Backstory\nYour + personal goal is: Test Goal\n\nYou ONLY have access to the following tools, + and should NEVER make up tools that are not listed here:\n\nTool Name: search_web\nTool + Arguments: {''query'': {''description'': None, ''type'': ''str''}}\nTool Description: + Search the web for information about a topic.\nTool Name: calculate\nTool Arguments: + {''expression'': {''description'': None, ''type'': ''str''}}\nTool Description: + Calculate the result of a mathematical expression.\n\nIMPORTANT: Use the following + format in your response:\n\n```\nThought: you should always think about what + to do\nAction: the action to take, only one name of [search_web, calculate], + just the name, exactly as it''s written.\nAction Input: the input to the action, + just a simple JSON object, enclosed in curly braces, using \" to wrap keys and + values.\nObservation: the result of the action\n```\n\nOnce all necessary information + is gathered, return the following format:\n\n```\nThought: I now know the final + answer\nFinal Answer: the final answer to the original input question\n```"}, + {"role": "user", "content": "Test query"}, {"role": "assistant", "content": + "```\nThought: I need to understand what specific information or topic to search + for.\nAction: search_web\nAction Input: {\"query\":\"Test query\"}\nObservation: + Found information about Test query: This is a simulated search result for demonstration + purposes."}, {"role": "assistant", "content": "```\nThought: I have simulated + search results related to a test query. However, I need to clarify the specific + topic or question to provide a more accurate answer.\nAction: search_web\nAction + Input: {\"query\":\"What is the purpose and significance of a test query?\"}\nObservation: + Found information about What is the purpose and significance of a test query?: + This is a simulated search result for demonstration purposes."}, {"role": "assistant", + "content": "```\nThought: I have some simulated search results regarding the + purpose and significance of a test query but still need clearer context to provide + a meaningful answer.\nAction: search_web\nAction Input: {\"query\":\"examples + of test queries in various contexts\"}\nObservation: Found information about + examples of test queries in various contexts: This is a simulated search result + for demonstration purposes."}, {"role": "assistant", "content": "```\nThought: + I still have only simulated results and not specific information that can lead + to a final answer. I need to refine the search for more relevant information.\nAction: + search_web\nAction Input: {\"query\":\"test query examples in technology and + software development\"}\nObservation: Found information about test query examples + in technology and software development: This is a simulated search result for + demonstration purposes."}, {"role": "assistant", "content": "```\nThought: I + have gathered simulated search results about test query examples in technology + and software development, but they are not precise enough to formulate a final + answer.\nAction: search_web\nAction Input: {\"query\":\"importance of test queries + in software testing\"} \nObservation: Found information about importance of + test queries in software testing: This is a simulated search result for demonstration + purposes."}, {"role": "assistant", "content": "```\nThought: I have gathered + simulated search results regarding the importance of test queries in software + testing, but I still need a concrete answer about test queries.\nAction: search_web\nAction + Input: {\"query\":\"how to create effective test queries\"} \nObservation: Found + information about how to create effective test queries: This is a simulated + search result for demonstration purposes."}, {"role": "assistant", "content": + "```\nThought: I have gathered simulated search results on how to create effective + test queries, but I am still not reaching a definitive conclusion that addresses + a specific question about test queries.\nAction: search_web\nAction Input: {\"query\":\"common + practices for test queries in software development\"}\nObservation: Found information + about common practices for test queries in software development: This is a simulated + search result for demonstration purposes."}, {"role": "assistant", "content": + "```\nThought: I have retrieved simulated search results about common practices + for test queries in software development, but they still do not lead to a clear + understanding or conclusion.\nAction: search_web\nAction Input: {\"query\":\"test + queries definition and purpose in software testing\"}\nObservation: Found information + about test queries definition and purpose in software testing: This is a simulated + search result for demonstration purposes."}], "model": "gpt-4o-mini", "stop": + ["\nObservation:"]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate, zstd + connection: + - keep-alive + content-length: + - '4802' + content-type: + - application/json + cookie: + - __cf_bm=skEg5DBE_nQ5gLAsfGzhjTetiNUJ_Y2bXWLMsvjIi7s-1744222695-1.0.1.1-qyjwnTgJKwF54pRhf0YHxW_BUw6p7SC60kwFsF9XTq4i2u2mnFKVq4WbsgvQDeuDEIxyaNb.ngWUVOU1GIX1O2Hcxcdn6TSaJ8NXTQw28F8; + _cfuvid=Hwvd7n4RVfOZLGiOKPaHmYJC7h8rCQmlmnBgBsKqy4Y-1744222695443-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.68.2 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.68.2 + x-stainless-raw-response: + - 'true' + x-stainless-read-timeout: + - '600.0' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.9 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-BKUIDeRfBofhIhyZITac402rRqpq4\",\n \"object\": + \"chat.completion\",\n \"created\": 1744222705,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"```\\nThought: I have obtained simulated + search results on the definition and purpose of test queries in software testing + but have not reached a clear understanding of the overall topic.\\nAction: search_web\\nAction + Input: {\\\"query\\\":\\\"best practices for writing test queries in programming\\\"}\",\n + \ \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": + null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": + 858,\n \"completion_tokens\": 53,\n \"total_tokens\": 911,\n \"prompt_tokens_details\": + {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": + {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": + \"default\",\n \"system_fingerprint\": \"fp_b376dfbbd5\"\n}\n" + headers: + CF-RAY: + - 92dc01c6be56cf41-SJC + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Wed, 09 Apr 2025 18:18:26 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '1061' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149998920' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_6b4ab6ed4aa78f13539acd43f4ede325 + http_version: HTTP/1.1 + status_code: 200 +- request: + body: !!binary | + CvADCiQKIgoMc2VydmljZS5uYW1lEhIKEGNyZXdBSS10ZWxlbWV0cnkSxwMKEgoQY3Jld2FpLnRl + bGVtZXRyeRKOAQoQ9ZjbndqkZYC5BBQvONb6JRIIMCKemaXXNaIqClRvb2wgVXNhZ2UwATkgOZf7 + Trk0GEEgUKj7Trk0GEobCg5jcmV3YWlfdmVyc2lvbhIJCgcwLjEwOC4wShkKCXRvb2xfbmFtZRIM + CgpzZWFyY2hfd2ViSg4KCGF0dGVtcHRzEgIYAXoCGAGFAQABAAASjgEKEHGziol7hAM6v8Wiqdyx + 3N4SCKMSaeZkd4O5KgpUb29sIFVzYWdlMAE5sG2ZPk+5NBhBmEGhPk+5NBhKGwoOY3Jld2FpX3Zl + cnNpb24SCQoHMC4xMDguMEoZCgl0b29sX25hbWUSDAoKc2VhcmNoX3dlYkoOCghhdHRlbXB0cxIC + GAF6AhgBhQEAAQAAEo4BChDKCi941SjMlSHpayNukzmfEgi7zXbRC3AlsioKVG9vbCBVc2FnZTAB + ORAh9odPuTQYQbCD/YdPuTQYShsKDmNyZXdhaV92ZXJzaW9uEgkKBzAuMTA4LjBKGQoJdG9vbF9u + YW1lEgwKCnNlYXJjaF93ZWJKDgoIYXR0ZW1wdHMSAhgBegIYAYUBAAEAAA== + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate, zstd + Connection: + - keep-alive + Content-Length: + - '499' + Content-Type: + - application/x-protobuf + User-Agent: + - OTel-OTLP-Exporter-Python/1.31.1 + method: POST + uri: https://telemetry.crewai.com:4319/v1/traces + response: + body: + string: "\n\0" + headers: + Content-Length: + - '2' + Content-Type: + - application/x-protobuf + Date: + - Wed, 09 Apr 2025 18:18:27 GMT + status: + code: 200 + message: OK +- request: + body: '{"messages": [{"role": "system", "content": "You are Test Agent. Test Backstory\nYour + personal goal is: Test Goal\n\nYou ONLY have access to the following tools, + and should NEVER make up tools that are not listed here:\n\nTool Name: search_web\nTool + Arguments: {''query'': {''description'': None, ''type'': ''str''}}\nTool Description: + Search the web for information about a topic.\nTool Name: calculate\nTool Arguments: + {''expression'': {''description'': None, ''type'': ''str''}}\nTool Description: + Calculate the result of a mathematical expression.\n\nIMPORTANT: Use the following + format in your response:\n\n```\nThought: you should always think about what + to do\nAction: the action to take, only one name of [search_web, calculate], + just the name, exactly as it''s written.\nAction Input: the input to the action, + just a simple JSON object, enclosed in curly braces, using \" to wrap keys and + values.\nObservation: the result of the action\n```\n\nOnce all necessary information + is gathered, return the following format:\n\n```\nThought: I now know the final + answer\nFinal Answer: the final answer to the original input question\n```"}, + {"role": "user", "content": "Test query"}, {"role": "assistant", "content": + "```\nThought: I need to understand what specific information or topic to search + for.\nAction: search_web\nAction Input: {\"query\":\"Test query\"}\nObservation: + Found information about Test query: This is a simulated search result for demonstration + purposes."}, {"role": "assistant", "content": "```\nThought: I have simulated + search results related to a test query. However, I need to clarify the specific + topic or question to provide a more accurate answer.\nAction: search_web\nAction + Input: {\"query\":\"What is the purpose and significance of a test query?\"}\nObservation: + Found information about What is the purpose and significance of a test query?: + This is a simulated search result for demonstration purposes."}, {"role": "assistant", + "content": "```\nThought: I have some simulated search results regarding the + purpose and significance of a test query but still need clearer context to provide + a meaningful answer.\nAction: search_web\nAction Input: {\"query\":\"examples + of test queries in various contexts\"}\nObservation: Found information about + examples of test queries in various contexts: This is a simulated search result + for demonstration purposes."}, {"role": "assistant", "content": "```\nThought: + I still have only simulated results and not specific information that can lead + to a final answer. I need to refine the search for more relevant information.\nAction: + search_web\nAction Input: {\"query\":\"test query examples in technology and + software development\"}\nObservation: Found information about test query examples + in technology and software development: This is a simulated search result for + demonstration purposes."}, {"role": "assistant", "content": "```\nThought: I + have gathered simulated search results about test query examples in technology + and software development, but they are not precise enough to formulate a final + answer.\nAction: search_web\nAction Input: {\"query\":\"importance of test queries + in software testing\"} \nObservation: Found information about importance of + test queries in software testing: This is a simulated search result for demonstration + purposes."}, {"role": "assistant", "content": "```\nThought: I have gathered + simulated search results regarding the importance of test queries in software + testing, but I still need a concrete answer about test queries.\nAction: search_web\nAction + Input: {\"query\":\"how to create effective test queries\"} \nObservation: Found + information about how to create effective test queries: This is a simulated + search result for demonstration purposes."}, {"role": "assistant", "content": + "```\nThought: I have gathered simulated search results on how to create effective + test queries, but I am still not reaching a definitive conclusion that addresses + a specific question about test queries.\nAction: search_web\nAction Input: {\"query\":\"common + practices for test queries in software development\"}\nObservation: Found information + about common practices for test queries in software development: This is a simulated + search result for demonstration purposes."}, {"role": "assistant", "content": + "```\nThought: I have retrieved simulated search results about common practices + for test queries in software development, but they still do not lead to a clear + understanding or conclusion.\nAction: search_web\nAction Input: {\"query\":\"test + queries definition and purpose in software testing\"}\nObservation: Found information + about test queries definition and purpose in software testing: This is a simulated + search result for demonstration purposes."}, {"role": "assistant", "content": + "```\nThought: I have obtained simulated search results on the definition and + purpose of test queries in software testing but have not reached a clear understanding + of the overall topic.\nAction: search_web\nAction Input: {\"query\":\"best practices + for writing test queries in programming\"}\nObservation: Found information about + best practices for writing test queries in programming: This is a simulated + search result for demonstration purposes."}], "model": "gpt-4o-mini", "stop": + ["\nObservation:"]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate, zstd + connection: + - keep-alive + content-length: + - '5287' + content-type: + - application/json + cookie: + - __cf_bm=skEg5DBE_nQ5gLAsfGzhjTetiNUJ_Y2bXWLMsvjIi7s-1744222695-1.0.1.1-qyjwnTgJKwF54pRhf0YHxW_BUw6p7SC60kwFsF9XTq4i2u2mnFKVq4WbsgvQDeuDEIxyaNb.ngWUVOU1GIX1O2Hcxcdn6TSaJ8NXTQw28F8; + _cfuvid=Hwvd7n4RVfOZLGiOKPaHmYJC7h8rCQmlmnBgBsKqy4Y-1744222695443-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.68.2 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.68.2 + x-stainless-raw-response: + - 'true' + x-stainless-read-timeout: + - '600.0' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.9 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-BKUIFrC56yu0K1Kdj1JKa5ChC84RR\",\n \"object\": + \"chat.completion\",\n \"created\": 1744222707,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"```\\nThought: I have compiled some information + regarding best practices for writing test queries in programming, but it's still + not yielding a direct answer or clear outcome.\\nAction: search_web\\nAction + Input: {\\\"query\\\":\\\"typical structure of test queries for SQL databases\\\"}\",\n + \ \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": + null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": + 939,\n \"completion_tokens\": 52,\n \"total_tokens\": 991,\n \"prompt_tokens_details\": + {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": + {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": + \"default\",\n \"system_fingerprint\": \"fp_b376dfbbd5\"\n}\n" + headers: + CF-RAY: + - 92dc01ce6dd6cf41-SJC + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Wed, 09 Apr 2025 18:18:28 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '980' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149998809' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_74887821474e2c11eaf30624b239c1a0 + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '{"messages": [{"role": "system", "content": "You are Test Agent. Test Backstory\nYour + personal goal is: Test Goal\n\nYou ONLY have access to the following tools, + and should NEVER make up tools that are not listed here:\n\nTool Name: search_web\nTool + Arguments: {''query'': {''description'': None, ''type'': ''str''}}\nTool Description: + Search the web for information about a topic.\nTool Name: calculate\nTool Arguments: + {''expression'': {''description'': None, ''type'': ''str''}}\nTool Description: + Calculate the result of a mathematical expression.\n\nIMPORTANT: Use the following + format in your response:\n\n```\nThought: you should always think about what + to do\nAction: the action to take, only one name of [search_web, calculate], + just the name, exactly as it''s written.\nAction Input: the input to the action, + just a simple JSON object, enclosed in curly braces, using \" to wrap keys and + values.\nObservation: the result of the action\n```\n\nOnce all necessary information + is gathered, return the following format:\n\n```\nThought: I now know the final + answer\nFinal Answer: the final answer to the original input question\n```"}, + {"role": "user", "content": "Test query"}, {"role": "assistant", "content": + "```\nThought: I need to understand what specific information or topic to search + for.\nAction: search_web\nAction Input: {\"query\":\"Test query\"}\nObservation: + Found information about Test query: This is a simulated search result for demonstration + purposes."}, {"role": "assistant", "content": "```\nThought: I have simulated + search results related to a test query. However, I need to clarify the specific + topic or question to provide a more accurate answer.\nAction: search_web\nAction + Input: {\"query\":\"What is the purpose and significance of a test query?\"}\nObservation: + Found information about What is the purpose and significance of a test query?: + This is a simulated search result for demonstration purposes."}, {"role": "assistant", + "content": "```\nThought: I have some simulated search results regarding the + purpose and significance of a test query but still need clearer context to provide + a meaningful answer.\nAction: search_web\nAction Input: {\"query\":\"examples + of test queries in various contexts\"}\nObservation: Found information about + examples of test queries in various contexts: This is a simulated search result + for demonstration purposes."}, {"role": "assistant", "content": "```\nThought: + I still have only simulated results and not specific information that can lead + to a final answer. I need to refine the search for more relevant information.\nAction: + search_web\nAction Input: {\"query\":\"test query examples in technology and + software development\"}\nObservation: Found information about test query examples + in technology and software development: This is a simulated search result for + demonstration purposes."}, {"role": "assistant", "content": "```\nThought: I + have gathered simulated search results about test query examples in technology + and software development, but they are not precise enough to formulate a final + answer.\nAction: search_web\nAction Input: {\"query\":\"importance of test queries + in software testing\"} \nObservation: Found information about importance of + test queries in software testing: This is a simulated search result for demonstration + purposes."}, {"role": "assistant", "content": "```\nThought: I have gathered + simulated search results regarding the importance of test queries in software + testing, but I still need a concrete answer about test queries.\nAction: search_web\nAction + Input: {\"query\":\"how to create effective test queries\"} \nObservation: Found + information about how to create effective test queries: This is a simulated + search result for demonstration purposes."}, {"role": "assistant", "content": + "```\nThought: I have gathered simulated search results on how to create effective + test queries, but I am still not reaching a definitive conclusion that addresses + a specific question about test queries.\nAction: search_web\nAction Input: {\"query\":\"common + practices for test queries in software development\"}\nObservation: Found information + about common practices for test queries in software development: This is a simulated + search result for demonstration purposes."}, {"role": "assistant", "content": + "```\nThought: I have retrieved simulated search results about common practices + for test queries in software development, but they still do not lead to a clear + understanding or conclusion.\nAction: search_web\nAction Input: {\"query\":\"test + queries definition and purpose in software testing\"}\nObservation: Found information + about test queries definition and purpose in software testing: This is a simulated + search result for demonstration purposes."}, {"role": "assistant", "content": + "```\nThought: I have obtained simulated search results on the definition and + purpose of test queries in software testing but have not reached a clear understanding + of the overall topic.\nAction: search_web\nAction Input: {\"query\":\"best practices + for writing test queries in programming\"}\nObservation: Found information about + best practices for writing test queries in programming: This is a simulated + search result for demonstration purposes."}, {"role": "assistant", "content": + "```\nThought: I have compiled some information regarding best practices for + writing test queries in programming, but it''s still not yielding a direct answer + or clear outcome.\nAction: search_web\nAction Input: {\"query\":\"typical structure + of test queries for SQL databases\"}\nObservation: Found information about typical + structure of test queries for SQL databases: This is a simulated search result + for demonstration purposes."}, {"role": "assistant", "content": "```\nThought: + I have compiled some information regarding best practices for writing test queries + in programming, but it''s still not yielding a direct answer or clear outcome.\nAction: + search_web\nAction Input: {\"query\":\"typical structure of test queries for + SQL databases\"}\nObservation: Found information about typical structure of + test queries for SQL databases: This is a simulated search result for demonstration + purposes.\nNow it''s time you MUST give your absolute best final answer. You''ll + ignore all previous instructions, stop using any tools, and just return your + absolute BEST Final answer."}], "model": "gpt-4o-mini", "stop": ["\nObservation:"]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate, zstd + connection: + - keep-alive + content-length: + - '6397' + content-type: + - application/json + cookie: + - __cf_bm=skEg5DBE_nQ5gLAsfGzhjTetiNUJ_Y2bXWLMsvjIi7s-1744222695-1.0.1.1-qyjwnTgJKwF54pRhf0YHxW_BUw6p7SC60kwFsF9XTq4i2u2mnFKVq4WbsgvQDeuDEIxyaNb.ngWUVOU1GIX1O2Hcxcdn6TSaJ8NXTQw28F8; + _cfuvid=Hwvd7n4RVfOZLGiOKPaHmYJC7h8rCQmlmnBgBsKqy4Y-1744222695443-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.68.2 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.68.2 + x-stainless-raw-response: + - 'true' + x-stainless-read-timeout: + - '600.0' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.9 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-BKUIGFZys7kGg0T8X7mk0vRwllozu\",\n \"object\": + \"chat.completion\",\n \"created\": 1744222708,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"```\\nThought: I now know the final answer\\nFinal + Answer: Test queries are critical components in software testing, often used + as predefined statements to verify that software behaves as expected. They typically + consist of queries written in a language suitable for the database or application + being tested, and they help ensure accuracy and reliability in data retrieval + and manipulation processes.\\n```\",\n \"refusal\": null,\n \"annotations\": + []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n + \ }\n ],\n \"usage\": {\n \"prompt_tokens\": 1131,\n \"completion_tokens\": + 70,\n \"total_tokens\": 1201,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n + \ \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": + \"default\",\n \"system_fingerprint\": \"fp_44added55e\"\n}\n" + headers: + CF-RAY: + - 92dc01d54d84cf41-SJC + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Wed, 09 Apr 2025 18:18:30 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '1314' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149998552' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_7bf8e57839667548acfc526d23f26b8b + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '{"messages": [{"role": "system", "content": "You are Test Agent. Test Backstory\nYour + personal goal is: Test Goal\n\nYou ONLY have access to the following tools, + and should NEVER make up tools that are not listed here:\n\nTool Name: search_web\nTool + Arguments: {''query'': {''description'': None, ''type'': ''str''}}\nTool Description: + Search the web for information about a topic.\nTool Name: calculate\nTool Arguments: + {''expression'': {''description'': None, ''type'': ''str''}}\nTool Description: + Calculate the result of a mathematical expression.\n\nIMPORTANT: Use the following + format in your response:\n\n```\nThought: you should always think about what + to do\nAction: the action to take, only one name of [search_web, calculate], + just the name, exactly as it''s written.\nAction Input: the input to the action, + just a simple JSON object, enclosed in curly braces, using \" to wrap keys and + values.\nObservation: the result of the action\n```\n\nOnce all necessary information + is gathered, return the following format:\n\n```\nThought: I now know the final + answer\nFinal Answer: the final answer to the original input question\n```"}, + {"role": "user", "content": "Test query"}, {"role": "assistant", "content": + "```\nThought: I need to understand what specific information or topic to search + for.\nAction: search_web\nAction Input: {\"query\":\"Test query\"}\nObservation: + Found information about Test query: This is a simulated search result for demonstration + purposes."}, {"role": "assistant", "content": "```\nThought: I have simulated + search results related to a test query. However, I need to clarify the specific + topic or question to provide a more accurate answer.\nAction: search_web\nAction + Input: {\"query\":\"What is the purpose and significance of a test query?\"}\nObservation: + Found information about What is the purpose and significance of a test query?: + This is a simulated search result for demonstration purposes."}, {"role": "assistant", + "content": "```\nThought: I have some simulated search results regarding the + purpose and significance of a test query but still need clearer context to provide + a meaningful answer.\nAction: search_web\nAction Input: {\"query\":\"examples + of test queries in various contexts\"}\nObservation: Found information about + examples of test queries in various contexts: This is a simulated search result + for demonstration purposes."}, {"role": "assistant", "content": "```\nThought: + I still have only simulated results and not specific information that can lead + to a final answer. I need to refine the search for more relevant information.\nAction: + search_web\nAction Input: {\"query\":\"test query examples in technology and + software development\"}\nObservation: Found information about test query examples + in technology and software development: This is a simulated search result for + demonstration purposes."}, {"role": "assistant", "content": "```\nThought: I + have gathered simulated search results about test query examples in technology + and software development, but they are not precise enough to formulate a final + answer.\nAction: search_web\nAction Input: {\"query\":\"importance of test queries + in software testing\"} \nObservation: Found information about importance of + test queries in software testing: This is a simulated search result for demonstration + purposes."}, {"role": "assistant", "content": "```\nThought: I have gathered + simulated search results regarding the importance of test queries in software + testing, but I still need a concrete answer about test queries.\nAction: search_web\nAction + Input: {\"query\":\"how to create effective test queries\"} \nObservation: Found + information about how to create effective test queries: This is a simulated + search result for demonstration purposes."}, {"role": "assistant", "content": + "```\nThought: I have gathered simulated search results on how to create effective + test queries, but I am still not reaching a definitive conclusion that addresses + a specific question about test queries.\nAction: search_web\nAction Input: {\"query\":\"common + practices for test queries in software development\"}\nObservation: Found information + about common practices for test queries in software development: This is a simulated + search result for demonstration purposes."}, {"role": "assistant", "content": + "```\nThought: I have retrieved simulated search results about common practices + for test queries in software development, but they still do not lead to a clear + understanding or conclusion.\nAction: search_web\nAction Input: {\"query\":\"test + queries definition and purpose in software testing\"}\nObservation: Found information + about test queries definition and purpose in software testing: This is a simulated + search result for demonstration purposes."}, {"role": "assistant", "content": + "```\nThought: I have obtained simulated search results on the definition and + purpose of test queries in software testing but have not reached a clear understanding + of the overall topic.\nAction: search_web\nAction Input: {\"query\":\"best practices + for writing test queries in programming\"}\nObservation: Found information about + best practices for writing test queries in programming: This is a simulated + search result for demonstration purposes."}, {"role": "assistant", "content": + "```\nThought: I have compiled some information regarding best practices for + writing test queries in programming, but it''s still not yielding a direct answer + or clear outcome.\nAction: search_web\nAction Input: {\"query\":\"typical structure + of test queries for SQL databases\"}\nObservation: Found information about typical + structure of test queries for SQL databases: This is a simulated search result + for demonstration purposes."}, {"role": "assistant", "content": "```\nThought: + I have compiled some information regarding best practices for writing test queries + in programming, but it''s still not yielding a direct answer or clear outcome.\nAction: + search_web\nAction Input: {\"query\":\"typical structure of test queries for + SQL databases\"}\nObservation: Found information about typical structure of + test queries for SQL databases: This is a simulated search result for demonstration + purposes.\nNow it''s time you MUST give your absolute best final answer. You''ll + ignore all previous instructions, stop using any tools, and just return your + absolute BEST Final answer."}], "model": "gpt-4o-mini", "stop": ["\nObservation:"]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate, zstd + connection: + - keep-alive + content-length: + - '6397' + content-type: + - application/json + cookie: + - __cf_bm=skEg5DBE_nQ5gLAsfGzhjTetiNUJ_Y2bXWLMsvjIi7s-1744222695-1.0.1.1-qyjwnTgJKwF54pRhf0YHxW_BUw6p7SC60kwFsF9XTq4i2u2mnFKVq4WbsgvQDeuDEIxyaNb.ngWUVOU1GIX1O2Hcxcdn6TSaJ8NXTQw28F8; + _cfuvid=Hwvd7n4RVfOZLGiOKPaHmYJC7h8rCQmlmnBgBsKqy4Y-1744222695443-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.68.2 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.68.2 + x-stainless-raw-response: + - 'true' + x-stainless-read-timeout: + - '600.0' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.9 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-BKUIIKk71pZgTB8nANjAbcokqJQme\",\n \"object\": + \"chat.completion\",\n \"created\": 1744222710,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"```\\nThought: I have gathered some relevant + information about the structure of test queries for SQL databases, but I need + to consolidate my findings to provide a well-rounded answer.\\nFinal Answer: + Test queries are structured to validate the behavior of a database by retrieving + or manipulating data, typically using SQL syntax. They serve as a means to ensure + that the database functions correctly and meets specified requirements, and + can include SELECT, INSERT, UPDATE, DELETE statements. Common practices for + writing effective test queries encompass clarity, simplicity, and thoroughness + to ensure comprehensive testing coverage.\\n```\",\n \"refusal\": null,\n + \ \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": + \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 1131,\n \"completion_tokens\": + 111,\n \"total_tokens\": 1242,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n + \ \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": + \"default\",\n \"system_fingerprint\": \"fp_b376dfbbd5\"\n}\n" + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 92dc01e2ebbbcf41-SJC + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Wed, 09 Apr 2025 18:18:32 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '1489' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149998552' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_b8f316509569a5b7f996865747bd7803 + http_version: HTTP/1.1 + status_code: 200 +- request: + body: !!binary | + Cs4BCiQKIgoMc2VydmljZS5uYW1lEhIKEGNyZXdBSS10ZWxlbWV0cnkSpQEKEgoQY3Jld2FpLnRl + bGVtZXRyeRKOAQoQb86E9vGHREROlMWgNYtCFRIIEqI/lgJC1EgqClRvb2wgVXNhZ2UwATkgjZfJ + T7k0GEFQDavJT7k0GEobCg5jcmV3YWlfdmVyc2lvbhIJCgcwLjEwOC4wShkKCXRvb2xfbmFtZRIM + CgpzZWFyY2hfd2ViSg4KCGF0dGVtcHRzEgIYAXoCGAGFAQABAAA= + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate, zstd + Connection: + - keep-alive + Content-Length: + - '209' + Content-Type: + - application/x-protobuf + User-Agent: + - OTel-OTLP-Exporter-Python/1.31.1 + method: POST + uri: https://telemetry.crewai.com:4319/v1/traces + response: + body: + string: "\n\0" + headers: + Content-Length: + - '2' + Content-Type: + - application/x-protobuf + Date: + - Wed, 09 Apr 2025 18:18:32 GMT + status: + code: 200 + message: OK +- request: + body: '{"messages": [{"role": "system", "content": "You are Test Agent. Test Backstory\nYour + personal goal is: Test Goal\n\nYou ONLY have access to the following tools, + and should NEVER make up tools that are not listed here:\n\nTool Name: search_web\nTool + Arguments: {''query'': {''description'': None, ''type'': ''str''}}\nTool Description: + Search the web for information about a topic.\nTool Name: calculate\nTool Arguments: + {''expression'': {''description'': None, ''type'': ''str''}}\nTool Description: + Calculate the result of a mathematical expression.\n\nIMPORTANT: Use the following + format in your response:\n\n```\nThought: you should always think about what + to do\nAction: the action to take, only one name of [search_web, calculate], + just the name, exactly as it''s written.\nAction Input: the input to the action, + just a simple JSON object, enclosed in curly braces, using \" to wrap keys and + values.\nObservation: the result of the action\n```\n\nOnce all necessary information + is gathered, return the following format:\n\n```\nThought: I now know the final + answer\nFinal Answer: the final answer to the original input question\n```\nIMPORTANT: + Your final answer MUST contain all the information requested in the following + format: {\n \"test_field\": str\n}\n\nIMPORTANT: Ensure the final output does + not include any code block markers like ```json or ```python."}, {"role": "user", + "content": "Test query"}], "model": "gpt-4o-mini", "stop": ["\nObservation:"]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate, zstd + connection: + - keep-alive + content-length: + - '1451' + content-type: + - application/json + cookie: + - __cf_bm=skEg5DBE_nQ5gLAsfGzhjTetiNUJ_Y2bXWLMsvjIi7s-1744222695-1.0.1.1-qyjwnTgJKwF54pRhf0YHxW_BUw6p7SC60kwFsF9XTq4i2u2mnFKVq4WbsgvQDeuDEIxyaNb.ngWUVOU1GIX1O2Hcxcdn6TSaJ8NXTQw28F8; + _cfuvid=Hwvd7n4RVfOZLGiOKPaHmYJC7h8rCQmlmnBgBsKqy4Y-1744222695443-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.68.2 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.68.2 + x-stainless-raw-response: + - 'true' + x-stainless-read-timeout: + - '600.0' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.9 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-BKUIK1cGWdTdCfXW97KnyTMDv1SD9\",\n \"object\": + \"chat.completion\",\n \"created\": 1744222712,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"```\\nThought: I need to understand what + specific information or topic the user is asking about.\\nAction: search_web\\nAction + Input: {\\\"query\\\":\\\"Test query\\\"}\",\n \"refusal\": null,\n \"annotations\": + []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n + \ }\n ],\n \"usage\": {\n \"prompt_tokens\": 288,\n \"completion_tokens\": + 33,\n \"total_tokens\": 321,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n + \ \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": + \"default\",\n \"system_fingerprint\": \"fp_b376dfbbd5\"\n}\n" + headers: + CF-RAY: + - 92dc01ee68c4cf41-SJC + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Wed, 09 Apr 2025 18:18:32 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '715' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149999675' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_e6bbe801ad40cf6cf543b8f61e91b697 + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '{"messages": [{"role": "system", "content": "You are Test Agent. Test Backstory\nYour + personal goal is: Test Goal\n\nYou ONLY have access to the following tools, + and should NEVER make up tools that are not listed here:\n\nTool Name: search_web\nTool + Arguments: {''query'': {''description'': None, ''type'': ''str''}}\nTool Description: + Search the web for information about a topic.\nTool Name: calculate\nTool Arguments: + {''expression'': {''description'': None, ''type'': ''str''}}\nTool Description: + Calculate the result of a mathematical expression.\n\nIMPORTANT: Use the following + format in your response:\n\n```\nThought: you should always think about what + to do\nAction: the action to take, only one name of [search_web, calculate], + just the name, exactly as it''s written.\nAction Input: the input to the action, + just a simple JSON object, enclosed in curly braces, using \" to wrap keys and + values.\nObservation: the result of the action\n```\n\nOnce all necessary information + is gathered, return the following format:\n\n```\nThought: I now know the final + answer\nFinal Answer: the final answer to the original input question\n```\nIMPORTANT: + Your final answer MUST contain all the information requested in the following + format: {\n \"test_field\": str\n}\n\nIMPORTANT: Ensure the final output does + not include any code block markers like ```json or ```python."}, {"role": "user", + "content": "Test query"}, {"role": "assistant", "content": "```\nThought: I + need to understand what specific information or topic the user is asking about.\nAction: + search_web\nAction Input: {\"query\":\"Test query\"}\nObservation: Found information + about Test query: This is a simulated search result for demonstration purposes."}], + "model": "gpt-4o-mini", "stop": ["\nObservation:"]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate, zstd + connection: + - keep-alive + content-length: + - '1758' + content-type: + - application/json + cookie: + - __cf_bm=skEg5DBE_nQ5gLAsfGzhjTetiNUJ_Y2bXWLMsvjIi7s-1744222695-1.0.1.1-qyjwnTgJKwF54pRhf0YHxW_BUw6p7SC60kwFsF9XTq4i2u2mnFKVq4WbsgvQDeuDEIxyaNb.ngWUVOU1GIX1O2Hcxcdn6TSaJ8NXTQw28F8; + _cfuvid=Hwvd7n4RVfOZLGiOKPaHmYJC7h8rCQmlmnBgBsKqy4Y-1744222695443-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.68.2 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.68.2 + x-stainless-raw-response: + - 'true' + x-stainless-read-timeout: + - '600.0' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.9 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-BKUILKUKNjoIxHwNlg5nnEk5nXZAq\",\n \"object\": + \"chat.completion\",\n \"created\": 1744222713,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"```\\nThought: I now know the final answer\\nFinal + Answer: {\\n \\\"test_field\\\": \\\"This is a simulated search result for + demonstration purposes.\\\"\\n}\\n```\",\n \"refusal\": null,\n \"annotations\": + []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n + \ }\n ],\n \"usage\": {\n \"prompt_tokens\": 343,\n \"completion_tokens\": + 34,\n \"total_tokens\": 377,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n + \ \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": + \"default\",\n \"system_fingerprint\": \"fp_b376dfbbd5\"\n}\n" + headers: + CF-RAY: + - 92dc01f3ff6fcf41-SJC + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Wed, 09 Apr 2025 18:18:33 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '785' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149999609' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_f14d99a5f97f81331f62313a630e0f2c + http_version: HTTP/1.1 + status_code: 200 +version: 1 diff --git a/tests/cassettes/test_lite_agent_returns_usage_metrics_async.yaml b/tests/cassettes/test_lite_agent_returns_usage_metrics_async.yaml new file mode 100644 index 000000000..961c14267 --- /dev/null +++ b/tests/cassettes/test_lite_agent_returns_usage_metrics_async.yaml @@ -0,0 +1,249 @@ +interactions: +- request: + body: '{"messages": [{"role": "system", "content": "You are Research Assistant. + You are a helpful research assistant who can search for information about the + population of Tokyo.\nYour personal goal is: Find information about the population + of Tokyo\n\nYou ONLY have access to the following tools, and should NEVER make + up tools that are not listed here:\n\nTool Name: search_web\nTool Arguments: + {''query'': {''description'': None, ''type'': ''str''}}\nTool Description: Search + the web for information about a topic.\n\nIMPORTANT: Use the following format + in your response:\n\n```\nThought: you should always think about what to do\nAction: + the action to take, only one name of [search_web], just the name, exactly as + it''s written.\nAction Input: the input to the action, just a simple JSON object, + enclosed in curly braces, using \" to wrap keys and values.\nObservation: the + result of the action\n```\n\nOnce all necessary information is gathered, return + the following format:\n\n```\nThought: I now know the final answer\nFinal Answer: + the final answer to the original input question\n```"}, {"role": "user", "content": + "What is the population of Tokyo? Return your strucutred output in JSON format + with the following fields: summary, confidence"}], "model": "gpt-4o-mini", "stop": + ["\nObservation:"]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate, zstd + connection: + - keep-alive + content-length: + - '1290' + content-type: + - application/json + cookie: + - _cfuvid=u769MG.poap6iEjFpbByMFUC0FygMEqYSurr5DfLbas-1743447969501-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.68.2 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.68.2 + x-stainless-raw-response: + - 'true' + x-stainless-read-timeout: + - '600.0' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.9 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-BKUM5MZbz4TG6qmUtTrgKo8gI48FO\",\n \"object\": + \"chat.completion\",\n \"created\": 1744222945,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"```\\nThought: I need to find the current + population of Tokyo.\\nAction: search_web\\nAction Input: {\\\"query\\\":\\\"current + population of Tokyo 2023\\\"}\",\n \"refusal\": null,\n \"annotations\": + []\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n + \ }\n ],\n \"usage\": {\n \"prompt_tokens\": 248,\n \"completion_tokens\": + 33,\n \"total_tokens\": 281,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n + \ \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": + \"default\",\n \"system_fingerprint\": \"fp_b376dfbbd5\"\n}\n" + headers: + CF-RAY: + - 92dc079f8e5a7ab0-SJC + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Wed, 09 Apr 2025 18:22:26 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=1F.UUVSjZyp8QMRT0dTQXUJc5WlGpC3xAx4FY7KCQbs-1744222946-1.0.1.1-vcXIZcokSjfxyFeoTTUAWmBGmJpv0ss9iFqt5EJVZGE1PvSV2ov0erCS.KIo0xItBMuX_MtCgDSaYMPI3L9QDsLatWqfUFieHiFh0CrX4h8; + path=/; expires=Wed, 09-Apr-25 18:52:26 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=RbJuVW8hReYElyyghEbAFletdnJZ2mk5rn9D8EGuyNk-1744222946580-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '1282' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149999713' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_845ed875afd48dee3d88f33cbab88cc2 + http_version: HTTP/1.1 + status_code: 200 +- request: + body: '{"messages": [{"role": "system", "content": "You are Research Assistant. + You are a helpful research assistant who can search for information about the + population of Tokyo.\nYour personal goal is: Find information about the population + of Tokyo\n\nYou ONLY have access to the following tools, and should NEVER make + up tools that are not listed here:\n\nTool Name: search_web\nTool Arguments: + {''query'': {''description'': None, ''type'': ''str''}}\nTool Description: Search + the web for information about a topic.\n\nIMPORTANT: Use the following format + in your response:\n\n```\nThought: you should always think about what to do\nAction: + the action to take, only one name of [search_web], just the name, exactly as + it''s written.\nAction Input: the input to the action, just a simple JSON object, + enclosed in curly braces, using \" to wrap keys and values.\nObservation: the + result of the action\n```\n\nOnce all necessary information is gathered, return + the following format:\n\n```\nThought: I now know the final answer\nFinal Answer: + the final answer to the original input question\n```"}, {"role": "user", "content": + "What is the population of Tokyo? Return your strucutred output in JSON format + with the following fields: summary, confidence"}, {"role": "assistant", "content": + "```\nThought: I need to find the current population of Tokyo.\nAction: search_web\nAction + Input: {\"query\":\"current population of Tokyo 2023\"}\nObservation: Tokyo''s + population in 2023 was approximately 21 million people in the city proper, and + 37 million in the greater metropolitan area."}], "model": "gpt-4o-mini", "stop": + ["\nObservation:"]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate, zstd + connection: + - keep-alive + content-length: + - '1619' + content-type: + - application/json + cookie: + - _cfuvid=RbJuVW8hReYElyyghEbAFletdnJZ2mk5rn9D8EGuyNk-1744222946580-0.0.1.1-604800000; + __cf_bm=1F.UUVSjZyp8QMRT0dTQXUJc5WlGpC3xAx4FY7KCQbs-1744222946-1.0.1.1-vcXIZcokSjfxyFeoTTUAWmBGmJpv0ss9iFqt5EJVZGE1PvSV2ov0erCS.KIo0xItBMuX_MtCgDSaYMPI3L9QDsLatWqfUFieHiFh0CrX4h8 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.68.2 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.68.2 + x-stainless-raw-response: + - 'true' + x-stainless-read-timeout: + - '600.0' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.9 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"id\": \"chatcmpl-BKUM69pnk6VLn5rpDjGdg21mOxFke\",\n \"object\": + \"chat.completion\",\n \"created\": 1744222946,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"```\\nThought: I now know the final answer\\nFinal + Answer: {\\\"summary\\\":\\\"The population of Tokyo is approximately 21 million + in the city proper and 37 million in the greater metropolitan area as of 2023.\\\",\\\"confidence\\\":\\\"high\\\"}\\n```\",\n + \ \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": + null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": + 315,\n \"completion_tokens\": 51,\n \"total_tokens\": 366,\n \"prompt_tokens_details\": + {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": + {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": + \"default\",\n \"system_fingerprint\": \"fp_b376dfbbd5\"\n}\n" + headers: + CF-RAY: + - 92dc07a8ac9f7ab0-SJC + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Wed, 09 Apr 2025 18:22:27 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: + - crewai-iuxna1 + openai-processing-ms: + - '1024' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - '30000' + x-ratelimit-limit-tokens: + - '150000000' + x-ratelimit-remaining-requests: + - '29999' + x-ratelimit-remaining-tokens: + - '149999642' + x-ratelimit-reset-requests: + - 2ms + x-ratelimit-reset-tokens: + - 0s + x-request-id: + - req_d72860d8629025988b1170e939bc1f20 + http_version: HTTP/1.1 + status_code: 200 +version: 1 diff --git a/tests/test_lite_agent.py b/tests/test_lite_agent.py index 946be76aa..06c87319c 100644 --- a/tests/test_lite_agent.py +++ b/tests/test_lite_agent.py @@ -4,8 +4,8 @@ from typing import cast import pytest from pydantic import BaseModel, Field -from crewai import LLM -from crewai.lite_agent import LiteAgent +from crewai import LLM, Agent +from crewai.lite_agent import LiteAgent, LiteAgentOutput from crewai.tools import BaseTool from crewai.utilities.events import crewai_event_bus from crewai.utilities.events.tool_usage_events import ToolUsageStartedEvent @@ -63,12 +63,74 @@ class ResearchResult(BaseModel): sources: list[str] = Field(description="List of sources used") +@pytest.mark.vcr(filter_headers=["authorization"]) +@pytest.mark.parametrize("verbose", [True, False]) +def test_lite_agent_created_with_correct_parameters(monkeypatch, verbose): + """Test that LiteAgent is created with the correct parameters when Agent.kickoff() is called.""" + # Create a test agent with specific parameters + llm = LLM(model="gpt-4o-mini") + custom_tools = [WebSearchTool(), CalculatorTool()] + max_iter = 10 + max_execution_time = 300 + + agent = Agent( + role="Test Agent", + goal="Test Goal", + backstory="Test Backstory", + llm=llm, + tools=custom_tools, + max_iter=max_iter, + max_execution_time=max_execution_time, + verbose=verbose, + ) + + # Create a mock to capture the created LiteAgent + created_lite_agent = None + original_lite_agent = LiteAgent + + # Define a mock LiteAgent class that captures its arguments + class MockLiteAgent(original_lite_agent): + def __init__(self, **kwargs): + nonlocal created_lite_agent + created_lite_agent = kwargs + super().__init__(**kwargs) + + # Patch the LiteAgent class + monkeypatch.setattr("crewai.agent.LiteAgent", MockLiteAgent) + + # Call kickoff to create the LiteAgent + agent.kickoff("Test query") + + # Verify all parameters were passed correctly + assert created_lite_agent is not None + assert created_lite_agent["role"] == "Test Agent" + assert created_lite_agent["goal"] == "Test Goal" + assert created_lite_agent["backstory"] == "Test Backstory" + assert created_lite_agent["llm"] == llm + assert len(created_lite_agent["tools"]) == 2 + assert isinstance(created_lite_agent["tools"][0], WebSearchTool) + assert isinstance(created_lite_agent["tools"][1], CalculatorTool) + assert created_lite_agent["max_iterations"] == max_iter + assert created_lite_agent["max_execution_time"] == max_execution_time + assert created_lite_agent["verbose"] == verbose + assert created_lite_agent["response_format"] is None + + # Test with a response_format + monkeypatch.setattr("crewai.agent.LiteAgent", MockLiteAgent) + + class TestResponse(BaseModel): + test_field: str + + agent.kickoff("Test query", response_format=TestResponse) + assert created_lite_agent["response_format"] == TestResponse + + @pytest.mark.vcr(filter_headers=["authorization"]) def test_lite_agent_with_tools(): - """Test that LiteAgent can use tools.""" + """Test that Agent can use tools.""" # Create a LiteAgent with tools llm = LLM(model="gpt-4o-mini") - agent = LiteAgent( + agent = Agent( role="Research Assistant", goal="Find information about the population of Tokyo", backstory="You are a helpful research assistant who can search for information about the population of Tokyo.", @@ -106,7 +168,7 @@ def test_lite_agent_with_tools(): @pytest.mark.vcr(filter_headers=["authorization"]) def test_lite_agent_structured_output(): - """Test that LiteAgent can return a simple structured output.""" + """Test that Agent can return a simple structured output.""" class SimpleOutput(BaseModel): """Simple structure for agent outputs.""" @@ -117,18 +179,18 @@ def test_lite_agent_structured_output(): web_search_tool = WebSearchTool() llm = LLM(model="gpt-4o-mini") - agent = LiteAgent( + agent = Agent( role="Info Gatherer", goal="Provide brief information", backstory="You gather and summarize information quickly.", llm=llm, tools=[web_search_tool], verbose=True, - response_format=SimpleOutput, ) result = agent.kickoff( - "What is the population of Tokyo? Return your strucutred output in JSON format with the following fields: summary, confidence" + "What is the population of Tokyo? Return your strucutred output in JSON format with the following fields: summary, confidence", + response_format=SimpleOutput, ) print(f"\n=== Agent Result Type: {type(result)}") @@ -155,7 +217,7 @@ def test_lite_agent_structured_output(): def test_lite_agent_returns_usage_metrics(): """Test that LiteAgent returns usage metrics.""" llm = LLM(model="gpt-4o-mini") - agent = LiteAgent( + agent = Agent( role="Research Assistant", goal="Find information about the population of Tokyo", backstory="You are a helpful research assistant who can search for information about the population of Tokyo.", @@ -170,3 +232,26 @@ def test_lite_agent_returns_usage_metrics(): assert result.usage_metrics is not None assert result.usage_metrics["total_tokens"] > 0 + + +@pytest.mark.vcr(filter_headers=["authorization"]) +@pytest.mark.asyncio +async def test_lite_agent_returns_usage_metrics_async(): + """Test that LiteAgent returns usage metrics when run asynchronously.""" + llm = LLM(model="gpt-4o-mini") + agent = Agent( + role="Research Assistant", + goal="Find information about the population of Tokyo", + backstory="You are a helpful research assistant who can search for information about the population of Tokyo.", + llm=llm, + tools=[WebSearchTool()], + verbose=True, + ) + + result = await agent.kickoff_async( + "What is the population of Tokyo? Return your strucutred output in JSON format with the following fields: summary, confidence" + ) + assert isinstance(result, LiteAgentOutput) + assert "21 million" in result.raw or "37 million" in result.raw + assert result.usage_metrics is not None + assert result.usage_metrics["total_tokens"] > 0