Skip to content

@anthropic-ai/claude-agent-sdk is missing a dependency on @anthropic-ai/sdk #864

@bessey

Description

@bessey

I've been building out an agent and was confused that the typing for events in the stream was coming through as any. I was accessing these events via

import { query } from '@anthropic-ai/claude-agent-sdk';

const stream = query({..}
for await (const event of stream) {
  ... 
}

Following through the definitions, I got to: @anthropic-ai/claude-agent-sdk/entrypoints/agentSdkTypes.d.ts line 2:

import type { 
  BetaMessage as APIAssistantMessage, 
  BetaUsage as Usage, 
  BetaRawMessageStreamEvent as RawMessageStreamEvent 
} from '@anthropic-ai/sdk/resources/beta/messages/messages.mjs';

So the Agent SDK is re-exporting aliased types from @anthropic-ai/sdk, however it does not depend on this package. If you add @anthropic-ai/sdk to your package.json it resolves the issue, but would be great if this was a dependency of the agent SDK so that this footgun does not exist.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions