Skip to content

Conversation

@jpvajda
Copy link
Contributor

@jpvajda jpvajda commented Jul 24, 2025

PR Summary: Function Call Context / History Feature

TL;DR

Successfully implemented the Function Call Context / History feature for the Deepgram Python SDK, enabling agents to maintain conversation context and function call history across sessions. The implementation is fully API specification compliant and includes comprehensive testing.

What Changed

New Classes Added:

  • Flags: Configuration flags with history boolean (defaults to true)
  • Context: Container for conversation history messages
  • HistoryConversationMessage: Conversation text messages in history format
  • HistoryFunctionCallsMessage: Function call messages in history format
  • FunctionCallHistory: Individual function call records with id, name, arguments, response, and client_side flag

Enhanced Existing Classes:

  • Agent: Added optional context field for conversation history
  • SettingsOptions: Added optional flags field for feature flags

Pylint Config

  • Added # pylint: disable=too-many-instance-attributes to the Agent class definition
  • This allows the class to have the 8 attributes required by the API specification

Key Features:

  • ✅ Full API specification compliance
  • ✅ Backward compatibility maintained
  • ✅ Union type handling for mixed message types
  • ✅ Proper serialization/deserialization
  • ✅ Comprehensive error handling
  • ✅ Developer-friendly construction patterns

Testing

Unit Tests (41 new tests):

  • TestFlags: 6 tests for flags functionality
  • TestHistoryConversationMessage: 5 tests for conversation messages
  • TestFunctionCallHistory: 4 tests for function call records
  • TestHistoryFunctionCallsMessage: 6 tests for function call messages
  • TestContext: 6 tests for context container
  • TestAgentIntegration: 3 tests for agent integration
  • TestSettingsOptionsIntegration: 5 tests for settings integration
  • TestErrorHandling: 6 tests for edge cases

Demo Application:

  • Comprehensive schema testing focused on implementation validation
  • Real-world usage patterns demonstration
  • Edge case testing
  • API specification compliance validation

Regression Testing:

  • All 193 existing tests pass (152 original + 41 new)
  • No regressions introduced

API Specification Compliance

Flags Structure:

{
  "flags": {
    "history": true
  }
}

Agent Context Structure:

{
  "agent": {
    "context": {
      "messages": [
        {
          "type": "History",
          "role": "user", 
          "content": "What's the weather?"
        },
        {
          "type": "History",
          "function_calls": [
            {
              "id": "fc_12345",
              "name": "get_weather",
              "client_side": true,
              "arguments": "{\"location\": \"NYC\"}",
              "response": "Sunny, 72°F"
            }
          ]
        }
      ]
    }
  }
}

Usage Example

from deepgram.clients.agent import (
    SettingsOptions, Agent, Flags, Context,
    HistoryConversationMessage, HistoryFunctionCallsMessage, 
    FunctionCallHistory
)

# Create conversation history
conversation_msg = HistoryConversationMessage(
    role="user",
    content="What's my account balance?"
)

# Create function call history
function_call = FunctionCallHistory(
    id="fc_balance_123",
    name="get_account_balance", 
    client_side=True,
    arguments='{"account_id": "12345"}',
    response="Current balance: $1,250.50"
)
func_msg = HistoryFunctionCallsMessage(function_calls=[function_call])

# Create context and settings
context = Context(messages=[conversation_msg, func_msg])
settings = SettingsOptions(
    flags=Flags(history=True),
    agent=Agent(
        language="en",
        context=context
    )
)

# Use in agent websocket connection
connection = client.agent.websocket.v("1")
connection.start(settings)

Files Modified

Core Implementation:

  • deepgram/clients/agent/v1/websocket/options.py - Added new classes and enhanced existing ones

Export Updates:

  • deepgram/clients/agent/v1/websocket/__init__.py
  • deepgram/clients/agent/v1/__init__.py
  • deepgram/clients/agent/client.py
  • deepgram/clients/agent/__init__.py

Testing:

  • tests/unit_test/test_unit_agent_history_context.py - Comprehensive test suite

Demo (temporary):

  • temp-test/demo_history_context.py - Schema validation demo (cleaned up)

Quality Assurance

Code Quality:

  • ✅ Follows existing SDK patterns and conventions
  • ✅ Proper docstrings and type hints
  • ✅ Consistent error handling
  • ✅ No linter errors or warnings

Architecture:

  • ✅ Maintains backward compatibility
  • ✅ Uses standard dataclasses-json patterns
  • ✅ Proper Union type handling with __post_init__ discrimination
  • ✅ Clean separation of concerns

Testing Coverage:

  • ✅ 41 comprehensive unit tests added
  • ✅ All edge cases covered
  • ✅ Schema validation included
  • ✅ Integration tests with existing functionality
  • ✅ No regressions (193/193 tests passing)

Documentation:

  • ✅ Comprehensive usage examples
  • ✅ Clear API specification mapping
  • ✅ Realistic developer usage patterns
  • ✅ Edge case documentation

🚀 Ready for Production: The Function Call Context / History feature is fully implemented, tested, and ready for release!

Types of changes

What types of changes does your code introduce to the community Python SDK?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update or tests (if none of the other choices apply)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING doc
  • I have lint'ed all of my code using repo standards
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

Summary by CodeRabbit

  • New Features

    • Agent history context: conversation and function-call history message types, a new History event, WebSocket handling to parse/emit history, and top-level SDK exports for these types.
  • Bug Fixes

    • Improved safe serialization/deserialization and normalization for nested context and function-call history payloads.
  • Tests

    • Comprehensive unit/integration tests covering history/context, edge cases, and round-trip serialization.
  • Examples

    • Runnable demo demonstrating history-driven context with live function-calling.
  • Chores

    • Updated test fixtures (timestamps, IDs, model metadata).

@jpvajda jpvajda requested a review from lukeocodes July 24, 2025 20:58
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 24, 2025

Walkthrough

Adds history/context dataclasses and Flags, integrates them into agent websocket options and clients to parse/emit History events, expands public exports/aliases, introduces comprehensive unit tests and an example, and updates multiple test fixtures and response fixtures.

Changes

