edgecrab-sdk 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,168 @@
1
+ Metadata-Version: 2.4
2
+ Name: edgecrab-sdk
3
+ Version: 0.1.0
4
+ Summary: Python SDK for EdgeCrab — a Rust-native autonomous coding agent
5
+ Project-URL: Homepage, https://github.com/raphaelmansuy/edgecrab
6
+ Project-URL: Repository, https://github.com/raphaelmansuy/edgecrab
7
+ Project-URL: Documentation, https://github.com/raphaelmansuy/edgecrab/tree/main/sdks/python
8
+ Keywords: ai,agent,llm,edgecrab,coding-agent
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Software Development :: Libraries
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ Requires-Dist: httpx<1,>=0.27.0
22
+ Requires-Dist: pydantic<3,>=2.0.0
23
+ Provides-Extra: dev
24
+ Requires-Dist: pytest<9,>=8.0; extra == "dev"
25
+ Requires-Dist: pytest-asyncio<1,>=0.24; extra == "dev"
26
+ Requires-Dist: pytest-httpx<1,>=0.34; extra == "dev"
27
+ Requires-Dist: respx<1,>=0.22; extra == "dev"
28
+
29
+ # edgecrab-sdk
30
+
31
+ [![PyPI](https://img.shields.io/pypi/v/edgecrab-sdk.svg)](https://pypi.org/project/edgecrab-sdk/)
32
+ [![Python](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://python.org)
33
+
34
+ Python SDK for **EdgeCrab** — a Rust-native autonomous coding agent.
35
+
36
+ ## Install
37
+
38
+ ```bash
39
+ pip install edgecrab-sdk
40
+ ```
41
+
42
+ ## Quick Start
43
+
44
+ ```python
45
+ from edgecrab import EdgeCrabClient
46
+
47
+ # Connect to a running EdgeCrab API server
48
+ client = EdgeCrabClient(
49
+ base_url="http://127.0.0.1:8642",
50
+ api_key="your-api-key", # optional
51
+ )
52
+
53
+ # Simple chat
54
+ reply = client.chat("Explain Rust ownership in 3 sentences")
55
+ print(reply)
56
+
57
+ # With system prompt
58
+ reply = client.chat(
59
+ "Refactor this function",
60
+ system="You are a senior Rust developer",
61
+ model="anthropic/claude-sonnet-4-20250514",
62
+ )
63
+ ```
64
+
65
+ ## Async
66
+
67
+ ```python
68
+ import asyncio
69
+ from edgecrab import AsyncEdgeCrabClient
70
+
71
+ async def main():
72
+ async with AsyncEdgeCrabClient() as client:
73
+ reply = await client.chat("Hello!")
74
+ print(reply)
75
+
76
+ asyncio.run(main())
77
+ ```
78
+
79
+ ## Agent API (recommended)
80
+
81
+ ```python
82
+ from edgecrab import Agent
83
+
84
+ agent = Agent(
85
+ model="anthropic/claude-sonnet-4-20250514",
86
+ system_prompt="You are a helpful coding assistant",
87
+ )
88
+
89
+ # Chat with automatic conversation history
90
+ reply = agent.chat("Explain Rust ownership")
91
+ print(reply)
92
+
93
+ # Continue the conversation
94
+ follow_up = agent.chat("Give me an example")
95
+ print(follow_up)
96
+
97
+ # Full run with result metadata
98
+ result = agent.run("Refactor this function")
99
+ print(result.response)
100
+ print(f"Turns: {result.turns_used}, Tokens: {result.usage.total_tokens}")
101
+ ```
102
+
103
+ ## Streaming
104
+
105
+ ```python
106
+ from edgecrab import EdgeCrabClient, ChatMessage
107
+
108
+ with EdgeCrabClient() as client:
109
+ messages = [ChatMessage(role="user", content="Write a haiku about Rust")]
110
+ for chunk in client.stream_completion(messages=messages):
111
+ for choice in chunk.choices:
112
+ if choice.delta.content:
113
+ print(choice.delta.content, end="", flush=True)
114
+ print()
115
+ ```
116
+
117
+ ## CLI
118
+
119
+ ```bash
120
+ edgecrab chat "What is the meaning of life?"
121
+ edgecrab chat --model gpt-4 --system "Be concise" "Explain monads"
122
+ edgecrab chat --stream "Tell me a story"
123
+ edgecrab models
124
+ edgecrab health
125
+ ```
126
+
127
+ ### Environment Variables
128
+
129
+ | Variable | Description |
130
+ |---|---|
131
+ | `EDGECRAB_BASE_URL` | API server URL (default: `http://127.0.0.1:8642`) |
132
+ | `EDGECRAB_API_KEY` | Bearer token for authentication |
133
+
134
+ ## API Reference
135
+
136
+ ### `EdgeCrabClient`
137
+
138
+ | Method | Description |
139
+ |---|---|
140
+ | `chat(message, *, model, system, temperature, max_tokens)` | Simple chat — returns string |
141
+ | `create_completion(messages, *, model, temperature, max_tokens, tools)` | Full completion — returns `ChatCompletionResponse` |
142
+ | `stream_completion(messages, *, model, temperature, max_tokens, tools)` | Streaming — yields `StreamChunk` |
143
+ | `list_models()` | List available models |
144
+ | `health()` | Health check |
145
+
146
+ ### `AsyncEdgeCrabClient`
147
+
148
+ Same API as `EdgeCrabClient`, but all methods are `async`.
149
+
150
+ ### `Agent` / `AsyncAgent`
151
+
152
+ | Method | Description |
153
+ |---|---|
154
+ | `chat(message)` | Send message, return reply. Maintains history. |
155
+ | `run(message, *, max_turns)` | Full conversation run — returns `AgentResult` |
156
+ | `add_message(role, content)` | Inject a message into history |
157
+ | `reset()` | Clear history, start new session |
158
+ | `get_messages()` | Get conversation history |
159
+ | `get_turn_count()` | Number of completed turns |
160
+ | `get_usage()` | Accumulated token usage |
161
+ | `list_models()` | List available models |
162
+ | `health()` | Check server health |
163
+
164
+ ## Links
165
+
166
+ - [GitHub](https://github.com/raphaelmansuy/edgecrab)
167
+ - [Node.js SDK](https://github.com/raphaelmansuy/edgecrab/tree/main/sdks/node)
168
+ - [EdgeCrab Documentation](https://github.com/raphaelmansuy/edgecrab/tree/main/docs)
@@ -0,0 +1,140 @@
1
+ # edgecrab-sdk
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/edgecrab-sdk.svg)](https://pypi.org/project/edgecrab-sdk/)
4
+ [![Python](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://python.org)
5
+
6
+ Python SDK for **EdgeCrab** — a Rust-native autonomous coding agent.
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ pip install edgecrab-sdk
12
+ ```
13
+
14
+ ## Quick Start
15
+
16
+ ```python
17
+ from edgecrab import EdgeCrabClient
18
+
19
+ # Connect to a running EdgeCrab API server
20
+ client = EdgeCrabClient(
21
+ base_url="http://127.0.0.1:8642",
22
+ api_key="your-api-key", # optional
23
+ )
24
+
25
+ # Simple chat
26
+ reply = client.chat("Explain Rust ownership in 3 sentences")
27
+ print(reply)
28
+
29
+ # With system prompt
30
+ reply = client.chat(
31
+ "Refactor this function",
32
+ system="You are a senior Rust developer",
33
+ model="anthropic/claude-sonnet-4-20250514",
34
+ )
35
+ ```
36
+
37
+ ## Async
38
+
39
+ ```python
40
+ import asyncio
41
+ from edgecrab import AsyncEdgeCrabClient
42
+
43
+ async def main():
44
+ async with AsyncEdgeCrabClient() as client:
45
+ reply = await client.chat("Hello!")
46
+ print(reply)
47
+
48
+ asyncio.run(main())
49
+ ```
50
+
51
+ ## Agent API (recommended)
52
+
53
+ ```python
54
+ from edgecrab import Agent
55
+
56
+ agent = Agent(
57
+ model="anthropic/claude-sonnet-4-20250514",
58
+ system_prompt="You are a helpful coding assistant",
59
+ )
60
+
61
+ # Chat with automatic conversation history
62
+ reply = agent.chat("Explain Rust ownership")
63
+ print(reply)
64
+
65
+ # Continue the conversation
66
+ follow_up = agent.chat("Give me an example")
67
+ print(follow_up)
68
+
69
+ # Full run with result metadata
70
+ result = agent.run("Refactor this function")
71
+ print(result.response)
72
+ print(f"Turns: {result.turns_used}, Tokens: {result.usage.total_tokens}")
73
+ ```
74
+
75
+ ## Streaming
76
+
77
+ ```python
78
+ from edgecrab import EdgeCrabClient, ChatMessage
79
+
80
+ with EdgeCrabClient() as client:
81
+ messages = [ChatMessage(role="user", content="Write a haiku about Rust")]
82
+ for chunk in client.stream_completion(messages=messages):
83
+ for choice in chunk.choices:
84
+ if choice.delta.content:
85
+ print(choice.delta.content, end="", flush=True)
86
+ print()
87
+ ```
88
+
89
+ ## CLI
90
+
91
+ ```bash
92
+ edgecrab chat "What is the meaning of life?"
93
+ edgecrab chat --model gpt-4 --system "Be concise" "Explain monads"
94
+ edgecrab chat --stream "Tell me a story"
95
+ edgecrab models
96
+ edgecrab health
97
+ ```
98
+
99
+ ### Environment Variables
100
+
101
+ | Variable | Description |
102
+ |---|---|
103
+ | `EDGECRAB_BASE_URL` | API server URL (default: `http://127.0.0.1:8642`) |
104
+ | `EDGECRAB_API_KEY` | Bearer token for authentication |
105
+
106
+ ## API Reference
107
+
108
+ ### `EdgeCrabClient`
109
+
110
+ | Method | Description |
111
+ |---|---|
112
+ | `chat(message, *, model, system, temperature, max_tokens)` | Simple chat — returns string |
113
+ | `create_completion(messages, *, model, temperature, max_tokens, tools)` | Full completion — returns `ChatCompletionResponse` |
114
+ | `stream_completion(messages, *, model, temperature, max_tokens, tools)` | Streaming — yields `StreamChunk` |
115
+ | `list_models()` | List available models |
116
+ | `health()` | Health check |
117
+
118
+ ### `AsyncEdgeCrabClient`
119
+
120
+ Same API as `EdgeCrabClient`, but all methods are `async`.
121
+
122
+ ### `Agent` / `AsyncAgent`
123
+
124
+ | Method | Description |
125
+ |---|---|
126
+ | `chat(message)` | Send message, return reply. Maintains history. |
127
+ | `run(message, *, max_turns)` | Full conversation run — returns `AgentResult` |
128
+ | `add_message(role, content)` | Inject a message into history |
129
+ | `reset()` | Clear history, start new session |
130
+ | `get_messages()` | Get conversation history |
131
+ | `get_turn_count()` | Number of completed turns |
132
+ | `get_usage()` | Accumulated token usage |
133
+ | `list_models()` | List available models |
134
+ | `health()` | Check server health |
135
+
136
+ ## Links
137
+
138
+ - [GitHub](https://github.com/raphaelmansuy/edgecrab)
139
+ - [Node.js SDK](https://github.com/raphaelmansuy/edgecrab/tree/main/sdks/node)
140
+ - [EdgeCrab Documentation](https://github.com/raphaelmansuy/edgecrab/tree/main/docs)
@@ -0,0 +1,61 @@
1
+ """edgecrab — Python SDK for the EdgeCrab autonomous coding agent."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from edgecrab._version import __version__
6
+ from edgecrab.agent import Agent, AsyncAgent, AgentResult
7
+ from edgecrab.client import (
8
+ EdgeCrabClient,
9
+ AsyncEdgeCrabClient,
10
+ EdgeCrabError,
11
+ AuthenticationError,
12
+ RateLimitError,
13
+ ServerError,
14
+ TimeoutError,
15
+ ConnectionError,
16
+ MaxTurnsExceededError,
17
+ InterruptedError,
18
+ )
19
+ from edgecrab.types import (
20
+ ChatMessage,
21
+ ChatCompletionRequest,
22
+ ChatCompletionResponse,
23
+ ChatChoice,
24
+ UsageInfo,
25
+ ModelInfo,
26
+ HealthResponse,
27
+ StreamDelta,
28
+ StreamChoice,
29
+ StreamChunk,
30
+ )
31
+
32
+ __all__ = [
33
+ "__version__",
34
+ # High-level Agent API
35
+ "Agent",
36
+ "AsyncAgent",
37
+ "AgentResult",
38
+ # Low-level HTTP clients
39
+ "EdgeCrabClient",
40
+ "AsyncEdgeCrabClient",
41
+ # Error hierarchy
42
+ "EdgeCrabError",
43
+ "AuthenticationError",
44
+ "RateLimitError",
45
+ "ServerError",
46
+ "TimeoutError",
47
+ "ConnectionError",
48
+ "MaxTurnsExceededError",
49
+ "InterruptedError",
50
+ # Types
51
+ "ChatMessage",
52
+ "ChatCompletionRequest",
53
+ "ChatCompletionResponse",
54
+ "ChatChoice",
55
+ "UsageInfo",
56
+ "ModelInfo",
57
+ "HealthResponse",
58
+ "StreamDelta",
59
+ "StreamChoice",
60
+ "StreamChunk",
61
+ ]
@@ -0,0 +1,3 @@
1
+ """Version string for the edgecrab SDK."""
2
+
3
+ __version__ = "0.1.0"