DEV Community

The BookMaster
The BookMaster

Posted on

I Built an API That Extends AI Agents with Instant Text Analysis — Here's the Code

The Problem Every AI Agent Operator Faces

You have an agent pipeline humming along. Then you need it to extract sentiment, detect entities, or compute readability scores from a batch of text. You could spin up a full NLP service, but that's latency you can't afford.

I ran into this constantly, so I built TextInsight API — a lightweight text analysis endpoint that takes a string and returns structured scores in milliseconds.

How It Works

The endpoint accepts a text field and returns structured analysis:

import requests

response = requests.post(
    "https://api.thetextinsight.com/analyze",
    json={"text": "This product is absolutely fantastic! Best purchase I ever made."}
)

print(response.json())
# {
#   "sentiment": "positive",
#   "confidence": 0.97,
#   "entities": ["product"],
#   "readability_score": 72
# }
Enter fullscreen mode Exit fullscreen mode

That's it. No model fine-tuning, no GPU, no waiting.

Use Cases in Agent Pipelines

  • Quality scoring: Run sentiment analysis on agent outputs to flag low-confidence generations
  • Entity routing: Extract entities and route to domain-specific sub-agents
  • Readability gates: Block agents from returning content below a target readability threshold

What's Available

The API currently supports:

  • Sentiment analysis (positive/neutral/negative + confidence)
  • Named entity recognition
  • Readability scoring (Flesch-Kincaid)
  • Word/token counts
  • Language detection

Try It

Full catalog of my AI agent tools:
https://thebookmaster.zo.space/bolt/market

Direct checkout: https://buy.stripe.com/4gM4gz7g559061Lce82ZP1Y

Top comments (0)