Cohort / File(s) Change Summary
Websocket options & models
deepgram/clients/agent/v1/websocket/options.py
Added dataclasses: Flags, HistoryConversationMessage, FunctionCallHistory, HistoryFunctionCallsMessage, Context. Added context to Agent and flags to SettingsOptions. Added post_init normalization for nested dicts.
Websocket client handling
deepgram/clients/agent/v1/websocket/async_client.py, deepgram/clients/agent/v1/websocket/client.py
Added handling for AgentWebSocketEvents.History: detect payload shape (conversation vs function-call history), parse via .from_json into the new dataclasses, log and emit History event, fallback to raw payload if unknown.
Enums
deepgram/clients/agent/enums.py
Added History = "History" member to AgentWebSocketEvents.
Package exports / aliases
deepgram/clients/agent/__init__.py, deepgram/clients/agent/client.py, deepgram/clients/agent/v1/__init__.py, deepgram/clients/agent/v1/websocket/__init__.py, deepgram/__init__.py, deepgram/client.py, deepgram/clients/__init__.py
Re-exported/aliased new types (Flags, Context, HistoryConversationMessage, HistoryFunctionCallsMessage, FunctionCallHistory) at client and package levels.
Agent websocket options init/exports
deepgram/clients/agent/v1/websocket/__init__.py
Exported Flags, Context, HistoryConversationMessage, HistoryFunctionCallsMessage, FunctionCallHistory from .options.
Tests (new)
tests/unit_test/test_unit_agent_history_context.py
New comprehensive unit/integration tests for Flags, HistoryConversationMessage, FunctionCallHistory, HistoryFunctionCallsMessage, Context, Agent (integration), and SettingsOptions (integration), covering defaults, serialization/deserialization, post-init conversions, edge cases, and round-trips.
Examples (new)
examples/agent/context-history/main.py
New example demonstrating Context/history usage and function-calling (get_weather) with handlers for History and FunctionCallRequest flows.
Top-level client exports
deepgram/__init__.py, deepgram/client.py
Re-exported new symbols at top-level: Flags, Context, HistoryConversationMessage, HistoryFunctionCallsMessage, FunctionCallHistory.
Test fixtures (updated)
tests/response_data/agent/websocket/*, tests/response_data/listen/*, tests/response_data/read/*, tests/response_data/speak/*, tests/response_data/listen/websocket/*
Multiple test fixtures rebased/updated: event timestamps, request_ids, some event payload shapes (History → EndOfThought/AgentStartedSpeaking/ConversationText adjustments), function call IDs updated, and model/metadata changes in listen/read/speak fixtures. Changes are data-only.
Function-call ids fixture
tests/response_data/agent/websocket/function_call_conversation-...-function_calls.json
Updated function call IDs in fixture entries (IDs changed, other fields unchanged).

Sequence Diagram(s)

sequenceDiagram
    participant Server
    participant AgentWSClient
    participant Parser
    participant App

    Server->>AgentWSClient: send text (event: History, payload)
    AgentWSClient->>Parser: inspect payload
    alt payload has role & content
        Parser->>Parser: parse -> HistoryConversationMessage
    else payload has function_calls
        Parser->>Parser: parse -> HistoryFunctionCallsMessage (contains FunctionCallHistory items)
    else
        Parser->>Parser: keep raw payload
    end
    Parser-->>AgentWSClient: parsed history_result
    AgentWSClient->>App: emit AgentWebSocketEvents.History(history=history_result, **kwargs)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

Possibly related PRs

  • chore: agent daily test #554 — Related to History handling and websocket parsing/emission changes; overlaps on AgentWebSocketEvents and History processing.
  • feat: support for agent v1 #520 — Modifies agent-v1 websocket API surface and exports; overlaps with added Context/Flags exports and aliases.
  • Feat/keyterms+nova 3 #502 — Changes to agent websocket options/dataclasses; overlaps on Context/SettingsOptions serialization and defaults.

Suggested reviewers

  • naomi-lgbt
  • lukeocodes

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Pylint (3.3.7)
deepgram/clients/agent/v1/websocket/options.py
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/agent-context-history

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
tests/unit_test/test_unit_agent_history_context.py (1)

133-198: Consider adding round-trip test for consistency

Other test classes include round-trip serialization tests. Consider adding one for FunctionCallHistory to maintain consistency and ensure complete coverage.

Add this test method to the TestFunctionCallHistory class:

def test_function_call_history_round_trip(self):
    """Test serialization and deserialization round-trip"""
    original = FunctionCallHistory(
        id="fc_roundtrip",
        name="test_function",
        client_side=True,
        arguments='{"test": "value"}',
        response="Test response"
    )
    
    serialized = original.to_dict()
    restored = FunctionCallHistory.from_dict(serialized)
    
    assert restored.id == original.id
    assert restored.name == original.name
    assert restored.client_side == original.client_side
    assert restored.arguments == original.arguments
    assert restored.response == original.response
deepgram/clients/agent/v1/websocket/options.py (1)

323-324: Address pylint violation for too many instance attributes.

The pipeline failure indicates that the Agent class now has 8 instance attributes, exceeding pylint's default limit of 7. Since the additional context field is legitimately needed for the Function Call Context/History feature, consider disabling this specific pylint rule for the class.

Add a pylint disable comment above the class definition:

+# pylint: disable=too-many-instance-attributes
 @dataclass
 class Agent(BaseResponse):
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d605248 and 5e0a9d2.

📒 Files selected for processing (6)
  • deepgram/clients/agent/__init__.py (2 hunks)
  • deepgram/clients/agent/client.py (4 hunks)
  • deepgram/clients/agent/v1/__init__.py (2 hunks)
  • deepgram/clients/agent/v1/websocket/__init__.py (2 hunks)
  • deepgram/clients/agent/v1/websocket/options.py (4 hunks)
  • tests/unit_test/test_unit_agent_history_context.py (1 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#424
File: deepgram/clients/speak/v1/response.py:48-209
Timestamp: 2024-06-27T00:06:23.128Z
Learning: User dvonthenen prefers to defer certain suggestions, specifically regarding error handling and documentation enhancements in new data classes of `deepgram/clients/speak/v1/response.py`, and may revisit them later.
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#424
File: deepgram/clients/speak/v1/response.py:48-209
Timestamp: 2024-10-09T02:19:48.728Z
Learning: User dvonthenen prefers to defer certain suggestions, specifically regarding error handling and documentation enhancements in new data classes of `deepgram/clients/speak/v1/response.py`, and may revisit them later.
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#426
File: deepgram/clients/listen/v1/__init__.py:36-43
Timestamp: 2024-07-01T19:17:04.194Z
Learning: Unused imports in `deepgram/clients/listen/v1/__init__.py` are retained to maintain backward compatibility and should not be flagged for removal in reviews.
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#426
File: deepgram/clients/listen/v1/__init__.py:36-43
Timestamp: 2024-10-09T02:19:46.086Z
Learning: Unused imports in `deepgram/clients/listen/v1/__init__.py` are retained to maintain backward compatibility and should not be flagged for removal in reviews.
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#426
File: deepgram/clients/listen/__init__.py:37-38
Timestamp: 2024-07-01T19:13:29.909Z
Learning: Unused imports in `deepgram/clients/listen/__init__.py` are retained to maintain backward compatibility.
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#426
File: deepgram/clients/listen/__init__.py:37-38
Timestamp: 2024-10-09T02:19:46.087Z
Learning: Unused imports in `deepgram/clients/listen/__init__.py` are retained to maintain backward compatibility.
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#426
File: deepgram/clients/listen/__init__.py:54-55
Timestamp: 2024-10-09T02:19:46.086Z
Learning: Unused imports in `deepgram/clients/listen/__init__.py` are retained to maintain backward compatibility.
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#426
File: deepgram/clients/listen/__init__.py:54-55
Timestamp: 2024-07-01T19:13:11.612Z
Learning: Unused imports in `deepgram/clients/listen/__init__.py` are retained to maintain backward compatibility.
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#424
File: deepgram/client.py:81-81
Timestamp: 2024-06-27T00:06:01.811Z
Learning: Imports for SpeakStreamClient and AsyncSpeakStreamClient in `deepgram/client.py` are necessary for export purposes and should not be flagged as unused in reviews.
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#424
File: deepgram/client.py:81-81
Timestamp: 2024-10-09T02:19:46.087Z
Learning: Imports for SpeakStreamClient and AsyncSpeakStreamClient in `deepgram/client.py` are necessary for export purposes and should not be flagged as unused in reviews.
deepgram/clients/agent/v1/__init__.py (10)

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/v1/websocket/init.py:8-8
Timestamp: 2024-07-01T19:21:39.778Z
Learning: Unused imports in deepgram/clients/listen/v1/websocket/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/v1/websocket/init.py:8-8
Timestamp: 2024-10-09T02:19:46.086Z
Learning: Unused imports in deepgram/clients/listen/v1/websocket/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/v1/init.py:36-43
Timestamp: 2024-07-01T19:17:04.194Z
Learning: Unused imports in deepgram/clients/listen/v1/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/v1/init.py:36-43
Timestamp: 2024-10-09T02:19:46.086Z
Learning: Unused imports in deepgram/clients/listen/v1/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/init.py:42-50
Timestamp: 2024-07-01T19:13:28.504Z
Learning: Unused imports in deepgram/clients/listen/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/init.py:19-24
Timestamp: 2024-10-09T02:19:46.087Z
Learning: Unused imports in deepgram/clients/listen/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/init.py:42-50
Timestamp: 2024-10-09T02:19:46.086Z
Learning: Unused imports in deepgram/clients/listen/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/init.py:19-24
Timestamp: 2024-07-01T19:14:20.539Z
Learning: Unused imports in deepgram/clients/listen/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/init.py:10-13
Timestamp: 2024-10-09T02:19:46.086Z
Learning: Unused imports in deepgram/clients/listen/__init__.py are retained for backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/init.py:10-13
Timestamp: 2024-07-01T19:14:11.334Z
Learning: Unused imports in deepgram/clients/listen/__init__.py are retained for backward compatibility and should not be flagged for removal in reviews.

deepgram/clients/agent/v1/websocket/__init__.py (10)

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/v1/websocket/init.py:8-8
Timestamp: 2024-07-01T19:21:39.778Z
Learning: Unused imports in deepgram/clients/listen/v1/websocket/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/v1/websocket/init.py:8-8
Timestamp: 2024-10-09T02:19:46.086Z
Learning: Unused imports in deepgram/clients/listen/v1/websocket/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #431
File: deepgram/clients/listen/v1/websocket/client.py:30-30
Timestamp: 2024-07-11T14:10:17.231Z
Learning: The LiveOptions import in deepgram/clients/listen/v1/websocket/client.py is intentionally present for future use and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #431
File: deepgram/clients/listen/v1/websocket/client.py:30-30
Timestamp: 2024-10-09T02:19:46.087Z
Learning: The LiveOptions import in deepgram/clients/listen/v1/websocket/client.py is intentionally present for future use and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/v1/init.py:36-43
Timestamp: 2024-07-01T19:17:04.194Z
Learning: Unused imports in deepgram/clients/listen/v1/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/v1/init.py:36-43
Timestamp: 2024-10-09T02:19:46.086Z
Learning: Unused imports in deepgram/clients/listen/v1/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/init.py:42-50
Timestamp: 2024-07-01T19:13:28.504Z
Learning: Unused imports in deepgram/clients/listen/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/init.py:42-50
Timestamp: 2024-10-09T02:19:46.086Z
Learning: Unused imports in deepgram/clients/listen/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/init.py:19-24
Timestamp: 2024-10-09T02:19:46.087Z
Learning: Unused imports in deepgram/clients/listen/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/init.py:19-24
Timestamp: 2024-07-01T19:14:20.539Z
Learning: Unused imports in deepgram/clients/listen/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

deepgram/clients/agent/client.py (10)

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/v1/init.py:36-43
Timestamp: 2024-10-09T02:19:46.086Z
Learning: Unused imports in deepgram/clients/listen/v1/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/v1/init.py:36-43
Timestamp: 2024-07-01T19:17:04.194Z
Learning: Unused imports in deepgram/clients/listen/v1/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/speak/init.py:16-19
Timestamp: 2024-10-09T02:19:46.087Z
Learning: Unused imports in deepgram/clients/speak/__init__.py are retained for backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/speak/init.py:16-19
Timestamp: 2024-07-01T19:12:57.715Z
Learning: Unused imports in deepgram/clients/speak/__init__.py are retained for backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/init.py:42-50
Timestamp: 2024-07-01T19:13:28.504Z
Learning: Unused imports in deepgram/clients/listen/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/init.py:42-50
Timestamp: 2024-10-09T02:19:46.086Z
Learning: Unused imports in deepgram/clients/listen/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/init.py:19-24
Timestamp: 2024-10-09T02:19:46.087Z
Learning: Unused imports in deepgram/clients/listen/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/init.py:19-24
Timestamp: 2024-07-01T19:14:20.539Z
Learning: Unused imports in deepgram/clients/listen/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/init.py:10-13
Timestamp: 2024-10-09T02:19:46.086Z
Learning: Unused imports in deepgram/clients/listen/__init__.py are retained for backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/init.py:10-13
Timestamp: 2024-07-01T19:14:11.334Z
Learning: Unused imports in deepgram/clients/listen/__init__.py are retained for backward compatibility and should not be flagged for removal in reviews.

deepgram/clients/agent/__init__.py (10)

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/speak/init.py:16-19
Timestamp: 2024-10-09T02:19:46.087Z
Learning: Unused imports in deepgram/clients/speak/__init__.py are retained for backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/speak/init.py:16-19
Timestamp: 2024-07-01T19:12:57.715Z
Learning: Unused imports in deepgram/clients/speak/__init__.py are retained for backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/v1/init.py:36-43
Timestamp: 2024-07-01T19:17:04.194Z
Learning: Unused imports in deepgram/clients/listen/v1/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/v1/init.py:36-43
Timestamp: 2024-10-09T02:19:46.086Z
Learning: Unused imports in deepgram/clients/listen/v1/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/init.py:42-50
Timestamp: 2024-07-01T19:13:28.504Z
Learning: Unused imports in deepgram/clients/listen/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/init.py:19-24
Timestamp: 2024-10-09T02:19:46.087Z
Learning: Unused imports in deepgram/clients/listen/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/init.py:42-50
Timestamp: 2024-10-09T02:19:46.086Z
Learning: Unused imports in deepgram/clients/listen/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/init.py:19-24
Timestamp: 2024-07-01T19:14:20.539Z
Learning: Unused imports in deepgram/clients/listen/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/init.py:10-13
Timestamp: 2024-10-09T02:19:46.086Z
Learning: Unused imports in deepgram/clients/listen/__init__.py are retained for backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/init.py:10-13
Timestamp: 2024-07-01T19:14:11.334Z
Learning: Unused imports in deepgram/clients/listen/__init__.py are retained for backward compatibility and should not be flagged for removal in reviews.

deepgram/clients/agent/v1/websocket/options.py (9)

Learnt from: dvonthenen
PR: #431
File: deepgram/clients/listen/v1/websocket/client.py:30-30
Timestamp: 2024-10-09T02:19:46.087Z
Learning: The LiveOptions import in deepgram/clients/listen/v1/websocket/client.py is intentionally present for future use and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #431
File: deepgram/clients/listen/v1/websocket/client.py:30-30
Timestamp: 2024-07-11T14:10:17.231Z
Learning: The LiveOptions import in deepgram/clients/listen/v1/websocket/client.py is intentionally present for future use and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/v1/websocket/init.py:8-8
Timestamp: 2024-10-09T02:19:46.086Z
Learning: Unused imports in deepgram/clients/listen/v1/websocket/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/v1/websocket/init.py:8-8
Timestamp: 2024-07-01T19:21:39.778Z
Learning: Unused imports in deepgram/clients/listen/v1/websocket/__init__.py are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Learnt from: dvonthenen
PR: #468
File: examples/text-to-speech/websocket/complete/main.py:26-30
Timestamp: 2024-09-27T15:21:34.197Z
Learning: In examples/text-to-speech/websocket/complete/main.py, commented-out options like auto_flush_speak_delta and verbose are intentional in examples and should not be flagged in reviews.

Learnt from: dvonthenen
PR: #431
File: deepgram/clients/listen/v1/websocket/async_client.py:30-30
Timestamp: 2024-07-11T14:10:24.647Z
Learning: The unused import LiveOptions in deepgram/clients/listen/v1/websocket/async_client.py is intentional and will be used in PR #432.

Learnt from: dvonthenen
PR: #431
File: deepgram/clients/listen/v1/websocket/async_client.py:30-30
Timestamp: 2024-10-09T02:19:46.087Z
Learning: The unused import LiveOptions in deepgram/clients/listen/v1/websocket/async_client.py is intentional and will be used in PR #432.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/v1/rest/options.py:12-12
Timestamp: 2024-07-01T19:12:36.972Z
Learning: Unused imports in deepgram/clients/listen/v1/rest/options.py are retained to maintain backwards compatibility.

Learnt from: dvonthenen
PR: #426
File: deepgram/clients/listen/v1/rest/options.py:12-12
Timestamp: 2024-10-09T02:19:46.087Z
Learning: Unused imports in deepgram/clients/listen/v1/rest/options.py are retained to maintain backwards compatibility.

🧬 Code Graph Analysis (6)
deepgram/clients/agent/v1/__init__.py (1)
deepgram/clients/agent/v1/websocket/options.py (5)
  • Flags (250-255)
  • Context (301-320)
  • HistoryConversationMessage (259-266)
  • HistoryFunctionCallsMessage (283-297)
  • FunctionCallHistory (270-279)
deepgram/clients/agent/v1/websocket/__init__.py (1)
deepgram/clients/agent/v1/websocket/options.py (5)
  • Flags (250-255)
  • Context (301-320)
  • HistoryConversationMessage (259-266)
  • HistoryFunctionCallsMessage (283-297)
  • FunctionCallHistory (270-279)
deepgram/clients/agent/client.py (1)
deepgram/clients/agent/v1/websocket/options.py (5)
  • Flags (250-255)
  • Context (301-320)
  • HistoryConversationMessage (259-266)
  • HistoryFunctionCallsMessage (283-297)
  • FunctionCallHistory (270-279)
tests/unit_test/test_unit_agent_history_context.py (2)
deepgram/client.py (1)
  • agent (593-597)
deepgram/clients/agent/v1/websocket/options.py (7)
  • SettingsOptions (430-466)
  • Agent (324-384)
  • Flags (250-255)
  • Context (301-320)
  • HistoryConversationMessage (259-266)
  • HistoryFunctionCallsMessage (283-297)
  • FunctionCallHistory (270-279)
deepgram/clients/agent/__init__.py (1)
deepgram/clients/agent/v1/websocket/options.py (5)
  • Flags (250-255)
  • Context (301-320)
  • HistoryConversationMessage (259-266)
  • HistoryFunctionCallsMessage (283-297)
  • FunctionCallHistory (270-279)
deepgram/clients/agent/v1/websocket/options.py (1)
deepgram/clients/common/v1/shared_response.py (1)
  • BaseResponse (16-44)
🪛 GitHub Actions: Check - lint
deepgram/clients/agent/v1/websocket/options.py

[error] 331-331: pylint: Too many instance attributes (8/7) (too-many-instance-attributes)

🔇 Additional comments (14)
deepgram/clients/agent/v1/__init__.py (1)

45-45: Import additions follow established patterns

The new imports are properly organized according to the existing structure - Flags in the top-level section and context-related classes in the sub-level section.

Also applies to: 61-64

deepgram/clients/agent/__init__.py (1)

41-41: Consistent import structure maintained

The new imports correctly mirror the v1 module structure and maintain consistency across the package hierarchy.

Also applies to: 57-60

deepgram/clients/agent/v1/websocket/__init__.py (1)

36-36: WebSocket module imports properly structured

The new imports from .options module follow the established pattern and correctly expose the new history context classes.

Also applies to: 52-55

deepgram/clients/agent/client.py (1)

40-40: Versioning pattern correctly implemented

The new classes follow the SDK's established versioning pattern with Latest prefixes for imports and clean re-exports for the current version.

Also applies to: 56-59, 93-93, 109-112

tests/unit_test/test_unit_agent_history_context.py (1)

1-814: Comprehensive test coverage

The test suite provides excellent coverage of the new history context features including:

  • Unit tests for each new class
  • Integration tests with existing Agent and SettingsOptions
  • Edge cases and error handling
  • Serialization/deserialization round-trips

Well-structured and thorough testing approach.

deepgram/clients/agent/v1/websocket/options.py (9)

247-256: LGTM! Clean implementation of configuration flags.

The Flags class follows the established SDK patterns with proper inheritance, type hints, and default values. The history flag defaults to True, which is appropriate for enabling the feature by default.


258-267: LGTM! Well-structured conversation message class.

The HistoryConversationMessage class properly represents text messages in conversation history with appropriate fields (role for "user"/"assistant" and content for message text). The default values are sensible.


269-280: LGTM! Comprehensive function call history representation.

The FunctionCallHistory class captures all necessary details for function call tracking: id, name, client_side flag, arguments, and response. The field types and defaults are appropriate.


282-298: LGTM! Proper handling of nested object conversion.

The class correctly implements the __post_init__ method to convert dictionary entries in function_calls to FunctionCallHistory instances. This follows the established SDK pattern for handling nested data structures during deserialization.


300-321: LGTM! Excellent union type handling and message discrimination.

The Context class properly handles the union type for messages by using the presence of the "function_calls" key to discriminate between HistoryConversationMessage and HistoryFunctionCallsMessage types. The __post_init__ method correctly converts dictionary messages to their appropriate typed objects.


356-358: LGTM! Proper integration of context field.

The context field is correctly added to the Agent class with appropriate type hints, default value, and serialization metadata following the established SDK patterns.


382-383: LGTM! Consistent deserialization handling.

The __getitem__ method correctly handles conversion of dictionary context data to Context instances, maintaining consistency with other field conversions in the method.


439-441: LGTM! Proper flags field integration.

The flags field is correctly added to the SettingsOptions class with appropriate type hints, default value, and serialization metadata following the established SDK patterns.


449-451: LGTM! Consistent flags deserialization.

The __getitem__ method correctly handles conversion of dictionary flags data to Flags instances, maintaining consistency with other field conversions.

@jpvajda
Copy link
Contributor Author

jpvajda commented Jul 24, 2025

Use this preview build URL: https://deepgram-preview-fffa92b2-f434-4c0a-80a0-98427d2dbc55.docs.buildwithfern.com/home

the one above is wonky.

@jpvajda
Copy link
Contributor Author

jpvajda commented Jul 29, 2025

I need to double checkout the approach after chatting with @lukeocodes

@jpvajda
Copy link
Contributor Author

jpvajda commented Aug 1, 2025

I validated this approach is correct, but this PR will need a rebase once we merge in #562 which I can do when it's merged, else it's ready for review.

lukeocodes
lukeocodes previously approved these changes Aug 9, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (4)
deepgram/clients/agent/v1/websocket/options.py (4)

258-267: Tighten typing for discriminators and role to prevent typos

Consider using Literal types for the "type" discriminator and the "role" field to catch mistakes at type-check time.

-class HistoryConversationMessage(BaseResponse):
+class HistoryConversationMessage(BaseResponse):
@@
-    type: str = field(default="History")
-    role: str = field(default="")  # "user" or "assistant"
+    type: Literal["History"] = "History"
+    role: Literal["user", "assistant"] = "user"  # adjust default if needed for BC
     content: str = field(default="")

269-280: Allow structured arguments/response for function calls

If the API can return JSON objects for arguments/response, widen the types beyond str. This improves fidelity and avoids unnecessary JSON stringify/parse churn.

-class FunctionCallHistory(BaseResponse):
+class FunctionCallHistory(BaseResponse):
@@
-    arguments: str = field(default="")
-    response: str = field(default="")
+    arguments: Union[str, Dict[str, Any]] = field(default_factory=str)
+    response: Union[str, Dict[str, Any]] = field(default_factory=str)

288-290: Use a Literal for message type discriminator

Minor typing improvement to align with a discriminated-union pattern.

-    type: str = field(default="History")
+    type: Literal["History"] = "History"

443-446: SettingsOptions.flags: consider symmetric post_init conversion

For consistency with Agent.context (and UpdateSpeakOptions.speak), convert flags dicts on init too; getitem already handles reads.

 @dataclass
 class SettingsOptions(BaseResponse):
@@
-    flags: Optional[Flags] = field(
-        default=None, metadata=dataclass_config(exclude=lambda f: f is None)
-    )
+    flags: Optional[Flags] = field(
+        default=None, metadata=dataclass_config(exclude=lambda f: f is None)
+    )
+
+    def __post_init__(self):
+        if isinstance(self.flags, dict):
+            self.flags = Flags.from_dict(self.flags)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c8bd52b and 82149f3.

📒 Files selected for processing (6)
  • deepgram/clients/agent/__init__.py (2 hunks)
  • deepgram/clients/agent/client.py (4 hunks)
  • deepgram/clients/agent/v1/__init__.py (2 hunks)
  • deepgram/clients/agent/v1/websocket/__init__.py (2 hunks)
  • deepgram/clients/agent/v1/websocket/options.py (5 hunks)
  • tests/unit_test/test_unit_agent_history_context.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • tests/unit_test/test_unit_agent_history_context.py
  • deepgram/clients/agent/v1/init.py
  • deepgram/clients/agent/init.py
🧰 Additional context used
🧠 Learnings (6)
📚 Learning: 2024-10-09T02:19:46.086Z
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#426
File: deepgram/clients/listen/v1/websocket/__init__.py:8-8
Timestamp: 2024-10-09T02:19:46.086Z
Learning: Unused imports in `deepgram/clients/listen/v1/websocket/__init__.py` are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Applied to files:

  • deepgram/clients/agent/v1/websocket/__init__.py
📚 Learning: 2024-10-09T02:19:46.087Z
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#431
File: deepgram/clients/listen/v1/websocket/client.py:30-30
Timestamp: 2024-10-09T02:19:46.087Z
Learning: The `LiveOptions` import in `deepgram/clients/listen/v1/websocket/client.py` is intentionally present for future use and should not be flagged for removal in reviews.

Applied to files:

  • deepgram/clients/agent/v1/websocket/__init__.py
📚 Learning: 2024-07-01T19:17:04.194Z
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#426
File: deepgram/clients/listen/v1/__init__.py:36-43
Timestamp: 2024-07-01T19:17:04.194Z
Learning: Unused imports in `deepgram/clients/listen/v1/__init__.py` are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Applied to files:

  • deepgram/clients/agent/v1/websocket/__init__.py
  • deepgram/clients/agent/client.py
📚 Learning: 2024-07-01T19:13:28.504Z
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#426
File: deepgram/clients/listen/__init__.py:42-50
Timestamp: 2024-07-01T19:13:28.504Z
Learning: Unused imports in `deepgram/clients/listen/__init__.py` are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Applied to files:

  • deepgram/clients/agent/v1/websocket/__init__.py
  • deepgram/clients/agent/client.py
📚 Learning: 2024-07-01T19:12:57.715Z
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#426
File: deepgram/clients/speak/__init__.py:16-19
Timestamp: 2024-07-01T19:12:57.715Z
Learning: Unused imports in `deepgram/clients/speak/__init__.py` are retained for backward compatibility and should not be flagged for removal in reviews.

Applied to files:

  • deepgram/clients/agent/client.py
📚 Learning: 2024-10-09T02:19:46.086Z
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#426
File: deepgram/clients/listen/__init__.py:10-13
Timestamp: 2024-10-09T02:19:46.086Z
Learning: Unused imports in `deepgram/clients/listen/__init__.py` are retained for backward compatibility and should not be flagged for removal in reviews.

Applied to files:

  • deepgram/clients/agent/client.py
🧬 Code Graph Analysis (3)
deepgram/clients/agent/v1/websocket/__init__.py (1)
deepgram/clients/agent/v1/websocket/options.py (5)
  • Flags (250-255)
  • Context (301-320)
  • HistoryConversationMessage (259-266)
  • HistoryFunctionCallsMessage (283-297)
  • FunctionCallHistory (270-279)
deepgram/clients/agent/client.py (1)
deepgram/clients/agent/v1/websocket/options.py (5)
  • Flags (250-255)
  • Context (301-320)
  • HistoryConversationMessage (259-266)
  • HistoryFunctionCallsMessage (283-297)
  • FunctionCallHistory (270-279)
deepgram/clients/agent/v1/websocket/options.py (1)
deepgram/clients/common/v1/shared_response.py (1)
  • BaseResponse (16-44)
🔇 Additional comments (9)
deepgram/clients/agent/v1/websocket/options.py (6)

249-256: Flags model looks good

Defaulting history to True and keeping it optional on SettingsOptions is reasonable. No issues spotted.


350-352: Agent.context addition is consistent and non-breaking

Optional Context with exclude-on-None matches existing patterns. Looks good.


355-355: Docstring update improves clarity

Noting both Speak and Context conversions here is helpful. No action needed.


365-368: Agent post_init: context dict-to-object conversion LGTM

Covers the common case where callers pass a dict. Nice.


380-382: Agent getitem: context conversion mirrors other fields

Consistent with existing getitem behavior across the module. Good.


453-455: SettingsOptions getitem: flags conversion LGTM

Deserialization path covered. No issues.

deepgram/clients/agent/v1/websocket/__init__.py (1)

36-56: Re-export of history/context types is correct

Importing Flags, Context, HistoryConversationMessage, HistoryFunctionCallsMessage, and FunctionCallHistory from .options aligns the v1 websocket surface. This maintains expected import paths.

deepgram/clients/agent/client.py (2)

40-60: Added Latest imports for new types — consistent with versioning scheme*

Flags, Context, and history message classes are properly wired through v1. Good.


93-113: Public re-exports of new types look good

Aliases make the new types available at the stable surface without breaking existing imports.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 82149f3 and eaa7e5b.

📒 Files selected for processing (7)
  • deepgram/__init__.py (2 hunks)
  • deepgram/client.py (2 hunks)
  • deepgram/clients/__init__.py (2 hunks)
  • deepgram/clients/agent/enums.py (1 hunks)
  • deepgram/clients/agent/v1/websocket/async_client.py (2 hunks)
  • deepgram/clients/agent/v1/websocket/client.py (2 hunks)
  • examples/agent/context-history/main.py (1 hunks)
🧰 Additional context used
🧠 Learnings (6)
📚 Learning: 2024-07-01T19:12:57.715Z
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#426
File: deepgram/clients/speak/__init__.py:16-19
Timestamp: 2024-07-01T19:12:57.715Z
Learning: Unused imports in `deepgram/clients/speak/__init__.py` are retained for backward compatibility and should not be flagged for removal in reviews.

Applied to files:

  • deepgram/__init__.py
  • deepgram/clients/__init__.py
  • deepgram/client.py
📚 Learning: 2024-07-01T19:17:04.194Z
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#426
File: deepgram/clients/listen/v1/__init__.py:36-43
Timestamp: 2024-07-01T19:17:04.194Z
Learning: Unused imports in `deepgram/clients/listen/v1/__init__.py` are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Applied to files:

  • deepgram/__init__.py
  • deepgram/clients/__init__.py
  • deepgram/client.py
📚 Learning: 2024-07-01T19:13:28.504Z
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#426
File: deepgram/clients/listen/__init__.py:42-50
Timestamp: 2024-07-01T19:13:28.504Z
Learning: Unused imports in `deepgram/clients/listen/__init__.py` are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Applied to files:

  • deepgram/__init__.py
  • deepgram/clients/__init__.py
  • deepgram/client.py
📚 Learning: 2024-10-09T02:19:46.086Z
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#426
File: deepgram/clients/listen/__init__.py:10-13
Timestamp: 2024-10-09T02:19:46.086Z
Learning: Unused imports in `deepgram/clients/listen/__init__.py` are retained for backward compatibility and should not be flagged for removal in reviews.

Applied to files:

  • deepgram/__init__.py
  • deepgram/clients/__init__.py
📚 Learning: 2024-10-09T02:19:46.086Z
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#426
File: deepgram/clients/listen/v1/websocket/__init__.py:8-8
Timestamp: 2024-10-09T02:19:46.086Z
Learning: Unused imports in `deepgram/clients/listen/v1/websocket/__init__.py` are retained to maintain backward compatibility and should not be flagged for removal in reviews.

Applied to files:

  • deepgram/clients/agent/v1/websocket/async_client.py
📚 Learning: 2024-10-09T02:19:46.087Z
Learnt from: dvonthenen
PR: deepgram/deepgram-python-sdk#424
File: deepgram/client.py:81-81
Timestamp: 2024-10-09T02:19:46.087Z
Learning: Imports for SpeakStreamClient and AsyncSpeakStreamClient in `deepgram/client.py` are necessary for export purposes and should not be flagged as unused in reviews.

Applied to files:

  • deepgram/client.py
🪛 GitHub Actions: Check - static
deepgram/clients/agent/v1/websocket/async_client.py

[error] 489-495: mypy: Name 'history_result' already defined on line 495 [no-redef]. Previous definition at line 489. Command: mypy --config-file mypy.ini --python-version 3.10 --exclude tests --exclude examples .

deepgram/clients/agent/v1/websocket/client.py

[error] 484-490: mypy: Name 'history_result' already defined on line 490 [no-redef]. Previous definition at line 484. Command: mypy --config-file mypy.ini --python-version 3.10 --exclude tests --exclude examples .

🔇 Additional comments (6)
deepgram/clients/agent/enums.py (1)

27-27: Add History event — LGTM

The new AgentWebSocketEvents.History value is correctly added and aligns with downstream handling. No issues.

deepgram/clients/agent/v1/websocket/client.py (1)

32-35: New imports for history types — LGTM

HistoryConversationMessage and HistoryFunctionCallsMessage are correctly imported for History parsing.

deepgram/clients/__init__.py (1)

366-386: Top-level re-exports for history/context — LGTM

Flags, Context, HistoryConversationMessage, HistoryFunctionCallsMessage, and FunctionCallHistory are correctly exposed for public API usage.

deepgram/client.py (1)

357-377: Public API re-exports for history/context — LGTM

Flags and the history/context models are properly re-exported. Consistent with clients/init.py.

deepgram/clients/agent/v1/websocket/async_client.py (1)

32-35: New imports for history types — LGTM

Required types imported for async History processing.

deepgram/__init__.py (1)

343-363: Top-level exports for history/context — LGTM

The added exports surface the new models at the package root, consistent with the SDK’s public API design.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (2)
tests/response_data/agent/websocket/agent_tags-e55ef69c-events.json (1)

51-57: AgentStartedSpeaking latency fields present; optional consistency nit

Latencies look correct. Optional: include "type": "AgentStartedSpeaking" inside data for consistency with other events that duplicate type in data.

If you prefer uniformity, tweak like:

 "data": {
+  "type": "AgentStartedSpeaking",
   "total_latency": 0.751554899,
   "tts_latency": 0.368593096,
   "ttt_latency": 0.382961593
 }

Also applies to: 102-108

tests/response_data/agent/websocket/basic_conversation-a40b2785-events.json (1)

51-57: AgentStartedSpeaking latency updates; optional data.type consistency

Latencies are fine. Optional: add data.type for consistency across events (fixtures only).

Example:

 "data": {
+  "type": "AgentStartedSpeaking",
   "total_latency": 0.834087238,
   "tts_latency": 0.305673514,
   "ttt_latency": 0.528413404
 }

Also applies to: 111-116

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eaa7e5b and 83d0cce.

⛔ Files ignored due to path filters (1)
  • tests/response_data/speak/rest/1fe0ad339338a9d6cffbab2c7ace41ba5387b5fe7906854795702dce91034fd3-f8c3bf62a9aa3e6fc1619c250e48abe7519373d3edf41be62eb5dc45199af2ef.wav is excluded by !**/*.wav
