Ask the endpoint

Note: Keep server.py running in the first terminal. Send the requests from a second terminal.

Is it up?

Every server answers /health. Check it before you send a real question.

Example

curl http://127.0.0.1:8000/health

Send a question

Post the question as JSON to the path you chose. The answer comes back as JSON with a response field.

Any program that can send a web request can now use the agent: a website, a phone app, or another script.

Example

curl -X POST http://127.0.0.1:8000/ask \
  -H "Content-Type: application/json" \
  -d '{"query": "What is AI?"}'

Example explained

  • -X POST — Sends data to the server instead of only reading a page.
  • query — The question the agent receives.
  • response — The field in the reply that holds the answer.

Reference: documentation