Quick Start

This guide will help you create your first NudgeLang agent in minutes.

Creating Your First Agent

Let’s create a simple customer support agent that can handle basic inquiries.

  1. Create a new file named support_agent.yaml:
manifest:
  version: "1.0"
  title: "Basic Support Agent"
  description: "A simple agent that handles customer inquiries"
  author: "Your Name"
  created_at: "2025-05-07"

models:
  - id: main_model
    type: claude
    version: "claude-3-7-sonnet"
    config:
      temperature: 0.7
      max_tokens: 1000

states:
  - id: start
    type: initial
    next: handle_inquiry
  
  - id: handle_inquiry
    type: llm
    model: main_model
    prompt: |
      You are a helpful customer support agent. Respond to the following inquiry:
      
      {query}
      
      Be friendly and professional in your response.      
    input:
      query: "${input.message}"
    next: end
  
  - id: end
    type: output
    value: "${previous.output}"
  1. Run the agent:
nudgelang run support_agent.yaml
  1. Test the agent:
curl -X POST http://localhost:8080/api/agent \
  -H "Content-Type: application/json" \
  -d '{"message": "How do I reset my password?"}'

Understanding the Components

Let’s break down the key components of our agent:

Manifest

The manifest section defines metadata about your agent:

manifest:
  version: "1.0"
  title: "Basic Support Agent"
  description: "A simple agent that handles customer inquiries"
  author: "Your Name"
  created_at: "2025-05-07"

Models

The models section defines the LLM to use:

models:
  - id: main_model
    type: claude
    version: "claude-3-7-sonnet"
    config:
      temperature: 0.7
      max_tokens: 1000

States

The states section defines the flow of your agent:

states:
  - id: start
    type: initial
    next: handle_inquiry
  
  - id: handle_inquiry
    type: llm
    model: main_model
    prompt: |
      You are a helpful customer support agent. Respond to the following inquiry:
      
      {query}
      
      Be friendly and professional in your response.      
    input:
      query: "${input.message}"
    next: end
  
  - id: end
    type: output
    value: "${previous.output}"

Adding Tools

Let’s enhance our agent with a tool to check order status:

tools:
  - id: check_order
    description: "Check the status of an order"
    parameters:
      - name: order_id
        type: string
        description: "Order ID to check"
        required: true
    implementation:
      type: http
      method: GET
      url: "https://api.example.com/orders/${order_id}"

Then update the handle_inquiry state to use the tool:

  - id: handle_inquiry
    type: llm
    model: main_model
    prompt: |
      You are a helpful customer support agent. Respond to the following inquiry:
      
      {query}
      
      If the customer is asking about an order, use the check_order tool to get the status.
      Be friendly and professional in your response.      
    input:
      query: "${input.message}"
    tools: [check_order]
    next: end

Next Steps

Last updated on