Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Required environment variables for quickstart agent example? #100

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

Closed
mikael-andersson91 opened this issue May 31, 2025 · 9 comments
Closed
Assignees

Comments

@mikael-andersson91
Copy link

I have been trying to follow the Quickstart Guide: UiPath LangChain Agents example to build my first agent.

In my version of it, I've removed any usage of Anthropic, otherwise everything is still the same in my agent as it is in the quickstart guide.

When I run the agent locally, after having authenticated to Orchestrator and setup my OPENAI_API_KEY environment variable, everything is working fine. However, whenever I try to run it from Orchestrator I always get the same error:
{"Code":"Serverless.PythonCodedAgent.PrepareEnvironmentError","Title":"Failed to prepare environment","Detail":"An error occurred while installing the package dependencies. Please try again. If the error persists, please contact support.","Category":"System","Status":null}

From trying my luck with support from the forum (see this post), I was pointed to the fact that my environment credentials were incorrectly setup.

Which brings me to my next question... Where do I find which environment variables are required? And which environment variables are required to be configured in Orchestrator for a bare-minimum agent?

Image
Image

@radu-mocanu
Copy link
Collaborator

radu-mocanu commented Jun 1, 2025

Hi @mikael-andersson91 ,

This problem is not related to the misconfiguration of environment variables.
There are 2 common issues for this error, which we documented on our FAQ page.
If running the agent locally works fine, then most likely the problem is due to setuptools package discovery strategy.
Please note that, if your project contains more than one .py file at root path, setuptools will refuse to create distribution archives to prevent common errors such as accidentally publishing code not meant for distribution (from their documentation).
If that is the case, the easiest fix is to add

[tool.setuptools]
py-modules = []

in your pyproject.toml file.

Thanks for opening this issue, we are currently working on an improvement to surface the underlying environment preparation errors on serverless executions.

@radu-mocanu radu-mocanu self-assigned this Jun 1, 2025
@mikael-andersson91
Copy link
Author

I've tried all the proposed solutions here, added the section to my toml file and moved my Python file to a src sub-folder. Same error as before.

Here's a snippet of my project folder:

Image

toml contents:

[project]
name = "my-agent"
version = "0.0.1"
description = "my-agent"
authors = [{ name = "John Doe", email = "[email protected]" }]
dependencies = [
    "uipath-langchain>=0.0.106",
]
requires-python = ">=3.10"

[tool.setuptools]
py-modules = []

And the rest is the exact project from the quickstart guide, with Anthropic usage removed.

@radu-mocanu
Copy link
Collaborator

radu-mocanu commented Jun 3, 2025

@mikael-andersson91 please attach here the NuGet (.nupkg) package.
also, considering the process version 2.4.1-pr-57... I assume you have some sort of github action or similar that is automatically packaging and publishing this agent. If that is the case, may you also share the pipeline .yml file?

@mikael-andersson91
Copy link
Author

mikael-andersson91 commented Jun 3, 2025

my-agent.2.5.1-pr-64-dd42293.nupkg.zip

I've got all of this in a private repository. Adding you temporarily as a collaborator to it.

And as for what is what in there:

The last workflow is what is used to combine packing and deployment of the Agent project, used here

@radu-mocanu
Copy link
Collaborator

radu-mocanu commented Jun 3, 2025

Thanks for providing the requested info.

The problem is with the package version created by the github workflow (eg. 2.5.1-pr-64-dd42293)
this is not a valid pyproject version, as it is not compliant with official project specifications.
Thus, the environment preparation step will fail:

Image

To see the environment preparation error logs in cloud, you can now set LOG_LEVEL=TRACE as process env variable.

Image

@mikael-andersson91
Copy link
Author

I get the same error with regular release versions, such as 1.0.0 and 2.0.0

@mikael-andersson91
Copy link
Author

Or wait, I've got a working version now. Seems like the toml and src changes did the trick with a new release version:

my-agent.2.5.2.zip

@mikael-andersson91
Copy link
Author

So I will just have to make sure to make my prerelease versions use a better version convention. Good to know :)

@radu-mocanu
Copy link
Collaborator

Glad to see this problem solved.
We will work on some Github action templates #101 to avoid similar issues in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants