No project description provided
Project description
Mech Server
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
- Python
>=3.10, <3.12 - Poetry
- Docker Engine + Docker Compose
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 -c <chain> |
Recompute package fingerprints, push packages and metadata to IPFS, and write METADATA_HASH and TOOLS_TO_PACKAGE_HASH to .env |
poetry run mech prepare-metadata -c <chain> --offchain-url <url> |
Same as above, also sets the offchain URL in metadata and .env |
poetry run mech update-metadata -c <chain> |
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)
-
Set up the workspace and deploy the mech on-chain:
poetry run mech setup -c <chain>
-
Scaffold a tool:
poetry run mech add-tool <author> <tool_name> -d "Tool description"
-
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
-
If your tool requires API keys or other secrets, add them to
~/.operate-mech/.env. -
(Optional) If your mech should serve off-chain requests over HTTP, provide a URL that routes to the mech's HTTP server (
localhost:8000). This URL is included in the mech's on-chain metadata so that clients can discover it:poetry run mech prepare-metadata -c <chain> --offchain-url <url>
Alternatively, set
MECH_OFFCHAIN_URLin~/.operate-mech/.env.<chain>and runprepare-metadatawithout the flag. -
Generate and publish metadata (to IPFS), then update the on-chain registry:
poetry run mech prepare-metadata -c <chain> poetry run mech update-metadata -c <chain>
-
Run:
poetry run mech run -c <chain>
Existing service (mech already running)
-
Stop the service:
poetry run mech stop -c <chain>
-
Scaffold, implement, and set any required API keys (same as steps 2–4 above).
-
Generate and publish metadata (to IPFS), then update:
poetry run mech prepare-metadata -c <chain> poetry run mech update-metadata -c <chain>
-
Restart:
poetry run mech run -c <chain>
Documentation
Find the full tutorial (tool development, publishing, sending requests) at stack.olas.network.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mech_server-0.7.0.tar.gz.
File metadata
- Download URL: mech_server-0.7.0.tar.gz
- Upload date:
- Size: 43.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
858c84ba2d27d5dcaa818c47d76627aea7d4c10254771eb57162faafd96b78fe
|
|
| MD5 |
77e8ce35310d147416014025864eee24
|
|
| BLAKE2b-256 |
923d6fda77de6f11d2266cc198f2876b23afdd47c894fb8752ee8437e62683ff
|
File details
Details for the file mech_server-0.7.0-py3-none-any.whl.
File metadata
- Download URL: mech_server-0.7.0-py3-none-any.whl
- Upload date:
- Size: 68.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
416ad25b9710e21c30706cef738364fdbe490858c3974dc2e06a1442490d1893
|
|
| MD5 |
7db007d1ea07b8e89edae0c6288d8cc6
|
|
| BLAKE2b-256 |
f471cc30335b6d3c027f3547b7f3397c45b158fe6de2e3fc79b6a9f05916786d
|