Skip to main content
POST
/
v1
/
sessions
/
{session_id}
/
resume
Resume Session
curl --request POST \
  --url https://api.example.com/v1/sessions/{session_id}/resume \
  --header 'Authorization: <authorization>'
{
  "success": true,
  "message": "Session resumed successfully"
}

Overview

Resume execution of a paused task. The task continues from where it was paused.

Request

session_id
string
required
The UUID of the session
Authorization
string
required
Bearer token for authentication

Response

success
boolean
Whether the operation completed successfully
message
string
Result message
{
  "success": true,
  "message": "Session resumed successfully"
}

Example

curl -X POST https://api.agi.tech/v1/sessions/<session_id>/resume \
  -H "Authorization: Bearer $AGI_API_KEY"

Use Cases

After Rate Limit Cooldown

# Pause during rate limit, resume after cooldown
def handle_rate_limit(session_id, cooldown=60):
    pause_session(session_id)
    print(f"Pausing for {cooldown}s due to rate limit")
    time.sleep(cooldown)
    resume_session(session_id)

After User Approval

# Pause for user approval, resume if approved
pause_session(session_id)
print("Agent wants to make a purchase. Approve? (y/n)")
approval = input()

if approval.lower() == 'y':
    resume_session(session_id)
else:
    cancel_session(session_id)

After Parameter Update

# Pause to adjust task parameters
pause_session(session_id)

# Send updated instructions
send_message(session_id, "Also check Amazon for comparison")

# Resume with new context
resume_session(session_id)

Error Handling

def safe_resume(session_id):
    """Resume with error handling"""
    try:
        result = resume_session(session_id)
        return result["success"]
    except requests.HTTPError as e:
        if e.response.status_code == 404:
            print("Session not found")
        elif "not_paused" in str(e.response.text):
            print("Session is not paused")
        else:
            raise
        return False

Best Practices

Resume only works on paused sessions. Check session status before attempting to resume.
Resuming a session continues task execution from where it was paused. The agent maintains its context.