Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Fixed `MessageHistory.to_list()` returning a reference to the internal list instead of a copy, causing simulator logs to contain future conversation messages that hadn't occurred at the time of logging. (PR: #PR_NUMBER_PLACEHOLDER)

**Interface**

- Agent adapter `gather_config()` in smolagents, langgraph, and llamaindex no longer silently swallows exceptions, ensuring config collection errors are visible instead of producing incomplete configuration data. (PR: #53)

### Added

**Core**
Expand Down
18 changes: 8 additions & 10 deletions maseval/interface/agents/langgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,17 +218,15 @@ def gather_config(self) -> dict[str, Any]:
safe_config["configurable"] = {"has_thread_id": "thread_id" in value if isinstance(value, dict) else False}
langgraph_config["config"] = safe_config

# Try to get graph structure info
# Get graph structure info — let errors propagate so they're
# visible in the registry's error output.
if hasattr(self.agent, "get_graph"):
try:
graph = self.agent.get_graph()
if graph:
langgraph_config["graph_info"] = {
"num_nodes": len(graph.nodes) if hasattr(graph, "nodes") else None,
"num_edges": len(graph.edges) if hasattr(graph, "edges") else None,
}
except Exception:
pass
graph = self.agent.get_graph()
if graph:
langgraph_config["graph_info"] = {
"num_nodes": len(graph.nodes) if hasattr(graph, "nodes") else None,
"num_edges": len(graph.edges) if hasattr(graph, "edges") else None,
}

if langgraph_config:
base_config["langgraph_config"] = langgraph_config
Expand Down
12 changes: 5 additions & 7 deletions maseval/interface/agents/llamaindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,12 @@ def gather_config(self) -> Dict[str, Any]:
for tool in tools
]

# Check if it's a workflow
# Check if it's a workflow — let errors propagate so they're
# visible in the registry's error output.
if hasattr(self.agent, "get_config"):
try:
workflow_config = self.agent.get_config()
if workflow_config:
llamaindex_config["workflow_config"] = workflow_config
except Exception:
pass
workflow_config = self.agent.get_config()
if workflow_config:
llamaindex_config["workflow_config"] = workflow_config

if llamaindex_config:
base_config["llamaindex_config"] = llamaindex_config
Expand Down
29 changes: 4 additions & 25 deletions maseval/interface/agents/smolagents.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,32 +425,11 @@ def gather_config(self) -> dict[str, Any]:
base_config = super().gather_config()
_check_smolagents_installed()

# Get comprehensive config from smolagents' native to_dict() method
smolagents_config = {}
# Get comprehensive config from smolagents' native to_dict() method.
# No try/except: if to_dict() exists but fails, the error should
# propagate so it's visible in the registry's error output.
if hasattr(self.agent, "to_dict"):
try:
smolagents_config = self.agent.to_dict()
except Exception:
# If to_dict fails, fall back to basic attributes
pass

# Add smolagents-specific config if available
if smolagents_config:
base_config["smolagents_config"] = smolagents_config
else:
# Fallback: manually collect common attributes
config_attrs = {}
for attr in ["max_steps", "planning_interval", "name", "description"]:
if hasattr(self.agent, attr):
config_attrs[attr] = getattr(self.agent, attr)

# CodeAgent-specific attributes
for attr in ["additional_authorized_imports", "authorized_imports", "executor_type"]:
if hasattr(self.agent, attr):
config_attrs[attr] = getattr(self.agent, attr)

if config_attrs:
base_config["smolagents_config"] = config_attrs
base_config["smolagents_config"] = self.agent.to_dict()

return base_config

Expand Down
3 changes: 3 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ def __init__(self, responses: Optional[List[str]] = None):
self._responses = responses or ["mock response"]
self._call_index = 0

def to_dict(self) -> dict:
return {"class": self.__class__.__name__, "model_id": self.model_id}

def __call__(self, *args, **kwargs):
return self.generate(*args, **kwargs)

Expand Down
Loading