Quickstart

Build Your First AI Agent with Beacon Labs in Under 2 Minutes

Build Your First Beacon Labs Agent

Let’s create a simple agent that is an expert in our company and acts as a Product Manager.

Before we proceed, make sure you have Beacon Labs installed. If you haven’t installed it yet, follow the installation guide.

Follow the steps below to get started! 🚀


1. Providing OpenAI API Key

Beacon Labs supports multiple LLMs. In this example, we will use OpenAI’s GPT-4 model, for which we need to set environment variables.

Python / Mac / Windows

pythonCopyEditimport os

os.environ["OPENAI_API_KEY"] = "sk-***"

2. Generate Your First Task

The task-centric structure is important for creating a programmatic design in agent systems. In Beacon Labs, you can generate a task-oriented structure with task descriptions, tools, context, and knowledge bases.

In this example, we will assign the Search tool to our task. The agent will use the Search tool at runtime.

pythonCopyEditfrom beaconlabs import Task, Agent
from beaconlabs.client.tools import Search

task = Task(
  "Research the latest news in Anthropic and OpenAI", 
  tools=[Search]
)

3. Generate an Expert Agent for Our Company

Beacon Labs has an automatic characterization mechanism. It’s essential to create agents tailored to your purpose. In this example, we will generate a Product Manager agent.

pythonCopyEditagent = Agent("Product Manager")

4. Running the Task on the Agent

pythonCopyEdit# Running the task
agent.print_do(task)

Connect Any MCP

The Beacon Labs framework supports connecting to any MCP server for your needs. Model Context Protocol (MCP) servers are maintained by various companies and communities, and Beacon Labs supports them all.

List of MCP Servers

At this step, you need to use the @client.mcp() decorator for a class with command, args, and env.

pythonCopyEdit# HackerNews MCP Server
class HackerNewsMCP:
    command = "uvx"
    args = ["mcp-hn"]
    # env = {"": ""}

task1 = Task(
  "Research the latest news in Anthropic and OpenAI", 
  tools=[HackerNewsMCP]
)

✅ You’ve successfully built your first agent with Beacon Labs! 🚀

Last updated