Skip to main content

Autonomous agent for task/action planning and execution

Project description

ACTION_GRAPH

A symbolic AI agent for generating action plans based on preconditions and effects. Similar to Goal Oriented Action Plan in concept, but this implementation treats individual state variables as nodes and uses DFS to generate a feasible, lowest cost plan.

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)

The interfaces for this library are similar to https://github.com/agoose77/GOAP. For more information on GOAP refer to http://alumni.media.mit.edu/~jorkin/goap.html

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.0.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

action_graph-1.0.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for action-graph-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e2db2162a916165b7f2f5510c9616d2548c9e5b6894102773b9adc6fb693a3c5
MD5 e81d9206f4efed96d65ea6ca17269eeb
BLAKE2b-256 0ecaa23c3017e7793e328ec1f4cab7d69d7dede9bca6966c6934f47da8e239e2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: action_graph-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for action_graph-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9c29f6f58f27c734b09c4167c098a85b2710d75cc164324049e181574d78ab70
MD5 741b3537247bf6a2d3845a75554d664a
BLAKE2b-256 68f7c4d5656976a3230582290659bd5aa291d70f02e5e598047800cb888dc9a3

See more details on using hashes here.

Supported by

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