Our startup uses `langgraph` for building AI agent...
# general
r
Our startup uses
langgraph
for building AI agentic workflows**. The team behind langgraph provide options for deploying agents in their cloud. Currently they only support the following two options: • Codebases thats use
requirements.txt
(docs). • Codebases that use
pyproject.toml
(docs). Our setup is a (1) monorepo, (2) we use protobuffs. I am looking into how I can make pants work under my constraints. ** Langgraph is the defacto framework for building AI agents.
I can generate a local
requirements.txt
before deployment. However, I don't know how I can materialize the python generated code. I am aware that I can use
pants export-codegen ::
but this write code under
dist/codegen
. This means I have write my imports as
import dist.codegen.<rest>
which is not ideal.
s
So for most python workflows, Pants typically does stuff by creating a sandbox, copying and generating necessary files, and then performing some kind of action wrt to the sandbox. It sounds like you're ultimately trying to bypass sandboxing. Is that correct? Can you deploy from a sandbox via stuff like https://www.pantsbuild.org/2.21/docs/ad-hoc-tools/integrating-new-tools-without-plugins and run_shell_command?
r
Thanks. The
adhoc_tool
seem like something that could be useful. I could write a rule that copies the source files, run proto compiler, and generate the requirements.txt.
https://www.pantsbuild.org/dev/reference/subsystems/python#default_run_goal_use_sandbox
My expectation was that if I use this option. If I do
pants test ::
the proto generated code won't be generated in a sandbox, but nothing was in the source directory. What's the expected outcome?
s
Ah sorry that was probably not a helpful. suggestion. The docs say
Copy code
"description": "Whether to use a sandbox when `run`ning this target. Defaults to `[python].default_run_goal_use_sandbox`.\n\nIf true, runs of this target with the `run` goal will copy the needed first-party sources into a temporary sandbox and run from there.\n\nIf false, runs of this target with the `run` goal will use the in-repo sources directly.\n\nNote that this field only applies when running a target with the `run` goal. No other goals (such as `test`, if applicable) consult this field.\n\nThe former mode is more hermetic, and is closer to building and running the source as it were packaged in a `pex_binary`. Additionally, it may be necessary if your sources depend transitively on \"generated\" files which will be materialized in the sandbox in a source root, but are not in-repo.\n\nThe latter mode is similar to creating, activating, and using a virtual environment when running your files. It may also be necessary if the source being run writes files into the repo and computes their location relative to the executed files. Django's `makemigrations` command is an example of such a process.",
Looking at it now the "run" in the
default_run_goal_use_sandbox
really sticks out.