📒 Files selected for processing (17)
  • deepgram/clients/agent/v1/websocket/async_client.py (2 hunks)
  • deepgram/clients/agent/v1/websocket/client.py (2 hunks)
  • deepgram/clients/agent/v1/websocket/options.py (5 hunks)
  • tests/response_data/agent/websocket/agent_tags-e55ef69c-events.json (3 hunks)
  • tests/response_data/agent/websocket/basic_conversation-a40b2785-events.json (4 hunks)
  • tests/response_data/agent/websocket/fallback_providers-e16542b1-events.json (3 hunks)
  • tests/response_data/agent/websocket/function_call_conversation-ac8ed698-events.json (3 hunks)
  • tests/response_data/agent/websocket/function_call_conversation-ac8ed698-function_calls.json (3 hunks)
  • tests/response_data/agent/websocket/inject_agent_message-3c5004a4-events.json (2 hunks)
  • tests/response_data/listen/rest/a231370d439312b1a404bb6ad8de955e900ec8eae9a906329af8cc672e6ec7ba-29e7c8100617f70da4ae9da1921cb5071a01219f4780ca70930b0a370ed2163a-response.json (1 hunks)
  • tests/response_data/listen/rest/a231370d439312b1a404bb6ad8de955e900ec8eae9a906329af8cc672e6ec7ba-a17f4880c5b4cf124ac54d06d77c9f0ab7f3fe1052ff1c7b090f7eaf8ede5b76-response.json (1 hunks)
  • tests/response_data/listen/rest/c4e1c0031174878d8f0e3dbd87916ee16d56f1c610ac525af5712ea37226a455-29e7c8100617f70da4ae9da1921cb5071a01219f4780ca70930b0a370ed2163a-response.json (1 hunks)
  • tests/response_data/listen/rest/c4e1c0031174878d8f0e3dbd87916ee16d56f1c610ac525af5712ea37226a455-a17f4880c5b4cf124ac54d06d77c9f0ab7f3fe1052ff1c7b090f7eaf8ede5b76-response.json (1 hunks)
  • tests/response_data/listen/websocket/ed5bfd217988aa8cad492f63f79dc59f5f02fb9b85befe6f6ce404b8f19aaa0d-42fc5ed98cabc1fa1a2f276301c27c46dd15f6f5187cd93d944cc94fa81c8469-response.json (1 hunks)
  • tests/response_data/listen/websocket/ed5bfd217988aa8cad492f63f79dc59f5f02fb9b85befe6f6ce404b8f19aaa0d-d7334c26cf6468c191e05ff5e8151da9b67985c66ab177e9446fd14bbafd70df-response.json (1 hunks)
  • tests/response_data/read/rest/3917a1c81c08e360c0d4bba0ff9ebd645e610e4149483e5f2888a2c5df388b37-23e873efdfd4d680286fda14ff8f10864218311e79efc92ecc82bce3e574c366-response.json (1 hunks)
  • tests/response_data/speak/rest/1fe0ad339338a9d6cffbab2c7ace41ba5387b5fe7906854795702dce91034fd3-f8c3bf62a9aa3e6fc1619c250e48abe7519373d3edf41be62eb5dc45199af2ef-response.json (1 hunks)
