Skip to content

[Feature Request] Add integration to smolagents #398

@FacerAin

Description

@FacerAin

Proposal

Hello OpenPipe Team! Thanks for creating such a cool project for agent RL.

I recently saw the LangGraph integration announcement and tested it, and it works great :)
I'd like to propose adding Smolagents integration as well.

I believe Smolagents is fit for ART for several reasons:

  • Simplicity: Smolagents follows a philosophy of simplicity, making it accessible while maintaining capabilities
  • Community: Like LangGraph, it provides diverse community examples and recipes. Particularly, recipes like open_deep_research are ideal use cases where ART's RL techniques can provide significant value
  • Integration-friendly: Smolagents' class architecture (ReACT, Memory, Message, Logging, etc.) is well-structured and easily accessible, making it straightforward to integrate with ART

Example

from art.smolagents import init_chat_model
from smolagents import CodeAgent, WebSearchTool
import art
import weave

@weave.op
async def rollout(model: art.Model, scenario: ResearchScenario) -> art.Trajectory:
    chat_model = init_chat_model(model.name, temperature=1.0)
    
    # Define available tools
    tools = [WebSearchTool()]
    
    # Create the Smolagents ReAct agent
    agent = CodeAgent(tools=tools, model=chat_model, stream_outputs=True)
    
    # Execute workflow (need to verify async support in smolagents)
    return await agent.run(scenario.messages)
    
from art.smolagents import wrap_rollout

...
for batch in training_iterator:
    groups = []
    for scenario in batch.items:
        groups.append(
            art.TrajectoryGroup([
                wrap_rollout(rollout)(model, scenario)
                for _ in range(training_config["rollouts_per_group"])
            ])
        )
...

Roadmap

  • Add art.smolagents integration module with wrapper functions
  • Add documentation and examples.

I'd be happy to work on implementing this feature if the team is interested.
Would love to hear your thoughts and any ideas! Thanks 😊

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions