Spaces:
Sleeping
Sleeping
Delete src/echo_cli.egg-info
Browse files
src/echo_cli.egg-info/PKG-INFO
DELETED
|
@@ -1,153 +0,0 @@
|
|
| 1 |
-
Metadata-Version: 2.4
|
| 2 |
-
Name: echo-cli
|
| 3 |
-
Version: 0.1.0
|
| 4 |
-
Summary: Add your description here
|
| 5 |
-
Requires-Python: >=3.10
|
| 6 |
-
Description-Content-Type: text/markdown
|
| 7 |
-
|
| 8 |
-
---
|
| 9 |
-
title: Echo Environment Server
|
| 10 |
-
emoji: 🔊
|
| 11 |
-
colorFrom: blue
|
| 12 |
-
colorTo: yellow
|
| 13 |
-
sdk: docker
|
| 14 |
-
pinned: false
|
| 15 |
-
app_port: 8000
|
| 16 |
-
base_path: /web
|
| 17 |
-
tags:
|
| 18 |
-
- openenv
|
| 19 |
-
---
|
| 20 |
-
|
| 21 |
-
# Echo Environment
|
| 22 |
-
|
| 23 |
-
A simple test environment that echoes back messages. Perfect for testing the env APIs as well as demonstrating environment usage patterns.
|
| 24 |
-
|
| 25 |
-
## Quick Start
|
| 26 |
-
|
| 27 |
-
The simplest way to use the Echo environment is through the `EchoEnv` class:
|
| 28 |
-
|
| 29 |
-
```python
|
| 30 |
-
from envs.echo_env import EchoAction, EchoEnv
|
| 31 |
-
|
| 32 |
-
try:
|
| 33 |
-
# Create environment from Docker image
|
| 34 |
-
echo_env = EchoEnv.from_docker_image("echo-env:latest")
|
| 35 |
-
|
| 36 |
-
# Reset
|
| 37 |
-
result = echo_env.reset()
|
| 38 |
-
print(f"Reset: {result.observation.echoed_message}")
|
| 39 |
-
|
| 40 |
-
# Send multiple messages
|
| 41 |
-
messages = ["Hello, World!", "Testing echo", "Final message"]
|
| 42 |
-
|
| 43 |
-
for msg in messages:
|
| 44 |
-
result = echo_env.step(EchoAction(message=msg))
|
| 45 |
-
print(f"Sent: '{msg}'")
|
| 46 |
-
print(f" → Echoed: '{result.observation.echoed_message}'")
|
| 47 |
-
print(f" → Length: {result.observation.message_length}")
|
| 48 |
-
print(f" → Reward: {result.reward}")
|
| 49 |
-
|
| 50 |
-
finally:
|
| 51 |
-
# Always clean up
|
| 52 |
-
echo_env.close()
|
| 53 |
-
```
|
| 54 |
-
|
| 55 |
-
That's it! The `EchoEnv.from_docker_image()` method handles:
|
| 56 |
-
- Starting the Docker container
|
| 57 |
-
- Waiting for the server to be ready
|
| 58 |
-
- Connecting to the environment
|
| 59 |
-
- Container cleanup when you call `close()`
|
| 60 |
-
|
| 61 |
-
## Building the Docker Image
|
| 62 |
-
|
| 63 |
-
Before using the environment, you need to build the Docker image:
|
| 64 |
-
|
| 65 |
-
```bash
|
| 66 |
-
# From project root
|
| 67 |
-
docker build -t echo-env:latest -f src/envs/echo_env/server/Dockerfile .
|
| 68 |
-
```
|
| 69 |
-
|
| 70 |
-
## Environment Details
|
| 71 |
-
|
| 72 |
-
### Action
|
| 73 |
-
**EchoAction**: Contains a single field
|
| 74 |
-
- `message` (str) - The message to echo back
|
| 75 |
-
|
| 76 |
-
### Observation
|
| 77 |
-
**EchoObservation**: Contains the echo response and metadata
|
| 78 |
-
- `echoed_message` (str) - The message echoed back
|
| 79 |
-
- `message_length` (int) - Length of the message
|
| 80 |
-
- `reward` (float) - Reward based on message length (length × 0.1)
|
| 81 |
-
- `done` (bool) - Always False for echo environment
|
| 82 |
-
- `metadata` (dict) - Additional info like step count
|
| 83 |
-
|
| 84 |
-
### Reward
|
| 85 |
-
The reward is calculated as: `message_length × 0.1`
|
| 86 |
-
- "Hi" → reward: 0.2
|
| 87 |
-
- "Hello, World!" → reward: 1.3
|
| 88 |
-
- Empty message → reward: 0.0
|
| 89 |
-
|
| 90 |
-
## Advanced Usage
|
| 91 |
-
|
| 92 |
-
### Connecting to an Existing Server
|
| 93 |
-
|
| 94 |
-
If you already have an Echo environment server running, you can connect directly:
|
| 95 |
-
|
| 96 |
-
```python
|
| 97 |
-
from envs.echo_env import EchoEnv
|
| 98 |
-
|
| 99 |
-
# Connect to existing server
|
| 100 |
-
echo_env = EchoEnv(base_url="<ENV_HTTP_URL_HERE>")
|
| 101 |
-
|
| 102 |
-
# Use as normal
|
| 103 |
-
result = echo_env.reset()
|
| 104 |
-
result = echo_env.step(EchoAction(message="Hello!"))
|
| 105 |
-
```
|
| 106 |
-
|
| 107 |
-
Note: When connecting to an existing server, `echo_env.close()` will NOT stop the server.
|
| 108 |
-
|
| 109 |
-
## Development & Testing
|
| 110 |
-
|
| 111 |
-
### Direct Environment Testing
|
| 112 |
-
|
| 113 |
-
Test the environment logic directly without starting the HTTP server:
|
| 114 |
-
|
| 115 |
-
```bash
|
| 116 |
-
# From the server directory
|
| 117 |
-
python3 src/envs/echo_env/server/test_echo_env.py
|
| 118 |
-
```
|
| 119 |
-
|
| 120 |
-
This verifies that:
|
| 121 |
-
- Environment resets correctly
|
| 122 |
-
- Step executes actions properly
|
| 123 |
-
- State tracking works
|
| 124 |
-
- Rewards are calculated correctly
|
| 125 |
-
|
| 126 |
-
### Running the Full Example
|
| 127 |
-
|
| 128 |
-
Run the complete example that demonstrates the full workflow:
|
| 129 |
-
|
| 130 |
-
```bash
|
| 131 |
-
python3 examples/local_echo_env.py
|
| 132 |
-
```
|
| 133 |
-
|
| 134 |
-
This example shows:
|
| 135 |
-
- Creating an environment from a Docker image
|
| 136 |
-
- Resetting and stepping through the environment
|
| 137 |
-
- Automatic cleanup with `close()`
|
| 138 |
-
|
| 139 |
-
## Project Structure
|
| 140 |
-
|
| 141 |
-
```
|
| 142 |
-
echo_env/
|
| 143 |
-
├── __init__.py # Module exports
|
| 144 |
-
├── README.md # This file
|
| 145 |
-
├── client.py # EchoEnv client implementation
|
| 146 |
-
├── models.py # Action and Observation models
|
| 147 |
-
└── server/
|
| 148 |
-
├── __init__.py # Server module exports
|
| 149 |
-
├── echo_environment.py # Core environment logic
|
| 150 |
-
├── app.py # FastAPI application
|
| 151 |
-
├── test_echo_env.py # Direct environment tests
|
| 152 |
-
└── Dockerfile # Container image definition
|
| 153 |
-
```
|
|
|
|
|
|
|
|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types.py
|
| 5 |
-
src/core/http_env_client.py
|
| 6 |
-
src/core/containers/__init__.py
|
| 7 |
-
src/core/containers/test_local_docker_provider.py
|
| 8 |
-
src/core/containers/runtime/__init__.py
|
| 9 |
-
src/core/containers/runtime/providers.py
|
| 10 |
-
src/core/containers/runtime/uv_provider.py
|
| 11 |
-
src/core/core/__init__.py
|
| 12 |
-
src/core/core/client_types.py
|
| 13 |
-
src/core/core/http_env_client.py
|
| 14 |
-
src/core/core/containers/__init__.py
|
| 15 |
-
src/core/core/containers/test_local_docker_provider.py
|
| 16 |
-
src/core/core/containers/runtime/__init__.py
|
| 17 |
-
src/core/core/containers/runtime/providers.py
|
| 18 |
-
src/core/core/containers/runtime/uv_provider.py
|
| 19 |
-
src/core/core/env_server/__init__.py
|
| 20 |
-
src/core/core/env_server/base_transforms.py
|
| 21 |
-
src/core/core/env_server/http_server.py
|
| 22 |
-
src/core/core/env_server/interfaces.py
|
| 23 |
-
src/core/core/env_server/types.py
|
| 24 |
-
src/core/core/env_server/web_interface.py
|
| 25 |
-
src/core/core/tools/__init__.py
|
| 26 |
-
src/core/core/tools/git_server_client.py
|
| 27 |
-
src/core/core/tools/local_python_executor.py
|
| 28 |
-
src/core/env_server/__init__.py
|
| 29 |
-
src/core/env_server/base_transforms.py
|
| 30 |
-
src/core/env_server/http_server.py
|
| 31 |
-
src/core/env_server/interfaces.py
|
| 32 |
-
src/core/env_server/types.py
|
| 33 |
-
src/core/env_server/web_interface.py
|
| 34 |
-
src/core/tools/__init__.py
|
| 35 |
-
src/core/tools/git_server_client.py
|
| 36 |
-
src/core/tools/local_python_executor.py
|
| 37 |
-
src/echo_cli.egg-info/PKG-INFO
|
| 38 |
-
src/echo_cli.egg-info/SOURCES.txt
|
| 39 |
-
src/echo_cli.egg-info/dependency_links.txt
|
| 40 |
-
src/echo_cli.egg-info/entry_points.txt
|
| 41 |
-
src/echo_cli.egg-info/top_level.txt
|
| 42 |
-
src/envs/echo_env/__init__.py
|
| 43 |
-
src/envs/echo_env/client.py
|
| 44 |
-
src/envs/echo_env/models.py
|
| 45 |
-
src/envs/echo_env/server/__init__.py
|
| 46 |
-
src/envs/echo_env/server/app.py
|
| 47 |
-
src/envs/echo_env/server/echo_environment.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/echo_cli.egg-info/dependency_links.txt
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
|
|
|
|
|
|
src/echo_cli.egg-info/entry_points.txt
DELETED
|
@@ -1,2 +0,0 @@
|
|
| 1 |
-
[console_scripts]
|
| 2 |
-
server = envs.echo_env.server.app:cli
|
|
|
|
|
|
|
|
|
src/echo_cli.egg-info/top_level.txt
DELETED
|
@@ -1,2 +0,0 @@
|
|
| 1 |
-
core
|
| 2 |
-
envs
|
|
|
|
|
|
|
|
|