Auto Agent
AutoAgent
Bases: Agent
AutoAgent that dynamically selects and initializes the correct agent based on the task and model.
Example Usage:
# AutoAgent as LanguageAgent:
auto_agent = AutoAgent(task="language", model_src="openai")
response = auto_agent.act("What is the capital of France?")
# AutoAgent as MotorAgent:
auto_agent = AutoAgent(task="motion-openvla", model_src="https://api.mbodi.ai/community-models/")
action = auto_agent.act("move hand forward", Image(size=(224, 224)))
# AutoAgent as SenseAgent:
auto_agent = AutoAgent(task="sense-depth-estimation", model_src="https://api.mbodi.ai/sense/")
depth = auto_agent.act(image=Image("resources/bridge_example.jpeg", size=(224, 224)))
Source code in mbodied/agents/auto/auto_agent.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
__getattr__(name)
Delegate attribute access to the agent if not found in AutoAgent.
Source code in mbodied/agents/auto/auto_agent.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
|
__init__(task=None, model_src=None, model_kwargs=None, **kwargs)
Initialize the AutoAgent with the specified task and model.
Source code in mbodied/agents/auto/auto_agent.py
45 46 47 48 49 50 51 52 53 54 55 |
|
act(*args, **kwargs)
Invoke the agent's act method without reinitializing the agent.
Source code in mbodied/agents/auto/auto_agent.py
83 84 85 |
|
available_tasks()
staticmethod
Print available tasks that can be used with AutoAgent.
Source code in mbodied/agents/auto/auto_agent.py
87 88 89 90 91 92 |
|
get_agent(task, model_src, model_kwargs=None, **kwargs)
Initialize the AutoAgent with the specified task and model.
This is an alternative to using the AutoAgent class directly. It returns the corresponding agent instance directly.
Usage:
# Get LanguageAgent instance
language_agent = get_agent(task="language", model_src="openai")
response = language_agent.act("What is the capital of France?")
# Get OpenVlaAgent instance
openvla_agent = get_agent(task="motion-openvla", model_src="https://api.mbodi.ai/community-models/")
action = openvla_agent.act("move hand forward", Image(size=(224, 224)))
# Get DepthEstimationAgent instance
depth_agent = get_agent(task="sense-depth-estimation", model_src="https://api.mbodi.ai/sense/")
depth = depth_agent.act(image=Image("resources/bridge_example.jpeg", size=(224, 224)))
Source code in mbodied/agents/auto/auto_agent.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
|