fix(chat): increase SDK buffer limit and add jq

- Add sdk_max_buffer_size config option (default 10MB, was 1MB)
- Pass max_buffer_size to ClaudeAgentOptions to prevent crashes on large tool outputs
- Install jq in Dockerfile for JSON processing capabilities

Fixes AUTOGPT-SERVER-7V2
This commit is contained in:
Zamil Majdy
2026-02-12 02:41:12 +00:00
parent 2025aaf5f2
commit cac93b0cc9
3 changed files with 8 additions and 1 deletions

View File

@@ -62,12 +62,13 @@ ENV POETRY_HOME=/opt/poetry \
DEBIAN_FRONTEND=noninteractive
ENV PATH=/opt/poetry/bin:$PATH
# Install Python, FFmpeg, and ImageMagick (required for video processing blocks)
# Install Python, FFmpeg, ImageMagick, and CLI tools for agent use
RUN apt-get update && apt-get install -y \
python3.13 \
python3-pip \
ffmpeg \
imagemagick \
jq \
&& rm -rf /var/lib/apt/lists/*
# Copy only necessary files from builder

View File

@@ -97,6 +97,11 @@ class ChatConfig(BaseSettings):
default=True,
description="Use Claude Agent SDK for chat completions",
)
sdk_max_buffer_size: int = Field(
default=10 * 1024 * 1024, # 10MB (default SDK is 1MB)
description="Max buffer size in bytes for SDK JSON message parsing. "
"Increase if tool outputs exceed the limit.",
)
# Extended thinking configuration for Claude models
thinking_enabled: bool = Field(

View File

@@ -290,6 +290,7 @@ async def stream_chat_completion_sdk(
allowed_tools=COPILOT_TOOL_NAMES,
hooks=create_security_hooks(user_id, sdk_cwd=sdk_cwd), # type: ignore[arg-type]
cwd=sdk_cwd,
max_buffer_size=config.sdk_max_buffer_size,
)
adapter = SDKResponseAdapter(message_id=message_id)