Selection Criteria
- Spring services: consider Spring AI and integrate it with existing authentication, transactions, and observability.
- TypeScript services: consider AI SDK or provider SDKs and compare streaming, tool contracts, and schema validation.
- A single-feature experiment: measure quality with one call before wrapping SDKs in multiple layers.
These are project-selection proposals, not a claim that the same framework suits every application.
Recommended Boundaries
HTTP request → authentication and request limits → AI service → model adapter / retrieval / tool executor → result validation → response.
Separate responsibilities so that web controllers do not directly combine model SDK calls and database administrator privileges.
Implementation Checklist
- Inject keys from server-side secret storage.
- Manage model IDs, prompt versions, and output limits through configuration.
- Set timeouts, cancellation, and concurrency limits.
- Bound retries for 429 and transient errors by both count and total time.
- Require idempotency keys and recheck permissions for write tools.
- Validate business meaning separately from JSON syntax.
Suggested First Project
Build a read-only assistant that accepts deployment logs and returns potential errors and supporting lines. Limit output to suspected causes, evidence, and the next diagnostic commands. Keep actual deployment and rollback in a separate workflow.
Official References