Skip to content

[Feat]: Add enterprise cloud model adapters (Bedrock Converse, Azure OpenAI, etc.) #262

Description

@rosspeili

Feature Description

Add first-class SkillLoader adapters for enterprise / cloud-hosted model APIs whose tool-calling wire format differs from the existing five adapters (OpenAI, DeepSeek-compatible, Claude, Gemini, Ollama prompt).

Phase 1 (this issue’s MVP — pick one provider in first PR):

  • to_bedrock_tool() (or equivalent) for AWS Bedrock Converse / tool-use API — map manifest.yaml parameters to Bedrock’s tool spec (name sanitization, schema shape per AWS docs).
  • Tests in tests/test_loader.py (no live AWS calls; fixture manifests only).
  • docs/usage/bedrock.md — install (boto3 or skillware[bedrock] extra if added), IAM/credentials, minimal agent loop snippet.
  • Optional runnable example under examples/ + examples/README.md row.
  • CHANGELOG.md [Unreleased].

Phase 2+ (follow-up issues/PRs — do not bundle in MVP):

  • Azure OpenAI (often OpenAI-compatible — document first; adapter only if schema diverges)
  • Google Vertex AI (may share Gemini shapes — evaluate reuse vs to_gemini_tool())
  • Cohere tool API (if schema differs materially)
  • IBM watsonx / other enterprise endpoints — only with clear demand

Explicit non-goals for this track:

  • Per-vendor adapters for OpenAI-compatible APIs (Kimi, GLM, Groq, etc.) — covered by docs issue for to_openai_tool() + base_url
  • New adapters for every local Ollama model name (Hermes, Qwen, …) — use to_ollama_prompt()
  • Running inference inside Skillware — adapters are schema conversion only, same as today

Rationale

Affected paths (optional)

skillware/core/loader.py, tests/test_loader.py, pyproject.toml (optional [bedrock] extra), docs/usage/README.md, docs/usage/bedrock.md, examples/bedrock_*.py, CHANGELOG.md, docs/contributing/ai_native_workflow.md

Implementation Idea

Design principles:

  1. Mirror existing adapter pattern in loader.py — static method on SkillLoader, input skill_bundle, output provider-native tool object or dict.
  2. Reuse _sanitize_function_tool_name() where provider allows; add _sanitize_bedrock_tool_name() only if AWS rules differ.
  3. Keep optional SDK deps out of core install — try/import with clear ImportError message (same as to_gemini_tool()).
  4. Phased delivery: Bedrock first PR; Azure/Vertex/Cohere as separate issues after validating schema delta.
  5. No breaking changes to execute(params) or existing adapters.

Bedrock sketch (illustrative — verify against current AWS Converse API):

# skillware/core/loader.py
@staticmethod
def to_bedrock_tool(skill_bundle: Dict[str, Any]) -> Dict[str, Any]:
    manifest = skill_bundle.get("manifest", {})
    return {
        "toolSpec": {
            "name": SkillLoader._sanitize_function_tool_name(manifest.get("name", "")),
            "description": manifest.get("description", ""),
            "inputSchema": {"json": manifest.get("parameters", {})},
        }
    }

Tests: Parametrize manifest fixtures (same as existing loader adapter tests); assert key fields present; no network.

Docs: Bedrock guide covers IAM role vs access keys, region, model ID, and that skills still use env_vars for skill keys (Etherscan, etc.) separate from Bedrock credentials.

Risks / how to avoid breaking the repo:

Risk Mitigation
Adapter explosion One cloud provider per PR; RFC comment on #39-sized changes
Optional dep bloat [bedrock] extra; not in [all] unless justified
Schema drift vs AWS Link official AWS docs in bedrock.md; version note in CHANGELOG
Duplicate OpenAI-compatible cloud Document “use to_openai_tool() + Azure endpoint” before new adapter
Example/doc drift Run pytest tests/test_registry_docs.py; update usage index

Acceptance criteria (MVP / Bedrock PR):

  • SkillLoader.to_bedrock_tool(bundle) implemented and tested offline
  • Usage guide + README index row
  • Optional extra documented in install_extras.md if new dependency
  • Existing five adapters unchanged; full pytest tests/test_loader.py green
  • Follow-up issues linked for Phase 2 providers

Metadata

Metadata

Assignees

No one assigned

    Labels

    core frameworkChanges to loader, env, base classes, or model adapters.enhancementNew feature or request.help wantedExtra attention is needed.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions