Skip to main content

No project description provided

Project description

Mech Server

PyPI PyPI - Python Version PyPI - Wheel License Downloads

Sanity checks and tests Coverage flake8 mypy Black bandit

A CLI to create, deploy and manage Mechs — AI agents that execute tasks on-chain for payment — on the Olas Marketplace.

Note: The codebase uses the term service (from the underlying Open Autonomy framework) interchangeably with AI agent.

Quick Start

poetry add mech-server
poetry run mech setup -c <chain>
poetry run mech run -c <chain>

Supported Chains

Chain Native OLAS Token USDC Token Nevermined
Gnosis
Base
Polygon
Optimism

Requirements

Commands

Command Description
poetry run mech setup -c <chain> Full first-time setup: workspace, agent build, mech deployment, env config, key setup
poetry run mech add-tool <author> <name> Scaffold a new mech tool
poetry run mech prepare-metadata Recompute package fingerprints, push packages and metadata to IPFS, and write METADATA_HASH and TOOLS_TO_PACKAGE_HASH to .env
poetry run mech update-metadata Update the metadata hash on-chain via Safe transaction
poetry run mech run -c <chain> Run the mech AI agent via Docker
poetry run mech stop -c <chain> Stop a running mech AI agent

Developing a new tool

New service (no existing mech)

  1. Set up the workspace and deploy the mech on-chain:

    poetry run mech setup -c <chain>
    
  2. Scaffold a tool:

    poetry run mech add-tool <author> <tool_name> -d "Tool description"
    
  3. Implement the tool logic in ~/.operate-mech/packages/<author>/customs/<tool_name>/<tool_name>.py. The scaffold generates a working stub with the correct structure:

    ALLOWED_TOOLS = ["tool_name"]
    
    def run(**kwargs: Any) -> MechResponse:
        prompt = kwargs.get("prompt")
        if prompt is None:
            return error_response("No prompt has been given.")
        result = do_work(prompt)
        context = None
        artifact = None
        callback = None
        return result, prompt, context, artifact, callback
    
  4. If your tool requires API keys or other secrets, add them to ~/.operate-mech/.env.

  5. Generate and publish metadata (to IPFS), then update the on-chain registry:

    poetry run mech prepare-metadata
    poetry run mech update-metadata
    
  6. Run:

    poetry run mech run -c <chain>
    

Existing service (mech already running)

  1. Stop the service:

    poetry run mech stop -c <chain>
    
  2. Scaffold, implement, and set any required API keys (same as steps 2–4 above).

  3. Generate and publish metadata (to IPFS), then update:

    poetry run mech prepare-metadata
    poetry run mech update-metadata
    
  4. Restart:

    poetry run mech run -c <chain>
    

Documentation

Find the full tutorial (tool development, publishing, sending requests) at stack.olas.network.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mech_server-0.6.0.tar.gz (40.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mech_server-0.6.0-py3-none-any.whl (65.8 kB view details)

Uploaded Python 3

File details

Details for the file mech_server-0.6.0.tar.gz.

File metadata

  • Download URL: mech_server-0.6.0.tar.gz
  • Upload date:
  • Size: 40.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mech_server-0.6.0.tar.gz
Algorithm Hash digest
SHA256 cab2b324376aa59826ff1f470da37e6145295dba170516d70f2d6cab47677195
MD5 29c1be7135f675a4599ff3ba5f056c8a
BLAKE2b-256 6dfede7148364f9fd2486ae8e69b4badc561f3c42ba4a674ba924a0c2cc20aa7

See more details on using hashes here.

File details

Details for the file mech_server-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: mech_server-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 65.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mech_server-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c4b4db72cf76b41c0f2bd09ba0e02829674c8d67929853f2000ffe27c8bad5a7
MD5 91e1825d29ba2ac495278bf648780691
BLAKE2b-256 d058f1d30eb1b8225ecae150832a37d806bc15aa4c3e7136cf51017ef5494aa8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page