vc_gemini / demo_agent.py
shrads78's picture
Upload folder using huggingface_hub
1ae84ae verified
import time
from client import VcGeminiEnv
from models import VcGeminiAction
def run_agent():
print("Starting Phase 8 VC Agent (11-Quarter Fund Pipeline)...")
print("Connecting to environment (ensure 'uv run python -m server.app' is running)...\n")
env = VcGeminiEnv(base_url="http://localhost:8000")
result = env.reset()
obs = result.observation
print(obs.observation_text)
done = getattr(result, "done", False) if 'result' in locals() else False
while not done:
quarter = obs.data.get("quarter", 1)
budget = obs.data.get("budget", 0)
turns_left = obs.data.get("turns_left", 0)
# In the new environment, we must extract the specific startup names from the observation text
# to target our actions properly.
lines = obs.observation_text.split('\n')
pitches = []
for line in lines:
if line.startswith("- ") and "(" in line:
startup_name = line[2:line.index("(")].strip()
pitches.append(startup_name)
if not pitches:
# Quarter might be over, try to wait to flush the turn
action = VcGeminiAction(action_type="wait", parameters={})
result = env.step(action)
obs = result.observation
done = result.done
continue
target_startup = pitches[0]
print(f"\n[Q{quarter} | Takes: {turns_left}] -> Evaluating {target_startup}")
# Action 1: Read the Pitch Deck for the Target Startup
# The new environment uses startup_name dynamically
action = VcGeminiAction(action_type="read_file", parameters={"path": f"{target_startup.replace(' ', '_')}/pitch_deck.txt", "startup_name": target_startup})
print(f"--- Q{quarter}: READ PITCH DECK ({target_startup}) ---")
result = env.step(action)
obs = result.observation
done = result.done
print(obs.data.get("file_content", "").strip())
# Simple heuristic agent logic based on remaining budget
if budget < 5000000:
print(f"--- Q{quarter}: PASS ON DEAL (Low Budget) ---")
action = VcGeminiAction(action_type="pass_on_deal", parameters={"startup_name": target_startup})
result = env.step(action)
obs = result.observation
done = result.done
print(obs.observation_text)
continue
# Action 2: Email Competitor to try to syndicate
action = VcGeminiAction(action_type="email_competitor", parameters={"competitor_id": "Sequoia Capital", "body": "Hey let's syndicate this deal?", "startup_name": target_startup})
print(f"--- Q{quarter}: EMAIL COMPETITOR ({target_startup}) ---")
result = env.step(action)
obs = result.observation
done = result.done
for msg in obs.inbox: print(f"From {msg['from']}: {msg['body']}")
# Action 3: Submit a Term Sheet
action = VcGeminiAction(
action_type="submit_term_sheet",
parameters={"valuation": 15000000, "amount": 10000000, "board_seats": 1, "startup_name": target_startup}
)
print(f"--- Q{quarter}: SUBMIT TERM SHEET ({target_startup}) ---")
result = env.step(action)
obs = result.observation
done = result.done
print(obs.observation_text)
# Episode has ended
print("\n\nFINAL RESULT:")
print("DONE:", result.done)
print("FINAL REWARD (TVPI):", result.reward)
if __name__ == "__main__":
run_agent()