✅ Files skipped from review due to trivial changes (5)
  • tests/response_data/read/rest/3917a1c81c08e360c0d4bba0ff9ebd645e610e4149483e5f2888a2c5df388b37-23e873efdfd4d680286fda14ff8f10864218311e79efc92ecc82bce3e574c366-response.json
  • tests/response_data/agent/websocket/function_call_conversation-ac8ed698-function_calls.json
  • tests/response_data/listen/websocket/ed5bfd217988aa8cad492f63f79dc59f5f02fb9b85befe6f6ce404b8f19aaa0d-d7334c26cf6468c191e05ff5e8151da9b67985c66ab177e9446fd14bbafd70df-response.json
  • tests/response_data/listen/websocket/ed5bfd217988aa8cad492f63f79dc59f5f02fb9b85befe6f6ce404b8f19aaa0d-42fc5ed98cabc1fa1a2f276301c27c46dd15f6f5187cd93d944cc94fa81c8469-response.json
  • tests/response_data/listen/rest/c4e1c0031174878d8f0e3dbd87916ee16d56f1c610ac525af5712ea37226a455-29e7c8100617f70da4ae9da1921cb5071a01219f4780ca70930b0a370ed2163a-response.json
🚧 Files skipped from review as they are similar to previous changes (3)
  • deepgram/clients/agent/v1/websocket/client.py
  • deepgram/clients/agent/v1/websocket/options.py
  • deepgram/clients/agent/v1/websocket/async_client.py
