ihere04u/business-strategy-env
π’ Business Strategy Simulation Environment
An OpenEnv-compliant real-world environment where an AI agent acts as CEO, making quarterly strategic decisions to grow a company. Features stochastic market dynamics and multi-objective reward optimization.
Built for the OpenEnv Hackathon β Round 1 Β· Live API Docs
π Why This Environment?
Business strategy is a genuine real-world task β companies live and die by quarterly decisions on hiring, marketing, pricing, and R&D. This environment models those decisions with:
- Stochastic market dynamics β random noise simulates real market unpredictability
- Interdependent state variables β actions have cascading effects (e.g. cutting costs reduces quality, reducing satisfaction, reducing market share)
- Multi-objective trade-offs β agents must balance short-term profit vs long-term growth
- Partial progress rewards β dense reward signal every quarter, not just at episode end
π― Tasks
π§ Action Space
10 strategic actions, each with an optional amount parameter (default: $5,000):
ποΈ Observation Space
This environment returns both raw business metrics and higher-level strategy signals.
{
"revenue": 50000.0,
"costs": 35000.0,
"profit": 15000.0,
"market_share": 0.10,
"employees": 20,
"customer_satisfaction": 0.70,
"marketing_budget": 5000.0,
"rd_investment": 2000.0,
"product_quality": 0.65,
"profit_margin": 0.30,
"cost_efficiency": 0.30,
"growth_signal": 0.40,
"profit_trend": 0.0,
"last_reward": 0.0,
"risk_level": 0.70,
"strategic_health": 0.37,
"growth_momentum": 0.07,
"decision_quality": "neutral",
"quarter": 1,
"max_quarters": 4,
"done": false,
"reward": 0.0,
"message": "Q1: Profit=$15,000 | Market=10.0%"
}π‘ API Endpoints
π Reward Design
All rewards are partial progress signals β no sparse binary end-of-episode rewards:
- survive:
profitable_quarters / total_quartersβ scores every quarter - grow_market_share:
min(final_share / 0.20, 1.0)+ early completion bonus - scale_profitably:
0.6 Γ revenue_score + 0.4 Γ satisfaction_scoreβ weighted multi-objective
Undesirable behaviors are penalized:
- Bankruptcy (profit < -$50,000) β early termination
- Over-hiring with no revenue β costs spiral punishes poor decisions
- Cutting costs repeatedly β product quality degrades, reducing future revenue
π§ Advanced Learning Dynamics
This environment is intentionally designed to challenge decision-making agents through:
1. Multi-Objective Optimization
Agents must balance:
- Profitability
- Market share growth
- Customer satisfaction
- Cost efficiency
2. Delayed Rewards
Investments in R&D improve future revenue rather than immediate outcomes.
3. Strategic Trade-offs
Each action has both positive and negative consequences:
- Expanding markets increases growth but reduces satisfaction
- Cost cutting improves margins but degrades product quality
4. Stochastic Environment
- Economic cycles affect revenue unpredictably
- Competitor pressure reduces market share dynamically
5. Non-Linear Reward Shaping
Rewards include:
- Trend-based bonuses
- Strategic diversity incentives
- Penalties for repetitive or short-sighted decisions
6. Failure Cascades
Poor decisions (e.g., low satisfaction) trigger compounding negative effects.
7. Decision Feedback
The environment exposes decision quality signals such as decision_quality and a final_summary at episode end.
This creates a realistic environment requiring long-term planning, adaptation, and strategic reasoning.
π Baseline Scores
Scores from the included rule-based baseline agent (baseline.py):
Note: Baseline performance is intentionally stochastic and may vary across seeds.
π€ Agent Strategy
The included rule-based inference agent (inference.py) uses adaptive task-specific logic:
- Survive: Maintains profitability by cutting costs when needed, then rotates between growth actions
- Grow Market Share: Progressively increases market reachβexpands when low, invests in marketing, then launches products
- Scale Profitably: Balances quality, satisfaction, and growthβinvests heavily in R&D, then scales with pricing and expansion
The agent includes anti-repetition safety to avoid over-using the same action, ensuring diverse strategy execution. The agent is fully rule-based and does not depend on external LLM calls, ensuring stable and deterministic performance. ---
π Setup & Run
Local
pip install -r requirements.txt
python baseline.py # verify logic
python server.py # start API serverVisit: http://localhost:7860/docs
Local app entrypoint
python main.pyDocker
docker build -t business-strategy-env .
docker run -p 7860:7860 business-strategy-envInference (Rule-Based Agent)
python inference.pyπ Quick Example
import requests
BASE = "https://ihere04u-business-strategy-env.hf.space"
# Reset
state = requests.post(f"{BASE}/reset", json={"task": "survive", "seed": 42}).json()
# Play 4 quarters
for _ in range(4):
state = requests.post(f"{BASE}/step", json={
"task": "survive",
"action": "increase_marketing",
"amount": 5000
}).json()
print(state["message"], "| Reward:", state["reward"])
# Grade
score = requests.post(f"{BASE}/grader", json={"task": "survive"}).json()
print("Final score:", score["score"])π Project Structure
business-strategy-env/
βββ environment.py # Core simulation logic + stochastic market dynamics
βββ graders.py # Task-specific graders returning scores in [0.0, 1.0]
βββ server.py # FastAPI server β all OpenEnv + additional endpoints
βββ baseline.py # Rule-based baseline agent
βββ inference.py # LLM agent using OpenAI-compatible client
βββ openenv.yaml # OpenEnv spec
βββ Dockerfile # Container β deploys on HF Spaces (port 7860)
βββ requirements.txt
βββ README.md