feat(api)!: redesign Python SDK API and lifecycle contracts - #39
Conversation
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Drive lifecycle selection from SDK/CLI operations and adapter capabilities instead of a user-authored runtime.mode field. Adapter descriptors now advertise session support, examples and schemas no longer include runtime mode, and session adapters require an explicit caller session_id. The Python SDK keeps async method signatures while native lifecycle calls remain direct for this slice; executor-backed native calls currently hang after returning. Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Expose session_id on Fabric.run and fabric run so callers can pass a stable conversation key without hand-editing RunRequest.context. Shared request helpers reject conflicting session ids, and CLI/SDK smokes cover propagation. Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Remove user-authored runtime.transport and the public Transport enum. Runtime execution support is now derived from adapter kind and declared capabilities, while runtime config keeps only input/output/artifact shape. Update examples, fixtures, schemas, reference docs, and SDK tests to match the slimmer config contract. Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Keep telemetry configuration focused on enabled/provider/project/output/config. Relay runtime mode remains an internal adapter environment default instead of a user-authored config field or telemetry metadata value. Update schemas, examples, and telemetry tests for the slimmer telemetry contract. Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
|
Note Reviews pausedUse the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThis PR migrates Fabric's lifecycle model from session-based ("session_id", ChangesRuntime lifecycle migration
Estimated code review effort: 4 (Complex) | ~75 minutes Sequence Diagram(s)sequenceDiagram
participant App as Caller App
participant Fabric as Fabric (SDK client)
participant Runtime as Runtime
participant CoreRT as fabric-core runtime
participant Adapter as Process/Python Adapter
App->>Fabric: start_runtime(agent, profiles, overrides)
Fabric->>CoreRT: resolve_run_plan + start runtime
CoreRT->>Adapter: start() -> RuntimeHandle(runtime_id)
CoreRT-->>Fabric: RuntimeHandle
Fabric-->>App: Runtime instance
loop multi-turn invocation
App->>Runtime: invoke(request)
Runtime->>CoreRT: adapter_invocation(runtime_context{runtime_id})
CoreRT->>Adapter: run invocation payload
Adapter-->>CoreRT: RunResult
CoreRT-->>Runtime: RunResult
Runtime-->>App: RunResult
end
App->>Runtime: stop()
Runtime->>CoreRT: stop_runtime(runtime_id)
CoreRT->>Adapter: shutdown
Runtime-->>App: RuntimeStatus.STOPPED
Estimated code review effortEstimated code review effort: 4 (Complex) | ~75 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
|
@CodeRabbit review full |
|
✅ Action performedFull review finished. |
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com> # Conflicts: # adapters/codex-cli/README.md # pyproject.toml # python/pyproject.toml # tests/adapters/test_adapaters_common_utils.py # tests/adapters/test_codex_cli.py # tests/e2e/test_hermes_cli.py # tests/e2e/test_hermes_e2e.py # tests/python/test_consumer_neutral.py
|
/ok to test 75b2ee6 |
|
📖 Fern docs preview: https://nvidia-preview-pull-request-39.docs.buildwithfern.com/nemo/fabric |
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
Signed-off-by: Anuradha Karuppiah <26330987+AnuradhaKaruppiah@users.noreply.github.com>
AjayThorve
left a comment
There was a problem hiding this comment.
Approving.
The implementation is aligned with the SDK contract we discussed and carries it consistently across the Rust core, Python API, adapters, schemas, docs, and examples.
I also validated the current head with a real Codex agent: both one-shot and multi-turn execution completed an actual repository repair, preserved runtime/thread state across turns, passed the external test suite, and produced correctly isolated patch artifacts.
There are expected hardening follow-ups, but nothing I consider blocking for the MVP.
Summary
This PR gives Fabric one Python-first SDK and runtime model:
FabricConfig -> Fabric -> RunPlan -> Runtime -> RunResultFabricthe entry point for path-backed and typed in-memory configuration;run()for one-shot start/invoke/stop andstart_runtime()for ordered multi-turn work;Validation
uv run --no-sync pytest -q— 212 passed, 3 skippedcargo test --workspace --locked— 46 passedcargo fmt --all -- --checkReview path
Start with
docs/sdk/python.mdx, then review:python/src/nemo_fabric/client.py,models.py, andruntime.pycrates/fabric-core/src/config.rsandruntime.rsRelated issues
Closes FABRIC-2, FABRIC-39