Skip to content

Conversation

contextablemark
Copy link
Contributor

@contextablemark contextablemark commented Aug 24, 2025

Draft PR for Kotlin SDK. Addresses #275.

@NathanTarbert
Copy link
Contributor

Hey @contextablemark, thanks for doing the work to add a Kotlin SDK!
Excited to merge this.

@contextablemark
Copy link
Contributor Author

Thanks, @NathanTarbert ! Docs still need a bit more work to get them into the .MDX format, but I wanted to get the draft PR submitted in case anyone wants to take an advance look.

@contextablemark contextablemark marked this pull request as ready for review August 29, 2025 23:44
@contextablemark
Copy link
Contributor Author

contextablemark commented Sep 3, 2025

@NathanTarbert Moving this back to draft as I just noticed that it seems to have the adk-middleware files intermingled. Will resubmit once I have a clean PR (unless the adk-middleware PR gets merged first 😄)

@contextablemark contextablemark marked this pull request as draft September 3, 2025 19:42
contextablemark and others added 8 commits September 3, 2025 19:59
Introduces a comprehensive Kotlin Multiplatform SDK for the Agent User Interaction Protocol (AG-UI) supporting Android, iOS, and JVM platforms.

## Features
- Modular architecture with 4 specialized modules (core, client, tools, agent-sdk)
- Real-time streaming with SSE support
- Type-safe protocol implementation with kotlinx.serialization
- Extensible tool execution framework
- State management with JSON Patch support
- Multiple authentication methods (Bearer, API Key, Basic Auth)

## Modules
- **kotlin-core**: Protocol types, events, and message definitions
- **kotlin-client**: HTTP transport, SSE parsing, and state management
- **kotlin-tools**: Tool execution framework with error handling
- **kotlin-agent-sdk**: High-level agent implementations

## Examples
- Chat application with Compose Multiplatform UI
- Java Android chat app demonstrating interop
- Tool executor examples

## Testing
- 140+ unit tests across all modules
- Platform-specific test coverage
- Integration test suites

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Add required Info.plist entry for Compose Multiplatform iOS support.
This key is strictly enforced since Compose Multiplatform 1.6.10 to
ensure proper support for high refresh rate displays (120Hz).

Without this key, the app crashes during initialization with:
PlistSanityCheck.performIfNeeded throwing a Kotlin/Native exception.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Fix gitignore pattern to properly exclude gradle-wrapper.jar files
  using **/gradle/wrapper/gradle-wrapper.jar instead of gradle/wrapper/gradle-wrapper.jar
- Add missing gradle-wrapper.jar for tools example to enable running tests
- Add gradle-wrapper.jar files for all examples and library modules

This allows all example projects to run their tests independently
without requiring parent gradle installation.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Fix flaky testDialogCancellation test by properly handling keyboard state
and UI transitions during dialog interactions.

Root cause: The test was failing because the soft keyboard remained open
after typing, causing view hierarchy transitions that interfered with
Espresso's ability to find the layoutEmptyState view.

Changes:
- Close soft keyboard explicitly before clicking Cancel button
- Add brief delay (100ms) to allow UI transitions to complete
- Add repository verification to ensure no agents were added
- Improve test robustness with initial state verification

Result: All Android instrumented tests now pass (30/30 = 100% success rate)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Fixes #58 - Remove old licensing boilerplate text from Kotlin files.

- Removed MIT license headers from 67 Kotlin files across examples
- All files in examples/chatapp and examples/tools affected
- License boilerplate (lines 1-23) removed while preserving code

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Implements complete support for thinking events in the Kotlin SDK:

- Add 5 new thinking event types: THINKING_START, THINKING_END,
  THINKING_TEXT_MESSAGE_START, THINKING_TEXT_MESSAGE_CONTENT,
  THINKING_TEXT_MESSAGE_END
- Add comprehensive event validation with state machine logic
- Create full test suite with 40 test cases covering valid/invalid sequences
- Add JSON serialization support for all thinking events
- Ensure 100% test coverage with all 98 tests passing

Thinking events enable AI agents to represent internal reasoning
processes in the AG-UI protocol, following the same patterns as
text messages but within thinking contexts.

Fixes #61

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
…SULT events

- Add TEXT_MESSAGE_CHUNK and TOOL_CALL_CHUNK event types to EventType enum
- Add TextMessageChunkEvent and ToolCallChunkEvent classes with proper serialization
- Add missing TOOL_CALL_RESULT event type and ToolCallResultEvent class
- Implement ChunkTransform that converts chunk events to structured sequences
- Transform automatically starts/ends message and tool call sequences as needed
- Add comprehensive test suite covering all chunk scenarios and TOOL_CALL_RESULT
- Add serialization tests for all new event types
- Add verifier tests to ensure proper event validation
- All 112 tests passing (100% success rate)
- Update event count from 23 to 24 to match TypeScript SDK

Resolves #55

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
…nt files

- Add complete MDX documentation structure covering client, core, and tools modules
- Create 12 detailed documentation files following JS SDK structure
- Fix all technical inaccuracies including ToolCall structure, missing events, and API signatures
- Update GitHub references from Contextable to ag-ui-protocol organization
- Clean up redundant README and OVERVIEW files (removed ~800 lines of duplicate content)
- Update package names from com.contextable to com.agui for consistency
- Update bundle identifiers to cleaner format (com.agui.example.chatapp)
- Update developer metadata to Mark Fogle while preserving ag-ui-protocol repository references

All tests passing across Android, iOS, and JVM platforms.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@contextablemark contextablemark marked this pull request as ready for review September 4, 2025 03:08
@contextablemark
Copy link
Contributor Author

Ready for review after rebasing off of main.

Copy link
Contributor

@tylerslaton tylerslaton left a comment

Choose a reason for hiding this comment

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

Hey @contextablemark, just a few things for this PR.

  1. Can you put the SDK under the following path: sdks/community/kotlin?
  2. Can you add a new Github action that will execute the Kotlin tests so we can sanity check they're passing in CI here?
  3. For the docs, can you add a mention that this is community contributed and maintained in the overview page?

With those in I'd feel comfortable merging this. The path is the same as the one provided by the Golang SDK in #339

This was referenced Sep 17, 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.

3 participants