🔇 Additional comments (24)
tests/response_data/speak/rest/1fe0ad339338a9d6cffbab2c7ace41ba5387b5fe7906854795702dce91034fd3-f8c3bf62a9aa3e6fc1619c250e48abe7519373d3edf41be62eb5dc45199af2ef-response.json (1)

1-1: Approve fixture refresh – no stale references found

The updated speak REST fixture is self-contained and no tests rely on the previous request_id or exact date value:

  • No occurrences of the old UUID or date remain in any test files.
  • Hard-coded UUIDs in test_unit_listen_websocket.py/test_unit_async_listen_websocket.py are part of independent input strings and unaffected by this change.

Optional nit: consider using stable placeholders for request_id and date in fixtures (or loosening assertions to check format rather than exact values) to reduce future diff noise.

tests/response_data/agent/websocket/fallback_providers-e16542b1-events.json (3)

77-82: LGTM: Event sequencing is consistent

AgentAudioDone events follow corresponding AgentStartedSpeaking/ConversationText sequences with increasing timestamps. Looks coherent for playback completion.

Also applies to: 111-116


4-4: No direct test references to fallback_providers-e16542b1-events.json
A repo-wide search didn’t find any tests loading or asserting against this particular fixture. You can safely ignore the previous warning about brittle timestamp/request_id checks for this file.

