Agent With Tools

Connect tools to your agent to interact with real world.

In this example, we will observe how to easily complete a Task that requires the use of tools with Beacon Labs agents.

Tools are the best method for connecting agents to the real world.


Agent with Tools

This agent will read and fetch the latest OpenAI developments from the internet.

agent_with_tools.py

pythonCopyEditfrom beaconlabs import Agent, Task
from beaconlabs.client.tools import Search  # Importing Search Tool

task = Task(
  "Find the latest OpenAI developments on the internet.", 
  tools=[Search]  # Adding Search tool to the Task
)

agent = Agent("Reporter")

agent.print_do(task)

To run the agent, install dependencies and export your OPENAI_API_KEY.


1. Set Up Your Virtual Environment

Mac / Windows

shCopyEditpython3 -m venv .venv
source .venv/bin/activate

2. Install Dependencies

Mac / Windows

shCopyEditpip install -U beaconlabs

3. Set Up Your OpenAI API Key

.env File

iniCopyEditOPENAI_API_KEY=sk-***

4. Run the Agent to Execute the Task

shCopyEditpython agent_with_tools.py

✅ You’ve successfully created an agent with tools using Beacon Labs! 🚀

Let me know if you need any modifications! 🎯

Last updated