client_notebook
Edison platform client usage example
import os
from edison_client import (
EdisonClient,
JobNames,
TaskRequest,
)
from edison_client.models import RuntimeConfig
from ldp.agent import AgentConfigClient instantiation
Here we instantiate an Edison client and authenticate our access to the platform. By default, the client will use the EDISON_PLATFORM_API_KEY environment variable to authenticate. The option api_key can be used to pass your API key.
Please log in to the platform and go to your user settings to get your API key.
client = EdisonClient(
api_key=os.getenv("EDISON_PLATFORM_API_KEY", "your-api-key"),
)Submit a task to an available Edison job
In the edison platform, we refer to the deployed combination of agent and environment as a job. Submitting a task to an edison job is done by calling the create_task method, which receives a TaskRequest object.
For convenience, one can use the run_tasks_until_done method, which submits the task, waits for the task to be completed, and returns a list of TaskResponse objects.
You can also pass a runtime_config to the run_tasks_until_done method, which will be used to configure the agent on runtime. Here, we will define a agent configuration and include it in the TaskRequest. This agent is used to decide the next action to take. We will also use the max_steps parameter to limit the number of steps the agent will take.
Continue a job
The platform allows to ask follow-up questions to the previous job. To accomplish that, we can use the runtime_config to pass the task_id of the previous task.
Notice that run_tasks_until_done accepts both a TaskRequest object and a dictionary with keywords arguments.
Last updated

