> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bothive.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# HiveLang

> A readable language for defining production-ready agent behavior

<div className="hero">
  <h1 className="text-gradient">HiveLang</h1>

  <p className="hero-subtitle">
    HiveLang is Bothive's native language for defining agent behavior. Write agents the way you think about them — not as tangled prompt strings.
  </p>
</div>

## Why HiveLang Exists

If you've built agents before, you know the pain of managing scattered prompts, tool definitions, and deployment configs across multiple files. HiveLang consolidates everything into one readable format.

**HiveLang defines:**

* Agent identity and personality
* Clear instructions and rules
* Tool capabilities and workflows
* Event hooks and orchestration
* Multi-agent Swarms

## Quick Example (v5)

Here's a complete agent in HiveLang v5:

```hivelang theme={null}
bot SupportBot {
  description: "Friendly customer support agent for BotHive"
  
  capabilities {
    knowledgebase.search
    billing.checkStatus
    support.createTicket
  }
  
  instructions {
    You help customers with billing and technical questions.
    
    Rules:
    - Always be helpful and patient
    - Ask clarifying questions before guessing
    - Never expose internal system details
    - If unsure, escalate to human support
  }
  
  before input {
    log info: "Incoming message received"
  }
}
```

## Core Concepts

### 1. Bot Block

Every HiveLang file defines agents via a `bot` (or `agent`) block:

```hivelang theme={null}
bot MyBot {
  description: "Clear description of who the agent is"
}
```

### 2. Instructions

Instructions define behavior using curly braces:

```hivelang theme={null}
bot CodeReviewer {
  instructions {
    You review pull requests for code quality.
    
    Focus on:
    - Security vulnerabilities
    - Performance issues
    - Code style violations
    - Missing tests
    
    Be constructive, not critical.
  }
}
```

<Info className="callout callout-info glass-effect">
  The v5 parser natively understands curly braces for multi-line instructions, eliminating the need for quotes.
</Info>

### 3. Capabilities

Capabilities give agents access to integrations:

```hivelang theme={null}
bot DevAssistant {
  capabilities {
    github.createIssue
    github.searchCode
    code.runTests
    code.deployPreview
  }
}
```

### 4. Event Hooks

Define pre- and post-processing:

```hivelang theme={null}
bot OnboardingBot {
  before input {
    say "Welcome! Let me check your details..."
  }
  
  after response {
    call metrics.logEvent with { action: "response_sent" }
  }
}
```

### 5. Multi-Agent Swarms

Orchestrate complex workflows with `swarm`:

```hivelang theme={null}
swarm CustomerResolution {
  description: "Handles complex customer support flows"

  agent Triage {
    role: "Determine issue urgency"
    capabilities { tickets.read }
  }

  agent Responder {
    role: "Draft response to user"
    capabilities { kb.search }
  }

  on input {
    urgency = delegate to Triage with { query: input }
    if urgency > 5 {
      delegate to Responder with { query: input }
    } else {
      say "We will get back to you shortly."
    }
  }
}
```

## HiveLang vs Traditional Approaches

<CardGroup cols={2}>
  <Card title="Compared to Raw Prompts" icon="code" className="card glass-effect">
    **Python:**

    ```python theme={null}
    prompt = f"""
    You are a support agent...
    Here are tools: {tools}
    """
    ```

    **HiveLang:**

    ```hivelang theme={null}
    bot Support {
      instructions { You are a support agent... }
      capabilities { approved.tools }
    }
    ```
  </Card>

  <Card title="Compared to LangChain" icon="link" className="card glass-effect">
    **LangChain:**

    ```python theme={null}
    agent = Agent(llm=llm, tools=[...])
    ```

    **HiveLang:**

    ```hivelang theme={null}
    bot MyAgent {
      capabilities { tool1, tool2 }
    }
    ```
  </Card>
</CardGroup>

## Next Steps

<CardGroup cols={3}>
  <Card title="Build Agent" icon="hammer" href="/guides/build-your-first-agent" className="card glass-effect" />

  <Card title="Vercel AI SDK" icon="bolt" href="/concepts/bothive-vs-vercel-ai" className="card glass-effect" />

  <Card title="Observability" icon="chart-line" href="/concepts/observability" className="card glass-effect" />
</CardGroup>
