Skip to content

[ATOM gRPC] The atom.grpc.v1 proto and its generated Python modules (3/14) - #3660

Closed
Jasen2201 wants to merge 1 commit into
jasen/atom-grpc-02-mesh-atom-rank-mappingfrom
jasen/atom-grpc-03-proto
Closed

Jasen2201 wants to merge 1 commit into
jasen/atom-grpc-02-mesh-atom-rank-mappingfrom
jasen/atom-grpc-03-proto

Conversation

@Jasen2201

@Jasen2201 Jasen2201 commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Part 3/14 of the stack proposed in #3657. No blocking issues.

Why

ATOM served HTTP only: a router that renders and tokenizes chats itself had no ATOM service to send token ids to, and the EngineCore wire protocol (engine_v1) had no Python binding.

What changed

  • atom/entrypoints/grpc/atom_grpc.proto defines atom.grpc.v1.AtomEngine: Generate, Abort, GetModelInfo, GetServerInfo, HealthCheck, the Session (engine_v1 messages both ways) and PrepareStructuredOutput. It imports engine_v1 for SamplingParams and TokenIds.
  • PrepareStructuredOutput takes a chat's StructuredOutput with the request's sampling, stop ids and kv_transfer_params, and answers the engine_v1 SamplingParams fields the HTTP chat route derives from them.
  • python -m atom.entrypoints.grpc.generate writes the committed atom_grpc_pb2.py, atom_grpc_pb2_grpc.py and engine_v1_pb2.py with grpcio-tools 1.78.0; ruff and black skip them.
  • pyproject.toml declares grpcio>=1.78.0 and protobuf>=6.31.1,<7, the floors the modules check at import and the versions the Docker image installs.

Review focus

  1. StructuredOutput: message-declared tools ride apart from the top-level tools, which the chat route reads differently.
  2. The protobuf floor in pyproject.toml.

Testing

tests/test_grpc_proto.py checks that the committed modules are byte-identical to what generate.py writes, and the service's RPCs and message shapes.

jasen/atom-grpc-03-proto @ 53dd007: tests/test_grpc_proto.py 5 passed, the committed modules byte-identical to generate.py's output under grpcio-tools 1.78.0. ruff, black clean.

Follow-ups

none

Stack

ATOM serves atom.grpc.v1.AtomEngine beside its HTTP server (token ids in, token ids out, ATOM's P/D flow unchanged), and atomesh routes to ATOM gRPC workers, over a Generate call per request or one Session per instance. Bottom to top:

  1. [ATOM gRPC] Token-id prompts reuse block-hash chains; an idle EngineCore waits for input (1/14) #3658 Token-id prompts reuse block-hash chains; an idle EngineCore waits for input
  2. [ATOM gRPC] atomesh: share ATOM's P/D rank mapping and prefill-info parsing (2/14) #3659 atomesh: share ATOM's P/D rank mapping and prefill-info parsing
  3. [ATOM gRPC] The atom.grpc.v1 proto and its generated Python modules (3/14) #3660 The atom.grpc.v1 proto and its generated Python modules
  4. [ATOM gRPC] gRPC server: --grpc-port, info RPCs, Generate, Abort, structured output (4/14) #3661 gRPC server: --grpc-port, info RPCs, Generate, Abort, structured output
  5. [ATOM gRPC] gRPC server: the Session RPC and its engine_v1 frames codec (5/14) #3662 gRPC server: the Session RPC and its engine_v1 frames codec
  6. [ATOM gRPC] atomesh: compile ATOM's protos in every build (6/14) #3663 atomesh: compile ATOM's protos in every build
  7. [ATOM gRPC] atomesh: an ATOM gRPC client (7/14) #3664 atomesh: an ATOM gRPC client
  8. [ATOM gRPC] atomesh: discover ATOM gRPC workers, their model info and DP ranks (8/14) #3665 atomesh: discover ATOM gRPC workers, their model info and DP ranks
  9. [ATOM gRPC] atomesh: ATOM P/D over gRPC (9/14) #3666 atomesh: ATOM P/D over gRPC
  10. [ATOM gRPC] atomesh: the Session link to an ATOM instance (10/14) #3667 atomesh: the Session link to an ATOM instance
  11. [ATOM gRPC] atomesh: chat structured output to ATOM; refuse media and Responses (11/14) #3668 atomesh: chat structured output to ATOM; refuse media and Responses
  12. [ATOM gRPC] atomesh: gRPC chat and stream output as ATOM's HTTP routes give it (12/14) #3669 atomesh: gRPC chat and stream output as ATOM's HTTP routes give it
  13. [ATOM gRPC] atomesh: route ATOM requests over the Session (13/14) #3670 atomesh: route ATOM requests over the Session
  14. [ATOM gRPC] The Session's step delivery: Completions without ids, atomesh's Session on its own thread (14/14) #3671 The Session's step delivery: Completions without ids, atomesh's Session on its own thread

1 and 2 stand alone; 6 to 13 need only part 3 of the Python side; 14 changes both sides of the Session.

Evidence

At 53dd007, with grpcio-tools 1.78.0 and protobuf 6.33.6: pytest tests/test_grpc_proto.py 5 passed; ruff check and black --check (26.10.1) clean on the changed files, the three protoc modules excluded from both.

AtomEngine's RPCs: Generate, Abort, GetModelInfo, GetServerInfo, HealthCheck, Session, PrepareStructuredOutput.

🤖 Generated with Claude Code

…3/14)

`atom/entrypoints/grpc/atom_grpc.proto` defines `atom.grpc.v1.AtomEngine`,
ATOM's own gRPC service: token ids in, token ids out. It imports
engine_v1 for `SamplingParams` and `TokenIds`, so a Session carries
engine_v1 messages unchanged. `PrepareStructuredOutput` takes a chat's
`StructuredOutput` with the request's sampling, stop ids and
kv_transfer_params, and answers with the engine_v1 `SamplingParams`
fields the HTTP chat route derives from them.

`python -m atom.entrypoints.grpc.generate` writes the committed
`atom_grpc_pb2.py`, `atom_grpc_pb2_grpc.py` and `engine_v1_pb2.py` with
grpcio-tools 1.78.0; ruff and black skip them, and
`tests/test_grpc_proto.py` fails when one differs from what it writes. `pyproject.toml` declares
`grpcio>=1.78.0` and `protobuf>=6.31.1,<7`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jasen2201

Copy link
Copy Markdown
Collaborator Author

Superseded by #3673 after regrouping by function (see #3657).

@Jasen2201 Jasen2201 closed this Nov 21, 2026
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.

1 participant