{"id":19947343,"url":"https://github.com/firstbatchxyz/dria-workflows","last_synced_at":"2025-05-03T17:33:46.687Z","repository":{"id":255518649,"uuid":"852327991","full_name":"firstbatchxyz/dria-workflows","owner":"firstbatchxyz","description":"Workflow creation for Dria Agents","archived":false,"fork":false,"pushed_at":"2024-11-27T10:38:02.000Z","size":153,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-07T18:52:48.205Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/firstbatchxyz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-04T16:06:52.000Z","updated_at":"2024-11-27T10:38:32.000Z","dependencies_parsed_at":"2024-11-06T13:43:06.462Z","dependency_job_id":"8984f0c0-5f75-4767-91a1-fb12778965ef","html_url":"https://github.com/firstbatchxyz/dria-workflows","commit_stats":null,"previous_names":["firstbatchxyz/dria-workflows"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstbatchxyz%2Fdria-workflows","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstbatchxyz%2Fdria-workflows/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstbatchxyz%2Fdria-workflows/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firstbatchxyz%2Fdria-workflows/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/firstbatchxyz","download_url":"https://codeload.github.com/firstbatchxyz/dria-workflows/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252227167,"owners_count":21714955,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T00:35:38.848Z","updated_at":"2025-05-03T17:33:46.384Z","avatar_url":"https://github.com/firstbatchxyz.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dria Workflows\n\nDria Workflows enables the creation of workflows for Dria Agents.\n\n## Installation\n\nYou can install Dria Workflows using pip:\n```bash\npip install dria_workflows\n````\n\n## Usage Example\n\nHere's a simple example of how to use Dria Workflows:\n\n```python\nimport logging\nfrom dria_workflows import WorkflowBuilder, Operator, Write, Edge, validate_workflow_json\n\n\ndef main():\n    logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')\n\n    builder = WorkflowBuilder()\n\n    # Add a step to your workflow\n    builder.generative_step(id=\"write_poem\", prompt=\"Write a poem as if you are Kahlil Gibran\", operator=Operator.GENERATION, outputs=[Write.new(\"poem\")])\n    \n    # Define the flow of your workflow\n    flow = [Edge(source=\"write_poem\", target=\"_end\")]\n    builder.flow(flow)\n    \n    # Set the return value of your workflow\n    builder.set_return_value(\"poem\")\n    \n    # Build your workflow\n    workflow = builder.build()\n\n    # Validate your workflow\n    validate_workflow_json(workflow.model_dump_json(indent=2, exclude_unset=True, exclude_none=True))\n\n    # Save workflow\n    workflow.save(\"poem_workflow.json\")\n\n\nif __name__ == \"__main__\":\n    main()\n```\n\n# Here is a more complex workflow\n\n```python\nimport logging\nfrom dria_workflows import WorkflowBuilder, ConditionBuilder, Operator, Write, GetAll, Read, Push, Edge, Expression, validate_workflow_json\n\n\ndef main():\n    logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')\n\n    # Give a starting memory as input\n    builder = WorkflowBuilder(memory={\"topic_1\":\"Linear Algebra\", \"topic_2\":\"CUDA\"})\n\n    # Add steps to your workflow\n    builder.generative_step(id=\"create_query\", prompt=\"Write down a search query related to following topics: {{topic_1}} and {{topic_2}}. If any, avoid asking questions asked before: {{history}}\", operator=Operator.GENERATION, inputs=[GetAll.new(\"history\", False)], outputs=[Write.new(\"search_query\")])\n    builder.generative_step(id=\"search\", prompt=\"{{search_query}}\", operator=Operator.FUNCTION_CALLING, outputs=[Write.new(\"result\"), Push.new(\"history\")])\n    builder.generative_step(id=\"evaluate\", prompt=\"Evaluate if search result is related and high quality to given question by saying Yes or No. Question: {{search_query}} , Search Result: {{result}}. Only output Yes or No and nothing else.\", operator=Operator.GENERATION, outputs=[Write.new(\"is_valid\")])\n\n    # Define the flow of your workflow\n    flow = [\n        Edge(source=\"create_query\", target=\"search\"),\n        Edge(source=\"search\", target=\"evaluate\"),\n        Edge(source=\"evaluate\", target=\"_end\", condition=ConditionBuilder.build(expected=\"Yes\", target_if_not=\"create_query\", expression=Expression.CONTAINS, input=Read.new(\"is_valid\", True))),\n    ]\n    builder.flow(flow)\n\n    # Set the return value of your workflow\n    builder.set_return_value(\"result\")\n\n    # Build your workflow\n    workflow = builder.build()\n    validate_workflow_json(workflow.model_dump_json(indent=2, exclude_unset=True, exclude_none=True))\n\n    workflow.save(\"search_workflow.json\")\n\n\nif __name__ == \"__main__\":\n    main()\n```\n\nDetailed docs soon.\n[andthattoo](https://x.com/andthatto)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirstbatchxyz%2Fdria-workflows","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffirstbatchxyz%2Fdria-workflows","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirstbatchxyz%2Fdria-workflows/lists"}