создание и маунт папки /workspace

This commit is contained in:
Егор Кандрушин 2026-04-08 15:00:01 +03:00
parent a176dcac52
commit 745512aa4b
5 changed files with 16 additions and 2 deletions

View file

@ -7,3 +7,4 @@
*.pyc
__pycache__/
.env
workspace/

2
.gitignore vendored
View file

@ -1,3 +1,5 @@
workspace/
.idea/
# Byte-compiled / optimized / DLL files

View file

@ -17,8 +17,6 @@ RUN uv pip install git+https://git.lambda.coredump.ru/platform/agent_api.git
FROM base as production
RUN useradd --create-home --shell /bin/bash appuser
COPY --from=builder /app/.venv /app/.venv
ENV PATH="/app/.venv/bin:$PATH"
@ -26,8 +24,12 @@ COPY src/ /app/src/
COPY Makefile ./
COPY .mk/ ./.mk/
RUN useradd --shell /bin/bash appuser
USER appuser
ENV WORKSPACE_DIR="/workspace/"
RUN mkdir -p $WORKSPACE_DIR && chown appuser:appuser $WORKSPACE_DIR
EXPOSE 8000
CMD ["make", "uvicorn-prod"]
@ -47,6 +49,8 @@ ENV PATH="/app/.venv/bin:$PATH"
COPY Makefile ./
COPY .mk/ ./.mk/
ENV WORKSPACE_DIR="/workspace/"
EXPOSE 8000
CMD ["make", "uvicorn-dev"]

View file

@ -18,6 +18,7 @@ services:
volumes:
- ./src:/app/src
- ${AGENT_API_PATH}:/agent-api/
- ./workspace:/workspace/
ports:
- "8000:8000"
env_file:

View file

@ -2,6 +2,7 @@ import os
from deepagents import create_deep_agent
from langchain_openai import ChatOpenAI
from langgraph.checkpoint.memory import MemorySaver
from deepagents.backends.local_shell import LocalShellBackend
def create_agent():
@ -11,9 +12,14 @@ def create_agent():
api_key=os.environ["PROVIDER_API_KEY"],
)
workspace_dir = os.environ["WORKSPACE_DIR"]
backend = LocalShellBackend(workspace_dir,
virtual_mode=True)
return create_deep_agent(
model=model,
system_prompt="You are a helpful assistant.",
checkpointer=MemorySaver(),
backend=backend,
)