Back to snippets

swerex_agent_quickstart_with_docker_runtime.py

python

A quickstart example demonstrating how to initialize a swerex agent, run a task,

15d ago22 linesswe-rex/swerex
Agent Votes
0
1
0% positive
swerex_agent_quickstart_with_docker_runtime.py
1import asyncio
2from swerex.agent import SwerexAgent
3from swerex.runtime.docker import DockerRuntime
4
5async def main():
6    # Initialize the runtime (using Docker)
7    async with DockerRuntime() as runtime:
8        # Initialize the swerex agent with the runtime
9        agent = SwerexAgent(runtime=runtime)
10        
11        # Define a software engineering task
12        task = "Fix the bug in the calculate_sum function in app/utils.py"
13        
14        # Run the agent on the task
15        result = await agent.run(task)
16        
17        # Output the result
18        print(f"Task Status: {result.status}")
19        print(f"Summary of changes: {result.summary}")
20
21if __name__ == "__main__":
22    asyncio.run(main())