Skip to main content

RunAgentClient

Synchronous client for interacting with RunAgent.

Constructor

Parameters

  • agent_id (str): The ID of your deployed agent
  • api_key (str, optional): API key for authentication
  • base_url (str): Base URL for API endpoints
  • timeout (int): Request timeout in seconds
  • max_retries (int): Maximum number of retry attempts
  • headers (dict, optional): Additional headers

Methods

run_generic

Run agent with generic input/output. Parameters:
  • input_data: Dictionary containing input for the agent
  • timeout: Override default timeout
  • headers: Additional headers for this request
Returns: Dictionary with agent response

run_generic_stream

Stream agent responses in real-time. Parameters:
  • input_data: Dictionary containing input for the agent
  • timeout: Override default timeout
  • headers: Additional headers for this request
Returns: Generator yielding response chunks

AsyncRunAgentClient

Asynchronous client for interacting with RunAgent.

Constructor

Parameters are the same as RunAgentClient.

Methods

run_generic

Async version of run_generic.

run_generic_stream

Async generator for streaming responses.

Exceptions

RunAgentError

Base exception for all RunAgent errors.

Specific Exceptions

  • AuthenticationError: Invalid or missing API key
  • AgentNotFoundError: Agent ID doesn’t exist
  • ValidationError: Invalid input data
  • RateLimitError: Too many requests
  • TimeoutError: Request timed out
  • NetworkError: Network-related errors

Type Definitions

Configuration

Environment Variables

  • RUNAGENT_API_KEY: Default API key
  • RUNAGENT_API_URL: Override base URL
  • RUNAGENT_TIMEOUT: Default timeout
  • RUNAGENT_LOG_LEVEL: Logging level

Configuration File

Location: ~/.runagent/config.json

Complete Example

See Also