agentforge-sdk
Official Python SDK for the AgentForge AI Agent Tool Marketplace.
Discover, execute, and manage AI tools from a unified API. Single dependency: httpx.
Install
pip install agentforge-sdk
Quick Start
from agentforge import AgentForge
agent = AgentForge(api_key="agf_agent_...")
tools = agent.discover(intent="translate text to French")
result = agent.execute(tools["tools"][0]["id"], {"text": "Hello", "target": "fr"})
print(result["data"])
Features
- Tool Discovery -- search by intent, category, protocol, tags, or price
- Schema Retrieval -- get function-calling compatible schemas for any tool
- Execution -- call any tool with typed parameters and get structured results
- Batch Execution -- run up to 10 tool calls in a single request
- Retry with Backoff -- exponential backoff with jitter (configurable)
- Circuit Breaker -- check tool health before calling unreliable endpoints
- Billing -- check balance, deposit funds, view call history
- Minimal Dependencies -- only
httpxrequired
Configuration
agent = AgentForge(
api_key="agf_agent_...",
base_url="https://api.agentforge.markets", # default
timeout=30.0, # default: 30s
max_retries=3, # default: 3, set 0 to disable
)
Use as a context manager for automatic cleanup:
with AgentForge(api_key="agf_agent_...") as agent:
result = agent.execute("tool-uuid", {"text": "Hello"})
API Reference
Discovery
# Discover tools by intent (natural language)
result = agent.discover(intent="summarize a webpage")
# Filter by category and price
cheap = agent.discover(category="nlp", maxPrice=0.01)
# List all tools with pagination
page = agent.list_tools(limit=20, offset=0)
# Get function-calling schema
schema = agent.get_tool_schema("tool-uuid")
Execution
# Execute a single tool
result = agent.execute("tool-uuid", {"text": "Hello world"})
# Batch execution (up to 10 calls)
batch = agent.execute_batch([
{"toolId": "tool-1", "parameters": {"query": "AI news"}},
{"toolId": "tool-2", "parameters": {"url": "https://example.com"}},
])
Billing
balance = agent.get_balance()
agent.deposit(10.00)
history = agent.get_history(limit=20)
Health Check
health = agent.health_check("tool-uuid")
# health["status"]: "CLOSED" (healthy) | "OPEN" (failing) | "HALF_OPEN" (testing)
Error Handling
from agentforge import AgentForge, AgentForgeError
agent = AgentForge(api_key="agf_agent_...")
try:
agent.execute("tool-uuid", {"text": "test"})
except AgentForgeError as e:
print(e.code) # "INSUFFICIENT_FUNDS", "TIMEOUT", etc.
print(e.status_code) # HTTP status code
print(e.retryable) # whether the SDK would auto-retry
Error Codes
| Code | HTTP | Description |
|---|---|---|
UNAUTHORIZED |
401 | Invalid or missing API key |
FORBIDDEN |
403 | Insufficient permissions |
NOT_FOUND |
404 | Tool or resource not found |
INSUFFICIENT_FUNDS |
402 | Agent balance too low |
VALIDATION_ERROR |
400 | Invalid request parameters |
RATE_LIMITED |
429 | Too many requests |
TIMEOUT |
-- | Request exceeded timeout |
NETWORK_ERROR |
-- | Connection failure |
SERVER_ERROR |
5xx | AgentForge server error |
CIRCUIT_OPEN |
503 | Tool endpoint failing (circuit open) |
Use with LLMs
The SDK works seamlessly with LLM function-calling workflows:
import anthropic
from agentforge import AgentForge
client = anthropic.Anthropic()
forge = AgentForge(api_key="agf_agent_...")
# Discover tools and build function definitions
discovered = forge.discover(intent=user_message)
tools = []
for t in discovered["tools"][:5]:
schema = forge.get_tool_schema(t["id"])
tools.append({
"name": schema["function"]["name"],
"description": schema["function"]["description"],
"input_schema": schema["function"]["parameters"],
})
# Let Claude decide which tool to use
response = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=1024,
tools=tools,
messages=[{"role": "user", "content": user_message}],
)
Full Documentation
Visit agentforge.markets/docs for the complete API reference, guides, and examples.
License
MIT
Metadata
Release files for agentforge-markets 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| agentforge_markets-1.0.0.tar.gz | 7.2 kB | Without provenance | Details for agentforge_markets-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agentforge_markets-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for agentforge_markets-1.0.0-py3-none-any.whl |
Total release size: 15.9 kB
Release files / agentforge_markets-1.0.0.tar.gz
| Download URL | agentforge_markets-1.0.0.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2e6930bfc68970b32840d5081e17d78327626bc41de390e70823adb58dc0fe6f
|
|
BLAKE2b-256 checksum How to use checksums |
3cc3055174922164bce3d2d3780e29967370d8439f9ae70e003d96d221c4f054
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / agentforge_markets-1.0.0-py3-none-any.whl
| Download URL | agentforge_markets-1.0.0-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bb3c62379744375418bb7c406f58bc3db744bf2ee50a48d24929cba9ae325288
|
|
BLAKE2b-256 checksum How to use checksums |
742a9ddf243cd0b93b2f5fd1d268f4c2bedcda204848b3e938c3862c2ee8bafd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Security for agentforge-markets 1.0.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.