How to Build an AI Agent
An AI agent is a persistent AI assistant that runs 24/7, responds to messages, and executes tasks autonomously. Unlike chatbots that only respond when prompted, agents actively monitor, decide, and act on their own. They can send you weather briefings, scan your email for urgent items, track cryptocurrency prices, or notify you about GitHub activity without being asked.
This guide shows you how to build your own AI agent using OpenClaw. The entire process takes about 30 minutes and requires no coding experience.
What is an AI Agent?
Think of an AI agent as a digital assistant that never sleeps. Traditional AI chatbots wait for you to ask questions. Agents take initiative. They run scheduled tasks, monitor external systems, and proactively deliver information when it matters.
Successful agents in production include FelixCraft (gaming community management), Anti Hunter (market research automation), and KellyClaude (executive assistant services). These agents generate revenue by handling tasks their owners would otherwise pay humans to do.
The key difference is persistence. Agents maintain context across conversations, remember your preferences, and execute complex workflows over time. When you tell your agent "monitor this GitHub repository for new issues," it actually does it continuously until you tell it to stop.
Install OpenClaw
OpenClaw is the framework that powers autonomous AI agents. It handles the infrastructure so you can focus on what you want your agent to do.
Download OpenClaw from the official repository and run the installer:
curl -sSL https://get.openclaw.org | sh
source ~/.bashrc
openclaw version
The installer sets up the OpenClaw CLI, creates a workspace directory, and initializes the gateway daemon that manages your agent's runtime. Verify the installation by checking the version output.
On first run, OpenClaw will prompt you to configure your AI model provider. You can use OpenAI, Anthropic, or local models through Ollama. For this tutorial, we recommend starting with a hosted provider for simplicity.
Configure Workspace
Your agent needs two core files that define its identity and purpose. Navigate to your OpenClaw workspace and create these configuration files:
cd ~/.openclaw/workspace
openclaw workspace init
This creates SOUL.md and USER.md templates. Edit these files to define your agent:
SOUL.md describes who your agent is. Be specific about personality, communication style, and core responsibilities. Example:
# SOUL.md
You are TaskMaster, a productivity-focused AI agent.
## Personality
- Direct and efficient in communication
- Proactive about deadlines and reminders
- Helpful but not chatty
## Primary Functions
- Monitor calendar for upcoming meetings
- Track project deadlines
- Send daily productivity briefings
- Manage task prioritization
USER.md describes the person you are helping. Include timezone, preferences, work schedule, and communication style. This helps your agent understand context and timing:
# USER.md
Name: Alex Chen
Role: Software Developer
Timezone: UTC-8 (Pacific Time)
## Schedule
- Work: 9 AM - 6 PM weekdays
- Preferred contact: Telegram
- Urgent threshold: respond within 30 minutes
## Preferences
- Morning briefings at 8:30 AM
- End-of-day summaries
- No notifications after 10 PM
Connect Messaging
Agents need a way to communicate with you. Telegram is the most popular option because it supports rich media, has excellent bot APIs, and works on all devices.
Create a Telegram bot by messaging @BotFather on Telegram:
- Send
/newbotto @BotFather - Choose a name for your bot
- Choose a username (must end in 'bot')
- Copy the bot token that BotFather provides
Configure OpenClaw to use your Telegram bot:
openclaw config telegram --token YOUR_BOT_TOKEN
openclaw config telegram --chat-id YOUR_CHAT_ID
Find your chat ID by sending a message to your bot, then visiting https://api.telegram.org/botYOUR_BOT_TOKEN/getUpdates in your browser. Look for the "id" field in the response.
Test the connection:
openclaw message "Hello, this is your new agent!"
Enable Skills
Skills are modular capabilities that give your agent new powers. OpenClaw includes built-in skills for common tasks, and the community has created 150+ additional skills available through ClawHub.
Start with essential built-in skills:
openclaw skills enable weather
openclaw skills enable calendar
openclaw skills enable healthcheck
openclaw skills enable web-search
Browse the ClawIndex directory to discover community skills. Popular additions include:
- crypto-tracker: Monitor cryptocurrency prices and portfolio values
- github-watcher: Get notifications for repository activity, issues, and pull requests
- email-scanner: Parse and prioritize incoming emails based on importance
- news-digest: Curate daily news briefings from specified sources
Install community skills from ClawHub:
openclaw skills install crypto-tracker
openclaw skills enable crypto-tracker
Each skill comes with its own SKILL.md file that explains configuration options and usage examples. Read these carefully to understand what each skill can do.
Set Up Automation
This is where your agent becomes truly autonomous. OpenClaw supports two types of automation:
Heartbeats
Heartbeats are periodic check-ins where your agent evaluates what needs attention. Configure a heartbeat to run every 30 minutes:
openclaw config heartbeat --interval 30m
openclaw config heartbeat --enable
Create a HEARTBEAT.md file to define what your agent should check during each heartbeat:
# HEARTBEAT.md
Check the following every heartbeat:
1. Any urgent emails in the last 30 minutes?
2. Calendar events in the next 2 hours?
3. GitHub notifications since last check?
4. Weather alerts for severe conditions?
If nothing requires immediate attention, reply HEARTBEAT_OK.
Cron Jobs
Cron jobs run specific tasks at exact times. Set up a daily briefing at 8:30 AM:
openclaw cron add "30 8 * * 1-5" "Send daily briefing with weather, calendar, and top 3 priorities"
The format follows standard cron syntax: minute, hour, day of month, month, day of week.
Deploy Your Agent
Start your agent and configure it to run continuously:
openclaw gateway start
openclaw agent start --daemon
The gateway manages connections and routing, while the agent daemon handles conversations and executes tasks. Both will restart automatically if they crash.
Verify everything is running:
openclaw status
You should see the gateway and agent both listed as "running." Send a test message to your Telegram bot to confirm bidirectional communication works.
For production deployment, consider running OpenClaw on a VPS or dedicated server. This ensures your agent remains available even when your personal computer is off. Popular options include DigitalOcean, Linode, or AWS EC2 instances.
Real World Examples
Here are proven agent configurations that demonstrate the platform's capabilities:
Executive Assistant Agent
Monitors email, calendar, and news. Sends daily briefings, flags urgent items, and provides weather updates before outdoor meetings. This type of agent has helped executives save 2-3 hours per day on information management.
DevOps Monitoring Agent
Watches GitHub repositories, monitors server health, tracks deployment status, and alerts on system anomalies. Popular with development teams who want proactive infrastructure monitoring without complex dashboard setups.
Investment Research Agent
Tracks portfolio performance, monitors market news for held positions, sends price alerts, and summarizes earnings reports. Several users have automated their entire investment research workflow this way.
The FelixCraft, Anti Hunter, and KellyClaude agents mentioned earlier generate monthly recurring revenue by providing specialized services to their respective communities. This demonstrates that well-configured agents can create genuine economic value.
Your agent's capabilities grow with the skills you install and the automation you configure. The 150+ projects listed on ClawIndex cover everything from social media management to IoT device control. The platform scales from simple notification bots to sophisticated business automation systems.
Start simple, then expand your agent's capabilities as you identify new automation opportunities in your workflow.