Skip to content

Issues using compactionControl #863

@gustavosizilio

Description

@gustavosizilio

Hello, im using the beta.messages.toolRunner with streaming mode. Im sure that the streaming is enabled (true). Everything was working fine until I enabled the compactionControl

I just added the param:

compactionControl: {
enabled: true,
contextTokenThreshold: 10000,
}

When I enable the compactionControl I always get the following error when the lib is trying to use (inside the lib):

const isCompacted = await this.#checkAndCompact();

ERROR:

AnthropicError: Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details
at Anthropic.calculateNonstreamingTimeout (/Users/gustavosizilio/Workspace/x/node_modules/@anthropic-ai/sdk/src/client.ts:834:13)
at Messages.create (/Users/gustavosizilio/Workspace/x/node_modules/@anthropic-ai/sdk/src/resources/beta/messages/messages.ts:110:30)
at BetaToolRunner._BetaToolRunner_checkAndCompact (/Users/gustavosizilio/Workspace/x/node_modules/@anthropic-ai/sdk/src/lib/tools/BetaToolRunner.ts:124:54)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at BetaToolRunner.[Symbol.asyncIterator] (/Users/gustavosizilio/Workspace/x/node_modules/@anthropic-ai/sdk/src/lib/tools/BetaToolRunner.ts:201:31)
at ParsePromptStream.parse (/Users/gustavosizilio/Workspace/x/src/app/ai/chat-agents/parsers/parse-prompt-stream.ts:40:24)
at ChatAgentsService.wssChatAgentsNewMessageHandler (/Users/gustavosizilio/Workspace/x/src/app/ai/chat-agents/chat-agents.service.ts:360:13)
at EventSubscribersLoader.wrapFunctionInTryCatchBlocks (/Users/gustavosizilio/Workspace/x/node_modules/@nestjs/event-emitter/lib/event-subscribers.loader.ts:190:14)

Considerations:

One detail is that this is giving this message even though the conversation is less than a minute... im trying with compaction threshold very small to test the functionality.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions