Skip to content

Update provider capabilities documentation with three-level hierarchy#27

Merged
theFong merged 4 commits intomainfrom
devin/1734137500-update-provider-capabilities-docs
Aug 13, 2025
Merged

Update provider capabilities documentation with three-level hierarchy#27
theFong merged 4 commits intomainfrom
devin/1734137500-update-provider-capabilities-docs

Conversation

@devin-ai-integration
Copy link
Contributor

Update provider capabilities documentation with three-level hierarchy

Summary

Enhanced the "How to Add a Cloud Provider" documentation to clarify the three distinct levels of capabilities in the SDK and explain the complexity of instance type mapping. This addresses feedback that the capability system needed better explanation for new provider implementers.

Key changes:

  • Restructured the "Capabilities: Be Precise" section with three clear levels:
    1. Provider-level capabilities - High-level API features declared in GetCapabilities()
    2. Instance type capabilities - Hardware-specific features as boolean fields on InstanceType
    3. Instance capabilities - Runtime state-dependent features for individual instances
  • Added new section on Instance Type Mapping Complexity explaining the challenges of converting provider-specific data to v1.InstanceType format
  • Added references to Lambda Labs implementation examples for each concept

Review & Testing Checklist for Human

  • Verify capability level accuracy: Check that the three capability levels are correctly described by examining pkg/v1/capabilities.go, pkg/v1/instancetype.go, and internal/lambdalabs/v1/capabilities.go
  • Validate Lambda Labs examples: Confirm that convertLambdaLabsInstanceTypeToV1InstanceType() in internal/lambdalabs/v1/instancetype.go actually demonstrates the mapping complexity I described
  • Test documentation flow: Read through the updated section to ensure it integrates smoothly with existing content and provides clear guidance for new implementers

Diagram

%%{ init : { "theme" : "default" }}%%
graph TD
    HowToDoc["docs/how-to-add-a-provider.md"]:::major-edit --> CapabilitiesCore["pkg/v1/capabilities.go"]:::context
    HowToDoc --> InstanceTypeCore["pkg/v1/instancetype.go"]:::context
    HowToDoc --> LambdaCaps["internal/lambdalabs/v1/capabilities.go"]:::context
    HowToDoc --> LambdaInstanceType["internal/lambdalabs/v1/instancetype.go"]:::context
    
    CapabilitiesCore -.->|"Provider-level<br/>capabilities"| LambdaCaps
    InstanceTypeCore -.->|"Instance type<br/>capabilities"| LambdaInstanceType
    LambdaInstanceType -.->|"Mapping complexity<br/>example"| HowToDoc
    
    subgraph Legend
        L1[Major Edit]:::major-edit
        L2[Minor Edit]:::minor-edit  
        L3[Context/No Edit]:::context
    end

    classDef major-edit fill:#90EE90
    classDef minor-edit fill:#87CEEB  
    classDef context fill:#F5F5F5
Loading

Notes

This change was requested to improve clarity around the capability system after feedback that instance type mapping is "one of the trickier things" in provider implementation. The documentation now provides concrete guidance and examples for each capability level.

Link to Devin run: https://app.devin.ai/sessions/a811ba02cf8c45338aa1f6c1c8d6252e
Requested by: @theFong

- Add three-level capability hierarchy (Provider, Instance Type, Instance)
- Explain provider-level capabilities declared in GetCapabilities()
- Document instance type capabilities as hardware-specific boolean fields
- Describe instance capabilities as runtime state-dependent features
- Add section on instance type mapping complexity
- Reference Lambda Labs examples for implementation guidance

Co-Authored-By: Alec Fong <alecsanf@usc.edu>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

- `Preemptible`: Whether this instance type supports spot/preemptible pricing

### 3. Instance Capabilities
These are runtime state-dependent features for individual running instances. For example, a running instance might support certain operations that a stopped instance cannot, or vice versa. These are typically checked dynamically based on the instance's current `LifecycleStatus`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instance capabilities are very similar to Instance Type capabilities but for a running instance vs type (template)

### 3. Instance Capabilities
These are runtime state-dependent features for individual running instances. For example, a running instance might support certain operations that a stopped instance cannot, or vice versa. These are typically checked dynamically based on the instance's current `LifecycleStatus`.

### Instance Type Mapping Complexity
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets remove this section for now on instance type comlexity

- Remove entire 'Instance Type Mapping Complexity' section as requested
- Clarify that Instance capabilities are similar to Instance Type capabilities but for running instances vs type templates
- Keep focus on the three-level capability hierarchy

Co-Authored-By: Alec Fong <alecsanf@usc.edu>
- Handle availability and regional variations consistently

See `convertLambdaLabsInstanceTypeToV1InstanceType()` in ../internal/lambdalabs/v1/instancetype.go for a complete example of this complex mapping process.
These are runtime state-dependent features for individual running instances, similar to Instance Type capabilities but applied to a running instance rather than the type template. For example, a running instance might support certain operations that a stopped instance cannot, or vice versa. These are typically checked dynamically based on the instance's current `LifecycleStatus`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically true that they can be changed based on state (they are note, good thing to note). however what I'm referring to is some booleans like (stoppable) are replicated on the instance even though you can figure it out through the instance type thats correlated with it. Its redundant but important to remember they need to be accurate none the less. Take a look at the instance

- Explain that Instance capabilities are boolean fields duplicated from InstanceType for performance/convenience
- Note that while they appear redundant, they must be kept accurate and in sync
- Mention they can reflect runtime state-dependent variations
- Address PR feedback about the redundant but important nature of these fields

Co-Authored-By: Alec Fong <alecsanf@usc.edu>
These are capability boolean fields replicated on individual `Instance` objects, similar to Instance Type capabilities but applied to the running instance rather than the type template. While these fields could theoretically be derived from the associated `InstanceType`, they are duplicated on the instance for performance and convenience reasons. Examples include:
- `Stoppable`: Whether this specific instance can be stopped/started
- `Rebootable`: Whether this specific instance can be rebooted
- `IsContainer`: Whether this instance runs in container mode
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets remove IsContainer this because I dont want to highlight container capabilities.

- Address PR feedback from @theFong to not highlight container capabilities
- Keep Stoppable and Rebootable examples which are more relevant
- Maintain documentation clarity and flow

Co-Authored-By: Alec Fong <alecsanf@usc.edu>
@theFong theFong merged commit 69ebeac into main Aug 13, 2025
4 checks passed
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