Likely an incorrect or invalid review comment.


34-39: Confirmed EndOfThought as Unhandled in fallback_providers fixture

The fallback_providers-e16542b1-events.json fixture now emits only Unhandled entries with raw {"type":"EndOfThought"} at lines 34–39 and 69–74, and no tests for this file reference “History”. The daily websocket tests (test_daily_agent_websocket.py) explicitly document that EndOfThought appears as Unhandled, so our client/deserializer logic and test expectations are aligned—no further changes needed.

tests/response_data/listen/rest/a231370d439312b1a404bb6ad8de955e900ec8eae9a906329af8cc672e6ec7ba-a17f4880c5b4cf124ac54d06d77c9f0ab7f3fe1052ff1c7b090f7eaf8ede5b76-response.json (2)

1-1: Model metadata update looks consistent.

models contains a single UUID that matches the key in model_info, and the version/name align with the nova-3 lineage. No schema issues observed.


1-1: Leading newline is intentional and consistent across all fixtures
All scanned response.json files under tests/response_data/listen/rest include the leading \n in paragraphs.transcript. Since every fixture exhibits this behavior, no change to strip or replace the newline is required.

tests/response_data/listen/rest/a231370d439312b1a404bb6ad8de955e900ec8eae9a906329af8cc672e6ec7ba-29e7c8100617f70da4ae9da1921cb5071a01219f4780ca70930b0a370ed2163a-response.json (1)

