Skip to content

[Question] about adding chat history at the first time connect to claude agent sdk using ClaudeSDKClient? #481

@phamkhactu

Description

@phamkhactu

I want to add chat history to the claude agent sdk at the first time init, but it not works

here is my code

from claude_agent_sdk import (
    ClaudeAgentOptions,
    ClaudeSDKClient,
)


class IntentAnalysisAgent:
    def __init__(self, options: ClaudeAgentOptions):
        self.sdk_client = ClaudeSDKClient(options=options)
        self.is_connected = False

    async def connect(self, history_stream=None):
        if not self.is_connected:
            await self.sdk_client.connect(prompt=history_stream)
            self.is_connected = True

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