aea.manager

This module contains the implementation of AEA agents manager.

AgentRunAsyncTask Objects

class AgentRunAsyncTask()

Async task wrapper for agent.

__init__

 | __init__(agent: AEA, loop: asyncio.AbstractEventLoop) -> None

Init task with agent and loop.

create_run_loop

 | create_run_loop() -> None

Create run loop.

start

 | start() -> None

Start task.

wait

 | wait() -> asyncio.Future

Return future to wait task completed.

stop

 | stop() -> None

Stop task.

run

 | async run() -> None

Run task body.

is_running

 | @property
 | is_running() -> bool

Return is task running.

AgentRunThreadTask Objects

class AgentRunThreadTask(AgentRunAsyncTask)

Threaded wrapper to run agent.

__init__

 | __init__(agent: AEA, loop: asyncio.AbstractEventLoop) -> None

Init task with agent and loop.

create_run_loop

 | create_run_loop() -> None

Create run loop.

start

 | start() -> None

Run task in a dedicated thread.

MultiAgentManager Objects

class MultiAgentManager()

Multi agents manager.

__init__

 | __init__(working_dir: str, mode: str = "async", registry_path: str = "packages") -> None

Initialize manager.

Arguments:

  • working_dir: directory to store base agents.

is_running

 | @property
 | is_running() -> bool

Is manager running.

add_error_callback

 | add_error_callback(error_callback: Callable[[str, BaseException], None]) -> None

Add error callback to call on error raised.

start_manager

 | start_manager() -> "MultiAgentManager"

Start manager.

stop_manager

 | stop_manager() -> "MultiAgentManager"

Stop manager.

Stops all running agents and stop agent.

Returns:

None

add_project

 | add_project(public_id: PublicId, local: bool = True) -> "MultiAgentManager"

Fetch agent project and all dependencies to working_dir.

Arguments:

  • public_id: the public if of the agent project.
  • local: whether or not to fetch from local registry.

remove_project

 | remove_project(public_id: PublicId) -> "MultiAgentManager"

Remove agent project.

list_projects

 | list_projects() -> List[PublicId]

List all agents projects added.

Returns:

lit of public ids of projects

add_agent

 | add_agent(public_id: PublicId, agent_name: Optional[str] = None, agent_overrides: Optional[dict] = None, component_overrides: Optional[List[dict]] = None) -> "MultiAgentManager"

Create new agent configuration based on project with config overrides applied.

Alias is stored in memory only!

Arguments:

  • public_id: base agent project public id
  • agent_name: unique name for the agent
  • agent_overrides: overrides for agent config.
  • component_overrides: overrides for component section.

Returns:

manager

list_agents

 | list_agents(running_only: bool = False) -> List[str]

List all agents.

Arguments:

  • running_only: returns only running if set to True

Returns:

list of agents names

remove_agent

 | remove_agent(agent_name: str) -> "MultiAgentManager"

Remove agent alias definition from registry.

Arguments:

  • agent_name: agent name to remove

Returns:

None

start_agent

 | start_agent(agent_name: str) -> "MultiAgentManager"

Start selected agent.

Arguments:

  • agent_name: agent name to start

Returns:

None

start_all_agents

 | start_all_agents() -> "MultiAgentManager"

Start all not started agents.

Returns:

None

stop_agent

 | stop_agent(agent_name: str) -> "MultiAgentManager"

Stop running agent.

Arguments:

  • agent_name: agent name to stop

Returns:

None

stop_all_agents

 | stop_all_agents() -> "MultiAgentManager"

Stop all agents running.

Returns:

None

stop_agents

 | stop_agents(agent_names: List[str]) -> "MultiAgentManager"

Stop specified agents.

Returns:

None

start_agents

 | start_agents(agent_names: List[str]) -> "MultiAgentManager"

Stop specified agents.

Returns:

None

get_agent_alias

 | get_agent_alias(agent_name: str) -> AgentAlias

Return details about agent alias definition.

Returns:

AgentAlias

install_pypi_dependencies

 | install_pypi_dependencies() -> None

Install dependencies for every project has at least one agent alias.