Skip to content

Commit 06ae8ae

Browse files
committed
feat: introduce api leveling documentation
this document outlines different API stability levels, how to enforce them, and next steps Signed-off-by: Charlie Doern <[email protected]>
1 parent 28696c3 commit 06ae8ae

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

docs/source/apis/api_leveling.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Llama Stack API Stability Leveling
2+
3+
In order to provide a stable experience in Llama Stack, the various APIs need different stability levels indicating the level of support, backwards compatability, and overall production readiness.
4+
5+
## Different Levels
6+
7+
### v1alpha
8+
9+
- Little to no expectation of support between versions
10+
- Breaking changes are permitted
11+
- Datatypes and parameters can break
12+
- Routes can be added and removed
13+
14+
#### Graduation Criteria
15+
16+
- an API can graduate from `v1alpha` to `v1beta` if the team has identified the extent of the mandatory surface of the API. "mandatory surface" means non-optional routes and the shape of their parameters/return types eg. `/v1/openai/chat/completions`. Optional types can change.
17+
- CRUD must stay stable once in `v1beta`.
18+
- for OpenAI APIs, a comparison to the OpenAI spec for the specific API can be done to ensure completeness.
19+
20+
### v1beta
21+
22+
- API routes ensured between versions
23+
- Parameters and return types are not ensured between versions
24+
- API, besides minor fixes and adjustments, should be _almost_ v1. Changes should not be drastic.
25+
26+
#### Graduation Criteria
27+
28+
- an API can graduate from `v1beta` to `v1` if the API surface and datatypes are complete as identified by the team. The parameters and return types that are mandatory for each route are stable. All aspects of graduating from `v1alpha1` to `v1beta` apply as well.
29+
- Optional parameters, routes, or parts of the return type can be added after graduating to `v1`
30+
31+
### v1 (stable)
32+
33+
- Considered stable
34+
- Backwards compatible between Z-streams
35+
- Y-stream breaking changes must go through the proper approval and announcement process.
36+
- Datatypes for a route and its return types cannot changed between Z-streams
37+
- Y-stream datatype changes should be sparing, unless the changes are additional net-new parameters
38+
- Must have proper conformance testing as outlined in https://github.com/llamastack/llama-stack/issues/3237
39+
40+
### API Stability vs. Provider Stability
41+
42+
The leveling introduced in this document relates to the stability of the API and not specifically the providers within the API.
43+
44+
Providers can iterate as much as they want on functionality as long as they work within the bounds of an API. If they need to change the API, then the API should not be `/v1`, or those breaking changes can only happen on a y-stream release basis.
45+
46+
### Approval and Announcement Process for Breaking Changes
47+
48+
- **PR Labeling**: Any pull request that introduces a breaking API change must be clearly labeled with `breaking-change`.
49+
- **Maintainer Review**: At least one maintainer must explicitly acknowledge the breaking change during review by applying the `breaking-change` label. An approval must come with this label or the acknowledgement this label has already been applied.
50+
- **Announcement**: Breaking changes require inclusion in release notes and, if applicable, a separate communication (e.g., Discord, Github Issues, or GitHub Discussions) prior to release.
51+
52+
## Enforcement
53+
54+
### Migration of API routes under `/v1alpha`, `/v1beta`, and `/v1`
55+
56+
Instead of placing every API under `/v1`, any API that is not fully stable or complete should go under `/v1alpha` or `/v1beta`. For example, at the time of this writing, `post_training` belongs here, as well as any OpenAI-compatible API whose surface does not exactly match the upstream OpenAI API it mimics.
57+
58+
This migration is crucial as we get Llama Stack in the hands of users who intend to productize various APIs. A clear view of what is stable and what is actively being developed will enable users to pick and choose various APIs to build their products on.
59+
60+
This migration will be a breaking change for any API moving out of `/v1`. Ideally, this should happen before 0.3.0 and especially 1.0.0.
61+
62+
### `x-stability` tags in the OpenAPI spec for oasdiff
63+
64+
`x-stability` tags allow tools like oasdiff to enforce different rules for different stability levels; these tags should match the routes: [oasdiff stability](https://github.com/oasdiff/oasdiff/blob/main/docs/STABILITY.md)
65+
66+
### Testing
67+
68+
The testing of each stable API is already outlined in [issue #3237](https://github.com/llamastack/llama-stack/issues/3237) and is being worked on. These sorts of conformance tests should apply primarily to `/v1` APIs only, with `/v1alpha` and `/v1beta` having any tests the maintainers see fit as well as basic testing to ensure the routing works properly.
69+
70+
### New APIs going forward
71+
72+
Any subsequently introduced APIs should be introduced as `/v1alpha`

0 commit comments

Comments
 (0)