modelprofile.com Kotlin support

Native FlexHarness support for Android applications, following the Swift support library: immutable JSON/tool values, model contracts, sequential tool execution, bounded agent runs, and a non-streaming Anthropic Messages provider. No Node process or application credentials gateway is needed.

The provider owns the official third-party HTTP protocol. Application feature APIs continue to use generated TypedSocket clients from api.global/kotlinsupport. Supplier vaults, browser execution, egress rules, secret scrubbing and UI belong to the application. AnthropicModel.beforeRequest receives the complete final provider request body before any network bytes; a host can refuse it with AgentAborted. Apps must scrub ordinary tool errors/results before returning them to the generic agent loop.

runAgent counts model calls with AgentLimits.maxSteps, runs tools sequentially, preserves paired tool results, propagates cancellation/security aborts, and bounds tool calls, conversation content and tool results. The provider caps bodies at 4 MiB and JSON depth at 64. Diagnostics are redacted, provider error bodies are never repeated, redirects/retries are disabled, and cancellation cancels the underlying network call. Input/output usage reflects the provider's stated input/output counts; this library makes no pricing claim.

Prompt cache defaults match Swift/TypeScript: one-hour stable prefix at system or last tool, five-minute rolling breakpoints on the final blocks of the last two messages. Bodies use sorted keys. Tests use scripted models and loopback MockWebServer and do not contact Anthropic.

Include android/ from a pinned Git submodule as a Gradle Android library project. The module uses minSdk 26, compileSdk 37 and Java 17. Verify with ci/in-docker.sh ./gradlew :android:testDebugUnitTest :android:lintDebug :android:assembleRelease. No package publication or release is performed by these commands.

Hosts with a platform firewall may supply ProviderNetwork: readiness is checked before every request (including connection reuse), while DNS and unconnected socket creation bind to that platform route. This does not move provider wire code, authentication, endpoint selection or TLS validation into the app. Revoked routing aborts before another request; applications must also cancel active work and close their protected sockets when their platform route ends.

S
Description
Shared Kotlin model and FlexHarness support for native Android applications.
Readme MIT
101 KiB
0 Stars 3 Watchers 0 Forks
Languages
Kotlin 92.7%
Dockerfile 4.3%
Shell 3%