Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md


VoltAgent Example: Using Reasoning Tools (`think` & `analyze`)
This example demonstrates how to equip a VoltAgent with `think` and `analyze` tools to enable step-by-step reasoning and analysis during task execution.

npm version Contributor Covenant Discord Twitter Follow


VoltAgent: With Thinking Tools Example

This example showcases how to integrate the think and analyze tools from @voltagent/core into an agent. These tools allow the agent to perform structured reasoning:

  • think: Acts as a scratchpad for the agent to break down problems, plan steps, and explain its reasoning before taking action.
  • analyze: Allows the agent to evaluate the results of its actions or thoughts and decide on the next step (continue, validate, or provide a final answer).

By using these tools, agents can tackle more complex tasks, exhibit clearer thought processes, and potentially improve their accuracy and reliability.

This example sets up a basic agent, includes the reasoning tools, and logs the reasoning steps emitted by the agent during its interaction.

Setup

  1. Clone the repository (if you haven't already):
    git clone https://github.com/voltagent/voltagent.git
    cd voltagent/examples/with-thinking-tool
  2. Install dependencies:
    npm install
  3. Set up environment variables: Create a .env file in this directory (examples/with-thinking-tool) and add your OpenAI API key:
    OPENAI_API_KEY=your_openai_api_key_here

Run the Example

npm run dev

Observe the console output. You should see the agent's final response as well as the ReasoningStep objects logged whenever the agent uses the think or analyze tools.