Skip to content

Conversation

rmidianyi
Copy link

@rmidianyi rmidianyi commented Oct 17, 2025

This repository is public. Do not put here any private DataRobot or customer's data: code, datasets, model artifacts, .etc.

Summary

Adds support for installing extra dependencies for an agent in runtime to improve iteration speed during agent development (image rebuild is no required now):

  • extra dependencies should be added to extras group in agent's pyproject.toml.
  • extra dependencies are synced when agent is executed in codespace (run_agent.py) or when LRS is started during deployment (start_server_drum.sh).

Caveats

  • some dependencies will be hard/impossible to install in runtime due to many specifics (e.g. TikToken, nltk, ...). In this case using custom image is the only workaround
  • network access will be needed to install dependencies in a runtime, so for air-gapped envs - build custom execution env

Codespace:
Screenshot 2025-10-17 at 14 28 08

Custom Model:
Screenshot 2025-10-17 at 14 27 41

RUN . ${VENV_PATH}/bin/activate && \
uv sync
uv sync && \
chmod -R 777 ${VENV_PATH}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Venv should be writable both for notebook user (10101) and custom model user (1000).

ARG VENV_PATH

COPY ./pyproject.toml ${WORKDIR}/pyproject.toml
COPY ./uv.lock ${WORKDIR}/uv.lock
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We didn't use lock file, but it's better to have it for consistency of env.

# this stage has only bare minimal of dependencies installed to optimize build time for the local development

ENV ANNOY_COMPILER_ARGS="-D_CRT_SECURE_NO_WARNINGS,-DANNOYLIB_MULTITHREADED_BUILD,-march=x86-64"
ENV UV_COMPILE_BYTECODE=1 \
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Env variables are not passed between docker stages, so need to explicitly enable bytecode compilation again for uv sync.

Comment on lines +225 to +226
[dependency-groups]
extras = []
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra user dependencies will go here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this work well to put it here. We should update the templates pyproject.toml everywhere to have this addition

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, working on another PR do do the same changes in af-component-agent.

Comment on lines -1 to -2
# This file was autogenerated by uv via the following command:
# uv pip compile --no-annotate --no-emit-index-url --no-emit-trusted-host --output-file=requirements.txt pyproject.toml
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uv lock 
uv sync
uv pip freeze > requirements.txt

@devexp-slackbot
Copy link

The Needs Review labels were added based on the following file changes.

Team @datarobot/buzok (#genai) was assigned because of changes in files:

public_dropin_environments/python311_genai_agents/Dockerfile
public_dropin_environments/python311_genai_agents/Dockerfile.local
public_dropin_environments/python311_genai_agents/env_info.json
public_dropin_environments/python311_genai_agents/pyproject.toml
public_dropin_environments/python311_genai_agents/requirements.txt
public_dropin_environments/python311_genai_agents/run_agent.py
public_dropin_environments/python311_genai_agents/start_server_drum.sh
public_dropin_environments/python311_genai_agents/uv.lock

If you think that there are some issues with ownership, please discuss with C&A domain at #sdtk slack channel and create PR to update DRCODEOWNERS\CODEOWNERS file.

@rmidianyi rmidianyi requested a review from tsdaemon October 17, 2025 12:48
Copy link
Contributor

@tsdaemon tsdaemon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

@devexp-slackbot
Copy link

Label Needs Review: GenAI Tooling (Buzok) was removed because @tsdaemon is part of Generative AI Tooling domain.

ARG VENV_PATH

COPY ./pyproject.toml ${WORKDIR}/pyproject.toml
COPY ./uv.lock ${WORKDIR}/uv.lock
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the user doesn't have a uv.lock file would this be a problem? Say they just to a task start + task deploy, they might not have built a local environment. They "must" have a pyproject.toml, but the uv.lock could be missing

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This particular uv.lock is part of execution env (I've added it).

If we are talking about agent itself:

  • uv sync is non-critical - we would still attempt to run the agent.
  • uv.lock is generally supposed to be always present because recommended way to add dependency would be via uv add --no-upgrade --group extras <dependency> or via some Task shortcut. Manual editing of pyproject.toml is not recommended (unless you know what you are doing).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you mean that uv.lock may be missing when building docker image locally using Dockerfile.local - I guess it's okay to require user to freeze env by generating lock file in this case. Lock file is generally a must in image if we're talking about consistency of dependencies.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, thats fair. If you make a ticket or two for updating docks related to this I can help pickup recipe and agent updates next week. I know you'll be out soon.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To your second comment I think that makes sense

Copy link
Contributor

@mjnitz02 mjnitz02 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with this overall. The only question for this as a docker_context would be the possibility of uv.lock not existing, but maybe thats not really a thing to worry about

@rmidianyi rmidianyi changed the title [BUZZOK-27814][BUZZOK-27812] Install extra agent dependecies in runtime. [BUZZOK-27814] Install extra agent dependecies in runtime. Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants