Execute an Agent
import agent_orbit as orbit
orbit.api_key = "YOUR_API_KEY"
agent = orbit.Agent.retrieve(id="15d19ca3-26f1-4adb-9cea-3955b73d9b4e")
execution_result = agent.execute(
wait=True,
payload={"foo": "bar"}
)Parameters:
wait:If
True, the method waits for the agent to finish executing and returns anExecutionobject.If
False, the method returns anAgentExecutorJobobject immediately.
payload: (Optional) A dictionary used to pass data to the agent. The agent can access this via therequest.payloadattribute.
Example: Accessing the Payload in the Agent Script
def main(request, store):
print(request.payload["foo"]) # prints "bar"Returns:
If
wait=True: AnExecutionobject containing the result of the agent's execution.If
wait=False: AnAgentExecutorJobobject representing the execution job.
Last updated