Blog

Build and Publish an AI Agent in 10 Minutes

Step-by-step guide to wrapping any Python or TypeScript script as a Runcept-compatible agent endpoint and publishing it to the marketplace.

If you have a useful AI script, you can turn it into a paid API endpoint in 10 minutes. Here's the complete path from script to marketplace listing.

What You Need

  • An AI script that does something useful
  • A Vercel account (free tier works)
  • A Runcept account

Step 1 — Wrap Your Script as an HTTP Handler (3 min)

Your agent must accept POST with { "input": {...} } and return { "output": {...} }.

Create a new Next.js app:

npx create-next-app@latest my-agent --typescript --app --no-src-dir
cd my-agent
npm install @anthropic-ai/sdk

Create app/api/agent/route.ts:

import Anthropic from '@anthropic-ai/sdk'
import { NextRequest, NextResponse } from 'next/server'

export const maxDuration = 60

const client = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY })

export async function POST(req: NextRequest) {
  const { input } = await req.json()

  // Validate required fields
  if (!input?.text || typeof input.text !== 'string') {
    return NextResponse.json({ error: 'input.text is required' }, { status: 400 })
  }

  const msg = await client.messages.create({
    model: 'claude-haiku-4-5-20251001',
    max_tokens: 512,
    messages: [{ role: 'user', content: `Summarise in 3 bullet points:\n${input.text}` }],
  })

  return NextResponse.json({
    output: {
      summary: msg.content[0].type === 'text' ? msg.content[0].text : '',
    },
  })
}

Step 2 — Deploy to Vercel (2 min)

npm install -g vercel
vercel --prod

Add your Anthropic API key in the Vercel dashboard under Environment Variables.

Test it:

curl -X POST https://your-agent.vercel.app/api/agent \
  -H "Content-Type: application/json" \
  -d '{"input": {"text": "Some long text to summarise..."}}'

Step 3 — Register on Runcept (5 min)

Go to runcept.com/dashboard/submit and fill in:

  • Name: "Text Summariser"
  • Slug: "text-summariser"
  • Endpoint URL: https://your-agent.vercel.app/api/agent
  • Credits per run: 5 (= $0.05)
  • Category: writing
  • Input schema:
    {
      "type": "object",
      "properties": { "text": { "type": "string" } },
      "required": ["text"]
    }
    
  • Output schema:
    {
      "type": "object",
      "properties": { "summary": { "type": "string" } }
    }
    

Submit. Your agent goes into review (1-2 days). Once approved, it's live.

What Happens After Approval

Your agent appears in the marketplace. Every time a developer calls it via POST /api/v1/run with {"agent": "text-summariser", "input": {...}}, Runcept:

  1. Validates their credits
  2. Calls your endpoint
  3. Returns the output to the consumer
  4. Credits 80% of the run cost to your balance

At 5 credits/run with 500 runs/month, you earn $17.50/month passively.

Tips

  • Use Claude Haiku — it's fast and cheap, maximising your margin
  • Keep your endpoint under 10 seconds for best UX
  • Write clear schema descriptions — they show in the marketplace
  • Add input validation — failed runs refund the consumer and earn you nothing

Next Steps

Related posts

The Complete Guide to GitHub Actions AI AutomationSetting Up AI Code Review in Your CI Pipeline