[AGE-451] Agent deployed by yourself, how to configure it when you want to Create a Custom App?
lsm1103 opened this issue · 3 comments
To configure an agent for creating a custom app and resolve the configuration check error, follow these steps:
-
Install Agenta:
pip install -U agenta
-
Clone the Example Application:
git clone https://github.com/Agenta-AI/simple_prompt && cd simple_prompt
-
Set Up Environment Variable:
echo -e "OPENAI_API_KEY=sk-xxx" > .env
-
Setup Agenta (Select Start from Blank):
agenta init
-
Serve an App Variant:
agenta variant serve --file_name app.py
Additionally, ensure your .env
file includes the following configuration settings:
NEXT_PUBLIC_AGENTA_API_URL=http://localhost
NEXT_PUBLIC_FF=oss
NEXT_PUBLIC_TELEMETRY_TRACKING_ENABLED=true
OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxx
Replace sk-xxxxxxxxxxxxxxxxxxxxxxxx
with your actual OpenAI API key [1][2].
If you encounter a 502
status code error, it may be due to an application already running on the default backend server port (8000). To resolve this:
- Verify the Traefik configuration to ensure it is correctly forwarding requests to the backend server on the
/api
route. - Check the relevant Traefik rule in the
docker-compose.yml
file. - Prune Docker resources by stopping and removing all agenta containers and associated volumes:
docker stop $(docker ps -q -f "name=agenta-*") docker rm $(docker ps -aq -f "name=agenta-*") docker volume ls -q -f "name=agenta-*") docker volume rm VOLUME_NAME
- Restart the application by running
docker compose up
and access the backend server by making requests tohttp://localhost:8000
[3].
For managing API keys within the Agenta web interface:
-
List API Keys:
from agenta.client import AgentaApi client = AgentaApi( api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api", ) api_keys = client.list_api_keys()
-
Create an API Key:
from agenta.client import AgentaApi client = AgentaApi( api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api", ) new_api_key = client.create_api_key( workspace_id="workspace_id", )
-
Delete an API Key:
from agenta.client import AgentaApi client = AgentaApi( api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api", ) response = client.delete_api_key( key_prefix="key_prefix", )
-
Validate an API Key:
from agenta.client import AgentaApi client = AgentaApi( api_key="YOUR_API_KEY", base_url="https://yourhost.com/path/to/api", ) is_valid = client.validate_api_key( key_prefix="key_prefix", ) ``` <sup>[[4]](https://github.com/Agenta-AI/agenta/blob/main/agenta-cli/agenta/client/backend/client.py)</sup>.
These steps should help you configure and manage your custom app effectively.
Hi @lsm1103 ,
In this case, I think in this case running agenta init --backend_host
is not working from the CLI.
Please try running agenta init
and then following the questionnaire for initializing the app then running it.
Please let me know whether it fixes the problem.