Test a Python, LangChain or other HTTP service
BehavTest calls your service over HTTP, so it works with any language or framework (FastAPI, Flask, Express, LangChain, LlamaIndex...). The service needs one endpoint:
# FastAPI example: POST {"input": ...} -> {"output": "..."}
from fastapi import FastAPI
app = FastAPI()
@app.post("/answer")
def answer(body: dict):
answer = my_chain.invoke(body["input"]) # your LangChain chain, agent, or plain function
return {"output": answer}
{
"name": "my-service",
"pipeline": { "adapter": "http", "config": { "url": "${PIPELINE_URL:-http://localhost:8000/answer}" } },
"cases": [{ "id": "greeting", "input": "Say hello", "scorers": ["llmJudge"] }],
"defaults": { "judge": "anthropic:claude-haiku-4-5" }
}
The response may also include costUsd, usage (token counts) and steps (a trace of tool calls and LLM calls) for cost checks and trace scorers.