Python SDK for EdgeCrab — a Rust-native autonomous coding agent
Project description
edgecrab-sdk
Python SDK for EdgeCrab — a Rust-native autonomous coding agent.
Install
pip install edgecrab-sdk
Quick Start
from edgecrab import EdgeCrabClient
# Connect to a running EdgeCrab API server
client = EdgeCrabClient(
base_url="http://127.0.0.1:8642",
api_key="your-api-key", # optional
)
# Simple chat
reply = client.chat("Explain Rust ownership in 3 sentences")
print(reply)
# With system prompt
reply = client.chat(
"Refactor this function",
system="You are a senior Rust developer",
model="anthropic/claude-sonnet-4-20250514",
)
Async
import asyncio
from edgecrab import AsyncEdgeCrabClient
async def main():
async with AsyncEdgeCrabClient() as client:
reply = await client.chat("Hello!")
print(reply)
asyncio.run(main())
Agent API (recommended)
from edgecrab import Agent
agent = Agent(
model="anthropic/claude-sonnet-4-20250514",
system_prompt="You are a helpful coding assistant",
)
# Chat with automatic conversation history
reply = agent.chat("Explain Rust ownership")
print(reply)
# Continue the conversation
follow_up = agent.chat("Give me an example")
print(follow_up)
# Full run with result metadata
result = agent.run("Refactor this function")
print(result.response)
print(f"Turns: {result.turns_used}, Tokens: {result.usage.total_tokens}")
Streaming
from edgecrab import EdgeCrabClient, ChatMessage
with EdgeCrabClient() as client:
messages = [ChatMessage(role="user", content="Write a haiku about Rust")]
for chunk in client.stream_completion(messages=messages):
for choice in chunk.choices:
if choice.delta.content:
print(choice.delta.content, end="", flush=True)
print()
CLI
edgecrab chat "What is the meaning of life?"
edgecrab chat --model gpt-4 --system "Be concise" "Explain monads"
edgecrab chat --stream "Tell me a story"
edgecrab models
edgecrab health
Environment Variables
| Variable | Description |
|---|---|
EDGECRAB_BASE_URL |
API server URL (default: http://127.0.0.1:8642) |
EDGECRAB_API_KEY |
Bearer token for authentication |
API Reference
EdgeCrabClient
| Method | Description |
|---|---|
chat(message, *, model, system, temperature, max_tokens) |
Simple chat — returns string |
create_completion(messages, *, model, temperature, max_tokens, tools) |
Full completion — returns ChatCompletionResponse |
stream_completion(messages, *, model, temperature, max_tokens, tools) |
Streaming — yields StreamChunk |
list_models() |
List available models |
health() |
Health check |
AsyncEdgeCrabClient
Same API as EdgeCrabClient, but all methods are async.
Agent / AsyncAgent
| Method | Description |
|---|---|
chat(message) |
Send message, return reply. Maintains history. |
run(message, *, max_turns) |
Full conversation run — returns AgentResult |
add_message(role, content) |
Inject a message into history |
reset() |
Clear history, start new session |
get_messages() |
Get conversation history |
get_turn_count() |
Number of completed turns |
get_usage() |
Accumulated token usage |
list_models() |
List available models |
health() |
Check server health |
Links
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 edgecrab_sdk-0.3.2.tar.gz.
File metadata
- Download URL: edgecrab_sdk-0.3.2.tar.gz
- Upload date:
- Size: 18.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c059926924bf3821a6cadd863a5d679aa4cf4aacd1b0ef34f430ca899285fe60
|
|
| MD5 |
cb434b0fa9ccad91e5e15f1cac4d70e2
|
|
| BLAKE2b-256 |
0f50285275aa45d975d32c7949e506de4a4413e28c67b7dfb1a30c65d4b2c7da
|
Provenance
The following attestation bundles were made for edgecrab_sdk-0.3.2.tar.gz:
Publisher:
release-python.yml on raphaelmansuy/edgecrab
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
edgecrab_sdk-0.3.2.tar.gz -
Subject digest:
c059926924bf3821a6cadd863a5d679aa4cf4aacd1b0ef34f430ca899285fe60 - Sigstore transparency entry: 1277677767
- Sigstore integration time:
-
Permalink:
raphaelmansuy/edgecrab@3bcf95fee13d91ce1d5f6fe66a4cdf4e0a4d6c78 -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/raphaelmansuy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@3bcf95fee13d91ce1d5f6fe66a4cdf4e0a4d6c78 -
Trigger Event:
push
-
Statement type:
File details
Details for the file edgecrab_sdk-0.3.2-py3-none-any.whl.
File metadata
- Download URL: edgecrab_sdk-0.3.2-py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1721cc3382fa70a92835a5bf42d4846a0a250623d702c5b14d6b3381c5c0d9a
|
|
| MD5 |
505558775a163f8225b2e40082d75338
|
|
| BLAKE2b-256 |
1912941e288787b7a88c57fcd4112ae08affad8ae9a5e6c491597f7c925a3558
|
Provenance
The following attestation bundles were made for edgecrab_sdk-0.3.2-py3-none-any.whl:
Publisher:
release-python.yml on raphaelmansuy/edgecrab
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
edgecrab_sdk-0.3.2-py3-none-any.whl -
Subject digest:
a1721cc3382fa70a92835a5bf42d4846a0a250623d702c5b14d6b3381c5c0d9a - Sigstore transparency entry: 1277677819
- Sigstore integration time:
-
Permalink:
raphaelmansuy/edgecrab@3bcf95fee13d91ce1d5f6fe66a4cdf4e0a4d6c78 -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/raphaelmansuy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@3bcf95fee13d91ce1d5f6fe66a4cdf4e0a4d6c78 -
Trigger Event:
push
-
Statement type: