Skip to main content

Open-Moss-Agents

provide python module interface as tool for OpenAI Agents

for example:

math case

Installation

from pip:

pip install openai-moss-agents

write agent with MossProtocolTool:

from agents import Agent
from openai_moss_agents.moss_tool import MOSSProtocolTool

# tool without any python module, working as python interpreter
tool = MOSSProtocolTool(
    # provide python module as tool for the agent. 
    name="openai_moss_agents.example_moss_libs.terminal",
)

# generate instructions with `MOSS Protocol` information. 
instruction = tool.with_instruction("assistant for human")

# create an openai agent with `moss protocol tool` as agent tool. 
moss_agent = Agent(
    name="moss_agent",
    instructions=instruction,
    tools=[tool.as_agent_tool()]
)

You can create a lot of agents with different python modules.

If you want to see the instruction generate from any python module, run:

openai-moss-agents python_module_name

# example:
openai-moss-agents openai_moss_agents.example_moss_libs.math_lib

Examples

use terminal by Terminal library.

terminal case

run the examples by yourself:

git clone https://github.com/thirdgerb/openai-moss-agents  openai-moss-agents 

cd openai-moss-agents 
uv venv
uv sync --active --all-groups

# case 1, ask agent to use python interpreter
python examples/strawberry.py

# case 2, ask agent to use functions provided by `openai_moss_agents.example_moss_libs.math_lib`
python examples/openai_agent_baseline.py

# case 3, ask agent to use IoCContainer injections provided by `openai_moss_agents.example_moss_libs.terminal`
# !!!!!!!!! this case has risk, Agent will execute terminal command. don't ask agent to delete your root path.
python examples/moss_with_terminal.py

Advanced Feature

If you want to provide runtime injection for the agent, you can create a library with ghostos_moss.Moss:

# the imported abstract class and function are reflected into interface automatically
from ghostos_moss import Moss as Parent
from openai_moss_agents.example_moss_libs.terminal_lib.abcd import Terminal


# define a Moss Class in the module
# when LLM generate `run` function, the moss instance will pass to it 
# the typehint on Moss will be dynamic injected by IoC Container, see `openai_moss_agents.facade`
class Moss(Parent):
    # put the ModuleType or class values in the __watching__, will reflect their source code to LLM
    __watching__ = []

    # all the typehint classes will be reflected into interface for LLM
    # remember to provide the injections global IoCContainer before using, or give them to MossProtocolTool
    terminal: Terminal
    """your terminal """

# <moss-hide>

# the content between `# <moss-hide>` mark are not visible to LLM.
# you can do something here. 

# </moss-hide>

remember to register injection providers into IoCContainer by methods in openai_moss_agents.facade

What Is MOSS Protocol ?

MOSS stands for model-oriented operating system simulation, which means:

  1. reflect python module into model-oriented code interface.
  2. with runtime-injections by ioc container, providing tools from the outer system (Agent Framework? OS? Embodied AI?).
  3. let LLM understand the python context, use any library within it, execute the code generated by LLM in temporary module.
  4. Save long-term variables in the PyContext object, for multi-turns conversation usage.

So MOSS is a protocol, provide Turing-complete programming interface as the bridge for interaction between LLM and operating system. This library is just an early experiment of the protocol from Project Ghostos.

Full code-driven interaction represents the next-generation core paradigm for LLMAgent, following the era of JSONSchemaTool.

The expected objects called through code include toolkit, libraries, terminal, agent, workflows, thinking, planning, knowledge, memory...

Even allows a Meta-Agent to build its own agents swarm and toolkit through code, and call them immediately. (Which is also dangerous), empowers the Agent to autonomously iterate and evolve.

We expect every programming language (like TypedScript) develop it own popular model-oriented programming protocol, or even A universal model-oriented programming language.

For more details: MOSS: Enabling Code-Driven Evolution and Context Management for AI Agents

Metadata

Release files for openai-moss-agents 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openai-moss-agents 0.1.0
File Size Uploaded Provenance Actions
openai_moss_agents-0.1.0.tar.gz 79.5 kB Without provenance Details for openai_moss_agents-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for openai-moss-agents 0.1.0
File Interpreter ABI Platform Actions
openai_moss_agents-0.1.0-py3-none-any.whl Python 3 none any Details for openai_moss_agents-0.1.0-py3-none-any.whl

Total release size: 95.1 kB

Release files / openai_moss_agents-0.1.0.tar.gz

Download URL openai_moss_agents-0.1.0.tar.gz
Size 79.5 kB
Tags Source
SHA-256 checksum
How to use checksums
02e6f00d9313b0c36095d63c8ee264b78608dbfeeef45f11f160b7defd925b97
BLAKE2b-256 checksum
How to use checksums
d5fc9ef0c4e3539bf76dee182d6930900f420d084a756a7a83de78deedccf025
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.3

Release files / openai_moss_agents-0.1.0-py3-none-any.whl

Download URL openai_moss_agents-0.1.0-py3-none-any.whl
Size 15.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ffef6252cc09d4bf82477c7ad6c6e1ca6b714b0a817afa29a92bbf7f9888b67
BLAKE2b-256 checksum
How to use checksums
13df03a74621e38b10e7209de5e1db1731da6c6be644e43a08c19bc6df594936
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.3

Security for openai-moss-agents 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page