mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-11-29 00:38:33 +00:00
Some checks failed
CI and Release / Docker / Build and test / amd64 (push) Has been cancelled
CI and Release / Docker / Build and test / arm64 (push) Has been cancelled
Security / CodeQL / Analyze python (push) Has been cancelled
CI / Python quality / Pre-commit (push) Has been cancelled
CI / Python tests / Unit Tests - py3.12 (push) Has been cancelled
CI / Python tests / Unit Tests - py3.13 (push) Has been cancelled
CI / Python tests / Unit Tests - py3.14 (push) Has been cancelled
CI / Python packages / Build and verify distributions (push) Has been cancelled
CI / Python quality / GitHub Actions (push) Has been cancelled
CI / Python tests / Hermes embedded - ubuntu-latest (push) Has been cancelled
CI / Python tests / Hermes embedded - windows-latest (push) Has been cancelled
CI / Python tests / Unit Tests - py3.11 (push) Has been cancelled
CI / ReMe Studio / Studio checks (push) Has been cancelled
Deploy / Documentation / Build documentation (push) Has been cancelled
CI / Windows / CLI smoke - py3.11 (push) Has been cancelled
Security / CodeQL / Analyze javascript-typescript (push) Has been cancelled
CI and Release / Docker / Publish multi-platform tags (push) Has been cancelled
Deploy / Documentation / deploy (push) Has been cancelled
* refactor(core): reorganize the ReMe runtime and shared helpers * test(status): import the base component from its canonical module * test: remove redundant unit checks * refactor(core): use canonical runtime imports and shared CLI discovery Restore evolve behavior to the base branch and update its imports. Use Application as the runtime entry point and encode SSE in the HTTP service. * fix(cli): honor caller config when service replay is incomplete Use partial startup overrides for port probes and resolve named configs before requesting the service process working directory.
35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
"""Simple step that adds two numbers — used as a demo tool for agent wrapper."""
|
|
|
|
from ..base_step import BaseStep
|
|
from ...core.registry import R
|
|
|
|
|
|
@R.register("add_step")
|
|
class AddStep(BaseStep):
|
|
"""Add two numbers and return the result as the response answer.
|
|
|
|
Inputs (from RuntimeContext):
|
|
a (float, required): first addend.
|
|
b (float, required): second addend.
|
|
|
|
Output (written to context.response.answer):
|
|
The sum of ``a`` and ``b`` as a string.
|
|
"""
|
|
|
|
async def execute(self):
|
|
assert self.context is not None
|
|
try:
|
|
a = float(self.context.get("a", 0.0))
|
|
b = float(self.context.get("b", 0.0))
|
|
except (TypeError, ValueError) as exc:
|
|
self.context.response.success = False
|
|
self.context.response.answer = f"Invalid add arguments: {exc}"
|
|
return self.context.response
|
|
|
|
result = a + b
|
|
self.logger.info(f"[{self.name}] add({a}, {b}) = {result}")
|
|
|
|
self.context.response.success = True
|
|
self.context.response.answer = str(result)
|
|
self.context.response.metadata.update({"a": a, "b": b, "result": result})
|
|
return self.context.response
|