Skip to main content

Autonomous agent for task/action planning and execution

Project description

ActionGraph

ActionGraph is a symbolic AI agent for generating action plans based on preconditions and effects. This is loosely based on STRIPS approach (https://en.wikipedia.org/wiki/Stanford_Research_Institute_Problem_Solver). State variables are modeled as nodes; the actions represent edges/transitions from one state to another. Dijikstra's shortest path algorithm (A* but without the heuristic cost estimate) is used to generate a feasible, lowest cost plan.

Source: https://github.com/bharathra/ACTION_GRAPH

Usage:


from action_graph.agent import Agent
from action_graph.action import Action


class Drive(Action):
    effects = {"driving": True}
    preconditions = {"has_drivers_license": True, "tank_has_gas": True}


class FillGas(Action):
    effects = {"tank_has_gas": True}
    preconditions = {"has_car": True}


class RentCar(Action):
    effects = {"has_car": True}

    cost = 100  # dollars


class BuyCar(Action):
    effects = {"has_car": True}
    preconditions = {}

    cost = 10_000  # dollars


if __name__ == "__main__":
    world_state = {"has_car": False, "has_drivers_license": True}
    goal_state = {"driving": True}

    ai = Agent()

    actions = [a(ai) for a in Action.__subclasses__()]
    ai.load_actions(actions)

    print("Initial State:", world_state)
    ai.update_state(world_state)

    print("Goal State:   ", goal_state)
    plan = ai.get_plan(goal_state)

    # ai.execute_plan(plan)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

action-graph-1.3.5.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

action_graph-1.3.5-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file action-graph-1.3.5.tar.gz.

File metadata

  • Download URL: action-graph-1.3.5.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for action-graph-1.3.5.tar.gz
Algorithm Hash digest
SHA256 80341d5afc49a204c82e860733002444539fb47568b3c367fe98043bb7778bbe
MD5 39af13f02fccef9e2ece0914207d5832
BLAKE2b-256 1fc100827cbc8e5328931241edaa186b38a75894b8e12b08f0864692fac20204

See more details on using hashes here.

File details

Details for the file action_graph-1.3.5-py3-none-any.whl.

File metadata

File hashes

Hashes for action_graph-1.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b2f32998a75601ca108845dbf4019c64acb3ffff6fa9cc583a0f32e16588d1ee
MD5 d618300723a6d358a160e8fd9f5106c3
BLAKE2b-256 79001ae916475a29a7fc1da63bbf7e1bb7e0c3108351fd179dc9c92a530188cd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page