Installation
Create your TypeScript file (run_agent.ts)
Run the agent
Method Reference
Method | Purpose | Returns |
---|---|---|
executeAgent() | Start agent execution | execution_id |
waitForExecutionResult() | Wait for completion | result |
getExecutionStatus() | Check current status | status_info |
getExecutionResult() | Get final result | result |
uploadExecutionFiles() | Upload files | upload_response |
getExecutionFiles() | Get execution files | files[] |
downloadExecutionFile() | Download file | file_path |
getBrowserSessionRecording() | Get recording URL | url |
getCredentialsPublicKey() | Get encryption public key | public_key |
getAgentProfiles() | List agent profiles | profiles |
getAgentProfile() | Get specific profile | profile |
createAgentProfile() | Create new profile | profile |
updateAgentProfile() | Update existing profile | profile |
deleteAgentProfile() | Delete profile | success_message |
getLastNExecutionActivities() | Get execution activities | activities |
addMessageToExecution() | Add message to execution | void |
TypeScript Examples
API Reference
Core Methods
executeAgent() - Execute an agent with prompt variables
executeAgent() - Execute an agent with prompt variables
client
: The configured API clientagentId
: The ID of the agent to executeexecutionData
: The execution parametersagent_profile_id
: Optional ID of the agent profile
- Error: If the execution request fails
getExecutionStatus() - Get the current status for an execution
getExecutionStatus() - Get the current status for an execution
client
: The configured API clientexecutionId
: The execution identifier
- Error: If the status request fails
getExecutionResult() - Get the final result of an execution
getExecutionResult() - Get the final result of an execution
client
: The configured API clientexecutionId
: The execution identifier
- Error: If the result request fails or execution failed
waitForExecutionResult() - Wait for an execution to reach a terminal state and return the result
waitForExecutionResult() - Wait for an execution to reach a terminal state and return the result
client
: The configured API clientexecutionId
: The execution identifierinterval
: Polling interval in milliseconds (default is 1000)timeout
: Maximum wait time in milliseconds (default is 3600000 - 1 hour)
- Error: If the execution ends as “cancelled” or “failed”, or times out
AsteroidClient() - Create an API client with authentication
AsteroidClient() - Create an API client with authentication
apiKey
: Your API key for authentication
- Error: If the client initialization fails
uploadExecutionFiles() - Upload files to an execution
uploadExecutionFiles() - Upload files to an execution
client
: The configured API clientexecutionId
: The execution identifierfiles
: Array of files to upload (Blob or File objects)
- Error: If the upload request fails
getExecutionFiles() - Get a list of files associated with an execution
getExecutionFiles() - Get a list of files associated with an execution
client
: The configured API clientexecutionId
: The execution identifier
- Error: If the files request fails
downloadExecutionFile() - Download a file from an execution using its signed URL
downloadExecutionFile() - Download a file from an execution using its signed URL
client
: The configured API clientfile
: The File object containing the signed URL and metadatadownloadPath
: Path where the file should be saved. Can be a directory or full file pathcreateDirs
: Whether to create parent directories if they don’t exist (default: true)timeout
: Request timeout in seconds (default: 30)
- Error: If the download request fails
getBrowserSessionRecording() - Get the browser session recording URL for a completed execution
getBrowserSessionRecording() - Get the browser session recording URL for a completed execution
client
: The configured API clientexecutionId
: The execution identifier
- Error: If the recording request fails
Agent Profiles
getAgentProfiles() - Get a list of agent profiles
getAgentProfiles() - Get a list of agent profiles
client
: The configured API clientorganizationId
: The organization identifier (optional). Returns all agent profiles if no organizationId is provided.
- Error: If the agent profiles request fails
getAgentProfile() - Get a specific agent profile by ID
getAgentProfile() - Get a specific agent profile by ID
client
: The configured API clientprofileId
: The agent profile ID
- Error: If the agent profile request fails
createAgentProfile() - Create a new agent profile
createAgentProfile() - Create a new agent profile
client
: The configured API clientpayload
: The agent profile data
- Error: If the agent profile creation fails
updateAgentProfile() - Update an existing agent profile
updateAgentProfile() - Update an existing agent profile
client
: The configured API clientprofileId
: The agent profile IDpayload
: The update data
- Error: If the agent profile update fails
deleteAgentProfile() - Delete an agent profile by ID
deleteAgentProfile() - Delete an agent profile by ID
client
: The configured API clientprofileId
: The agent profile ID
- Error: If the agent profile deletion fails