Skip to content

feat: add agent decorators for configuration-as-code#98

Merged
NicoleMGomes merged 1 commit into
SAP:mainfrom
Cocossoul:feature/add-agent-decorators
May 11, 2026
Merged

feat: add agent decorators for configuration-as-code#98
NicoleMGomes merged 1 commit into
SAP:mainfrom
Cocossoul:feature/add-agent-decorators

Conversation

@Cocossoul
Copy link
Copy Markdown
Contributor

@Cocossoul Cocossoul commented May 11, 2026

Description

Adds an agent_decorators module to the SAP Cloud SDK for Python. This module provides three decorator functions — @prompt_section, @agent_config, and @agent_model — that developers apply to zero-argument functions to expose agent configuration fields (prompts, settings, model selections) to external low-code tooling. The decorated functions remain fully callable and return their coded defaults unchanged; the decorators act as static markers that tooling discovers and extracts at build or deploy time.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

How to Test

  1. Install the SDK and import the new module:

    from sap_cloud_sdk.agent_decorators import prompt_section, agent_config, agent_model
  2. Verify decorated functions remain callable and return their default values:

    @prompt_section(key="prompts.system", label="System Prompt", description="Main prompt")
    def system_prompt() -> str:
        return "You are a helpful assistant."
    
    assert system_prompt() == "You are a helpful assistant."
  3. Verify key validation raises AgentDecoratorError for empty or whitespace-only keys:

    from sap_cloud_sdk.agent_decorators.exceptions import AgentDecoratorError
    import pytest
    
    with pytest.raises(AgentDecoratorError):
        @prompt_section(key="", label="L", description="D")
        def bad(): return ""
  4. Run the unit test suite:

    uv run pytest tests/agent_decorators/ -q

Checklist

  • My code follows the project's Code Guidelines
  • I have added type hints for all public APIs
  • I have added unit tests covering the new functionality
  • I have added or updated the user guide (user-guide.md) in the module directory
  • All existing tests pass locally
  • My commits follow Conventional Commits format
  • No confidential or SAP-internal information is included

Disclaimer: Do not include SAP-internal or customer-specific information in this PR. This is a public repository.

@Cocossoul Cocossoul force-pushed the feature/add-agent-decorators branch from 2d96b17 to e13f86d Compare May 11, 2026 09:59
@cla-assistant
Copy link
Copy Markdown

cla-assistant Bot commented May 11, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@NicoleMGomes NicoleMGomes marked this pull request as ready for review May 11, 2026 12:52
@NicoleMGomes NicoleMGomes requested a review from a team as a code owner May 11, 2026 12:52
@NicoleMGomes NicoleMGomes merged commit 633f814 into SAP:main May 11, 2026
9 of 11 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.

3 participants