Skip to main content

Python SDK for the Forge compute economy — where AI agents earn and spend Compute Units

Project description

forge-sdk

Python SDK for the Forge compute economy. AI agents earn and spend Compute Units.

Install

pip install forge-sdk

Quick Start

from forge_sdk import ForgeClient

forge = ForgeClient()  # connects to localhost:3000

# Check your CU balance
balance = forge.balance()
print(f"Balance: {balance['effective_balance']} CU")

# Run inference (costs CU)
result = forge.chat("What is gravity?")
print(f"Answer: {result['content']}")
print(f"Cost: {result['cu_cost']} CU")
print(f"Remaining: {result['balance']} CU")

Autonomous Agent

from forge_sdk import ForgeAgent

agent = ForgeAgent(max_cu_per_task=500)

while agent.has_budget():
    result = agent.think("What should I do next?")
    if result is None:
        break  # budget exhausted
    print(result['content'])

print(agent.status())

API

Method Description
forge.balance() CU balance, reputation
forge.pricing() Market price, cost estimates
forge.chat(prompt) Run inference, pay CU
forge.can_afford(tokens) Check before spending
forge.trades() Trade history
forge.network() Mesh economic state + Merkle root
forge.providers() Ranked providers by cost/reputation
forge.safety() Kill switch, circuit breaker status
forge.kill(reason) Emergency halt
forge.invoice(cu) Create Lightning invoice

Environment

Variable Default Description
FORGE_URL http://127.0.0.1:3000 Forge node URL
FORGE_API_TOKEN (none) Bearer token for protected nodes

What is Forge?

Forge is a distributed inference protocol where compute is currency. Unlike Bitcoin (useless SHA-256 hashes), Forge nodes earn CU by performing useful LLM inference. AI agents can autonomously earn, spend, and manage their compute budget.

Full documentation

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

forge_sdk-0.2.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

forge_sdk-0.2.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file forge_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: forge_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for forge_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a94629622d924db61c3bdc495e825425290fc485b6021fa2c6db47425f80a74e
MD5 7af28b014f0fbc4bce92557255950084
BLAKE2b-256 64a91f74d9fb7945df4a7102a8c8b50e251057e2bb96a8f84bdbd8ab11648dc7

See more details on using hashes here.

File details

Details for the file forge_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: forge_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for forge_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b5c42fc2d0c926cea59ae2b0407deb2e67e994bc621f4030f45aa8f1eb64f2bd
MD5 d4ab4d2a89b62f1b9a8d2909c30b148e
BLAKE2b-256 2c02534bf56a12ebc80db7d5509cbf0b80d883ab84e31c4d05143330b4564545

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