Elastic Agent Client
raw JSON → 0.0.1.dev2 verified Mon Apr 27 auth: no python
A Python implementation of an Elastic Agent Client. Currently at version 0.0.1.dev2 (development release). Release cadence is unknown as the project is in early development. Requires Python >=3.10.
pip install elastic-agent-client Common errors
error ModuleNotFoundError: No module named 'elastic_agent_client' ↓
cause Package not installed or wrong import name.
fix
Install with 'pip install elastic-agent-client' and import as 'from elastic_agent_client import ...'
error elastic_agent_client.exceptions.ConnectionError: Failed to connect to Elastic Agent ↓
cause Incorrect URL or network issue.
fix
Check ELASTIC_AGENT_URL environment variable or the url parameter. Ensure the agent is reachable.
Warnings
gotcha The package is in early development (0.0.1.dev2). APIs are unstable and may change without notice. ↓
fix Pin to a specific version and monitor for changes.
gotcha The import path uses underscores: 'elastic_agent_client', not hyphens or no underscores. ↓
fix Use 'from elastic_agent_client import ...'
gotcha No authentication is set by default; you must provide an API key or token via environment variable or constructor argument. ↓
fix Set ELASTIC_AGENT_API_KEY or pass api_key parameter.
Imports
- ElasticAgentClient wrong
from elasticagentclient import ElasticAgentClientcorrectfrom elastic_agent_client import ElasticAgentClient
Quickstart
from elastic_agent_client import ElasticAgentClient
client = ElasticAgentClient(
url=os.environ.get('ELASTIC_AGENT_URL', 'http://localhost:8220'),
api_key=os.environ.get('ELASTIC_AGENT_API_KEY', '')
)
# Example: check health
health = client.health()
print(health)