Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AGE-451] Agent deployed by yourself, how to configure it when you want to Create a Custom App? #1913

Closed
lsm1103 opened this issue Jul 18, 2024 · 3 comments
Assignees
Labels
1 points Created by Linear-GitHub Sync bug Something isn't working CLI High Priority linear Created by Linear-GitHub Sync unconfirmed bug
Milestone

Comments

@lsm1103
Copy link

lsm1103 commented Jul 18, 2024

截屏2024-07-19 01 18 55
截屏2024-07-19 01 15 05

The cloud version can get the api key.
截屏2024-07-19 01 17 54

AGE-451

Copy link

dosubot bot commented Jul 18, 2024

To configure an agent for creating a custom app and resolve the configuration check error, follow these steps:

  1. Install Agenta:

    pip install -U agenta
  2. Clone the Example Application:

    git clone https://github.com/Agenta-AI/simple_prompt && cd simple_prompt
  3. Set Up Environment Variable:

    echo -e "OPENAI_API_KEY=sk-xxx" > .env
  4. Setup Agenta (Select Start from Blank):

    agenta init
  5. 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=https://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 to https://localhost:8000 [3].

For managing API keys within the Agenta web interface:

  1. 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()
  2. 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",
    )
  3. 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",
    )
  4. 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.

To continue talking to Dosu, mention @dosu.

@mmabrouk mmabrouk added bug Something isn't working CLI unconfirmed bug linear Created by Linear-GitHub Sync labels Jul 18, 2024
@mmabrouk mmabrouk changed the title Agent deployed by yourself, how to configure it when you want to Create a Custom App? [AGE-451] Agent deployed by yourself, how to configure it when you want to Create a Custom App? Jul 18, 2024
@mmabrouk mmabrouk modified the milestones: Bugs, v.54 Jul 18, 2024
@mmabrouk mmabrouk added High Priority 1 points Created by Linear-GitHub Sync labels Jul 18, 2024
@mmabrouk
Copy link
Member

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.

@lsm1103
Copy link
Author

lsm1103 commented Jul 19, 2024

image

It was deployed using docker-compose.coh.yml, and the web version can be accessed normally, but creating the app with the command is still 502
image

error:
image

@mmabrouk mmabrouk modified the milestones: v.54, v.55, v.56 Jul 21, 2024
@mmabrouk mmabrouk modified the milestones: v.56, v.57 Aug 13, 2024
@mmabrouk mmabrouk modified the milestones: v.57, v.58 Aug 27, 2024
@mmabrouk mmabrouk closed this as not planned Won't fix, can't repro, duplicate, stale Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 points Created by Linear-GitHub Sync bug Something isn't working CLI High Priority linear Created by Linear-GitHub Sync unconfirmed bug
Projects
None yet
Development

No branches or pull requests

3 participants