1-1: LGTM: fixture structure and model_info mapping are consistent.

The updated model id/version align with model_info key, and the results structure (alternatives/words/paragraphs/summary) remains valid. Minor confidence deltas are acceptable for fixture refresh.

tests/response_data/listen/rest/c4e1c0031174878d8f0e3dbd87916ee16d56f1c610ac525af5712ea37226a455-a17f4880c5b4cf124ac54d06d77c9f0ab7f3fe1052ff1c7b090f7eaf8ede5b76-response.json (2)

1-1: LGTM: updated model metadata and payload integrity look correct.

models and model_info keys match, timestamps/ids refreshed, and transcript content is unchanged aside from expected minor confidence drift.


1-1: Uniform migration confirmed

  • No fixtures reference the old model UUID 3b3aabe4-608a-46ac-9585-7960a25daf1a or version 2024-12-20.0.
  • Tests contain no direct assertions on request_id or created fields; static metadata in fixtures isn’t used in assertions.
tests/response_data/agent/websocket/agent_tags-e55ef69c-events.json (3)

4-8: Welcome event: new request_id and rebased timestamp look good

The added request_id in data and timestamp shifts are fine and match the updated fixture baseline.


60-66: Assistant text updates align with the revised phrasing

Updated assistant content and sequencing read well and match the EndOfThought-delimited flow.

Also applies to: 93-99, 111-117


35-39: Confirm client parsing of EndOfThought marker

I searched the entire repo and found no references to “EndOfThought” in the client code (only in test fixtures and tests), so it looks like this event is currently treated purely as an unhandled payload. Please verify that:

  • The WebSocket event parser in deepgram/clients correctly accepts Unhandled.raw containing {"type":"EndOfThought"}
  • No remaining logic is expecting a “History” block at this point
  • If special handling is needed for EndOfThought in future, the client code is updated accordingly
tests/response_data/agent/websocket/inject_agent_message-3c5004a4-events.json (4)

4-8: Welcome/Open/SettingsApplied baseline shifts accepted

Rebased timestamps and the new Welcome.request_id are fine.

Also applies to: 12-20


52-57: Latency values updated for AgentStartedSpeaking

Metrics updated and plausible; no schema concerns.


35-39: Confirm EndOfThought handling in Unhandled.raw

I ran:

rg -n "Unhandled" -A4 -B2 deepgram/clients | rg -n "EndOfThought" -A2 -B2

and found no matches. Please verify (or implement) that the client code in deepgram/clients correctly detects and handles the EndOfThought marker in the Unhandled.raw payload instead of falling back to History blocks.


60-66: No inline assertions to update—JSON fixtures cover the changes
I ran searches across all non-JSON test files and didn’t find any hard-coded checks for the old or new assistant messages. Since tests consume the updated JSON fixtures (which have already been updated), no further test changes are required.

tests/response_data/agent/websocket/basic_conversation-a40b2785-events.json (2)

4-8: Header events updated (timestamps/request_id) — looks good

No issues with the rebased timing and added request_id.

Also applies to: 12-20


102-107: Approve updated assistant text and verify test strings

The assistant’s closing message has been updated to “2 + 2 is 4!” across the JSON fixtures. I confirmed with ripgrep that all occurrences in tests/response_data/agent/websocket/basic_conversation-a40b2785-events.json now use this exact phrasing. No further changes are needed.

tests/response_data/agent/websocket/function_call_conversation-ac8ed698-events.json (6)

50-50: Function arguments string format: matches expected JSON-string payload

Arguments remain a JSON-encoded string, which aligns with prior behavior and typical FunctionCallRequest payloads. LGTM.

Also applies to: 82-82, 97-97


26-26: Confirm duplicated EndOfThought Unhandled events
We’ve verified that there are 2 instances of

{ "type":"Unhandled", "data":{ "raw":"{\"type\":\"EndOfThought\"}" } }

in tests/response_data/agent/websocket/function_call_conversation-ac8ed698-events.json. Please confirm whether this duplication is intentional (e.g., to mirror turn boundaries). If not, update the test to remove or consolidate the extra event.

Locations to check:

  • Line 26
  • Line 67

48-48: Cross-fixture FunctionCallRequest IDs Are Consistent

Verified that the three call_… IDs in
• tests/response_data/agent/websocket/function_call_conversation-ac8ed698-events.json
• tests/response_data/agent/websocket/function_call_conversation-ac8ed698-function_calls.json
match exactly. No discrepancies found—no updates needed.


4-19: Verified monotonic timestamps and singleton events

  • tests/response_data/agent/websocket/function_call_conversation-ac8ed698-events.json
    • Timestamps are strictly non-decreasing
    • Exactly one Welcome, Open, and SettingsApplied event
    • Welcome request_id “c808d204-8bea-4d20-8514-9c69710aaaff” is present and consistent

All checks pass—no further changes required.


26-40: Verify parser support for Unhandled raw JSON payloads

Please confirm that our websocket message parser correctly handles Unhandled events whose data.raw field contains a serialized JSON string (e.g. {"type":"EndOfThought"}) and deserializes it into an object. I wasn’t able to find any codepaths in the source that explicitly parse or dispatch on Unhandled.raw.

• tests/response_data/agent/websocket/function_call_conversation-ac8ed698-events.json (lines 26–40): contains

  {
    "type": "Unhandled",
    "timestamp": 1754948246.4373288,
    "data": {
      "type": "Unhandled",
      "raw": "{\"type\":\"EndOfThought\"}"
    }
  }

– Ensure this string payload is fed through JSON.parse (or equivalent) and handled by the conversation state machine.

• Codebase: no references to Unhandled parsing were found—please verify or implement support in the websocket handler.


114-118: Latency Assertion Suggestion Not Needed

The *-events.json files under tests/response_data are nightly snapshots produced by the daily websocket tests—they aren’t consumed by any unit tests that assert exact floating values. We confirmed:

  • All AgentStartedSpeaking events satisfy total_latency ≈ tts_latency + ttt_latency.
  • No tests load these fixtures to perform brittle equality checks on latency fields.

You can safely ignore this comment.

Likely an incorrect or invalid review comment.

Co-authored-by: Naomi <accounts+github@nhcarrigan.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (2)
deepgram/clients/agent/v1/websocket/options.py (2)

291-304: Robust normalization of function_calls in post_init (matches prior feedback)

Normalizing None/falsey to [] and converting dicts → FunctionCallHistory is correct and resilient.


314-333: Good normalization of Context.messages in post_init (matches prior feedback)

Handling None/[] and mixed dict/object inputs is solid. This should prevent surprises from callers passing messages=None or raw dicts.

🧹 Nitpick comments (4)
deepgram/clients/agent/v1/websocket/options.py (4)

283-304: Return typed FunctionCallHistory in getitem for consistency

Most container models in this file convert nested dicts/lists back to typed objects in getitem (e.g., Think.functions, Audio.input/output). HistoryFunctionCallsMessage currently does not. Add getitem to keep behavior consistent.

 class HistoryFunctionCallsMessage(BaseResponse):
@@
     function_calls: List[FunctionCallHistory] = field(default_factory=list)
 
     def __post_init__(self):
@@
         self.function_calls = [call for call in converted_calls if call is not None]
+
+    def __getitem__(self, key):
+        _dict = self.to_dict()
+        if "function_calls" in _dict and isinstance(_dict["function_calls"], list):
+            _dict["function_calls"] = [
+                FunctionCallHistory.from_dict(call) if isinstance(call, dict) else call
+                for call in _dict["function_calls"]
+            ]
+        return _dict[key]

306-333: Return typed messages in Context.getitem for consistency

Access via context["messages"] currently returns dicts. Mirror the pattern used elsewhere to return typed HistoryConversationMessage/HistoryFunctionCallsMessage instances.

 class Context(BaseResponse):
@@
     def __post_init__(self):
@@
         self.messages = converted_messages
+
+    def __getitem__(self, key):
+        _dict = self.to_dict()
+        if "messages" in _dict and isinstance(_dict["messages"], list):
+            typed = []
+            for message in _dict["messages"]:
+                if isinstance(message, dict):
+                    if "function_calls" in message:
+                        typed.append(HistoryFunctionCallsMessage.from_dict(message))
+                    else:
+                        typed.append(HistoryConversationMessage.from_dict(message))
+                else:
+                    typed.append(message)
+            _dict["messages"] = typed
+        return _dict[key]

264-264: Prefer enum for type="History" to align with other messages

Elsewhere (e.g., Settings/UpdateSpeak/UpdatePrompt) the type uses AgentWebSocketEvents. Using the enum here improves consistency and reduces string drift.

-    type: str = field(default="History")
+    type: str = str(AgentWebSocketEvents.History)

Apply for both HistoryConversationMessage and HistoryFunctionCallsMessage.

Also applies to: 288-288


259-267: Constrain role values or validate at construction

role is documented as "user" or "assistant". Consider enforcing this to catch bad inputs early.

Options:

  • Type as Literal["user", "assistant"] (requires choosing a sensible default).
  • Or add a lightweight post_init that warns on unexpected roles:
def __post_init__(self):
    if self.role not in ("user", "assistant"):
        logging.getLogger(__name__).warning(
            "Unknown role '%s' in HistoryConversationMessage; expected 'user' or 'assistant'", self.role
        )
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5c3685e and 7f0a9a1.

📒 Files selected for processing (1)
  • deepgram/clients/agent/v1/websocket/options.py (5 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
deepgram/clients/agent/v1/websocket/options.py (1)
deepgram/clients/common/v1/shared_response.py (1)
  • BaseResponse (16-44)
🔇 Additional comments (3)
deepgram/clients/agent/v1/websocket/options.py (3)

362-364: Agent.context integration looks correct

Optional field with dict→Context conversion in both post_init and getitem matches existing patterns. No issues.

Also applies to: 377-380, 392-394


455-457: SettingsOptions.flags integration LGTM

Optional Flags with dict→Flags conversion in getitem is consistent. Default history=True matches the spec.

Also applies to: 465-467


275-280: arguments/response correctly typed as str

All fixtures and unit tests treat both arguments and response as string values (with JSON-encoded payloads when appropriate). No object-shaped usage was found in tests or response data, so the existing str typing is accurate and no change is needed.

@jpvajda jpvajda requested a review from lukeocodes August 11, 2025 22:15
@jpvajda
Copy link
Contributor Author

jpvajda commented Aug 11, 2025

@lukeocodes This now includes a working example of Context History with Agent.

@jpvajda
Copy link
Contributor Author

jpvajda commented Oct 8, 2025

closing as the auto generated v5 SDK now contains this.

Context History Features Available:

  1. AgentV1Context class for conversation context configuration
  2. AgentV1HistoryMessage class for individual history messages
  3. AgentV1Flags class with a history boolean flag (defaults to True)
  4. Full integration in the AgentV1SettingsMessage and AgentV1Agent classes

Key Components Found:

From 87:106:/deepgram-repos/deepgram-python-sdk/src/deepgram/extensions/types/sockets/agent_v1_settings_message.py

class AgentV1HistoryMessage(UniversalBaseModel):
    """Conversation text as part of the conversation history"""
    
    type: typing.Literal["History"] = "History"
    """Message type identifier for conversation text"""
    
    role: typing.Literal["user", "assistant"]
    """Identifies who spoke the statement"""
    
    content: str
    """The actual statement that was spoken"""

From 153:157:/deepgram-repos/deepgram-python-sdk/src/deepgram/extensions/types/sockets/agent_v1_settings_message.py

class AgentV1Flags(UniversalBaseModel):
    """Agent flags configuration"""
    
    history: bool = True
    """Enable or disable history message reporting"""

From 169:173:/deepgram-repos/deepgram-python-sdk/src/deepgram/extensions/types/sockets/agent_v1_settings_message.py

class AgentV1Context(UniversalBaseModel):
    """Conversation context including the history of messages and function calls"""
    
    messages: typing.Optional[typing.List[typing.Union[AgentV1HistoryMessage, AgentV1HistoryFunctionCalls]]] = None
    """Conversation history as a list of messages and function calls"""

The new SDK supports:

  • settings.flags.history boolean flag
  • agent.context.messages array with AgentV1HistoryMessage objects
  • ✅ Message objects with type: "History", role: "user"|"assistant", and content: str

@jpvajda jpvajda closed this Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants