Skip to content

Files

Latest commit

d5ac9a5 · Feb 10, 2025

History

History

api

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Feb 10, 2025
Jan 10, 2025
Jan 6, 2024
Jan 10, 2025
Feb 7, 2025
Dec 31, 2023
Feb 7, 2025
Jul 14, 2024
Feb 7, 2025
Aug 14, 2024
Feb 10, 2025
Feb 10, 2025

Backend Service for Agentok Studio

This project is the backend service for Agentok Studio. It is built with FastAPI, a modern web framework for building APIs with Python 3.6+ based on standard Python type hints.

This project uses Supabase as the database and authentication service. Supabase is an open-source Firebase alternative. It provides a set of tools to build modern web and mobile applications.

In this project, we use the Service Role Key to access the database and authentication service. The Service Role Key is a secret key that allows you to access the Supabase API. It is used to authenticate requests to the Supabase API.

Run the service:

poetry install
poetry run playwright install
poetry run uvicorn agentok_api.main:app --reload --port 5004

If you need to run the service with network proxy, you can use the following command:

poetry install
poetry run playwright install
poetry run proxychains4 uvicorn agentok_api.main:app --reload --port 5004

You need to configure proxychains4 to make it work, which is out of the scope of this document.

Docker Build

This does not work. We've reverted to the old way of building the image.

We've separated the Dockerfile to base image and app image for better caching. You can build the image with the following commands:

Base Image

docker buildx create --use
docker buildx build --platform linux/amd64,linux/arm64 -t hughlv/agentok-api-base:v1.0 -f Dockerfile.base . --push

Normally you don't need to do this, because we have put a base image on Docker Hub, you can build the app image directly.

App Image

docker build -t agentok-api .
docker run -d -p 5004:5004 agentok-api

API Docs

By default, when you create a FastAPI application, it automatically generates OpenAPI schemas for all your routes and serves them under /docs and /redoc paths.

You can visit /api-docs such as http://localhost:5004/api-docs to read the API docs, or /docs, such as http://localhost:5004/docs to test the APIs on Swagger UI.