Skip to content

Commit c35ceb0

Browse files
authored
Merge pull request #335 from santoshsahturing/calendar_gym_turing
calendar gym environment from turing
2 parents 29d6611 + 2e19f83 commit c35ceb0

File tree

100 files changed

+27393
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+27393
-0
lines changed

docs/environments.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,5 +437,25 @@ The OpenEnv community has built a catalog of ready-to-run environments that cove
437437
</div>
438438

439439

440+
<div class="environment-grid">
441+
<div class="environment-card">
442+
<div class="environment-card__body">
443+
<span class="environment-card__tag">Calendar Gym</span>
444+
<p class="environment-card__description">
445+
This environment exposes a Calendar Gym tools through the OpenEnv reset/step/state interface. The server runs a FastAPI app that serves the OpenEnv endpoints.
446+
</p>
447+
</div>
448+
<div class="environment-card__links">
449+
<a class="environment-card__icon" href="https://huggingface.co/spaces/TuringEnterprises/calendar-gym/blob/main/README.md" target="_blank" rel="noreferrer noopener" aria-label="RLVE Gym docs">
450+
<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
451+
<path d="M6 3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V9l-6-6H6zm8 1.5L18.5 9H14V4.5z" fill="currentColor"/>
452+
</svg>
453+
</a>
454+
<a class="environment-card__icon environment-card__icon--hf" href="https://huggingface.co/spaces/TuringEnterprises/calendar-gym" target="_blank" rel="noreferrer noopener" aria-label="RLVE Gym on Hugging Face">
455+
<img src="https://huggingface.co/front/assets/huggingface_logo-noborder.svg" alt="" aria-hidden="true" />
456+
</a>
457+
</div>
458+
</div>
459+
</div>
440460

441461
> Want to publish your own environment? Head over to the [Build Your Own Environment](environment-builder.md) guide for a step-by-step walkthrough.

envs/calendar_env/Dockerfile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Use Python 3.11 slim image as base
2+
FROM python:3.11-slim
3+
4+
ENV API_PORT=8004
5+
6+
# Set working directory
7+
WORKDIR /app
8+
9+
# Set environment variables
10+
ENV PYTHONDONTWRITEBYTECODE=1 \
11+
PYTHONUNBUFFERED=1 \
12+
PYTHONPATH=/app
13+
14+
# Install system dependencies
15+
RUN apt-get update && apt-get install -y \
16+
gcc \
17+
&& rm -rf /var/lib/apt/lists/*
18+
19+
# Copy requirements first for better caching
20+
COPY requirements.txt .
21+
22+
# Install Python dependencies
23+
RUN pip install --no-cache-dir --upgrade pip && \
24+
pip install --no-cache-dir -r requirements.txt
25+
26+
# Copy application code
27+
COPY . .
28+
29+
# Place seed database where the server expects it
30+
COPY server/mcp_databases /app/mcp_databases
31+
32+
# Create directory for database files
33+
RUN mkdir -p /app/mcp_databases
34+
35+
# Expose port 8004
36+
EXPOSE 8004
37+
38+
# Health check
39+
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
40+
CMD python -c "import requests; requests.get('http://localhost:8004/health')" || exit 1
41+
42+
# Run the application
43+
CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "8004"]

envs/calendar_env/README.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
title: Calendar Environment Server
3+
emoji: 📅
4+
colorFrom: blue
5+
colorTo: green
6+
sdk: docker
7+
pinned: false
8+
app_port: 8004
9+
base_path: /docs
10+
tags:
11+
- openenv
12+
---
13+
# Calendar Environment
14+
15+
This environment exposes a Calendar Gym tools through the OpenEnv reset/step/state interface. The server runs a FastAPI app that serves the OpenEnv endpoints.
16+
17+
## Server Setup
18+
19+
### Docker (Recommended)
20+
21+
```bash
22+
cd envs/calendar_env
23+
docker build -t calendar-env:latest .
24+
docker run --rm -p 8004:8004 calendar-env:latest
25+
curl http://localhost:8004/health
26+
```
27+
On Server health success response will be:
28+
`{"status":"healthy","service":"calendar-env"}`
29+
30+
### Without Docker
31+
32+
```bash
33+
cd envs/calendar_env
34+
python3 -m venv venv
35+
source venv/bin/activate
36+
pip install -r requirements.txt
37+
uvicorn server.app:app --host 0.0.0.0 --port 8004
38+
```
39+
40+
## Client Setup
41+
42+
### Quick Start (Demo)
43+
44+
For a quick demo, simply update `llm_api_key` in `scenario_config.json` and run:
45+
```bash
46+
python client.py --scenario scenario_config.json
47+
```
48+
The existing config includes a sample scenario for testing.
49+
50+
### Configure Scenario
51+
52+
To customize for your use case, edit `scenario_config.json` and update these fields:
53+
54+
**llm variables:**
55+
- `llm_api_key` - Your OpenAI/Anthropic/Google API key (or set via env var)
56+
- `llm_model` - Model name (e.g., `gpt-4o-mini`, `claude-3-5-sonnet-20241022`)
57+
- `llm_provider` - Provider: `openai`, `anthropic`, or `google`
58+
59+
**Scenario Variables**
60+
- `user_prompt` - Task for the agent to complete
61+
- `system_prompt` - Instructions for agent behavior
62+
- `context` - The auth headers for gym like (x-access-token)
63+
- `seed_database_file` - Path to SQL file for custom data
64+
- `verifiers` - SQL queries to validate task completion
65+
- `expected_tools` - Tools agent should use (for tracking)
66+
67+
### Run Client
68+
69+
**Run scenario-based benchmark:**
70+
```bash
71+
python client.py --scenario scenario_config.json
72+
```
73+
74+
Output will be saved to `response_output/` folder with execution details, tool calls, and verification results.
75+
76+
**Notebook Evaluation:**
77+
For interactive evaluation and testing, use the: [`Jupyter notebook`](client_notebooks/OpenEnv_and_mcp_Single_Gym_Client_Meta_Turing.ipynb)

envs/calendar_env/__init__.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# All rights reserved.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
"""Calendar Environment package exports."""
8+
9+
from typing import Any
10+
from .models import (
11+
CalendarAction,
12+
CalendarObservation,
13+
MCPAction,
14+
MCPObservation,
15+
ListToolsAction,
16+
ToolCallAction,
17+
)
18+
19+
__all__ = [
20+
"CalendarAction",
21+
"CalendarObservation",
22+
"CalendarEnv",
23+
"MCPAction",
24+
"MCPObservation",
25+
"ListToolsAction",
26+
"ToolCallAction",
27+
]
28+
29+
30+
def __getattr__(name: str) -> Any:
31+
if name == "CalendarEnv":
32+
from .client import CalendarEnv as _CalendarEnv
33+
34+
return _CalendarEnv
35+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")

0 commit comments

Comments
 (0)