{"id":27825,"library":"ghostos-moss","title":"GhostOS Moss","description":"GhostOS Moss is a code-driven Python interface for LLMs, agents, and the GhostOS project. It provides a functional reactive programming model for building AI agents with Python code. Current version 0.3.7, requires Python >=3.10. This package is part of the GhostOS ecosystem and is under active development, with frequent releases on PyPI.","status":"active","version":"0.3.7","language":"python","source_language":"en","source_url":"https://github.com/ghost-in-moss/GhostOS","tags":["llm","agents","functional-reactive","ghostos"],"install":[{"cmd":"pip install ghostos-moss","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"The correct import for the main class.","symbol":"Moss","correct":"from ghostos.moss import Moss"},{"note":"MossAgent is in the agent module, not moss.","wrong":"from ghostos.moss import MossAgent","symbol":"MossAgent","correct":"from ghostos.agent import MossAgent"},{"note":"Decorator for marking functions as moss actions.","symbol":"moss_function","correct":"from ghostos.moss import moss_function"}],"quickstart":{"code":"from ghostos.moss import Moss\nfrom ghostos.agent import MossAgent\n\n# Create a Moss instance\nmoss = Moss()\n\n# Define a simple agent\nclass MyAgent(MossAgent):\n    def respond(self, user_input: str) -> str:\n        return f\"Echo: {user_input}\"\n\n# Instantiate and run\nagent = MyAgent()\nprint(agent.respond(\"Hello\"))","lang":"python","description":"Initialize a Moss instance, create an agent by subclassing MossAgent, and define a respond method."},"warnings":[{"fix":"Ensure all functions decorated with `@moss_function` have a return type annotation, e.g., `def my_action() -> str:`.","message":"In version 0.3.0, the API for defining actions changed: `moss_function` now requires explicit return type annotations. Without them, the function will not be recognized as an action and may silently fail.","severity":"breaking","affected_versions":">=0.3.0"},{"fix":"Replace `class MyAction(MossAction): ...` with `@moss_function` decorator on a function.","message":"The `MossAction` class from `ghostos.moss.actions` is deprecated since 0.2.5 and will be removed in 0.4.0. Use `@moss_function` decorator instead.","severity":"deprecated","affected_versions":">=0.2.5, <0.4.0"},{"fix":"Use `from ghostos.agent import MossAgent`.","message":"Import `MossAgent` from `ghostos.agent`, not from `ghostos.moss`. The agent module is separate and contains the base class for agents.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Use `from ghostos.moss import Moss` instead of `from ghostos import Moss`.","cause":"Trying to import Moss directly from the top-level ghostos package instead of ghostos.moss submodule.","error":"ImportError: cannot import name 'Moss' from 'ghostos'"},{"fix":"Ensure your agent subclass defines `def respond(self, user_input: str) -> str:` method.","cause":"The agent class defined by the user does not have a respond method, or the method signature is incorrect.","error":"AttributeError: 'MyAgent' object has no attribute 'respond'"},{"fix":"Add a return type annotation to the function, e.g., `@moss_function` def my_action() -> str:`.","cause":"The decorated function does not have a return type annotation, causing the decorator to return None.","error":"TypeError: 'NoneType' object is not callable when using @moss_function"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}