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
Metadata
Release files for edgecrab-sdk 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| edgecrab_sdk-0.4.1.tar.gz | 18.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| edgecrab_sdk-0.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.8 kB
Release files / edgecrab_sdk-0.4.1.tar.gz
| Download URL | edgecrab_sdk-0.4.1.tar.gz |
|---|---|
| Size | 18.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4825145adc1f5e2b16540aab169b17ba827f45f84e7822d1b3aa74485c75d71f
|
|
BLAKE2b-256 checksum How to use checksums |
98b45c016ec38b969bd40f9a547f3b3502988d7365fe60a555e502dd76976b45
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 13, 2026.
Transparency logRelease files / edgecrab_sdk-0.4.1-py3-none-any.whl
| Download URL | edgecrab_sdk-0.4.1-py3-none-any.whl |
|---|---|
| Size | 14.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3e43523f216a0754a4d44f3bb76c248c3c424cdd3db06f5f218354c3b161df5c
|
|
BLAKE2b-256 checksum How to use checksums |
0dbb9e052f493d9d2e0e7f744f4529721c01d831adf11d51c3386ceb12dcb980
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 13, 2026.
Transparency log