-
Notifications
You must be signed in to change notification settings - Fork 3
Feature/annotation exposed params #288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
…y into feature/annotation-exposed-params
- Use setattr(func, _EXPOSED_PARAM_VAR_NAME)
- Add _ExposureHelper class that helps in inferring type hints - Add various collector private methods in ExposedParamMixin
- akd/_base/exposure/
- utils.py - core.py
- Add `akd.utils.rgetattr` - Add `akd.utils.rsetattr`
metadata at runtime - Now we can just pipe Exposed() on right side of a value
|
❌ Tests failed (exit code: 1) 📊 Test Results
Branch: 📋 Full coverage report and logs are available in the workflow run. |
|
❌ Tests failed (exit code: 1) 📊 Test Results
Branch: 📋 Full coverage report and logs are available in the workflow run. |
|
❌ Tests failed (exit code: 1) 📊 Test Results
Branch: 📋 Full coverage report and logs are available in the workflow run. |
|
❌ Tests failed (exit code: 1) 📊 Test Results
Branch: 📋 Full coverage report and logs are available in the workflow run. |
|
❌ Tests failed (exit code: 1) 📊 Test Results
Branch: 📋 Full coverage report and logs are available in the workflow run. |
|
❌ Tests failed (exit code: 1) 📊 Test Results
Branch: 📋 Full coverage report and logs are available in the workflow run. |
|
❌ Tests failed (exit code: 1) 📊 Test Results
Branch: 📋 Full coverage report and logs are available in the workflow run. |
|
❌ Tests failed (exit code: 1) 📊 Test Results
Branch: 📋 Full coverage report and logs are available in the workflow run. |
Summary 📝
This PR implements a comprehensive Parameter Exposure System, providing a unified interface for agents and tools to expose their internal parameters for external configuration, introspection, and UI integration. It replaces the previous exposure logic with a modular package that supports three complementary strategies: Decorators, Type Annotations, and a new Pipe Operator syntax.
For full documentation refer to
docs/specs/AKD_EXPOSURE_SYSTEM.md.Details
Refactoring & Core Logic
akd/_base/exposure.pywith a modular packageakd/_base/exposure/containing core logic, structures, and utilities.rgetattrandrsetattrutilities toakd/utils.pyto enable dot-notation access for nested configurations (e.g.,agent["component.config.temp"]).Exposure Strategies
@exposed_paramwithValidatedPropertyto enforce type safety on setters automatically.Annotated[T, Exposed()]to automatically create properties for nested config schema fields at class creation time.value | Exposed()syntax for dynamic parameter exposure within__init__, enabling support for runtime components where annotations are erased.Documentation & Testing
docs/specs/AKD_EXPOSURE_SYSTEM.md.Usage Section
This system allows you to expose parameters using three complementary methods. You can mix and match these strategies within the same agent.
1. Annotated (Static/Schema Level)
Best for: Config schemas, DataClasses, and static settings.
Use standard Python
Annotatedtype hints. The system automatically creates accessors (getters/setters) for these fields, even if they are nested deep in a config object.2. Pipe Operator (Runtime/Init Level)
Best for: Dynamic components, calculated values, or objects created in
__init__.Since Python erases variable annotations at runtime, we use the
|operator to attach metadata to values directly.We use this mechanism because python doesn't attach type/annotation information at runtime. (I had experimented with other processes like parsing ast, but this seems to be more interpretable)
3. Decorator (Logic Level)
Best for: Computed properties, read-only status, or parameters requiring custom validation logic.
Use
@exposed_paramon standard property methods.Full Example: Putting it all together
Here is a complete agent definition showing how all three methods integrate seamlessly.
Accessing & Introspection
External systems (UI/API) can interact with these parameters uniformly:
Checks