Skip to main content

What Are Agent Primitives?

Agent primitives are the fundamental building blocks that make up Agentbase agents. Understanding these primitives helps you build more sophisticated and capable agents.

Environment

Execution environments where agents operate

Essentials

Core capabilities every agent needs

Extensions

Advanced features for specialized use cases

Environment Primitives

The runtime environment where agents execute tasks.

Essential Primitives

Core capabilities that power agent functionality.
  • Prompts - Natural language instructions and system prompts
  • Custom Tools - Extend agent capabilities with your own tools
  • Hooks - Event-driven triggers and callbacks
  • Traces - Detailed execution logs and debugging
  • Evals - Quality assurance and testing

Extension Primitives

Advanced features for specialized use cases.
  • Memory - Long-term memory and recall
  • RAG - Retrieval-Augmented Generation
  • Workflow - Complex multi-step workflows
  • Orchestration - Coordinate complex agent systems
  • Tasks - Structured task management
  • Skills - Reusable agent capabilities
  • Trigger - Event-based automation
  • Scheduling - Time-based execution

How Primitives Work Together

Primitives combine to create powerful agent capabilities:

Example: Research Agent

A research agent might use these primitives:
1

Input via Prompts

User provides research query through natural language prompt
2

Web Search Extension

Agent uses web search to find relevant sources
3

Browser Environment

Navigates to websites and extracts content
4

RAG Extension

Stores and retrieves information from documents
5

File System

Saves research findings and generates report
6

Session Persistence

Maintains context across multiple queries
7

Traces

Logs all steps for debugging and optimization

Choosing the Right Primitives

Start Simple

Begin with essential primitives (prompts, sessions, file system)

Add as Needed

Incorporate extensions when requirements grow

Consider Performance

More primitives = more complexity (balance capability vs. efficiency)

Test Thoroughly

Use traces and evals to validate primitive interactions

Common Patterns

Pattern 1: Simple Task Execution

Primitives: Prompts + Sandbox + Traces
// Simple code execution
const result = await agentbase.runAgent({
  message: "Create a Python function to calculate fibonacci",
  mode: "base"
});

Pattern 2: Stateful Conversation

Primitives: Prompts + Sessions + Context Management
// Multi-turn conversation
const result1 = await agentbase.runAgent({
  message: "Analyze data.csv"
});

const result2 = await agentbase.runAgent({
  message: "Now create a visualization",
  session: result1.session
});

Pattern 3: Research & Analysis

Primitives: Web Search + Browser + RAG + File System
// Research task
const result = await agentbase.runAgent({
  message: "Research our top 3 competitors and create a comparison report",
  mode: "max"
});

Pattern 4: Automated Workflow

Primitives: Scheduling + Tasks + Hooks + Email
// Scheduled automation
const result = await agentbase.runAgent({
  message: "Check competitor pricing daily and email me if prices change",
  mode: "base"
});

Pattern 5: Multi-Agent System

Primitives: Multi-Agents + Orchestration + Parallelization
// Coordinated agents
const result = await agentbase.runAgent({
  message: "Use one agent to gather data and another to analyze it",
  mode: "max"
});

Learning Path

1

Start with Environment

Understand the sandbox, file system, and computer primitives
2

Master Essentials

3

Add Extensions

Explore extensions like web search, RAG, and memory as needed
4

Optimize & Monitor

Next Steps