Skip to content

Commit 683287c

Browse files
committed
update docs + llm config
1 parent 4c6954e commit 683287c

File tree

4 files changed

+755
-731
lines changed

4 files changed

+755
-731
lines changed

autogen/coding/remyx_code_executor.py

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -280,61 +280,58 @@ def explore(
280280
self,
281281
goal: str | None = None,
282282
interactive: bool = True,
283-
llm_model: str = "gpt-4o-mini",
283+
llm_model: str = "gpt-4o",
284+
llm_config: dict[str, Any] | None = None,
284285
max_turns: int | None = None,
285286
verbose: bool = True,
286287
) -> Any:
287288
"""
288289
Explore this research paper interactively with AI agents.
289-
290290
This is the recommended way to understand and experiment with research code.
291291
Creates a 2-agent system where one agent proposes experiments and another
292292
executes them in the paper's Docker environment.
293-
294293
Args:
295294
goal: Optional custom exploration goal. If None, uses a default exploration plan.
296295
interactive: If True, pauses for human guidance at each step. If False, runs automatically.
297-
llm_model: The LLM model to use for the exploring agent. Default is "gpt-4o-mini".
296+
llm_model: The LLM model to use for the exploring agent. Default is "gpt-4o". Ignored if llm_config provided.
297+
llm_config: Full LLM config dict. If None, creates default OpenAI config with llm_model.
298298
max_turns: Maximum number of conversation turns. If None, continues until termination.
299299
verbose: If True, prints session header and summary. If False, runs quietly.
300-
301300
Returns:
302301
The chat result from the exploration session.
303-
304302
Example:
305303
>>> # Interactive exploration (recommended for learning)
306-
>>> executor = RemyxCodeExecutor(arxiv_id="2010.11929v2")
304+
>>> executor = RemyxCodeExecutor(arxiv_id="2508.06434v1")
307305
>>> result = executor.explore(
308306
... goal="Help me understand the main innovation from this paper", interactive=True
309307
... )
310-
311308
>>> # Automated exploration (good for batch experiments)
312309
>>> result = executor.explore(
313310
... goal="Run all examples and benchmarks",
314311
... interactive=False,
315312
... verbose=False, # Quiet mode
316313
... )
314+
>>> # Use different LLM provider
315+
>>> result = executor.explore(
316+
... llm_config={"model": "gemini-2.0-flash-exp", "api_key": os.getenv("GOOGLE_API_KEY"), "api_type": "google"}
317+
... )
317318
"""
318319
from autogen import ConversableAgent, LLMConfig
319320

320321
# Default exploration goal
321322
default_goal = """Perform an interactive exploration of this research paper:
322-
323323
**Phase 1: Understanding** (2-3 turns)
324324
1. Examine the directory structure
325325
2. Read README and identify key files
326326
3. Understand the paper's implementation
327-
328327
**Phase 2: Experimentation** (3-5 turns)
329328
4. Run a minimal working example
330329
5. Experiment with different parameters
331330
6. Generate visualizations if applicable
332-
333331
**Phase 3: Analysis** (2-3 turns)
334332
7. Explain key implementation details
335333
8. Answer any questions about the code
336334
9. Suggest possible modifications/experiments
337-
338335
Work step-by-step. Wait for human guidance between phases.
339336
Type TERMINATE when exploration is complete."""
340337

