Back to Developer Hub

Expert Builder API

Create custom AI experts with domain-specific skills and knowledge. Build, chat, and export experts programmatically.

Overview

The Expert Builder API allows you to create AI experts tailored to specific domains. Experts are built with curated skills and can engage in domain-specific conversations.

Build Experts

Define a domain and GREP builds an expert with relevant skills.

Expert Chat

Engage in conversations with your experts using specialized knowledge.

Export

Export experts to Claude Code format for local use.

// Expert Lifecycle
CreateBuildChatExport

API Reference

POST/grep/expert/start

Start an expert builder job. The expert will be built asynchronously.

Request Body

ParameterTypeDescription
domainstringDomain of expertise (3-500 chars)
depthstring"standard" (~3 skills) or "deep" (~8 skills)
contextstring?Additional context (max 5000 chars)
curl
curl -X POST "https://api.grep.ai/v1/grep/expert/start" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "patent law and intellectual property",
    "depth": "standard",
    "context": "Focus on US patent prosecution"
  }'

Response

json
{
  "job_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "queued",
  "message": "Expert builder job started"
}
GET/grep/expert/job

Get the status and result of an expert builder job.

Query Parameters

ParameterTypeDescription
job_idstringThe job ID from start response
curl
curl "https://api.grep.ai/v1/grep/expert/job?job_id=550e8400-e29b-41d4..." \
  -H "Authorization: Bearer YOUR_API_KEY"

Response (Complete)

json
{
  "job_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "complete",
  "expert": {
    "id": "expert-abc123",
    "name": "Patent Law Expert",
    "description": "Specialized in US patent prosecution...",
    "skills": [
      {
        "name": "Patent Claim Analysis",
        "description": "Analyze patent claims for validity..."
      },
      {
        "name": "Prior Art Search",
        "description": "Search for relevant prior art..."
      }
    ]
  }
}
GET/grep/experts

List all experts accessible to the user, including their own and public experts.

Query Parameters

ParameterTypeDescription
include_publicbooleanInclude public experts (default: true)
GET/grep/experts/registry

Get the built-in expert registry with pre-configured experts.

Returns built-in experts that are code-defined, not user-created.

GET/grep/expert/{expert_id}

Get detailed information about a specific expert including skills and configuration.

POST/grep/expert/{expert_id}/visibility

Set an expert's visibility to public or private.

Request Body

ParameterTypeDescription
is_publicbooleanWhether the expert is publicly visible

Expert Chat

POST/grep/expert/{expert_id}/chat

Submit a chat message to an expert. Returns a job ID for tracking the response.

Request Body

ParameterTypeDescription
messagestringUser's message to the expert
contextstring?Additional context for the message
status_webhook_urlstring?URL for real-time status updates
status_webhook_filterstring[]?Filter: "Thinking", "text_block", "tool_use", "status"
curl
curl -X POST "https://api.grep.ai/v1/grep/expert/expert-abc123/chat" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "What is patentable subject matter under 35 USC 101?",
    "context": "I am filing a software patent application"
  }'

Response

json
{
  "job_id": "chat-job-xyz789",
  "status": "queued",
  "message": "Chat job started"
}
GET/grep/expert/{expert_id}/chat/stream/{job_id}

Stream expert chat response via Server-Sent Events (SSE).

Query Parameters

ParameterTypeDescription
replaybooleanReplay historical messages (default: true)

Connect with EventSource to receive real-time updates.

Webhook Integration

Use webhooks to receive real-time updates during expert chat. Filter which event types you want to receive.

Webhook Request with Filters

curl
curl -X POST "https://api.grep.ai/v1/grep/expert/expert-abc123/chat" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "Analyze this patent claim...",
    "status_webhook_url": "https://your-server.com/webhook",
    "status_webhook_filter": ["Thinking", "text_block", "tool_use"]
  }'

Webhook Payload

json
{
  "message_type": "text_block",
  "message": "Based on my analysis of the patent claim...",
  "job_id": "chat-job-xyz789",
  "timestamp": "2024-01-15T10:30:00Z"
}

Available Webhook Filters

  • Thinking - Extended thinking updates
  • text_block - Text response chunks
  • tool_use - Tool invocation events
  • status - General status messages

Export to Claude Code

POST/grep/expert/{expert_id}/export-claude-code

Export an expert to Claude Code format for local use.

curl
curl -X POST "https://api.grep.ai/v1/grep/expert/expert-abc123/export-claude-code" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

json
{
  "name": "patent-law-expert",
  "description": "Patent Law Expert - Specialized in US patent prosecution",
  "instructions": "You are a patent law expert specialized in...",
  "prompt": "# Patent Law Expert\n\nYou are an expert in patent law..."
}

Ready to Build Your Expert?

Get API access to start creating custom AI experts.