Skip to main content

Pharia Applications Quick Start Guide

Creating a Pharia Application

tip

Prerequisites:

This section explains how to create a Pharia Application using the Pharia AI CLI. The generated application includes a Pharia Application UI, a Pharia Application Service, and a Pharia Application Skill.

Run the command below in your terminal:

npx @aleph-alpha/pharia-ai-cli create

You will be prompted to provide a new app name and select a template:

✔ Please provide a new app name › <your-app-name>
✔ Please select a template › base / summary / qa

Once the application is created, follow these instructions to install dependencies and start each component (UI, Service, Skill) in separate terminal sessions.

Application UI:

cd <your-app-name>/ui
pnpm install
# Set your Pharia AI user token in <your-app-name>/ui/.env. To get a token, see: https://docs.aleph-alpha.com/products/pharia-studio/how-to/use-debug/#set-your-environment-variables
pnpm run dev

Application Service:

cd <your-app-name>/service
# Ensure your local Python version matches the one specified in pyproject.toml (e.g., pyenv install x.x.x && pyenv local x.x.x; see https://github.com/pyenv/pyenv)
# Verify that any missing environment variables are set in <your-app-name>/service/.env
uv sync --dev
uv run dev

Application Skill:

cd <your-app-name>/skill
# Ensure your local Python version matches the one specified in pyproject.toml
# Verify that ALEPH_ALPHA_OCI_REGISTRY_USER and ALEPH_ALPHA_OCI_REGISTRY_ACCESS_TOKEN are set in <your-app-name>/.env
set -a && source ../.env
uv sync --dev
info

Congratulations! You should now have your first Pharia Application up and running. To see your application in action, simply visit the Application UI URL. The user interface is already set up to communicate with the Application Service, and the Application Service is configured to work with the Application Skill.

warning

At this point, API calls from the Application Service to the PhariaAI Skill will fail. This is because the skill needs to be served through a Kernel. To resolve this, you'll need to publish the skill so that it can be served through your Pharia Kernel instance.

To publish the skill to the registry:

# Update the registry values in <your-app-name>/.env as needed, then run the following commands:
cd <your-app-name>/skill
set -a && source ../.env
uv sync --dev
uv run pharia-skill build <skill-name>
uv run pharia-skill publish <skill-name>

After publishing, update your namespace.toml file(Ask your Pharia AI Operator for the location of this file) by adding the new skill entry. Once updated, your Pharia Application is ready for use!

Previewing and Deploying Your Application

info

Before using any pharia-ai-cli command below, make sure all necessary environment variables are configured correctly in <your-app-name>/.env.

When you're ready to deploy your Pharia Application, first preview it locally using Pharia Assistant:

cd <your-app-name>
npx @aleph-alpha/pharia-ai-cli preview

This command starts the application locally. Copy the preview URL and follow the instructions in How to Use Developer Mode in Assistant to add the URL to the Developer Mode Server URL list in Pharia Assistant. Your application should then appear in the Assistant's left sidebar.

To deploy your application for all users, run the following commands:

cd <your-app-name>
npx @aleph-alpha/pharia-ai-cli publish
npx @aleph-alpha/pharia-ai-cli deploy

If you encounter any issues, check out the Troubleshooting section.

Next Steps

To learn more about Pharia Applications, explore these resources: