from dari import Dariclient = Dari(api_key="YOUR_API_KEY")# Create a managed session firstsession = client.create_session( screen_config={"width": 1440, "height": 900}, ttl=3600 # 1 hour)# Use the session for multiple actionsresult1 = client.run_single_action( action="Navigate to Google Calendar", session_id=session["session_id"], id="nav-to-calendar")result2 = client.run_single_action( action="Create a meeting called {{meeting_title}} for tomorrow at 3pm", session_id=session["session_id"], id="calendar-meeting-step", variables={"meeting_title": "Internal sync"})# With custom user agentresult3 = client.run_single_action( action="Navigate to the mobile version of the site", session_id=session["session_id"], id="mobile-nav-step", user_agent="Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15")# Clean up when doneclient.terminate_session(session["session_id"])
Copy
{ "success": true, "result": "Meeting scheduled for tomorrow at 3:00 PM", "credits": 4, "used_cache": false, "set_cache": true, "cache_failed": false}
Single Actions
Run Single Action
Execute a single browser action through the Computer Use agent
POST
https://api.usedari.com
/
public
/
single-actions
/
run-action
Copy
from dari import Dariclient = Dari(api_key="YOUR_API_KEY")# Create a managed session firstsession = client.create_session( screen_config={"width": 1440, "height": 900}, ttl=3600 # 1 hour)# Use the session for multiple actionsresult1 = client.run_single_action( action="Navigate to Google Calendar", session_id=session["session_id"], id="nav-to-calendar")result2 = client.run_single_action( action="Create a meeting called {{meeting_title}} for tomorrow at 3pm", session_id=session["session_id"], id="calendar-meeting-step", variables={"meeting_title": "Internal sync"})# With custom user agentresult3 = client.run_single_action( action="Navigate to the mobile version of the site", session_id=session["session_id"], id="mobile-nav-step", user_agent="Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15")# Clean up when doneclient.terminate_session(session["session_id"])
Copy
{ "success": true, "result": "Meeting scheduled for tomorrow at 3:00 PM", "credits": 4, "used_cache": false, "set_cache": true, "cache_failed": false}
This endpoint lets you trigger a single computer-use browser action. You must provide a session_id from a previously created session. The endpoint optionally reuses cached state for faster follow-up actions.
true if cached data existed but could not be applied, forcing a fresh run
Copy
from dari import Dariclient = Dari(api_key="YOUR_API_KEY")# Create a managed session firstsession = client.create_session( screen_config={"width": 1440, "height": 900}, ttl=3600 # 1 hour)# Use the session for multiple actionsresult1 = client.run_single_action( action="Navigate to Google Calendar", session_id=session["session_id"], id="nav-to-calendar")result2 = client.run_single_action( action="Create a meeting called {{meeting_title}} for tomorrow at 3pm", session_id=session["session_id"], id="calendar-meeting-step", variables={"meeting_title": "Internal sync"})# With custom user agentresult3 = client.run_single_action( action="Navigate to the mobile version of the site", session_id=session["session_id"], id="mobile-nav-step", user_agent="Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15")# Clean up when doneclient.terminate_session(session["session_id"])
Copy
{ "success": true, "result": "Meeting scheduled for tomorrow at 3:00 PM", "credits": 4, "used_cache": false, "set_cache": true, "cache_failed": false}