@@ -343,10 +340,8 @@ def explore(
343340

344341
# Create system message for writer agent
345342
system_message = f"""{paper_context}
346-
347343
**Your Mission:**
348344
{goal or default_goal}
349-
350345
**Important Guidelines:**
351346
- Repository is at /app with all dependencies installed
352347
- Execute ONE command at a time - don't rush
@@ -356,7 +351,6 @@ def explore(
356351
- Wait for human feedback before major actions (if interactive mode)
357352
- Focus on lightweight demos unless instructed otherwise
358353
- You can install additional packages if needed
359-
360354
**What You Can Do:**
361355
✓ Read and analyze code
362356
✓ Execute Python/bash commands
@@ -365,7 +359,6 @@ def explore(
365359
✓ Install additional dependencies
366360
✓ Answer questions about implementation
367361
✓ Suggest improvements or experiments
368-
369362
Begin by exploring the repository structure to understand what's available."""
370363

371364
# Create executor agent (no LLM)
@@ -377,14 +370,18 @@ def explore(
377370
is_termination_msg=lambda x: "TERMINATE" in x.get("content", "").upper(),
378371
)
379372

373+
# Use provided config or create default
374+
if llm_config is None:
375+
llm_config = {
376+
"model": llm_model,
377+
"api_key": os.getenv("OPENAI_API_KEY"),
378+
}
379+
380380
# Create writer agent (has LLM)
381381
writer_agent = ConversableAgent(
382382
"research_explorer",
383383
system_message=system_message,
384-
llm_config=LLMConfig(
385-
model=llm_model,
386-
api_key=os.getenv("OPENAI_API_KEY"),
387-
),
384+
llm_config=llm_config,
388385
code_execution_config=False,
389386
max_consecutive_auto_reply=50,
390387
human_input_mode="ALWAYS" if interactive else "NEVER",
@@ -440,22 +437,20 @@ def create_agents(
440437
self,
441438
goal: str | None = None,
442439
llm_model: str = "gpt-4o-mini",
440+
llm_config: dict[str, Any] | None = None,
443441
human_input_mode: Literal["ALWAYS", "NEVER", "TERMINATE"] = "ALWAYS",
444442
) -> tuple[Any, Any]:
445443
"""
446444
Create the 2-agent system without starting exploration.
447-
448445
Use this if you want more control over the exploration process.
449446
Most users should use the simpler `explore()` method instead.
450-
451447
Args:
452448
goal: Optional custom exploration goal.
453-
llm_model: The LLM model to use.
449+
llm_model: The LLM model to use. Ignored if llm_config provided.
450+
llm_config: Full LLM config dict. If None, creates default OpenAI config with llm_model.
454451
human_input_mode: "ALWAYS" for interactive, "NEVER" for automated.
455-
456452
Returns:
457453
Tuple of (executor_agent, writer_agent)
458-
459454
Example:
460455
>>> executor = RemyxCodeExecutor(arxiv_id="2010.11929v2")
461456
>>> executor_agent, writer_agent = executor.create_agents()
@@ -473,17 +468,14 @@ def create_agents(
473468

474469
# Create system message
475470
system_message = f"""{paper_context}
476-
477471
**Your Mission:**
478472
{goal or default_goal}
479-
480473
**Guidelines:**
481474
- Repository is at /app with all dependencies installed
482475
- Execute ONE command at a time
483476
- Use absolute paths starting with /app
484477
- Be conversational and explain your actions
485478
- Debug step-by-step if errors occur
486-
487479
Begin by exploring the repository structure."""
488480

489481
# Create executor agent
@@ -495,14 +487,18 @@ def create_agents(
495487
is_termination_msg=lambda x: "TERMINATE" in x.get("content", "").upper(),
496488
)
497489

490+
# Use provided config or create default
491+
if llm_config is None:
492+
llm_config = {
493+
"model": llm_model,
494+
"api_key": os.getenv("OPENAI_API_KEY"),
495+
}
496+
498497
# Create writer agent
499498
writer_agent = ConversableAgent(
500499
"research_explorer",
501500
system_message=system_message,
502-
llm_config=LLMConfig(
503-
model=llm_model,
504-
api_key=os.getenv("OPENAI_API_KEY"),
505-
),
501+
llm_config=llm_config,
506502
code_execution_config=False,
507503
max_consecutive_auto_reply=50,
508504
human_input_mode=human_input_mode,

0 commit comments

Comments
 (0)