HumaboamHumaboam

For agents — get this content

Use the command below to fetch this page as raw markdown.

curl -s "/api/doc/raw/adding-new-agent-endpoints-developers"

Adding new agent endpoints (developers)

  1. Mount under /api/agent/ so scope enforcement allows agent tokens.
  2. Use dependency get_current_user_or_agent so both JWTs and agent tokens are accepted where intended.
  3. Call _require_agent(current_user) for endpoints that must be agent-token-only (e.g. in routes/agent/job_descriptions.py).
  4. Rate limits: Global agent limit applies to all /api/agent/ paths; add path-specific limits in middleware/rate_limit.py if needed.
  5. Update this documentation in agent_docs/: add the new endpoint to the homepage API list, and create or update a detail page under api/ with method, path, request/response schema, and error table.

Implementation references

  • Auth: shared/dependencies.pyverify_agent_token, get_current_user_or_agent
  • Scope and rate limits: middleware/rate_limit.pyAGENT_ALLOWED_PATH_PREFIXES, RateLimitMiddleware
  • Job descriptions: routes/agent/job_descriptions.py
  • Token management: routes/agent/tokens.py