├── .dockerignore ├── .env.example ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ └── feature_request.yml ├── dependabot.yml ├── pull_request_template.md ├── settings.yml └── workflows │ ├── ci.yaml │ ├── conventional_commits.yml │ ├── dependency.yml │ ├── release-image.yaml │ ├── reusable-docker-build-push.yaml │ └── stale.yml ├── .gitignore ├── .gitmodules ├── .vscode └── settings.json ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── LICENSE ├── MAINTAINERS.md ├── Makefile ├── README.md ├── assets └── workflowserver.Dockerfile ├── copyright.txt ├── docker-bake.hcl ├── docs ├── .nojekyll ├── CONTRIBUTING.md ├── README.md ├── SECURITY.md ├── _sidebar.md └── index.html ├── manifest-spec └── openapi.yaml ├── poetry.lock ├── poetry.toml ├── pyproject.toml ├── src └── agent_workflow_server │ ├── __init__.py │ ├── agents │ ├── __init__.py │ ├── adapters │ │ ├── __init__.py │ │ ├── langgraph.py │ │ └── llamaindex.py │ ├── base.py │ ├── load.py │ └── oas_generator.py │ ├── apis │ ├── __init__.py │ ├── agents.py │ ├── authentication.py │ ├── stateless_runs.py │ ├── threads.py │ └── threads_runs.py │ ├── generated │ ├── apis │ │ ├── __init__.py │ │ ├── agents_api.py │ │ ├── agents_api_base.py │ │ ├── stateless_runs_api.py │ │ ├── stateless_runs_api_base.py │ │ ├── thread_runs_api.py │ │ ├── thread_runs_api_base.py │ │ ├── threads_api.py │ │ └── threads_api_base.py │ ├── manifest │ │ └── models │ │ │ ├── __init__.py │ │ │ ├── agent_acp_specs.py │ │ │ ├── agent_acp_specs_interrupts_inner.py │ │ │ ├── agent_capabilities.py │ │ │ ├── agent_connect_protocol.py │ │ │ ├── agent_dependency.py │ │ │ ├── agent_deployment.py │ │ │ ├── agent_deployment_deployment_options_inner.py │ │ │ ├── agent_manifest.py │ │ │ ├── agent_reference.py │ │ │ ├── deployment_manifest.py │ │ │ ├── docker_deployment.py │ │ │ ├── env_var.py │ │ │ ├── env_var_values.py │ │ │ ├── extra_models.py │ │ │ ├── interrupt_config.py │ │ │ ├── lang_graph_config.py │ │ │ ├── llama_index_config.py │ │ │ ├── locator.py │ │ │ ├── manifest.py │ │ │ ├── remote_service_deployment.py │ │ │ ├── skill.py │ │ │ ├── source_code_deployment.py │ │ │ ├── source_code_deployment_framework_config.py │ │ │ └── streaming_modes.py │ └── models │ │ ├── __init__.py │ │ ├── agent.py │ │ ├── agent_acp_descriptor.py │ │ ├── agent_acp_spec.py │ │ ├── agent_acp_spec_interrupts_inner.py │ │ ├── agent_capabilities.py │ │ ├── agent_metadata.py │ │ ├── agent_ref.py │ │ ├── agent_search_request.py │ │ ├── config.py │ │ ├── content.py │ │ ├── content_one_of_inner.py │ │ ├── custom_run_result_update.py │ │ ├── extra_models.py │ │ ├── message.py │ │ ├── message_any_block.py │ │ ├── message_text_block.py │ │ ├── run.py │ │ ├── run_create.py │ │ ├── run_create_stateful.py │ │ ├── run_create_stateless.py │ │ ├── run_error.py │ │ ├── run_interrupt.py │ │ ├── run_output.py │ │ ├── run_output_stream.py │ │ ├── run_result.py │ │ ├── run_search_request.py │ │ ├── run_stateful.py │ │ ├── run_stateless.py │ │ ├── run_status.py │ │ ├── run_wait_response_stateful.py │ │ ├── run_wait_response_stateless.py │ │ ├── stream_event_payload.py │ │ ├── stream_mode.py │ │ ├── streaming_mode.py │ │ ├── streaming_modes.py │ │ ├── thread.py │ │ ├── thread_checkpoint.py │ │ ├── thread_create.py │ │ ├── thread_patch.py │ │ ├── thread_search_request.py │ │ ├── thread_state.py │ │ ├── thread_status.py │ │ ├── value_run_error_update.py │ │ ├── value_run_interrupt_update.py │ │ └── value_run_result_update.py │ ├── logging │ └── logger.py │ ├── main.py │ ├── services │ ├── message.py │ ├── queue.py │ ├── runs.py │ ├── stream.py │ ├── thread_runs.py │ ├── thread_state.py │ ├── threads.py │ ├── utils.py │ └── validation.py │ ├── storage │ ├── models.py │ ├── service.py │ └── storage.py │ └── utils │ └── tools.py ├── templates ├── model_anyof.mustache └── model_oneof.mustache └── tests ├── .env.test ├── __init__.py ├── agents ├── __init__.py ├── jokeflow.py ├── jokeflow_manifest.json ├── jokereviewer.py ├── jokereviewer_manifest.json ├── mailcomposer.json └── mailcomposer.py ├── conftest.py ├── mock.py ├── mock_manifest.json ├── test_auth.py ├── test_generator.py ├── test_langgraph_adapter.py ├── test_llamaindex_adapter.py ├── test_load.py ├── test_openapi.json ├── test_runs.py ├── test_threads.py ├── test_validation.py └── tools.py /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | .github 3 | .gitignore 4 | .gitmodules 5 | .env 6 | .venv 7 | .vscode -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | ### SERVER-SPECIFIC ENV ### 2 | LOG_LEVEL=INFO 3 | API_HOST=127.0.0.1 4 | API_PORT=8000 5 | CORS_ALLOWED_ORIGINS="*" # comma-separated list of allowed origins 6 | AGENTS_REF='{"agent_uuid": "agent_module_name:agent_var"}' 7 | AGENT_MANIFEST_PATH=manifest.json 8 | AGWS_STORAGE_PERSIST=True 9 | AGWS_STORAGE_PATH=agws_storage.pkl 10 | NUM_WORKERS=5 11 | API_KEY=your-secret-key-here 12 | 13 | ### AGENT-SPECIFIC ENV ### -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | **/ @agntcy/workflow-srv-maintainers 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Report 3 | description: Report a bug to help us improve. 4 | title: "[Bug]: " 5 | labels: ["bug", "triage"] 6 | body: 7 | - type: markdown 8 | attributes: 9 | value: | 10 | Thanks for taking the time to fill out this bug report! 11 | - type: textarea 12 | id: description 13 | attributes: 14 | label: Bug Description 15 | description: Please provide a description of the problem 16 | validations: 17 | required: true 18 | - type: textarea 19 | id: expected 20 | attributes: 21 | label: Expected Behavior 22 | description: Please describe what you expected would happen 23 | validations: 24 | required: true 25 | - type: dropdown 26 | id: version 27 | attributes: 28 | label: Affected Version 29 | description: | 30 | If applicable, provide the version number or release tag where this 31 | issue was encountered 32 | options: 33 | - v1.0.0 34 | - v1.0.1 35 | - v1.0.2 36 | - v1.0.3 37 | default: 0 38 | validations: 39 | required: false 40 | - type: textarea 41 | id: steps 42 | attributes: 43 | label: Steps to Reproduce 44 | description: Please provide all steps to reproduce the behavior 45 | placeholder: | 46 | 1. In this environment... 47 | 1. With this config... 48 | 1. Run `this command`... 49 | 1. See error... 50 | validations: 51 | required: true 52 | - type: checkboxes 53 | id: checklist 54 | attributes: 55 | label: Checklist 56 | description: By submitting this issue, you agree to the following 57 | options: 58 | - label: I have read the [contributing guidelines](/agntcy/workflow-srv/blob/main/docs/CONTRIBUTING.md) 59 | required: true 60 | - label: I have verified this does not duplicate an existing issue 61 | required: true 62 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature Request 3 | description: Suggest a feature for this project. 4 | title: "[Feature]: " 5 | labels: ["enhancement", "triage"] 6 | body: 7 | - type: markdown 8 | attributes: 9 | value: | 10 | Thanks for taking the time to request a feature or enhancement! 11 | - type: textarea 12 | id: description 13 | attributes: 14 | label: Problem Statement 15 | description: | 16 | Please describe the problem or limitation to be addressed by 17 | the proposed feature 18 | validations: 19 | required: true 20 | - type: textarea 21 | id: solution 22 | attributes: 23 | label: Proposed Solution 24 | description: | 25 | Please describe what you envision the solution to this 26 | problem would look like 27 | validations: 28 | required: true 29 | - type: textarea 30 | id: alternatives 31 | attributes: 32 | label: Alternatives Considered 33 | description: | 34 | Please briefly describe which alternatives, if any, have been 35 | considered, including merits of alternate approaches and any tradeoffs 36 | validations: 37 | required: false 38 | - type: textarea 39 | id: context 40 | attributes: 41 | label: Additional Context 42 | description: Please provide any other information that may be relevant 43 | validations: 44 | required: false 45 | - type: checkboxes 46 | id: checklist 47 | attributes: 48 | label: Checklist 49 | description: By submitting this request, you agree to the following 50 | options: 51 | - label: I have read the [contributing guidelines](/agntcy/workflow-srv/blob/main/docs/CONTRIBUTING.md) 52 | required: true 53 | - label: | 54 | I have verified this does not duplicate an existing feature request 55 | required: true 56 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: 2 3 | updates: 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | groups: 7 | github: 8 | patterns: 9 | - "actions/*" 10 | - "github/*" 11 | schedule: 12 | interval: "weekly" 13 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | Please provide a meaningful description of what this change will do, or is for. 4 | Bonus points for including links to related issues, other PRs, or technical 5 | references. 6 | 7 | Note that by _not_ including a description, you are asking reviewers to do extra 8 | work to understand the context of this change, which may lead to your PR taking 9 | much longer to review, or result in it not being reviewed at all. 10 | 11 | ## Type of Change 12 | 13 | - [ ] Bugfix 14 | - [ ] New Feature 15 | - [ ] Breaking Change 16 | - [ ] Refactor 17 | - [ ] Documentation 18 | - [ ] Other (please describe) 19 | 20 | ## Checklist 21 | 22 | - [ ] I have read the [contributing guidelines](/agntcy/workflow-srv/blob/main/docs/CONTRIBUTING.md) 23 | - [ ] Existing issues have been referenced (where applicable) 24 | - [ ] I have verified this change is not present in other open pull requests 25 | - [ ] Functionality is documented 26 | - [ ] All code style checks pass 27 | - [ ] New code contribution is covered by automated tests 28 | - [ ] All new and existing tests pass 29 | -------------------------------------------------------------------------------- /.github/workflows/ci.yaml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | branches: 9 | - "main" 10 | 11 | concurrency: 12 | group: ${{ github.workflow }}-${{ github.ref }} 13 | cancel-in-progress: ${{ github.event_name == 'pull_request' }} 14 | 15 | jobs: 16 | lint-and-test: 17 | runs-on: ubuntu-latest 18 | steps: 19 | - uses: actions/checkout@v4 20 | - name: Install Python 21 | uses: actions/setup-python@v5 22 | with: 23 | python-version: "3.12" 24 | - name: Install Poetry 25 | uses: abatilo/actions-poetry@v4 26 | with: 27 | poetry-version: "2.1.1" 28 | - name: Install Dependencies 29 | run: | 30 | poetry install 31 | # Update output format to enable automatic inline annotations. 32 | - name: Lint check 33 | run: poetry run ruff check --output-format=github . 34 | - name: Unit test 35 | run: poetry run pytest 36 | docker-build: 37 | name: Build wfsrv docker image 38 | uses: ./.github/workflows/reusable-docker-build-push.yaml 39 | with: 40 | bake-target: workflowserver 41 | image-name: wfsrv 42 | image-tag: ${{ github.sha }} 43 | -------------------------------------------------------------------------------- /.github/workflows/conventional_commits.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: commit-msg 3 | 4 | on: 5 | push: 6 | # Run superlinter on pushes to default branch 7 | branches: 8 | - main 9 | # Run superlinter on pull request events 10 | pull_request: 11 | 12 | # Declare default permissions as read-only 13 | permissions: read-all 14 | 15 | jobs: 16 | conventional-commits: 17 | runs-on: ubuntu-latest 18 | permissions: 19 | contents: read 20 | packages: read 21 | statuses: write 22 | steps: 23 | - name: 🔒 harden runner 24 | uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0 25 | with: 26 | egress-policy: audit 27 | - uses: actions/checkout@v4 28 | with: 29 | fetch-depth: 0 30 | - name: 🧹 Conventional Commits 31 | uses: webiny/action-conventional-commits@v1.3.0 32 | with: 33 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 34 | -------------------------------------------------------------------------------- /.github/workflows/dependency.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: dependency 3 | 4 | on: 5 | # Review dependencies on pull requests to the default branch 6 | pull_request: 7 | branches: ["main"] 8 | 9 | # Declare default permissions as read-only 10 | permissions: read-all 11 | 12 | jobs: 13 | dependency-review: 14 | runs-on: ubuntu-latest 15 | permissions: 16 | contents: read 17 | pull-requests: write 18 | steps: 19 | - name: 🔒 harden runner 20 | uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0 21 | with: 22 | egress-policy: audit 23 | - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 24 | - name: 🔂 dependency review 25 | uses: actions/dependency-review-action@38ecb5b593bf0eb19e335c03f97670f792489a8b # v4.7.0 26 | with: 27 | fail-on-severity: "high" 28 | deny-licenses: "AGPL-1.0, AGPL-3.0" 29 | comment-summary-in-pr: true 30 | warn-on-openssf-scorecard-level: 3 31 | -------------------------------------------------------------------------------- /.github/workflows/release-image.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2025 Cisco and/or its affiliates. 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | --- 5 | name: ci-release-image 6 | 7 | on: 8 | push: 9 | tags: 10 | - "v?[0-9]+.[0-9]+.[0-9]+" 11 | - "v?[0-9]+.[0-9]+.[0-9]+-dev.[0-9]+" 12 | 13 | concurrency: 14 | group: ${{ github.workflow }}-${{ github.ref }} 15 | cancel-in-progress: ${{ github.event_name == 'pull_request' }} 16 | 17 | jobs: 18 | checkout-version-check: 19 | name: checkout & version check 20 | runs-on: ubuntu-latest 21 | steps: 22 | - name: Checkout repository 23 | uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 24 | with: 25 | fetch-depth: 0 26 | 27 | - name: Version check 28 | run: | 29 | MAIN_VERSION=${GITHUB_REF_NAME%-*} 30 | GIT_TAG_VERSION=${MAIN_VERSION#v} 31 | PYPROJECT_VERSION=$(grep -m 1 version pyproject.toml | grep -e '[0-9].[0-9].[0-9]' -o) 32 | if [[ "$GIT_TAG_VERSION" == "$PYPROJECT_VERSION" ]]; then 33 | printf "Version check passed" 34 | else 35 | printf "Version check failed: version in pyproject.toml (%s) and git tag version (%s) are mismatched" "$PYPROJECT_VERSION" "$GIT_TAG_VERSION" 36 | exit 1 37 | fi 38 | build-push: 39 | name: Build docker image - wfsrv 40 | needs: [checkout-version-check] 41 | uses: ./.github/workflows/reusable-docker-build-push.yaml 42 | permissions: 43 | contents: "read" 44 | packages: "write" 45 | attestations: "write" 46 | with: 47 | bake-target: workflowserver 48 | image-name: wfsrv 49 | image-tag: ${{ github.ref_name }} 50 | secrets: 51 | github-token: ${{ secrets.GITHUB_TOKEN }} 52 | -------------------------------------------------------------------------------- /.github/workflows/reusable-docker-build-push.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2025 Cisco and/or its affiliates. 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | --- 5 | name: Build and Push 6 | 7 | on: 8 | workflow_call: 9 | inputs: 10 | bake-target: 11 | required: true 12 | type: string 13 | description: "Bake target" 14 | bake-file: 15 | required: false 16 | type: string 17 | description: "Bake file" 18 | default: "docker-bake.hcl" 19 | image-name: 20 | required: true 21 | type: string 22 | description: "Image repo to use." 23 | image-tag: 24 | required: true 25 | type: string 26 | description: "Image tag to use." 27 | secrets: 28 | github-token: 29 | description: "github token" 30 | required: false 31 | 32 | jobs: 33 | build-and-push: 34 | name: Build and Push 35 | runs-on: ubuntu-latest 36 | 37 | steps: 38 | - name: Checkout code 39 | uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 40 | with: 41 | submodules: 'true' 42 | fetch-depth: 0 43 | 44 | - name: Login to GitHub Container Registry 45 | if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }} 46 | uses: docker/login-action@v3 47 | with: 48 | registry: ghcr.io 49 | username: ${{github.actor}} 50 | password: ${{secrets.github-token}} 51 | 52 | - name: Setup QEMU 53 | uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0 54 | 55 | - name: Setup Docker Buildx 56 | uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0 57 | 58 | - name: Docker metadata 59 | id: metadata 60 | uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5.7.0 61 | with: 62 | images: | 63 | ghcr.io/agntcy/acp/${{ inputs.image-name }} 64 | tags: | 65 | type=raw,value=${{ inputs.image-tag }} 66 | type=raw,value=latest,enable=${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }} 67 | 68 | - name: Build and push 69 | uses: docker/bake-action@a4d7f0b5b91c14a296d792d4ec53a9db17f02e67 # v5.5.0 70 | with: 71 | files: | 72 | ${{ inputs.bake-file }} 73 | ${{ steps.metadata.outputs.bake-file }} 74 | targets: ${{ inputs.bake-target }} 75 | push: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }} 76 | provenance: false 77 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: stale 3 | 4 | on: 5 | schedule: 6 | # Run weekly on Saturdays 7 | - cron: "30 1 * * 6" 8 | # Run the workflow manually 9 | workflow_dispatch: 10 | 11 | # Declare default permissions as read-only 12 | permissions: read-all 13 | 14 | jobs: 15 | mark-stale: 16 | # Call reusable workflow file 17 | uses: agntcy/github-reusable-workflows/.github/workflows/_stale.yml@main 18 | permissions: 19 | contents: read 20 | issues: write 21 | pull-requests: write 22 | with: 23 | days-until-stale: 60 24 | days-until-close: 7 25 | stale-label: "stale" 26 | exempt-label: "keep" 27 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "acp-spec"] 2 | path = acp-spec 3 | url = https://github.com/agntcy/acp-spec.git 4 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "python.testing.pytestArgs": [ 3 | "tests" 4 | ], 5 | "python.testing.unittestEnabled": false, 6 | "python.testing.pytestEnabled": true, 7 | "[python]": { 8 | "editor.formatOnSave": true, 9 | "editor.defaultFormatter": "charliermarsh.ruff", 10 | "editor.codeActionsOnSave": { 11 | "source.fixAll": "explicit" 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog -------------------------------------------------------------------------------- /MAINTAINERS.md: -------------------------------------------------------------------------------- 1 | # Maintainers 2 | 3 | - [janossk](https://github.com/janosSarusiKis) János Sarusi-Kis 4 | - [mtrinell](https://github.com/mtrinell) Marco Trinelli 5 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # Variables 5 | SPEC_FILE := acp-spec/openapi.json 6 | MANIFEST_SPEC_FILE := manifest-spec/manifest.json 7 | 8 | OUTPUT_DIR := src/agent_workflow_server/generated 9 | OUTPUT_DIR_TMP := src/agent_workflow_server/tmp 10 | 11 | 12 | PACKAGE_NAME := agent_workflow_server.generated 13 | GENERATOR_IMAGE := openapitools/openapi-generator-cli:latest 14 | ADDITIONAL_PROPERTIES := packageName=$(PACKAGE_NAME) 15 | 16 | MANIFEST_OUTPUT_DIR := src/agent_workflow_server/generated/manifest 17 | MANIFEST_PACKAGE_NAME := agent_workflow_server.generated.manifest 18 | MANIFEST_ADDITIONAL_PROPERTIES := packageName=$(MANIFEST_PACKAGE_NAME) 19 | 20 | 21 | .PHONY: clean validate-spec update-spec generate-api generate-manifest generate run docker-build-dev test format lint lint-fix 22 | 23 | # Ensure output directory exists 24 | $(OUTPUT_DIR): 25 | mkdir -p $(OUTPUT_DIR) 26 | 27 | 28 | # Clean generated files 29 | clean: 30 | rm -rf $(OUTPUT_DIR) 31 | 32 | clean-manifest: 33 | rm -rf $(MANIFEST_OUTPUT_DIR) 34 | 35 | validate-spec: 36 | docker run --rm -v $(PWD):/local $(GENERATOR_IMAGE) validate -i /local/$(SPEC_FILE) 37 | 38 | # Update spec (latest commit from submodule) 39 | update-spec: 40 | git submodule update --remote 41 | 42 | # Generate api (models and routes template) and manifest 43 | generate-api: clean update-spec 44 | docker run --rm \ 45 | -v $(PWD):/local \ 46 | $(GENERATOR_IMAGE) generate \ 47 | -i /local/$(SPEC_FILE) \ 48 | -t /local/templates \ 49 | -g python-fastapi \ 50 | -o /local/$(OUTPUT_DIR_TMP) \ 51 | --additional-properties=$(ADDITIONAL_PROPERTIES) 52 | mkdir -p $(OUTPUT_DIR)/models 53 | mkdir -p $(OUTPUT_DIR)/apis 54 | mv $(OUTPUT_DIR_TMP)/$(OUTPUT_DIR)/models $(OUTPUT_DIR) 55 | mv $(OUTPUT_DIR_TMP)/$(OUTPUT_DIR)/apis $(OUTPUT_DIR) 56 | rm -rf $(OUTPUT_DIR_TMP) 57 | 58 | # Generate manifest 59 | generate-manifest: clean-manifest 60 | docker run --rm \ 61 | -v $(PWD):/local \ 62 | $(GENERATOR_IMAGE) generate \ 63 | -i /local/$(MANIFEST_SPEC_FILE) \ 64 | -t /local/templates \ 65 | -g python-fastapi \ 66 | -o /local/$(OUTPUT_DIR_TMP) \ 67 | --additional-properties=$(MANIFEST_ADDITIONAL_PROPERTIES) 68 | mkdir -p $(MANIFEST_OUTPUT_DIR)/models 69 | mv $(OUTPUT_DIR_TMP)/$(MANIFEST_OUTPUT_DIR)/models $(MANIFEST_OUTPUT_DIR) 70 | rm -rf $(OUTPUT_DIR_TMP) 71 | 72 | generate: generate-api generate-manifest add-copyright 73 | 74 | add-copyright: 75 | find $(OUTPUT_DIR) -type f -name '*.py' -exec sh -c \ 76 | 'cat copyright.txt "{}" > tmpfile && mv tmpfile "{}"' \; 77 | 78 | # Install dependencies and run server 79 | run: 80 | poetry install 81 | poetry run server 82 | 83 | test: 84 | poetry install 85 | AGWS_STORAGE_PERSIST=False poetry run pytest 86 | 87 | format: 88 | poetry run ruff format . 89 | 90 | lint: 91 | poetry run ruff check . 92 | 93 | lint-fix: 94 | poetry run ruff check . --fix 95 | 96 | docker-build-dev: # Build the docker image. 97 | docker buildx bake workflowserver-dev --load 98 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Agent Workflow Server 2 | 3 | [![Release](https://img.shields.io/github/v/tag/agntcy/workflow-srv?label=latest)](https://github.com/agntcy/workflow-srv/pkgs/container/acp%2Fwfsrv) 4 | [![CI](https://github.com/agntcy/workflow-srv/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/agntcy/workflow-srv/actions/workflows/ci.yaml?query=branch%3Amain) 5 | [![Contributor-Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-fbab2c.svg)](CODE_OF_CONDUCT.md) 6 | 7 | The Agent Workflow Server (AgWS) enables participation in the Internet of Agents [(IoA)](https://docs.agntcy.org/). It accommodates AI Agents from diverse frameworks and exposes them through Agent Connect Protocol [(ACP)](https://github.com/agntcy/acp-spec), regardless of their underlying implementation. 8 | 9 | > [!NOTE] 10 | > If you wish to quickly deploy and run your Agent, please check out the user-facing [Workflow Server Manager](https://github.com/agntcy/workflow-srv-mgr) instead. 11 | 12 | ## Getting Started 13 | 14 | See [Agent Workflow Server Documentation](https://docs.agntcy.org/pages/agws/workflow_server) 15 | 16 | ## Contributing 17 | 18 | See [Contributing](https://docs.agntcy.org/pages/agws/workflow_server#contributing) 19 | 20 | Contributions are what make the open source community such an amazing place to 21 | learn, inspire, and create. Any contributions you make are **greatly 22 | appreciated**. For detailed contributing guidelines, please see 23 | [CONTRIBUTING.md](docs/CONTRIBUTING.md) 24 | 25 | ## Copyright Notice 26 | 27 | [Copyright Notice and License](./LICENSE) 28 | 29 | Distributed under Apache 2.0 License. See LICENSE for more information. 30 | Copyright AGNTCY Contributors (https://github.com/agntcy) 31 | -------------------------------------------------------------------------------- /assets/workflowserver.Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | FROM python:3.13 5 | 6 | ENV POETRY_VERSION=2.1.1 7 | 8 | RUN set -ex; pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org poetry==$POETRY_VERSION; 9 | 10 | WORKDIR /opt/agent-workflow-server 11 | 12 | COPY . . 13 | 14 | RUN poetry config virtualenvs.create true 15 | RUN poetry config virtualenvs.in-project true 16 | RUN poetry install --no-interaction 17 | 18 | EXPOSE 8000 19 | 20 | CMD ["poetry" ,"run", "server"] 21 | -------------------------------------------------------------------------------- /copyright.txt: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | -------------------------------------------------------------------------------- /docker-bake.hcl: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # Documentation available at: https://docs.docker.com/build/bake/ 5 | 6 | # Docker build args 7 | variable "IMAGE_REPO" {default = ""} 8 | variable "IMAGE_TAG" {default = "v0.0.0-dev"} 9 | 10 | function "get_tag" { 11 | params = [tags, name] 12 | result = coalescelist(tags, ["${IMAGE_REPO}/${name}:${IMAGE_TAG}"]) 13 | } 14 | 15 | group "default" { 16 | targets = ["workflowserver"] 17 | } 18 | 19 | group "workflowserver" { 20 | targets = [ 21 | "workflowserver", 22 | ] 23 | } 24 | 25 | target "_common" { 26 | output = [ 27 | "type=image", 28 | ] 29 | platforms = [ 30 | "linux/arm64", 31 | "linux/amd64", 32 | ] 33 | } 34 | 35 | target "docker-metadata-action" { 36 | tags = [] 37 | } 38 | 39 | target "workflowserver-dev" { 40 | context = "." 41 | dockerfile = "assets/workflowserver.Dockerfile" 42 | tags = [ 43 | "workflowserver:latest", 44 | ] 45 | } 46 | 47 | target "workflowserver" { 48 | tags = get_tag(target.docker-metadata-action.tags, "${target.workflowserver.name}") 49 | inherits = [ 50 | "workflowserver-dev", 51 | "_common", 52 | "docker-metadata-action", 53 | ] 54 | } 55 | -------------------------------------------------------------------------------- /docs/.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agntcy/workflow-srv/f00dc395ae7c3658f54e82fa7355d2770f15077d/docs/.nojekyll -------------------------------------------------------------------------------- /docs/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to Contribute 2 | 3 | Thanks for your interest in contributing to `workflow-srv`! Here are a few 4 | general guidelines on contributing and reporting bugs that we ask you to review. 5 | Following these guidelines helps to communicate that you respect the time of the 6 | contributors managing and developing this open source project. In return, they 7 | should reciprocate that respect in addressing your issue, assessing changes, and 8 | helping you finalize your pull requests. In that spirit of mutual respect, we 9 | endeavor to review incoming issues and pull requests within 10 days, and will 10 | close any lingering issues or pull requests after 60 days of inactivity. 11 | 12 | Please note that all of your interactions in the project are subject to our 13 | [Code of Conduct](/CODE_OF_CONDUCT.md). This includes creation of issues or pull 14 | requests, commenting on issues or pull requests, and extends to all interactions 15 | in any real-time space e.g., Slack, Discord, etc. 16 | 17 | ## Reporting Issues 18 | 19 | Before reporting a new issue, please ensure that the issue was not already 20 | reported or fixed by searching through our [issues 21 | list](https://github.com/agntcy/workflow-srv/issues). 22 | 23 | When creating a new issue, please be sure to include a **title and clear 24 | description**, as much relevant information as possible, and, if possible, a 25 | test case. 26 | 27 | **If you discover a security bug, please do not report it through GitHub. 28 | Instead, please see security procedures in [SECURITY.md](/SECURITY.md).** 29 | 30 | ## Sending Pull Requests 31 | 32 | Before sending a new pull request, take a look at existing pull requests and 33 | issues to see if the proposed change or fix has been discussed in the past, or 34 | if the change was already implemented but not yet released. 35 | 36 | We expect new pull requests to include tests for any affected behavior, and, as 37 | we follow semantic versioning, we may reserve breaking changes until the next 38 | major version release. 39 | 40 | ## Developer’s Certificate of Origin 41 | 42 | To improve tracking of who did what, we have introduced a “sign-off” procedure. 43 | The sign-off is a line at the end of the explanation for the commit, which 44 | certifies that you wrote it or otherwise have the right to pass it on as open 45 | source work. We use the Developer Certificate of Origin (see 46 | https://developercertificate.org/) for our sign-off procedure. You must include 47 | a sign-off in the commit message of your pull request for it to be accepted. The 48 | format for a sign-off is: 49 | 50 | ``` 51 | Signed-off-by: Random J Developer 52 | 53 | ``` 54 | 55 | You can use the -s when you do a git commit to simplify including a properly 56 | formatted sign-off in your commits. If you need to add your sign-off to a commit 57 | you have already made, you will need to amend: 58 | ``` 59 | git commit --amend --signoff 60 | ``` 61 | 62 | ## Other Ways to Contribute 63 | 64 | We welcome anyone that wants to contribute to `workflow-srv` to triage and 65 | reply to open issues to help troubleshoot and fix existing bugs. Here is what 66 | you can do: 67 | 68 | - Help ensure that existing issues follows the recommendations from the 69 | _[Reporting Issues](#reporting-issues)_ section, providing feedback to the 70 | issue's author on what might be missing. 71 | - Review and update the existing content of our 72 | [Wiki](https://github.com/agntcy/workflow-srv/wiki) with up-to-date 73 | instructions and code samples. 74 | - Review existing pull requests, and testing patches against real existing 75 | applications that use `workflow-srv`. 76 | - Write a test, or add a missing test case to an existing test. 77 | 78 | Thanks again for your interest on contributing to `workflow-srv`! 79 | 80 | :heart: 81 | -------------------------------------------------------------------------------- /docs/SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policies and Procedures 2 | 3 | This document outlines security procedures and general policies for the 4 | `workflow-srv` project. 5 | 6 | - [Security Policies and Procedures](#security-policies-and-procedures) 7 | - [Disclosing a security issue](#disclosing-a-security-issue) 8 | - [Vulnerability management](#vulnerability-management) 9 | - [Suggesting changes](#suggesting-changes) 10 | 11 | ## Disclosing a security issue 12 | 13 | The `workflow-srv` maintainers take all security issues in the project 14 | seriously. Thank you for improving the security of `workflow-srv`. We 15 | appreciate your dedication to responsible disclosure and will make every effort 16 | to acknowledge your contributions. 17 | 18 | `workflow-srv` leverages GitHub's private vulnerability reporting. 19 | 20 | To learn more about this feature and how to submit a vulnerability report, 21 | review [GitHub's documentation on private reporting](https://docs.github.com/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability). 22 | 23 | Here are some helpful details to include in your report: 24 | 25 | - a detailed description of the issue 26 | - the steps required to reproduce the issue 27 | - versions of the project that may be affected by the issue 28 | - if known, any mitigations for the issue 29 | 30 | A maintainer will acknowledge the report within three (3) business days, and 31 | will send a more detailed response within an additional three (3) business days 32 | indicating the next steps in handling your report. 33 | 34 | After the initial reply to your report, the maintainers will endeavor to keep 35 | you informed of the progress towards a fix and full announcement, and may ask 36 | for additional information or guidance. 37 | 38 | ## Vulnerability management 39 | 40 | When the maintainers receive a disclosure report, they will assign it to a 41 | primary handler. 42 | 43 | This person will coordinate the fix and release process, which involves the 44 | following steps: 45 | 46 | - confirming the issue 47 | - determining affected versions of the project 48 | - auditing code to find any potential similar problems 49 | - preparing fixes for all releases under maintenance 50 | 51 | ## Suggesting changes 52 | 53 | If you have suggestions on how this process could be improved please submit an 54 | issue or pull request. 55 | -------------------------------------------------------------------------------- /docs/_sidebar.md: -------------------------------------------------------------------------------- 1 | - [Getting Started](README.md) 2 | - [Contributing](CONTRIBUTING.md) 3 | - [Security](SECURITY.md) 4 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /poetry.toml: -------------------------------------------------------------------------------- 1 | [virtualenvs] 2 | in-project = true 3 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "agent-workflow-server" 3 | version = "0.3.0" 4 | description = "Run your agents and expose them through ACP" 5 | authors = [ 6 | {name = "Janos Sarusi-Kis", email = "janossk@cisco.com"}, 7 | {name = "Marco Trinelli ", email = "mtrinell@cisco.com"} 8 | ] 9 | 10 | readme = "README.md" 11 | requires-python = ">=3.12,<4" 12 | 13 | dependencies = [ 14 | "fastapi (>=0.115.11,<0.116.0)", 15 | "uvicorn (>=0.34.0,<0.35.0)", 16 | "langgraph (>=0.2.60)", 17 | "llama-index (>=0.12.30,<0.13.0)", 18 | "dotenv (>=0.9.9,<0.10.0)", 19 | "jsonschema (>=4.23.0,<5.0.0)", 20 | "openapi-spec-validator (>=0.7.1,<0.8.0)", 21 | "langgraph-checkpoint-postgres (>=2.0.21,<3.0.0)", 22 | "longchain (>=0.4.2,<0.5.0)", 23 | "jinja2 (>=3.1.6,<4.0.0)", 24 | "langchain (>=0.3.25,<0.4.0)", 25 | "psycopg[binary,pool] (>=3.2.9,<4.0.0)" 26 | ] 27 | 28 | [build-system] 29 | requires = ["poetry-core>=2.0.0,<3.0.0"] 30 | build-backend = "poetry.core.masonry.api" 31 | 32 | [tool.poetry.scripts] 33 | server = "agent_workflow_server.main:start" 34 | 35 | [tool.poetry.group.dev.dependencies] 36 | pytest = "^8.3.5" 37 | pytest-mock = "^3.14.0" 38 | ruff = "^0.11.0" 39 | pytest-asyncio = "^0.25.3" 40 | 41 | [tool.ruff] 42 | lint.select = [ "E", "F", "I", "TID251"] 43 | lint.ignore = [ "E501" ] 44 | indent-width = 4 45 | exclude = ["src/agent_workflow_server/generated/*"] 46 | 47 | [tool.ruff.format] 48 | quote-style = "double" 49 | indent-style = "space" 50 | 51 | [tool.pytest.ini_options] 52 | minversion = "6.0" 53 | testpaths = [ 54 | "tests" 55 | ] 56 | asyncio_default_fixture_loop_scope="function" 57 | -------------------------------------------------------------------------------- /src/agent_workflow_server/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | -------------------------------------------------------------------------------- /src/agent_workflow_server/agents/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | -------------------------------------------------------------------------------- /src/agent_workflow_server/agents/adapters/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | -------------------------------------------------------------------------------- /src/agent_workflow_server/agents/base.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | from abc import ABC, abstractmethod 5 | from typing import Any, AsyncGenerator, List, Optional 6 | 7 | from agent_workflow_server.generated.manifest.models.agent_deployment import ( 8 | AgentDeployment, 9 | ) 10 | from agent_workflow_server.services.message import Message 11 | from agent_workflow_server.services.thread_state import ThreadState 12 | from agent_workflow_server.storage.models import Run 13 | 14 | 15 | class ThreadsNotSupportedError(Exception): 16 | """Exception raised when threads are not supported by the agent.""" 17 | 18 | pass 19 | 20 | 21 | class BaseAgent(ABC): 22 | @abstractmethod 23 | async def astream(self, run: Run) -> AsyncGenerator[Message, None]: 24 | """Invokes the agent with the given `Run` and streams (returns) `Message`s asynchronously. 25 | The last `Message` includes the final result.""" 26 | pass 27 | 28 | @abstractmethod 29 | async def get_agent_state(self, thread_id: str) -> Optional[ThreadState]: 30 | """Returns the thread state associated with the agent.""" 31 | pass 32 | 33 | @abstractmethod 34 | async def get_history( 35 | self, thread_id: str, limit: int, before: int 36 | ) -> List[ThreadState]: 37 | """Returns the history of the thread associated with the agent.""" 38 | pass 39 | 40 | @abstractmethod 41 | async def update_agent_state( 42 | self, thread_id: str, state: ThreadState 43 | ) -> Optional[ThreadState]: 44 | """Updates the thread state associated with the agent.""" 45 | pass 46 | 47 | 48 | class BaseAdapter(ABC): 49 | @abstractmethod 50 | def load_agent( 51 | self, 52 | agent: Any, 53 | deployment: AgentDeployment, 54 | set_thread_persistance_flag: Optional[callable] = None, 55 | ) -> Optional[BaseAgent]: 56 | """Checks the type of the agent and if it is supported, returns an instance of the agent.""" 57 | pass 58 | -------------------------------------------------------------------------------- /src/agent_workflow_server/apis/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | -------------------------------------------------------------------------------- /src/agent_workflow_server/apis/authentication.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | import os 5 | from typing import Optional 6 | 7 | from dotenv import load_dotenv 8 | from fastapi import FastAPI, HTTPException, Security 9 | from fastapi.openapi.utils import get_openapi 10 | from fastapi.security.api_key import APIKeyHeader 11 | from starlette.status import HTTP_401_UNAUTHORIZED 12 | 13 | load_dotenv() 14 | 15 | API_KEY = os.getenv("API_KEY") 16 | API_KEY_NAME = "x-api-key" 17 | 18 | api_key_header = APIKeyHeader(name=API_KEY_NAME, auto_error=False) 19 | 20 | 21 | async def authentication_with_api_key( 22 | api_key_header: str = Security(api_key_header), 23 | ) -> Optional[str]: 24 | # If no API key is configured, authentication is disabled 25 | if not API_KEY: 26 | return None 27 | 28 | # If API key is configured, validate the header 29 | if api_key_header == API_KEY: 30 | return api_key_header 31 | 32 | raise HTTPException(status_code=HTTP_401_UNAUTHORIZED, detail="Invalid API Key") 33 | 34 | 35 | def setup_api_key_auth(app: FastAPI) -> None: 36 | """Setup API Key authentication for the FastAPI application""" 37 | 38 | def custom_openapi(): 39 | if app.openapi_schema: 40 | return app.openapi_schema 41 | 42 | openapi_schema = get_openapi( 43 | title=app.title, 44 | version=app.version, 45 | routes=app.routes, 46 | ) 47 | 48 | app.openapi_schema = add_authentication_to_spec(openapi_schema) 49 | return app.openapi_schema 50 | 51 | app.openapi = custom_openapi 52 | 53 | 54 | def add_authentication_to_spec(spec_dict: dict) -> dict: 55 | """Add API key authentication to an OpenAPI spec""" 56 | # Add security scheme 57 | if "components" not in spec_dict: 58 | spec_dict["components"] = {} 59 | 60 | spec_dict["components"]["securitySchemes"] = { 61 | "ApiKeyAuth": {"type": "apiKey", "in": "header", "name": API_KEY_NAME} 62 | } 63 | 64 | # Add global security requirement 65 | spec_dict["security"] = [{"ApiKeyAuth": []}] 66 | 67 | # Ensure all operations have security requirement 68 | for path in spec_dict["paths"].values(): 69 | for operation in path.values(): 70 | if isinstance(operation, dict): 71 | operation["security"] = [{"ApiKeyAuth": []}] 72 | 73 | return spec_dict 74 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/apis/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/apis/agents_api.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | from typing import Dict, List # noqa: F401 7 | import importlib 8 | import pkgutil 9 | 10 | from agent_workflow_server.generated.apis.agents_api_base import BaseAgentsApi 11 | import openapi_server.impl 12 | 13 | from fastapi import ( # noqa: F401 14 | APIRouter, 15 | Body, 16 | Cookie, 17 | Depends, 18 | Form, 19 | Header, 20 | HTTPException, 21 | Path, 22 | Query, 23 | Response, 24 | Security, 25 | status, 26 | ) 27 | 28 | from agent_workflow_server.generated.models.extra_models import TokenModel # noqa: F401 29 | from pydantic import Field, StrictStr 30 | from typing import List 31 | from typing_extensions import Annotated 32 | from agent_workflow_server.generated.models.agent import Agent 33 | from agent_workflow_server.generated.models.agent_acp_descriptor import AgentACPDescriptor 34 | from agent_workflow_server.generated.models.agent_search_request import AgentSearchRequest 35 | 36 | 37 | router = APIRouter() 38 | 39 | ns_pkg = openapi_server.impl 40 | for _, name, _ in pkgutil.iter_modules(ns_pkg.__path__, ns_pkg.__name__ + "."): 41 | importlib.import_module(name) 42 | 43 | 44 | @router.get( 45 | "/agents/{agent_id}/descriptor", 46 | responses={ 47 | 200: {"model": AgentACPDescriptor, "description": "Success"}, 48 | 404: {"model": str, "description": "Not Found"}, 49 | 422: {"model": str, "description": "Validation Error"}, 50 | }, 51 | tags=["Agents"], 52 | summary="Get Agent ACP Descriptor from its id", 53 | response_model_by_alias=True, 54 | ) 55 | async def get_acp_descriptor_by_id( 56 | agent_id: Annotated[StrictStr, Field(description="The ID of the agent.")] = Path(..., description="The ID of the agent."), 57 | ) -> AgentACPDescriptor: 58 | """Get agent ACP descriptor by agent ID.""" 59 | if not BaseAgentsApi.subclasses: 60 | raise HTTPException(status_code=500, detail="Not implemented") 61 | return await BaseAgentsApi.subclasses[0]().get_acp_descriptor_by_id(agent_id) 62 | 63 | 64 | @router.get( 65 | "/agents/{agent_id}", 66 | responses={ 67 | 200: {"model": Agent, "description": "Success"}, 68 | 404: {"model": str, "description": "Not Found"}, 69 | }, 70 | tags=["Agents"], 71 | summary="Get Agent", 72 | response_model_by_alias=True, 73 | ) 74 | async def get_agent_by_id( 75 | agent_id: Annotated[StrictStr, Field(description="The ID of the agent.")] = Path(..., description="The ID of the agent."), 76 | ) -> Agent: 77 | """Get an agent by ID.""" 78 | if not BaseAgentsApi.subclasses: 79 | raise HTTPException(status_code=500, detail="Not implemented") 80 | return await BaseAgentsApi.subclasses[0]().get_agent_by_id(agent_id) 81 | 82 | 83 | @router.post( 84 | "/agents/search", 85 | responses={ 86 | 200: {"model": List[Agent], "description": "Success"}, 87 | 422: {"model": str, "description": "Validation Error"}, 88 | }, 89 | tags=["Agents"], 90 | summary="Search Agents", 91 | response_model_by_alias=True, 92 | ) 93 | async def search_agents( 94 | agent_search_request: AgentSearchRequest = Body(None, description=""), 95 | ) -> List[Agent]: 96 | """Returns a list of agents matching the criteria provided in the request. This endpoint also functions as the endpoint to list all agents.""" 97 | if not BaseAgentsApi.subclasses: 98 | raise HTTPException(status_code=500, detail="Not implemented") 99 | return await BaseAgentsApi.subclasses[0]().search_agents(agent_search_request) 100 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/apis/agents_api_base.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | from typing import ClassVar, Dict, List, Tuple # noqa: F401 7 | 8 | from pydantic import Field, StrictStr 9 | from typing import List 10 | from typing_extensions import Annotated 11 | from agent_workflow_server.generated.models.agent import Agent 12 | from agent_workflow_server.generated.models.agent_acp_descriptor import AgentACPDescriptor 13 | from agent_workflow_server.generated.models.agent_search_request import AgentSearchRequest 14 | 15 | 16 | class BaseAgentsApi: 17 | subclasses: ClassVar[Tuple] = () 18 | 19 | def __init_subclass__(cls, **kwargs): 20 | super().__init_subclass__(**kwargs) 21 | BaseAgentsApi.subclasses = BaseAgentsApi.subclasses + (cls,) 22 | async def get_acp_descriptor_by_id( 23 | self, 24 | agent_id: Annotated[StrictStr, Field(description="The ID of the agent.")], 25 | ) -> AgentACPDescriptor: 26 | """Get agent ACP descriptor by agent ID.""" 27 | ... 28 | 29 | 30 | async def get_agent_by_id( 31 | self, 32 | agent_id: Annotated[StrictStr, Field(description="The ID of the agent.")], 33 | ) -> Agent: 34 | """Get an agent by ID.""" 35 | ... 36 | 37 | 38 | async def search_agents( 39 | self, 40 | agent_search_request: AgentSearchRequest, 41 | ) -> List[Agent]: 42 | """Returns a list of agents matching the criteria provided in the request. This endpoint also functions as the endpoint to list all agents.""" 43 | ... 44 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/apis/threads_api_base.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | from typing import ClassVar, Dict, List, Tuple # noqa: F401 7 | 8 | from pydantic import Field, StrictInt, StrictStr 9 | from typing import Any, List, Optional 10 | from typing_extensions import Annotated 11 | from agent_workflow_server.generated.models.thread import Thread 12 | from agent_workflow_server.generated.models.thread_create import ThreadCreate 13 | from agent_workflow_server.generated.models.thread_patch import ThreadPatch 14 | from agent_workflow_server.generated.models.thread_search_request import ThreadSearchRequest 15 | from agent_workflow_server.generated.models.thread_state import ThreadState 16 | 17 | 18 | class BaseThreadsApi: 19 | subclasses: ClassVar[Tuple] = () 20 | 21 | def __init_subclass__(cls, **kwargs): 22 | super().__init_subclass__(**kwargs) 23 | BaseThreadsApi.subclasses = BaseThreadsApi.subclasses + (cls,) 24 | async def copy_thread( 25 | self, 26 | thread_id: Annotated[StrictStr, Field(description="The ID of the thread.")], 27 | ) -> Thread: 28 | """Create a new thread with a copy of the state and checkpoints from an existing thread.""" 29 | ... 30 | 31 | 32 | async def create_thread( 33 | self, 34 | thread_create: ThreadCreate, 35 | ) -> Thread: 36 | """Create a new thread. """ 37 | ... 38 | 39 | 40 | async def delete_thread( 41 | self, 42 | thread_id: Annotated[StrictStr, Field(description="The ID of the thread.")], 43 | ) -> None: 44 | """Delete a thread.""" 45 | ... 46 | 47 | 48 | async def get_thread( 49 | self, 50 | thread_id: Annotated[StrictStr, Field(description="The ID of the thread.")], 51 | ) -> Thread: 52 | """Get a thread from its ID. """ 53 | ... 54 | 55 | 56 | async def get_thread_history( 57 | self, 58 | thread_id: Annotated[StrictStr, Field(description="The ID of the thread.")], 59 | limit: Optional[StrictInt], 60 | before: Optional[StrictStr], 61 | ) -> List[ThreadState]: 62 | """Get all past states for a thread.""" 63 | ... 64 | 65 | 66 | async def patch_thread( 67 | self, 68 | thread_id: Annotated[StrictStr, Field(description="The ID of the thread.")], 69 | thread_patch: ThreadPatch, 70 | ) -> Thread: 71 | """Update a thread.""" 72 | ... 73 | 74 | 75 | async def search_threads( 76 | self, 77 | thread_search_request: ThreadSearchRequest, 78 | ) -> List[Thread]: 79 | """Search for threads. This endpoint also functions as the endpoint to list all threads.""" 80 | ... 81 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/manifest/models/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/manifest/models/agent_acp_specs_interrupts_inner.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Manifest Definition 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.1 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, Field, StrictStr 27 | from typing import Any, ClassVar, Dict, List 28 | try: 29 | from typing import Self 30 | except ImportError: 31 | from typing_extensions import Self 32 | 33 | class AgentACPSpecsInterruptsInner(BaseModel): 34 | """ 35 | AgentACPSpecsInterruptsInner 36 | """ # noqa: E501 37 | interrupt_type: StrictStr = Field(description="Name of this interrupt type. Needs to be unique in the list of interrupts.") 38 | interrupt_payload: Dict[str, Any] = Field(description="This object contains an instance of an OpenAPI schema object, formatted as per the OpenAPI specs: https://spec.openapis.org/oas/v3.1.1.html#schema-object") 39 | resume_payload: Dict[str, Any] = Field(description="This object contains an instance of an OpenAPI schema object, formatted as per the OpenAPI specs: https://spec.openapis.org/oas/v3.1.1.html#schema-object") 40 | __properties: ClassVar[List[str]] = ["interrupt_type", "interrupt_payload", "resume_payload"] 41 | 42 | model_config = { 43 | "populate_by_name": True, 44 | "validate_assignment": True, 45 | "protected_namespaces": (), 46 | } 47 | 48 | 49 | def to_str(self) -> str: 50 | """Returns the string representation of the model using alias""" 51 | return pprint.pformat(self.model_dump(by_alias=True)) 52 | 53 | def to_json(self) -> str: 54 | """Returns the JSON representation of the model using alias""" 55 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 56 | return json.dumps(self.to_dict()) 57 | 58 | @classmethod 59 | def from_json(cls, json_str: str) -> Self: 60 | """Create an instance of AgentACPSpecsInterruptsInner from a JSON string""" 61 | return cls.from_dict(json.loads(json_str)) 62 | 63 | def to_dict(self) -> Dict[str, Any]: 64 | """Return the dictionary representation of the model using alias. 65 | 66 | This has the following differences from calling pydantic's 67 | `self.model_dump(by_alias=True)`: 68 | 69 | * `None` is only added to the output dict for nullable fields that 70 | were set at model initialization. Other fields with value `None` 71 | are ignored. 72 | """ 73 | _dict = self.model_dump( 74 | by_alias=True, 75 | exclude={ 76 | }, 77 | exclude_none=True, 78 | ) 79 | return _dict 80 | 81 | @classmethod 82 | def from_dict(cls, obj: Dict) -> Self: 83 | """Create an instance of AgentACPSpecsInterruptsInner from a dict""" 84 | if obj is None: 85 | return None 86 | 87 | if not isinstance(obj, dict): 88 | return cls.model_validate(obj) 89 | 90 | _obj = cls.model_validate({ 91 | "interrupt_type": obj.get("interrupt_type"), 92 | "interrupt_payload": obj.get("interrupt_payload"), 93 | "resume_payload": obj.get("resume_payload") 94 | }) 95 | return _obj 96 | 97 | 98 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/manifest/models/agent_connect_protocol.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Manifest Definition 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.1 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator 27 | from typing import Any, ClassVar, Dict, List, Optional 28 | try: 29 | from typing import Self 30 | except ImportError: 31 | from typing_extensions import Self 32 | 33 | class AgentConnectProtocol(BaseModel): 34 | """ 35 | ACP endpoint description 36 | """ # noqa: E501 37 | type: StrictStr 38 | url: StrictStr = Field(description="URL pointing to the ACP endpoint root.") 39 | agent_id: Optional[StrictStr] = Field(default=None, description="Agent identifier in ACP server. If missing, the first returned agent with matching name and version should be used.") 40 | authentication: Optional[Dict[str, Any]] = Field(default=None, description="This object contains an instance of an OpenAPI schema object, formatted as per the OpenAPI specs: https://spec.openapis.org/oas/v3.1.1.html#security-scheme-object-0") 41 | __properties: ClassVar[List[str]] = ["type", "url", "agent_id", "authentication"] 42 | 43 | @field_validator('type') 44 | def type_validate_enum(cls, value): 45 | """Validates the enum""" 46 | if value not in ('ACP',): 47 | raise ValueError("must be one of enum values ('ACP')") 48 | return value 49 | 50 | model_config = { 51 | "populate_by_name": True, 52 | "validate_assignment": True, 53 | "protected_namespaces": (), 54 | } 55 | 56 | 57 | def to_str(self) -> str: 58 | """Returns the string representation of the model using alias""" 59 | return pprint.pformat(self.model_dump(by_alias=True)) 60 | 61 | def to_json(self) -> str: 62 | """Returns the JSON representation of the model using alias""" 63 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 64 | return json.dumps(self.to_dict()) 65 | 66 | @classmethod 67 | def from_json(cls, json_str: str) -> Self: 68 | """Create an instance of AgentConnectProtocol from a JSON string""" 69 | return cls.from_dict(json.loads(json_str)) 70 | 71 | def to_dict(self) -> Dict[str, Any]: 72 | """Return the dictionary representation of the model using alias. 73 | 74 | This has the following differences from calling pydantic's 75 | `self.model_dump(by_alias=True)`: 76 | 77 | * `None` is only added to the output dict for nullable fields that 78 | were set at model initialization. Other fields with value `None` 79 | are ignored. 80 | """ 81 | _dict = self.model_dump( 82 | by_alias=True, 83 | exclude={ 84 | }, 85 | exclude_none=True, 86 | ) 87 | return _dict 88 | 89 | @classmethod 90 | def from_dict(cls, obj: Dict) -> Self: 91 | """Create an instance of AgentConnectProtocol from a dict""" 92 | if obj is None: 93 | return None 94 | 95 | if not isinstance(obj, dict): 96 | return cls.model_validate(obj) 97 | 98 | _obj = cls.model_validate({ 99 | "type": obj.get("type"), 100 | "url": obj.get("url"), 101 | "agent_id": obj.get("agent_id"), 102 | "authentication": obj.get("authentication") 103 | }) 104 | return _obj 105 | 106 | 107 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/manifest/models/agent_reference.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Manifest Definition 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.1 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, Field, StrictStr 27 | from typing import Any, ClassVar, Dict, List, Optional 28 | try: 29 | from typing import Self 30 | except ImportError: 31 | from typing_extensions import Self 32 | 33 | class AgentReference(BaseModel): 34 | """ 35 | Reference to the agent in the agent directory. It includes the version and the locator. 36 | """ # noqa: E501 37 | name: StrictStr = Field(description="Name of the agent that identifies the agent in its record") 38 | version: StrictStr = Field(description="Version of the agent in its record. Should be formatted according to semantic versioning (https://semver.org)") 39 | url: Optional[StrictStr] = Field(default=None, description="URL of the record. Can be a network location, i.e. an entry in the Agent Directory or a file.") 40 | __properties: ClassVar[List[str]] = ["name", "version", "url"] 41 | 42 | model_config = { 43 | "populate_by_name": True, 44 | "validate_assignment": True, 45 | "protected_namespaces": (), 46 | } 47 | 48 | 49 | def to_str(self) -> str: 50 | """Returns the string representation of the model using alias""" 51 | return pprint.pformat(self.model_dump(by_alias=True)) 52 | 53 | def to_json(self) -> str: 54 | """Returns the JSON representation of the model using alias""" 55 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 56 | return json.dumps(self.to_dict()) 57 | 58 | @classmethod 59 | def from_json(cls, json_str: str) -> Self: 60 | """Create an instance of AgentReference from a JSON string""" 61 | return cls.from_dict(json.loads(json_str)) 62 | 63 | def to_dict(self) -> Dict[str, Any]: 64 | """Return the dictionary representation of the model using alias. 65 | 66 | This has the following differences from calling pydantic's 67 | `self.model_dump(by_alias=True)`: 68 | 69 | * `None` is only added to the output dict for nullable fields that 70 | were set at model initialization. Other fields with value `None` 71 | are ignored. 72 | """ 73 | _dict = self.model_dump( 74 | by_alias=True, 75 | exclude={ 76 | }, 77 | exclude_none=True, 78 | ) 79 | return _dict 80 | 81 | @classmethod 82 | def from_dict(cls, obj: Dict) -> Self: 83 | """Create an instance of AgentReference from a dict""" 84 | if obj is None: 85 | return None 86 | 87 | if not isinstance(obj, dict): 88 | return cls.model_validate(obj) 89 | 90 | _obj = cls.model_validate({ 91 | "name": obj.get("name"), 92 | "version": obj.get("version"), 93 | "url": obj.get("url") 94 | }) 95 | return _obj 96 | 97 | 98 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/manifest/models/deployment_manifest.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Manifest Definition 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.1 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict 27 | from typing import Any, ClassVar, Dict, List 28 | from agent_workflow_server.generated.manifest.models.agent_acp_specs import AgentACPSpecs 29 | from agent_workflow_server.generated.manifest.models.agent_deployment import AgentDeployment 30 | try: 31 | from typing import Self 32 | except ImportError: 33 | from typing_extensions import Self 34 | 35 | class DeploymentManifest(BaseModel): 36 | """ 37 | Describe all the ACP specs of an agent, including schemas and protocol features. 38 | """ # noqa: E501 39 | acp: AgentACPSpecs 40 | deployment: AgentDeployment 41 | __properties: ClassVar[List[str]] = ["acp", "deployment"] 42 | 43 | model_config = { 44 | "populate_by_name": True, 45 | "validate_assignment": True, 46 | "protected_namespaces": (), 47 | } 48 | 49 | 50 | def to_str(self) -> str: 51 | """Returns the string representation of the model using alias""" 52 | return pprint.pformat(self.model_dump(by_alias=True)) 53 | 54 | def to_json(self) -> str: 55 | """Returns the JSON representation of the model using alias""" 56 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 57 | return json.dumps(self.to_dict()) 58 | 59 | @classmethod 60 | def from_json(cls, json_str: str) -> Self: 61 | """Create an instance of DeploymentManifest from a JSON string""" 62 | return cls.from_dict(json.loads(json_str)) 63 | 64 | def to_dict(self) -> Dict[str, Any]: 65 | """Return the dictionary representation of the model using alias. 66 | 67 | This has the following differences from calling pydantic's 68 | `self.model_dump(by_alias=True)`: 69 | 70 | * `None` is only added to the output dict for nullable fields that 71 | were set at model initialization. Other fields with value `None` 72 | are ignored. 73 | """ 74 | _dict = self.model_dump( 75 | by_alias=True, 76 | exclude={ 77 | }, 78 | exclude_none=True, 79 | ) 80 | # override the default output from pydantic by calling `to_dict()` of acp 81 | if self.acp: 82 | _dict['acp'] = self.acp.to_dict() 83 | # override the default output from pydantic by calling `to_dict()` of deployment 84 | if self.deployment: 85 | _dict['deployment'] = self.deployment.to_dict() 86 | return _dict 87 | 88 | @classmethod 89 | def from_dict(cls, obj: Dict) -> Self: 90 | """Create an instance of DeploymentManifest from a dict""" 91 | if obj is None: 92 | return None 93 | 94 | if not isinstance(obj, dict): 95 | return cls.model_validate(obj) 96 | 97 | _obj = cls.model_validate({ 98 | "acp": AgentACPSpecs.from_dict(obj.get("acp")) if obj.get("acp") is not None else None, 99 | "deployment": AgentDeployment.from_dict(obj.get("deployment")) if obj.get("deployment") is not None else None 100 | }) 101 | return _obj 102 | 103 | 104 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/manifest/models/docker_deployment.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Manifest Definition 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.1 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator 27 | from typing import Any, ClassVar, Dict, List, Optional 28 | try: 29 | from typing import Self 30 | except ImportError: 31 | from typing_extensions import Self 32 | 33 | class DockerDeployment(BaseModel): 34 | """ 35 | Describes the docker deployment for this agent 36 | """ # noqa: E501 37 | type: StrictStr 38 | name: Optional[StrictStr] = Field(default=None, description="Name this deployment option is referred to within this agent. This is needed to indicate which one is preferred when this manifest is referred. Can be omitted, in such case selection is not possible. -") 39 | image: StrictStr = Field(description="Container image built for the agent containing the agent and Workflow Server.") 40 | __properties: ClassVar[List[str]] = ["type", "name", "image"] 41 | 42 | @field_validator('type') 43 | def type_validate_enum(cls, value): 44 | """Validates the enum""" 45 | if value not in ('docker',): 46 | raise ValueError("must be one of enum values ('docker')") 47 | return value 48 | 49 | model_config = { 50 | "populate_by_name": True, 51 | "validate_assignment": True, 52 | "protected_namespaces": (), 53 | } 54 | 55 | 56 | def to_str(self) -> str: 57 | """Returns the string representation of the model using alias""" 58 | return pprint.pformat(self.model_dump(by_alias=True)) 59 | 60 | def to_json(self) -> str: 61 | """Returns the JSON representation of the model using alias""" 62 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 63 | return json.dumps(self.to_dict()) 64 | 65 | @classmethod 66 | def from_json(cls, json_str: str) -> Self: 67 | """Create an instance of DockerDeployment from a JSON string""" 68 | return cls.from_dict(json.loads(json_str)) 69 | 70 | def to_dict(self) -> Dict[str, Any]: 71 | """Return the dictionary representation of the model using alias. 72 | 73 | This has the following differences from calling pydantic's 74 | `self.model_dump(by_alias=True)`: 75 | 76 | * `None` is only added to the output dict for nullable fields that 77 | were set at model initialization. Other fields with value `None` 78 | are ignored. 79 | """ 80 | _dict = self.model_dump( 81 | by_alias=True, 82 | exclude={ 83 | }, 84 | exclude_none=True, 85 | ) 86 | return _dict 87 | 88 | @classmethod 89 | def from_dict(cls, obj: Dict) -> Self: 90 | """Create an instance of DockerDeployment from a dict""" 91 | if obj is None: 92 | return None 93 | 94 | if not isinstance(obj, dict): 95 | return cls.model_validate(obj) 96 | 97 | _obj = cls.model_validate({ 98 | "type": obj.get("type"), 99 | "name": obj.get("name"), 100 | "image": obj.get("image") 101 | }) 102 | return _obj 103 | 104 | 105 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/manifest/models/env_var.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Manifest Definition 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.1 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr 27 | from typing import Any, ClassVar, Dict, List, Optional 28 | try: 29 | from typing import Self 30 | except ImportError: 31 | from typing_extensions import Self 32 | 33 | class EnvVar(BaseModel): 34 | """ 35 | Describes an environment variable 36 | """ # noqa: E501 37 | desc: StrictStr 38 | name: StrictStr 39 | required: Optional[StrictBool] = None 40 | default_value: Optional[StrictStr] = Field(default=None, alias="defaultValue") 41 | __properties: ClassVar[List[str]] = ["desc", "name", "required", "defaultValue"] 42 | 43 | model_config = { 44 | "populate_by_name": True, 45 | "validate_assignment": True, 46 | "protected_namespaces": (), 47 | } 48 | 49 | 50 | def to_str(self) -> str: 51 | """Returns the string representation of the model using alias""" 52 | return pprint.pformat(self.model_dump(by_alias=True)) 53 | 54 | def to_json(self) -> str: 55 | """Returns the JSON representation of the model using alias""" 56 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 57 | return json.dumps(self.to_dict()) 58 | 59 | @classmethod 60 | def from_json(cls, json_str: str) -> Self: 61 | """Create an instance of EnvVar from a JSON string""" 62 | return cls.from_dict(json.loads(json_str)) 63 | 64 | def to_dict(self) -> Dict[str, Any]: 65 | """Return the dictionary representation of the model using alias. 66 | 67 | This has the following differences from calling pydantic's 68 | `self.model_dump(by_alias=True)`: 69 | 70 | * `None` is only added to the output dict for nullable fields that 71 | were set at model initialization. Other fields with value `None` 72 | are ignored. 73 | """ 74 | _dict = self.model_dump( 75 | by_alias=True, 76 | exclude={ 77 | }, 78 | exclude_none=True, 79 | ) 80 | return _dict 81 | 82 | @classmethod 83 | def from_dict(cls, obj: Dict) -> Self: 84 | """Create an instance of EnvVar from a dict""" 85 | if obj is None: 86 | return None 87 | 88 | if not isinstance(obj, dict): 89 | return cls.model_validate(obj) 90 | 91 | _obj = cls.model_validate({ 92 | "desc": obj.get("desc"), 93 | "name": obj.get("name"), 94 | "required": obj.get("required"), 95 | "defaultValue": obj.get("defaultValue") 96 | }) 97 | return _obj 98 | 99 | 100 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/manifest/models/env_var_values.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Manifest Definition 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.1 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, Field, StrictStr 27 | from typing import Any, ClassVar, Dict, List, Optional 28 | try: 29 | from typing import Self 30 | except ImportError: 31 | from typing_extensions import Self 32 | 33 | class EnvVarValues(BaseModel): 34 | """ 35 | Describes the values of the environment variables for a specific agent and it's dependencies 36 | """ # noqa: E501 37 | name: Optional[StrictStr] = Field(default=None, description="name of the agent dependency these environment variables are for") 38 | values: Optional[Dict[str, StrictStr]] = None 39 | env_deps: Optional[List[EnvVarValues]] = None 40 | __properties: ClassVar[List[str]] = ["name", "values", "env_deps"] 41 | 42 | model_config = { 43 | "populate_by_name": True, 44 | "validate_assignment": True, 45 | "protected_namespaces": (), 46 | } 47 | 48 | 49 | def to_str(self) -> str: 50 | """Returns the string representation of the model using alias""" 51 | return pprint.pformat(self.model_dump(by_alias=True)) 52 | 53 | def to_json(self) -> str: 54 | """Returns the JSON representation of the model using alias""" 55 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 56 | return json.dumps(self.to_dict()) 57 | 58 | @classmethod 59 | def from_json(cls, json_str: str) -> Self: 60 | """Create an instance of EnvVarValues from a JSON string""" 61 | return cls.from_dict(json.loads(json_str)) 62 | 63 | def to_dict(self) -> Dict[str, Any]: 64 | """Return the dictionary representation of the model using alias. 65 | 66 | This has the following differences from calling pydantic's 67 | `self.model_dump(by_alias=True)`: 68 | 69 | * `None` is only added to the output dict for nullable fields that 70 | were set at model initialization. Other fields with value `None` 71 | are ignored. 72 | """ 73 | _dict = self.model_dump( 74 | by_alias=True, 75 | exclude={ 76 | }, 77 | exclude_none=True, 78 | ) 79 | # override the default output from pydantic by calling `to_dict()` of each item in env_deps (list) 80 | _items = [] 81 | if self.env_deps: 82 | for _item in self.env_deps: 83 | if _item: 84 | _items.append(_item.to_dict()) 85 | _dict['env_deps'] = _items 86 | return _dict 87 | 88 | @classmethod 89 | def from_dict(cls, obj: Dict) -> Self: 90 | """Create an instance of EnvVarValues from a dict""" 91 | if obj is None: 92 | return None 93 | 94 | if not isinstance(obj, dict): 95 | return cls.model_validate(obj) 96 | 97 | _obj = cls.model_validate({ 98 | "name": obj.get("name"), 99 | "values": obj.get("values"), 100 | "env_deps": [EnvVarValues.from_dict(_item) for _item in obj.get("env_deps")] if obj.get("env_deps") is not None else None 101 | }) 102 | return _obj 103 | 104 | # TODO: Rewrite to not use raise_errors 105 | EnvVarValues.model_rebuild(raise_errors=False) 106 | 107 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/manifest/models/extra_models.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | from pydantic import BaseModel 7 | 8 | class TokenModel(BaseModel): 9 | """Defines a token model.""" 10 | 11 | sub: str 12 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/manifest/models/interrupt_config.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Manifest Definition 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.1 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, StrictStr 27 | from typing import Any, ClassVar, Dict, List 28 | try: 29 | from typing import Self 30 | except ImportError: 31 | from typing_extensions import Self 32 | 33 | class InterruptConfig(BaseModel): 34 | """ 35 | InterruptConfig 36 | """ # noqa: E501 37 | interrupt_ref: StrictStr 38 | resume_ref: StrictStr 39 | __properties: ClassVar[List[str]] = ["interrupt_ref", "resume_ref"] 40 | 41 | model_config = { 42 | "populate_by_name": True, 43 | "validate_assignment": True, 44 | "protected_namespaces": (), 45 | } 46 | 47 | 48 | def to_str(self) -> str: 49 | """Returns the string representation of the model using alias""" 50 | return pprint.pformat(self.model_dump(by_alias=True)) 51 | 52 | def to_json(self) -> str: 53 | """Returns the JSON representation of the model using alias""" 54 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 55 | return json.dumps(self.to_dict()) 56 | 57 | @classmethod 58 | def from_json(cls, json_str: str) -> Self: 59 | """Create an instance of InterruptConfig from a JSON string""" 60 | return cls.from_dict(json.loads(json_str)) 61 | 62 | def to_dict(self) -> Dict[str, Any]: 63 | """Return the dictionary representation of the model using alias. 64 | 65 | This has the following differences from calling pydantic's 66 | `self.model_dump(by_alias=True)`: 67 | 68 | * `None` is only added to the output dict for nullable fields that 69 | were set at model initialization. Other fields with value `None` 70 | are ignored. 71 | """ 72 | _dict = self.model_dump( 73 | by_alias=True, 74 | exclude={ 75 | }, 76 | exclude_none=True, 77 | ) 78 | return _dict 79 | 80 | @classmethod 81 | def from_dict(cls, obj: Dict) -> Self: 82 | """Create an instance of InterruptConfig from a dict""" 83 | if obj is None: 84 | return None 85 | 86 | if not isinstance(obj, dict): 87 | return cls.model_validate(obj) 88 | 89 | _obj = cls.model_validate({ 90 | "interrupt_ref": obj.get("interrupt_ref"), 91 | "resume_ref": obj.get("resume_ref") 92 | }) 93 | return _obj 94 | 95 | 96 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/manifest/models/lang_graph_config.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Manifest Definition 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.1 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, StrictStr, field_validator 27 | from typing import Any, ClassVar, Dict, List 28 | try: 29 | from typing import Self 30 | except ImportError: 31 | from typing_extensions import Self 32 | 33 | class LangGraphConfig(BaseModel): 34 | """ 35 | Describes langgraph based agent deployment config 36 | """ # noqa: E501 37 | framework_type: StrictStr 38 | graph: StrictStr 39 | __properties: ClassVar[List[str]] = ["framework_type", "graph"] 40 | 41 | @field_validator('framework_type') 42 | def framework_type_validate_enum(cls, value): 43 | """Validates the enum""" 44 | if value not in ('langgraph',): 45 | raise ValueError("must be one of enum values ('langgraph')") 46 | return value 47 | 48 | model_config = { 49 | "populate_by_name": True, 50 | "validate_assignment": True, 51 | "protected_namespaces": (), 52 | } 53 | 54 | 55 | def to_str(self) -> str: 56 | """Returns the string representation of the model using alias""" 57 | return pprint.pformat(self.model_dump(by_alias=True)) 58 | 59 | def to_json(self) -> str: 60 | """Returns the JSON representation of the model using alias""" 61 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 62 | return json.dumps(self.to_dict()) 63 | 64 | @classmethod 65 | def from_json(cls, json_str: str) -> Self: 66 | """Create an instance of LangGraphConfig from a JSON string""" 67 | return cls.from_dict(json.loads(json_str)) 68 | 69 | def to_dict(self) -> Dict[str, Any]: 70 | """Return the dictionary representation of the model using alias. 71 | 72 | This has the following differences from calling pydantic's 73 | `self.model_dump(by_alias=True)`: 74 | 75 | * `None` is only added to the output dict for nullable fields that 76 | were set at model initialization. Other fields with value `None` 77 | are ignored. 78 | """ 79 | _dict = self.model_dump( 80 | by_alias=True, 81 | exclude={ 82 | }, 83 | exclude_none=True, 84 | ) 85 | return _dict 86 | 87 | @classmethod 88 | def from_dict(cls, obj: Dict) -> Self: 89 | """Create an instance of LangGraphConfig from a dict""" 90 | if obj is None: 91 | return None 92 | 93 | if not isinstance(obj, dict): 94 | return cls.model_validate(obj) 95 | 96 | _obj = cls.model_validate({ 97 | "framework_type": obj.get("framework_type"), 98 | "graph": obj.get("graph") 99 | }) 100 | return _obj 101 | 102 | 103 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/manifest/models/llama_index_config.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Manifest Definition 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.1 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, StrictStr, field_validator 27 | from typing import Any, ClassVar, Dict, List, Optional 28 | from agent_workflow_server.generated.manifest.models.interrupt_config import InterruptConfig 29 | try: 30 | from typing import Self 31 | except ImportError: 32 | from typing_extensions import Self 33 | 34 | class LlamaIndexConfig(BaseModel): 35 | """ 36 | Describes llamaindex based agent deployment config 37 | """ # noqa: E501 38 | framework_type: StrictStr 39 | path: StrictStr 40 | interrupts: Optional[Dict[str, InterruptConfig]] = None 41 | __properties: ClassVar[List[str]] = ["framework_type", "path", "interrupts"] 42 | 43 | @field_validator('framework_type') 44 | def framework_type_validate_enum(cls, value): 45 | """Validates the enum""" 46 | if value not in ('llamaindex',): 47 | raise ValueError("must be one of enum values ('llamaindex')") 48 | return value 49 | 50 | model_config = { 51 | "populate_by_name": True, 52 | "validate_assignment": True, 53 | "protected_namespaces": (), 54 | } 55 | 56 | 57 | def to_str(self) -> str: 58 | """Returns the string representation of the model using alias""" 59 | return pprint.pformat(self.model_dump(by_alias=True)) 60 | 61 | def to_json(self) -> str: 62 | """Returns the JSON representation of the model using alias""" 63 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 64 | return json.dumps(self.to_dict()) 65 | 66 | @classmethod 67 | def from_json(cls, json_str: str) -> Self: 68 | """Create an instance of LlamaIndexConfig from a JSON string""" 69 | return cls.from_dict(json.loads(json_str)) 70 | 71 | def to_dict(self) -> Dict[str, Any]: 72 | """Return the dictionary representation of the model using alias. 73 | 74 | This has the following differences from calling pydantic's 75 | `self.model_dump(by_alias=True)`: 76 | 77 | * `None` is only added to the output dict for nullable fields that 78 | were set at model initialization. Other fields with value `None` 79 | are ignored. 80 | """ 81 | _dict = self.model_dump( 82 | by_alias=True, 83 | exclude={ 84 | }, 85 | exclude_none=True, 86 | ) 87 | # override the default output from pydantic by calling `to_dict()` of each value in interrupts (dict) 88 | _field_dict = {} 89 | if self.interrupts: 90 | for _key in self.interrupts: 91 | if self.interrupts[_key]: 92 | _field_dict[_key] = self.interrupts[_key].to_dict() 93 | _dict['interrupts'] = _field_dict 94 | return _dict 95 | 96 | @classmethod 97 | def from_dict(cls, obj: Dict) -> Self: 98 | """Create an instance of LlamaIndexConfig from a dict""" 99 | if obj is None: 100 | return None 101 | 102 | if not isinstance(obj, dict): 103 | return cls.model_validate(obj) 104 | 105 | _obj = cls.model_validate({ 106 | "framework_type": obj.get("framework_type"), 107 | "path": obj.get("path"), 108 | "interrupts": dict( 109 | (_k, InterruptConfig.from_dict(_v)) 110 | for _k, _v in obj.get("interrupts").items() 111 | ) 112 | if obj.get("interrupts") is not None 113 | else None 114 | }) 115 | return _obj 116 | 117 | 118 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/manifest/models/locator.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Manifest Definition 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.1 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr, field_validator 27 | from typing import Any, ClassVar, Dict, List, Optional 28 | try: 29 | from typing import Self 30 | except ImportError: 31 | from typing_extensions import Self 32 | 33 | class Locator(BaseModel): 34 | """ 35 | Locator 36 | """ # noqa: E501 37 | annotations: Optional[Dict[str, StrictStr]] = None 38 | digest: Optional[StrictStr] = None 39 | size: Optional[StrictInt] = None 40 | type: StrictStr 41 | url: StrictStr 42 | __properties: ClassVar[List[str]] = ["annotations", "digest", "size", "type", "url"] 43 | 44 | @field_validator('type') 45 | def type_validate_enum(cls, value): 46 | """Validates the enum""" 47 | if value not in ('binary', 'unspecified', 'helm-chart', 'docker-image', 'py-package', 'source-code',): 48 | raise ValueError("must be one of enum values ('binary', 'unspecified', 'helm-chart', 'docker-image', 'py-package', 'source-code')") 49 | return value 50 | 51 | model_config = { 52 | "populate_by_name": True, 53 | "validate_assignment": True, 54 | "protected_namespaces": (), 55 | } 56 | 57 | 58 | def to_str(self) -> str: 59 | """Returns the string representation of the model using alias""" 60 | return pprint.pformat(self.model_dump(by_alias=True)) 61 | 62 | def to_json(self) -> str: 63 | """Returns the JSON representation of the model using alias""" 64 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 65 | return json.dumps(self.to_dict()) 66 | 67 | @classmethod 68 | def from_json(cls, json_str: str) -> Self: 69 | """Create an instance of Locator from a JSON string""" 70 | return cls.from_dict(json.loads(json_str)) 71 | 72 | def to_dict(self) -> Dict[str, Any]: 73 | """Return the dictionary representation of the model using alias. 74 | 75 | This has the following differences from calling pydantic's 76 | `self.model_dump(by_alias=True)`: 77 | 78 | * `None` is only added to the output dict for nullable fields that 79 | were set at model initialization. Other fields with value `None` 80 | are ignored. 81 | """ 82 | _dict = self.model_dump( 83 | by_alias=True, 84 | exclude={ 85 | }, 86 | exclude_none=True, 87 | ) 88 | return _dict 89 | 90 | @classmethod 91 | def from_dict(cls, obj: Dict) -> Self: 92 | """Create an instance of Locator from a dict""" 93 | if obj is None: 94 | return None 95 | 96 | if not isinstance(obj, dict): 97 | return cls.model_validate(obj) 98 | 99 | _obj = cls.model_validate({ 100 | "annotations": obj.get("annotations"), 101 | "digest": obj.get("digest"), 102 | "size": obj.get("size"), 103 | "type": obj.get("type"), 104 | "url": obj.get("url") 105 | }) 106 | return _obj 107 | 108 | 109 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/manifest/models/manifest.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Manifest Definition 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.1 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, StrictStr 27 | from typing import Any, ClassVar, Dict, List, Optional 28 | from agent_workflow_server.generated.manifest.models.deployment_manifest import DeploymentManifest 29 | try: 30 | from typing import Self 31 | except ImportError: 32 | from typing_extensions import Self 33 | 34 | class Manifest(BaseModel): 35 | """ 36 | Manifest 37 | """ # noqa: E501 38 | annotations: Optional[Dict[str, StrictStr]] = None 39 | data: DeploymentManifest 40 | name: StrictStr 41 | version: Optional[StrictStr] = None 42 | __properties: ClassVar[List[str]] = ["annotations", "data", "name", "version"] 43 | 44 | model_config = { 45 | "populate_by_name": True, 46 | "validate_assignment": True, 47 | "protected_namespaces": (), 48 | } 49 | 50 | 51 | def to_str(self) -> str: 52 | """Returns the string representation of the model using alias""" 53 | return pprint.pformat(self.model_dump(by_alias=True)) 54 | 55 | def to_json(self) -> str: 56 | """Returns the JSON representation of the model using alias""" 57 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 58 | return json.dumps(self.to_dict()) 59 | 60 | @classmethod 61 | def from_json(cls, json_str: str) -> Self: 62 | """Create an instance of Manifest from a JSON string""" 63 | return cls.from_dict(json.loads(json_str)) 64 | 65 | def to_dict(self) -> Dict[str, Any]: 66 | """Return the dictionary representation of the model using alias. 67 | 68 | This has the following differences from calling pydantic's 69 | `self.model_dump(by_alias=True)`: 70 | 71 | * `None` is only added to the output dict for nullable fields that 72 | were set at model initialization. Other fields with value `None` 73 | are ignored. 74 | """ 75 | _dict = self.model_dump( 76 | by_alias=True, 77 | exclude={ 78 | }, 79 | exclude_none=True, 80 | ) 81 | # override the default output from pydantic by calling `to_dict()` of data 82 | if self.data: 83 | _dict['data'] = self.data.to_dict() 84 | return _dict 85 | 86 | @classmethod 87 | def from_dict(cls, obj: Dict) -> Self: 88 | """Create an instance of Manifest from a dict""" 89 | if obj is None: 90 | return None 91 | 92 | if not isinstance(obj, dict): 93 | return cls.model_validate(obj) 94 | 95 | _obj = cls.model_validate({ 96 | "annotations": obj.get("annotations"), 97 | "data": DeploymentManifest.from_dict(obj.get("data")) if obj.get("data") is not None else None, 98 | "name": obj.get("name"), 99 | "version": obj.get("version") 100 | }) 101 | return _obj 102 | 103 | 104 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/manifest/models/remote_service_deployment.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Manifest Definition 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.1 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator 27 | from typing import Any, ClassVar, Dict, List, Optional 28 | from agent_workflow_server.generated.manifest.models.agent_connect_protocol import AgentConnectProtocol 29 | try: 30 | from typing import Self 31 | except ImportError: 32 | from typing_extensions import Self 33 | 34 | class RemoteServiceDeployment(BaseModel): 35 | """ 36 | Describes the network endpoint where the agent is available 37 | """ # noqa: E501 38 | type: StrictStr 39 | name: Optional[StrictStr] = Field(default=None, description="Name this deployment option is referred to within this agent. This is needed to indicate which one is preferred when this manifest is referred. Can be omitted, in such case selection is not possible. -") 40 | protocol: AgentConnectProtocol 41 | __properties: ClassVar[List[str]] = ["type", "name", "protocol"] 42 | 43 | @field_validator('type') 44 | def type_validate_enum(cls, value): 45 | """Validates the enum""" 46 | if value not in ('remote_service',): 47 | raise ValueError("must be one of enum values ('remote_service')") 48 | return value 49 | 50 | model_config = { 51 | "populate_by_name": True, 52 | "validate_assignment": True, 53 | "protected_namespaces": (), 54 | } 55 | 56 | 57 | def to_str(self) -> str: 58 | """Returns the string representation of the model using alias""" 59 | return pprint.pformat(self.model_dump(by_alias=True)) 60 | 61 | def to_json(self) -> str: 62 | """Returns the JSON representation of the model using alias""" 63 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 64 | return json.dumps(self.to_dict()) 65 | 66 | @classmethod 67 | def from_json(cls, json_str: str) -> Self: 68 | """Create an instance of RemoteServiceDeployment from a JSON string""" 69 | return cls.from_dict(json.loads(json_str)) 70 | 71 | def to_dict(self) -> Dict[str, Any]: 72 | """Return the dictionary representation of the model using alias. 73 | 74 | This has the following differences from calling pydantic's 75 | `self.model_dump(by_alias=True)`: 76 | 77 | * `None` is only added to the output dict for nullable fields that 78 | were set at model initialization. Other fields with value `None` 79 | are ignored. 80 | """ 81 | _dict = self.model_dump( 82 | by_alias=True, 83 | exclude={ 84 | }, 85 | exclude_none=True, 86 | ) 87 | # override the default output from pydantic by calling `to_dict()` of protocol 88 | if self.protocol: 89 | _dict['protocol'] = self.protocol.to_dict() 90 | return _dict 91 | 92 | @classmethod 93 | def from_dict(cls, obj: Dict) -> Self: 94 | """Create an instance of RemoteServiceDeployment from a dict""" 95 | if obj is None: 96 | return None 97 | 98 | if not isinstance(obj, dict): 99 | return cls.model_validate(obj) 100 | 101 | _obj = cls.model_validate({ 102 | "type": obj.get("type"), 103 | "name": obj.get("name"), 104 | "protocol": AgentConnectProtocol.from_dict(obj.get("protocol")) if obj.get("protocol") is not None else None 105 | }) 106 | return _obj 107 | 108 | 109 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/manifest/models/skill.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Manifest Definition 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.1 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr 27 | from typing import Any, ClassVar, Dict, List, Optional 28 | try: 29 | from typing import Self 30 | except ImportError: 31 | from typing_extensions import Self 32 | 33 | class Skill(BaseModel): 34 | """ 35 | Describes the skills of the agent. 36 | """ # noqa: E501 37 | category_uid: Optional[StrictInt] = None 38 | class_uid: StrictInt 39 | category_name: Optional[StrictStr] = None 40 | class_name: Optional[StrictStr] = None 41 | annotations: Optional[Dict[str, StrictStr]] = None 42 | __properties: ClassVar[List[str]] = ["category_uid", "class_uid", "category_name", "class_name", "annotations"] 43 | 44 | model_config = { 45 | "populate_by_name": True, 46 | "validate_assignment": True, 47 | "protected_namespaces": (), 48 | } 49 | 50 | 51 | def to_str(self) -> str: 52 | """Returns the string representation of the model using alias""" 53 | return pprint.pformat(self.model_dump(by_alias=True)) 54 | 55 | def to_json(self) -> str: 56 | """Returns the JSON representation of the model using alias""" 57 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 58 | return json.dumps(self.to_dict()) 59 | 60 | @classmethod 61 | def from_json(cls, json_str: str) -> Self: 62 | """Create an instance of Skill from a JSON string""" 63 | return cls.from_dict(json.loads(json_str)) 64 | 65 | def to_dict(self) -> Dict[str, Any]: 66 | """Return the dictionary representation of the model using alias. 67 | 68 | This has the following differences from calling pydantic's 69 | `self.model_dump(by_alias=True)`: 70 | 71 | * `None` is only added to the output dict for nullable fields that 72 | were set at model initialization. Other fields with value `None` 73 | are ignored. 74 | """ 75 | _dict = self.model_dump( 76 | by_alias=True, 77 | exclude={ 78 | }, 79 | exclude_none=True, 80 | ) 81 | return _dict 82 | 83 | @classmethod 84 | def from_dict(cls, obj: Dict) -> Self: 85 | """Create an instance of Skill from a dict""" 86 | if obj is None: 87 | return None 88 | 89 | if not isinstance(obj, dict): 90 | return cls.model_validate(obj) 91 | 92 | _obj = cls.model_validate({ 93 | "category_uid": obj.get("category_uid"), 94 | "class_uid": obj.get("class_uid"), 95 | "category_name": obj.get("category_name"), 96 | "class_name": obj.get("class_name"), 97 | "annotations": obj.get("annotations") 98 | }) 99 | return _obj 100 | 101 | 102 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/manifest/models/streaming_modes.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Manifest Definition 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.1 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, Field, StrictBool 27 | from typing import Any, ClassVar, Dict, List, Optional 28 | try: 29 | from typing import Self 30 | except ImportError: 31 | from typing_extensions import Self 32 | 33 | class StreamingModes(BaseModel): 34 | """ 35 | Supported streaming modes. If missing, streaming is not supported. If no mode is supported attempts to stream output will result in an error. 36 | """ # noqa: E501 37 | values: Optional[StrictBool] = Field(default=None, description="This is `true` if the agent supports values streaming. If `false` or missing, values streaming is not supported. Values streaming consists of a stream of objects of type `ValueRunResultUpdate`, where each one sent over the stream fully replace the previous one.") 38 | custom: Optional[StrictBool] = Field(default=None, description="This is `true` if the agent supports custom objects streaming. If `false` or missing, custom streaming is not supported. Custom Objects streaming consists of a stream of object whose schema is specified by the agent ACP descriptor under `specs.custom_streaming_update`.") 39 | __properties: ClassVar[List[str]] = ["values", "custom"] 40 | 41 | model_config = { 42 | "populate_by_name": True, 43 | "validate_assignment": True, 44 | "protected_namespaces": (), 45 | } 46 | 47 | 48 | def to_str(self) -> str: 49 | """Returns the string representation of the model using alias""" 50 | return pprint.pformat(self.model_dump(by_alias=True)) 51 | 52 | def to_json(self) -> str: 53 | """Returns the JSON representation of the model using alias""" 54 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 55 | return json.dumps(self.to_dict()) 56 | 57 | @classmethod 58 | def from_json(cls, json_str: str) -> Self: 59 | """Create an instance of StreamingModes from a JSON string""" 60 | return cls.from_dict(json.loads(json_str)) 61 | 62 | def to_dict(self) -> Dict[str, Any]: 63 | """Return the dictionary representation of the model using alias. 64 | 65 | This has the following differences from calling pydantic's 66 | `self.model_dump(by_alias=True)`: 67 | 68 | * `None` is only added to the output dict for nullable fields that 69 | were set at model initialization. Other fields with value `None` 70 | are ignored. 71 | """ 72 | _dict = self.model_dump( 73 | by_alias=True, 74 | exclude={ 75 | }, 76 | exclude_none=True, 77 | ) 78 | return _dict 79 | 80 | @classmethod 81 | def from_dict(cls, obj: Dict) -> Self: 82 | """Create an instance of StreamingModes from a dict""" 83 | if obj is None: 84 | return None 85 | 86 | if not isinstance(obj, dict): 87 | return cls.model_validate(obj) 88 | 89 | _obj = cls.model_validate({ 90 | "values": obj.get("values"), 91 | "custom": obj.get("custom") 92 | }) 93 | return _obj 94 | 95 | 96 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/models/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/models/agent.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Connect Protocol 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.2.2 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, Field, StrictStr 27 | from typing import Any, ClassVar, Dict, List 28 | from agent_workflow_server.generated.models.agent_metadata import AgentMetadata 29 | try: 30 | from typing import Self 31 | except ImportError: 32 | from typing_extensions import Self 33 | 34 | class Agent(BaseModel): 35 | """ 36 | A description of an agent supported by this server 37 | """ # noqa: E501 38 | agent_id: StrictStr = Field(description="Unique identifier of the agent in this server.") 39 | metadata: AgentMetadata 40 | __properties: ClassVar[List[str]] = ["agent_id", "metadata"] 41 | 42 | model_config = { 43 | "populate_by_name": True, 44 | "validate_assignment": True, 45 | "protected_namespaces": (), 46 | } 47 | 48 | 49 | def to_str(self) -> str: 50 | """Returns the string representation of the model using alias""" 51 | return pprint.pformat(self.model_dump(by_alias=True)) 52 | 53 | def to_json(self) -> str: 54 | """Returns the JSON representation of the model using alias""" 55 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 56 | return json.dumps(self.to_dict()) 57 | 58 | @classmethod 59 | def from_json(cls, json_str: str) -> Self: 60 | """Create an instance of Agent from a JSON string""" 61 | return cls.from_dict(json.loads(json_str)) 62 | 63 | def to_dict(self) -> Dict[str, Any]: 64 | """Return the dictionary representation of the model using alias. 65 | 66 | This has the following differences from calling pydantic's 67 | `self.model_dump(by_alias=True)`: 68 | 69 | * `None` is only added to the output dict for nullable fields that 70 | were set at model initialization. Other fields with value `None` 71 | are ignored. 72 | """ 73 | _dict = self.model_dump( 74 | by_alias=True, 75 | exclude={ 76 | }, 77 | exclude_none=True, 78 | ) 79 | # override the default output from pydantic by calling `to_dict()` of metadata 80 | if self.metadata: 81 | _dict['metadata'] = self.metadata.to_dict() 82 | return _dict 83 | 84 | @classmethod 85 | def from_dict(cls, obj: Dict) -> Self: 86 | """Create an instance of Agent from a dict""" 87 | if obj is None: 88 | return None 89 | 90 | if not isinstance(obj, dict): 91 | return cls.model_validate(obj) 92 | 93 | _obj = cls.model_validate({ 94 | "agent_id": obj.get("agent_id"), 95 | "metadata": AgentMetadata.from_dict(obj.get("metadata")) if obj.get("metadata") is not None else None 96 | }) 97 | return _obj 98 | 99 | 100 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/models/agent_acp_descriptor.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Connect Protocol 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.2.2 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict 27 | from typing import Any, ClassVar, Dict, List 28 | from agent_workflow_server.generated.models.agent_acp_spec import AgentACPSpec 29 | from agent_workflow_server.generated.models.agent_metadata import AgentMetadata 30 | try: 31 | from typing import Self 32 | except ImportError: 33 | from typing_extensions import Self 34 | 35 | class AgentACPDescriptor(BaseModel): 36 | """ 37 | Describe all the ACP specs of an agent, including schemas and protocol features. 38 | """ # noqa: E501 39 | metadata: AgentMetadata 40 | specs: AgentACPSpec 41 | __properties: ClassVar[List[str]] = ["metadata", "specs"] 42 | 43 | model_config = { 44 | "populate_by_name": True, 45 | "validate_assignment": True, 46 | "protected_namespaces": (), 47 | } 48 | 49 | 50 | def to_str(self) -> str: 51 | """Returns the string representation of the model using alias""" 52 | return pprint.pformat(self.model_dump(by_alias=True)) 53 | 54 | def to_json(self) -> str: 55 | """Returns the JSON representation of the model using alias""" 56 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 57 | return json.dumps(self.to_dict()) 58 | 59 | @classmethod 60 | def from_json(cls, json_str: str) -> Self: 61 | """Create an instance of AgentACPDescriptor from a JSON string""" 62 | return cls.from_dict(json.loads(json_str)) 63 | 64 | def to_dict(self) -> Dict[str, Any]: 65 | """Return the dictionary representation of the model using alias. 66 | 67 | This has the following differences from calling pydantic's 68 | `self.model_dump(by_alias=True)`: 69 | 70 | * `None` is only added to the output dict for nullable fields that 71 | were set at model initialization. Other fields with value `None` 72 | are ignored. 73 | """ 74 | _dict = self.model_dump( 75 | by_alias=True, 76 | exclude={ 77 | }, 78 | exclude_none=True, 79 | ) 80 | # override the default output from pydantic by calling `to_dict()` of metadata 81 | if self.metadata: 82 | _dict['metadata'] = self.metadata.to_dict() 83 | # override the default output from pydantic by calling `to_dict()` of specs 84 | if self.specs: 85 | _dict['specs'] = self.specs.to_dict() 86 | return _dict 87 | 88 | @classmethod 89 | def from_dict(cls, obj: Dict) -> Self: 90 | """Create an instance of AgentACPDescriptor from a dict""" 91 | if obj is None: 92 | return None 93 | 94 | if not isinstance(obj, dict): 95 | return cls.model_validate(obj) 96 | 97 | _obj = cls.model_validate({ 98 | "metadata": AgentMetadata.from_dict(obj.get("metadata")) if obj.get("metadata") is not None else None, 99 | "specs": AgentACPSpec.from_dict(obj.get("specs")) if obj.get("specs") is not None else None 100 | }) 101 | return _obj 102 | 103 | 104 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/models/agent_acp_spec_interrupts_inner.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Connect Protocol 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.2.2 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, Field, StrictStr 27 | from typing import Any, ClassVar, Dict, List 28 | try: 29 | from typing import Self 30 | except ImportError: 31 | from typing_extensions import Self 32 | 33 | class AgentACPSpecInterruptsInner(BaseModel): 34 | """ 35 | AgentACPSpecInterruptsInner 36 | """ # noqa: E501 37 | interrupt_type: StrictStr = Field(description="Name of this interrupt type. Needs to be unique in the list of interrupts.") 38 | interrupt_payload: Dict[str, Any] = Field(description="This object contains an instance of an OpenAPI schema object, formatted as per the OpenAPI specs: https://spec.openapis.org/oas/v3.1.1.html#schema-object") 39 | resume_payload: Dict[str, Any] = Field(description="This object contains an instance of an OpenAPI schema object, formatted as per the OpenAPI specs: https://spec.openapis.org/oas/v3.1.1.html#schema-object") 40 | __properties: ClassVar[List[str]] = ["interrupt_type", "interrupt_payload", "resume_payload"] 41 | 42 | model_config = { 43 | "populate_by_name": True, 44 | "validate_assignment": True, 45 | "protected_namespaces": (), 46 | } 47 | 48 | 49 | def to_str(self) -> str: 50 | """Returns the string representation of the model using alias""" 51 | return pprint.pformat(self.model_dump(by_alias=True)) 52 | 53 | def to_json(self) -> str: 54 | """Returns the JSON representation of the model using alias""" 55 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 56 | return json.dumps(self.to_dict()) 57 | 58 | @classmethod 59 | def from_json(cls, json_str: str) -> Self: 60 | """Create an instance of AgentACPSpecInterruptsInner from a JSON string""" 61 | return cls.from_dict(json.loads(json_str)) 62 | 63 | def to_dict(self) -> Dict[str, Any]: 64 | """Return the dictionary representation of the model using alias. 65 | 66 | This has the following differences from calling pydantic's 67 | `self.model_dump(by_alias=True)`: 68 | 69 | * `None` is only added to the output dict for nullable fields that 70 | were set at model initialization. Other fields with value `None` 71 | are ignored. 72 | """ 73 | _dict = self.model_dump( 74 | by_alias=True, 75 | exclude={ 76 | }, 77 | exclude_none=True, 78 | ) 79 | return _dict 80 | 81 | @classmethod 82 | def from_dict(cls, obj: Dict) -> Self: 83 | """Create an instance of AgentACPSpecInterruptsInner from a dict""" 84 | if obj is None: 85 | return None 86 | 87 | if not isinstance(obj, dict): 88 | return cls.model_validate(obj) 89 | 90 | _obj = cls.model_validate({ 91 | "interrupt_type": obj.get("interrupt_type"), 92 | "interrupt_payload": obj.get("interrupt_payload"), 93 | "resume_payload": obj.get("resume_payload") 94 | }) 95 | return _obj 96 | 97 | 98 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/models/agent_metadata.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Connect Protocol 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.2.2 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, Field, StrictStr 27 | from typing import Any, ClassVar, Dict, List 28 | from agent_workflow_server.generated.models.agent_ref import AgentRef 29 | try: 30 | from typing import Self 31 | except ImportError: 32 | from typing_extensions import Self 33 | 34 | class AgentMetadata(BaseModel): 35 | """ 36 | Basic information associated to the agent 37 | """ # noqa: E501 38 | ref: AgentRef 39 | description: StrictStr = Field(description="Description of this agent, which should include what the intended use is, what tasks it accomplishes and how uses input and configs to produce the output and any other side effect") 40 | __properties: ClassVar[List[str]] = ["ref", "description"] 41 | 42 | model_config = { 43 | "populate_by_name": True, 44 | "validate_assignment": True, 45 | "protected_namespaces": (), 46 | } 47 | 48 | 49 | def to_str(self) -> str: 50 | """Returns the string representation of the model using alias""" 51 | return pprint.pformat(self.model_dump(by_alias=True)) 52 | 53 | def to_json(self) -> str: 54 | """Returns the JSON representation of the model using alias""" 55 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 56 | return json.dumps(self.to_dict()) 57 | 58 | @classmethod 59 | def from_json(cls, json_str: str) -> Self: 60 | """Create an instance of AgentMetadata from a JSON string""" 61 | return cls.from_dict(json.loads(json_str)) 62 | 63 | def to_dict(self) -> Dict[str, Any]: 64 | """Return the dictionary representation of the model using alias. 65 | 66 | This has the following differences from calling pydantic's 67 | `self.model_dump(by_alias=True)`: 68 | 69 | * `None` is only added to the output dict for nullable fields that 70 | were set at model initialization. Other fields with value `None` 71 | are ignored. 72 | """ 73 | _dict = self.model_dump( 74 | by_alias=True, 75 | exclude={ 76 | }, 77 | exclude_none=True, 78 | ) 79 | # override the default output from pydantic by calling `to_dict()` of ref 80 | if self.ref: 81 | _dict['ref'] = self.ref.to_dict() 82 | return _dict 83 | 84 | @classmethod 85 | def from_dict(cls, obj: Dict) -> Self: 86 | """Create an instance of AgentMetadata from a dict""" 87 | if obj is None: 88 | return None 89 | 90 | if not isinstance(obj, dict): 91 | return cls.model_validate(obj) 92 | 93 | _obj = cls.model_validate({ 94 | "ref": AgentRef.from_dict(obj.get("ref")) if obj.get("ref") is not None else None, 95 | "description": obj.get("description") 96 | }) 97 | return _obj 98 | 99 | 100 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/models/agent_ref.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Connect Protocol 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.2.2 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, Field, StrictStr 27 | from typing import Any, ClassVar, Dict, List, Optional 28 | try: 29 | from typing import Self 30 | except ImportError: 31 | from typing_extensions import Self 32 | 33 | class AgentRef(BaseModel): 34 | """ 35 | Reference to an Agent Record in the Agent Directory, it includes name, version and a locator. 36 | """ # noqa: E501 37 | name: StrictStr = Field(description="Name of the agent that identifies the agent in its record") 38 | version: StrictStr = Field(description="Version of the agent in its record. Should be formatted according to semantic versioning (https://semver.org)") 39 | url: Optional[StrictStr] = Field(default=None, description="URL of the record. Can be a network location, i.e. an entry in the Agent Directory or a file.") 40 | __properties: ClassVar[List[str]] = ["name", "version", "url"] 41 | 42 | model_config = { 43 | "populate_by_name": True, 44 | "validate_assignment": True, 45 | "protected_namespaces": (), 46 | } 47 | 48 | 49 | def to_str(self) -> str: 50 | """Returns the string representation of the model using alias""" 51 | return pprint.pformat(self.model_dump(by_alias=True)) 52 | 53 | def to_json(self) -> str: 54 | """Returns the JSON representation of the model using alias""" 55 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 56 | return json.dumps(self.to_dict()) 57 | 58 | @classmethod 59 | def from_json(cls, json_str: str) -> Self: 60 | """Create an instance of AgentRef from a JSON string""" 61 | return cls.from_dict(json.loads(json_str)) 62 | 63 | def to_dict(self) -> Dict[str, Any]: 64 | """Return the dictionary representation of the model using alias. 65 | 66 | This has the following differences from calling pydantic's 67 | `self.model_dump(by_alias=True)`: 68 | 69 | * `None` is only added to the output dict for nullable fields that 70 | were set at model initialization. Other fields with value `None` 71 | are ignored. 72 | """ 73 | _dict = self.model_dump( 74 | by_alias=True, 75 | exclude={ 76 | }, 77 | exclude_none=True, 78 | ) 79 | return _dict 80 | 81 | @classmethod 82 | def from_dict(cls, obj: Dict) -> Self: 83 | """Create an instance of AgentRef from a dict""" 84 | if obj is None: 85 | return None 86 | 87 | if not isinstance(obj, dict): 88 | return cls.model_validate(obj) 89 | 90 | _obj = cls.model_validate({ 91 | "name": obj.get("name"), 92 | "version": obj.get("version"), 93 | "url": obj.get("url") 94 | }) 95 | return _obj 96 | 97 | 98 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/models/agent_search_request.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Connect Protocol 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.2.2 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, Field, StrictStr 27 | from typing import Any, ClassVar, Dict, List, Optional 28 | from typing_extensions import Annotated 29 | try: 30 | from typing import Self 31 | except ImportError: 32 | from typing_extensions import Self 33 | 34 | class AgentSearchRequest(BaseModel): 35 | """ 36 | Payload for listing agents. 37 | """ # noqa: E501 38 | name: Optional[StrictStr] = Field(default=None, description="Match all agents with the name specified.") 39 | version: Optional[StrictStr] = Field(default=None, description="Match all agents with the version specified. Formatted according to semantic versioning (https://semver.org)") 40 | limit: Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]] = Field(default=10, description="Maximum number to return.") 41 | offset: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=0, description="Offset to start from.") 42 | __properties: ClassVar[List[str]] = ["name", "version", "limit", "offset"] 43 | 44 | model_config = { 45 | "populate_by_name": True, 46 | "validate_assignment": True, 47 | "protected_namespaces": (), 48 | } 49 | 50 | 51 | def to_str(self) -> str: 52 | """Returns the string representation of the model using alias""" 53 | return pprint.pformat(self.model_dump(by_alias=True)) 54 | 55 | def to_json(self) -> str: 56 | """Returns the JSON representation of the model using alias""" 57 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 58 | return json.dumps(self.to_dict()) 59 | 60 | @classmethod 61 | def from_json(cls, json_str: str) -> Self: 62 | """Create an instance of AgentSearchRequest from a JSON string""" 63 | return cls.from_dict(json.loads(json_str)) 64 | 65 | def to_dict(self) -> Dict[str, Any]: 66 | """Return the dictionary representation of the model using alias. 67 | 68 | This has the following differences from calling pydantic's 69 | `self.model_dump(by_alias=True)`: 70 | 71 | * `None` is only added to the output dict for nullable fields that 72 | were set at model initialization. Other fields with value `None` 73 | are ignored. 74 | """ 75 | _dict = self.model_dump( 76 | by_alias=True, 77 | exclude={ 78 | }, 79 | exclude_none=True, 80 | ) 81 | return _dict 82 | 83 | @classmethod 84 | def from_dict(cls, obj: Dict) -> Self: 85 | """Create an instance of AgentSearchRequest from a dict""" 86 | if obj is None: 87 | return None 88 | 89 | if not isinstance(obj, dict): 90 | return cls.model_validate(obj) 91 | 92 | _obj = cls.model_validate({ 93 | "name": obj.get("name"), 94 | "version": obj.get("version"), 95 | "limit": obj.get("limit") if obj.get("limit") is not None else 10, 96 | "offset": obj.get("offset") if obj.get("offset") is not None else 0 97 | }) 98 | return _obj 99 | 100 | 101 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/models/config.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Connect Protocol 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.2.2 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr 27 | from typing import Any, ClassVar, Dict, List, Optional 28 | try: 29 | from typing import Self 30 | except ImportError: 31 | from typing_extensions import Self 32 | 33 | class Config(BaseModel): 34 | """ 35 | The configuration for the agent. 36 | """ # noqa: E501 37 | tags: Optional[List[StrictStr]] = None 38 | recursion_limit: Optional[StrictInt] = None 39 | configurable: Optional[Any] = Field(default=None, description="The configuration for this agent. The schema is described in agent ACP descriptor under 'spec.config'. If missing, default values are used.") 40 | __properties: ClassVar[List[str]] = ["tags", "recursion_limit", "configurable"] 41 | 42 | model_config = { 43 | "populate_by_name": True, 44 | "validate_assignment": True, 45 | "protected_namespaces": (), 46 | } 47 | 48 | 49 | def to_str(self) -> str: 50 | """Returns the string representation of the model using alias""" 51 | return pprint.pformat(self.model_dump(by_alias=True)) 52 | 53 | def to_json(self) -> str: 54 | """Returns the JSON representation of the model using alias""" 55 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 56 | return json.dumps(self.to_dict()) 57 | 58 | @classmethod 59 | def from_json(cls, json_str: str) -> Self: 60 | """Create an instance of Config from a JSON string""" 61 | return cls.from_dict(json.loads(json_str)) 62 | 63 | def to_dict(self) -> Dict[str, Any]: 64 | """Return the dictionary representation of the model using alias. 65 | 66 | This has the following differences from calling pydantic's 67 | `self.model_dump(by_alias=True)`: 68 | 69 | * `None` is only added to the output dict for nullable fields that 70 | were set at model initialization. Other fields with value `None` 71 | are ignored. 72 | """ 73 | _dict = self.model_dump( 74 | by_alias=True, 75 | exclude={ 76 | }, 77 | exclude_none=True, 78 | ) 79 | # set to None if configurable (nullable) is None 80 | # and model_fields_set contains the field 81 | if self.configurable is None and "configurable" in self.model_fields_set: 82 | _dict['configurable'] = None 83 | 84 | return _dict 85 | 86 | @classmethod 87 | def from_dict(cls, obj: Dict) -> Self: 88 | """Create an instance of Config from a dict""" 89 | if obj is None: 90 | return None 91 | 92 | if not isinstance(obj, dict): 93 | return cls.model_validate(obj) 94 | 95 | _obj = cls.model_validate({ 96 | "tags": obj.get("tags"), 97 | "recursion_limit": obj.get("recursion_limit"), 98 | "configurable": obj.get("configurable") 99 | }) 100 | return _obj 101 | 102 | 103 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/models/custom_run_result_update.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Connect Protocol 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.2.2 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator 27 | from typing import Any, ClassVar, Dict, List, Optional 28 | from agent_workflow_server.generated.models.run_status import RunStatus 29 | try: 30 | from typing import Self 31 | except ImportError: 32 | from typing_extensions import Self 33 | 34 | class CustomRunResultUpdate(BaseModel): 35 | """ 36 | Object holding a custom defined update of the agent result during streaming. 37 | """ # noqa: E501 38 | type: StrictStr 39 | run_id: Optional[StrictStr] = Field(default=None, description="The ID of the run.") 40 | status: RunStatus = Field(description="Status of the Run when this result was generated") 41 | update: Dict[str, Any] = Field(description="An update in the SSE event streaming where streaming mode is set to custom. The schema is described in agent ACP descriptor under 'spec.custom_streaming_update'.") 42 | __properties: ClassVar[List[str]] = ["type", "run_id", "status", "update"] 43 | 44 | @field_validator('type') 45 | def type_validate_enum(cls, value): 46 | """Validates the enum""" 47 | if value not in ('custom',): 48 | raise ValueError("must be one of enum values ('custom')") 49 | return value 50 | 51 | model_config = { 52 | "populate_by_name": True, 53 | "validate_assignment": True, 54 | "protected_namespaces": (), 55 | } 56 | 57 | 58 | def to_str(self) -> str: 59 | """Returns the string representation of the model using alias""" 60 | return pprint.pformat(self.model_dump(by_alias=True)) 61 | 62 | def to_json(self) -> str: 63 | """Returns the JSON representation of the model using alias""" 64 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 65 | return json.dumps(self.to_dict()) 66 | 67 | @classmethod 68 | def from_json(cls, json_str: str) -> Self: 69 | """Create an instance of CustomRunResultUpdate from a JSON string""" 70 | return cls.from_dict(json.loads(json_str)) 71 | 72 | def to_dict(self) -> Dict[str, Any]: 73 | """Return the dictionary representation of the model using alias. 74 | 75 | This has the following differences from calling pydantic's 76 | `self.model_dump(by_alias=True)`: 77 | 78 | * `None` is only added to the output dict for nullable fields that 79 | were set at model initialization. Other fields with value `None` 80 | are ignored. 81 | """ 82 | _dict = self.model_dump( 83 | by_alias=True, 84 | exclude={ 85 | }, 86 | exclude_none=True, 87 | ) 88 | return _dict 89 | 90 | @classmethod 91 | def from_dict(cls, obj: Dict) -> Self: 92 | """Create an instance of CustomRunResultUpdate from a dict""" 93 | if obj is None: 94 | return None 95 | 96 | if not isinstance(obj, dict): 97 | return cls.model_validate(obj) 98 | 99 | _obj = cls.model_validate({ 100 | "type": obj.get("type"), 101 | "run_id": obj.get("run_id"), 102 | "status": obj.get("status"), 103 | "update": obj.get("update") 104 | }) 105 | return _obj 106 | 107 | 108 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/models/extra_models.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | from pydantic import BaseModel 7 | 8 | class TokenModel(BaseModel): 9 | """Defines a token model.""" 10 | 11 | sub: str 12 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/models/message.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Connect Protocol 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.2.2 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, Field, StrictStr 27 | from typing import Any, ClassVar, Dict, List, Optional 28 | from agent_workflow_server.generated.models.content import Content 29 | try: 30 | from typing import Self 31 | except ImportError: 32 | from typing_extensions import Self 33 | 34 | class Message(BaseModel): 35 | """ 36 | Message 37 | """ # noqa: E501 38 | role: StrictStr = Field(description="The role of the message.") 39 | content: Content 40 | id: Optional[StrictStr] = Field(default=None, description="The ID of the message.") 41 | metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata of the message.") 42 | __properties: ClassVar[List[str]] = ["role", "content", "id", "metadata"] 43 | 44 | model_config = { 45 | "populate_by_name": True, 46 | "validate_assignment": True, 47 | "protected_namespaces": (), 48 | } 49 | 50 | 51 | def to_str(self) -> str: 52 | """Returns the string representation of the model using alias""" 53 | return pprint.pformat(self.model_dump(by_alias=True)) 54 | 55 | def to_json(self) -> str: 56 | """Returns the JSON representation of the model using alias""" 57 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 58 | return json.dumps(self.to_dict()) 59 | 60 | @classmethod 61 | def from_json(cls, json_str: str) -> Self: 62 | """Create an instance of Message from a JSON string""" 63 | return cls.from_dict(json.loads(json_str)) 64 | 65 | def to_dict(self) -> Dict[str, Any]: 66 | """Return the dictionary representation of the model using alias. 67 | 68 | This has the following differences from calling pydantic's 69 | `self.model_dump(by_alias=True)`: 70 | 71 | * `None` is only added to the output dict for nullable fields that 72 | were set at model initialization. Other fields with value `None` 73 | are ignored. 74 | """ 75 | _dict = self.model_dump( 76 | by_alias=True, 77 | exclude={ 78 | }, 79 | exclude_none=True, 80 | ) 81 | # override the default output from pydantic by calling `to_dict()` of content 82 | if self.content: 83 | _dict['content'] = self.content.to_dict() 84 | return _dict 85 | 86 | @classmethod 87 | def from_dict(cls, obj: Dict) -> Self: 88 | """Create an instance of Message from a dict""" 89 | if obj is None: 90 | return None 91 | 92 | if not isinstance(obj, dict): 93 | return cls.model_validate(obj) 94 | 95 | _obj = cls.model_validate({ 96 | "role": obj.get("role"), 97 | "content": Content.from_dict(obj.get("content")) if obj.get("content") is not None else None, 98 | "id": obj.get("id"), 99 | "metadata": obj.get("metadata") 100 | }) 101 | return _obj 102 | 103 | 104 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/models/message_any_block.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Connect Protocol 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.2.2 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, StrictStr 27 | from typing import Any, ClassVar, Dict, List, Optional 28 | try: 29 | from typing import Self 30 | except ImportError: 31 | from typing_extensions import Self 32 | 33 | class MessageAnyBlock(BaseModel): 34 | """ 35 | MessageAnyBlock 36 | """ # noqa: E501 37 | type: StrictStr 38 | metadata: Optional[Dict[str, Any]] = None 39 | __properties: ClassVar[List[str]] = ["type", "metadata"] 40 | 41 | model_config = { 42 | "populate_by_name": True, 43 | "validate_assignment": True, 44 | "protected_namespaces": (), 45 | } 46 | 47 | 48 | def to_str(self) -> str: 49 | """Returns the string representation of the model using alias""" 50 | return pprint.pformat(self.model_dump(by_alias=True)) 51 | 52 | def to_json(self) -> str: 53 | """Returns the JSON representation of the model using alias""" 54 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 55 | return json.dumps(self.to_dict()) 56 | 57 | @classmethod 58 | def from_json(cls, json_str: str) -> Self: 59 | """Create an instance of MessageAnyBlock from a JSON string""" 60 | return cls.from_dict(json.loads(json_str)) 61 | 62 | def to_dict(self) -> Dict[str, Any]: 63 | """Return the dictionary representation of the model using alias. 64 | 65 | This has the following differences from calling pydantic's 66 | `self.model_dump(by_alias=True)`: 67 | 68 | * `None` is only added to the output dict for nullable fields that 69 | were set at model initialization. Other fields with value `None` 70 | are ignored. 71 | """ 72 | _dict = self.model_dump( 73 | by_alias=True, 74 | exclude={ 75 | }, 76 | exclude_none=True, 77 | ) 78 | return _dict 79 | 80 | @classmethod 81 | def from_dict(cls, obj: Dict) -> Self: 82 | """Create an instance of MessageAnyBlock from a dict""" 83 | if obj is None: 84 | return None 85 | 86 | if not isinstance(obj, dict): 87 | return cls.model_validate(obj) 88 | 89 | _obj = cls.model_validate({ 90 | "type": obj.get("type"), 91 | "metadata": obj.get("metadata") 92 | }) 93 | return _obj 94 | 95 | 96 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/models/message_text_block.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Connect Protocol 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.2.2 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, StrictStr 27 | from typing import Any, ClassVar, Dict, List, Optional 28 | try: 29 | from typing import Self 30 | except ImportError: 31 | from typing_extensions import Self 32 | 33 | class MessageTextBlock(BaseModel): 34 | """ 35 | MessageTextBlock 36 | """ # noqa: E501 37 | text: StrictStr 38 | type: Optional[Any] 39 | metadata: Optional[Dict[str, Any]] = None 40 | __properties: ClassVar[List[str]] = ["text", "type", "metadata"] 41 | 42 | model_config = { 43 | "populate_by_name": True, 44 | "validate_assignment": True, 45 | "protected_namespaces": (), 46 | } 47 | 48 | 49 | def to_str(self) -> str: 50 | """Returns the string representation of the model using alias""" 51 | return pprint.pformat(self.model_dump(by_alias=True)) 52 | 53 | def to_json(self) -> str: 54 | """Returns the JSON representation of the model using alias""" 55 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 56 | return json.dumps(self.to_dict()) 57 | 58 | @classmethod 59 | def from_json(cls, json_str: str) -> Self: 60 | """Create an instance of MessageTextBlock from a JSON string""" 61 | return cls.from_dict(json.loads(json_str)) 62 | 63 | def to_dict(self) -> Dict[str, Any]: 64 | """Return the dictionary representation of the model using alias. 65 | 66 | This has the following differences from calling pydantic's 67 | `self.model_dump(by_alias=True)`: 68 | 69 | * `None` is only added to the output dict for nullable fields that 70 | were set at model initialization. Other fields with value `None` 71 | are ignored. 72 | """ 73 | _dict = self.model_dump( 74 | by_alias=True, 75 | exclude={ 76 | }, 77 | exclude_none=True, 78 | ) 79 | # set to None if type (nullable) is None 80 | # and model_fields_set contains the field 81 | if self.type is None and "type" in self.model_fields_set: 82 | _dict['type'] = None 83 | 84 | return _dict 85 | 86 | @classmethod 87 | def from_dict(cls, obj: Dict) -> Self: 88 | """Create an instance of MessageTextBlock from a dict""" 89 | if obj is None: 90 | return None 91 | 92 | if not isinstance(obj, dict): 93 | return cls.model_validate(obj) 94 | 95 | _obj = cls.model_validate({ 96 | "text": obj.get("text"), 97 | "type": obj.get("type"), 98 | "metadata": obj.get("metadata") 99 | }) 100 | return _obj 101 | 102 | 103 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/models/run.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Connect Protocol 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.2.2 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from datetime import datetime 27 | from pydantic import BaseModel, ConfigDict, Field, StrictStr 28 | from typing import Any, ClassVar, Dict, List, Optional 29 | from agent_workflow_server.generated.models.run_status import RunStatus 30 | try: 31 | from typing import Self 32 | except ImportError: 33 | from typing_extensions import Self 34 | 35 | class Run(BaseModel): 36 | """ 37 | Holds common information of a run 38 | """ # noqa: E501 39 | run_id: StrictStr = Field(description="The ID of the run.") 40 | thread_id: Optional[StrictStr] = Field(default=None, description="Optional Thread ID wher the Run belongs to. This is populated only for runs on agents agents supporting Threads.") 41 | agent_id: StrictStr = Field(description="The agent that was used for this run.") 42 | created_at: datetime = Field(description="The time the run was created.") 43 | updated_at: datetime = Field(description="The last time the run was updated.") 44 | status: RunStatus = Field(description="The status of the run. One of 'pending', 'error', 'success', 'timeout', 'interrupted'.") 45 | __properties: ClassVar[List[str]] = ["run_id", "thread_id", "agent_id", "created_at", "updated_at", "status"] 46 | 47 | model_config = { 48 | "populate_by_name": True, 49 | "validate_assignment": True, 50 | "protected_namespaces": (), 51 | } 52 | 53 | 54 | def to_str(self) -> str: 55 | """Returns the string representation of the model using alias""" 56 | return pprint.pformat(self.model_dump(by_alias=True)) 57 | 58 | def to_json(self) -> str: 59 | """Returns the JSON representation of the model using alias""" 60 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 61 | return json.dumps(self.to_dict()) 62 | 63 | @classmethod 64 | def from_json(cls, json_str: str) -> Self: 65 | """Create an instance of Run from a JSON string""" 66 | return cls.from_dict(json.loads(json_str)) 67 | 68 | def to_dict(self) -> Dict[str, Any]: 69 | """Return the dictionary representation of the model using alias. 70 | 71 | This has the following differences from calling pydantic's 72 | `self.model_dump(by_alias=True)`: 73 | 74 | * `None` is only added to the output dict for nullable fields that 75 | were set at model initialization. Other fields with value `None` 76 | are ignored. 77 | """ 78 | _dict = self.model_dump( 79 | by_alias=True, 80 | exclude={ 81 | }, 82 | exclude_none=True, 83 | ) 84 | return _dict 85 | 86 | @classmethod 87 | def from_dict(cls, obj: Dict) -> Self: 88 | """Create an instance of Run from a dict""" 89 | if obj is None: 90 | return None 91 | 92 | if not isinstance(obj, dict): 93 | return cls.model_validate(obj) 94 | 95 | _obj = cls.model_validate({ 96 | "run_id": obj.get("run_id"), 97 | "thread_id": obj.get("thread_id"), 98 | "agent_id": obj.get("agent_id"), 99 | "created_at": obj.get("created_at"), 100 | "updated_at": obj.get("updated_at"), 101 | "status": obj.get("status") 102 | }) 103 | return _obj 104 | 105 | 106 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/models/run_error.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Connect Protocol 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.2.2 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator 27 | from typing import Any, ClassVar, Dict, List 28 | try: 29 | from typing import Self 30 | except ImportError: 31 | from typing_extensions import Self 32 | 33 | class RunError(BaseModel): 34 | """ 35 | Run terminated with an error 36 | """ # noqa: E501 37 | type: StrictStr 38 | run_id: StrictStr = Field(description="The ID of the run.") 39 | errcode: StrictInt = Field(description="code of the error") 40 | description: StrictStr = Field(description="description of the error") 41 | __properties: ClassVar[List[str]] = ["type", "run_id", "errcode", "description"] 42 | 43 | @field_validator('type') 44 | def type_validate_enum(cls, value): 45 | """Validates the enum""" 46 | if value not in ('error',): 47 | raise ValueError("must be one of enum values ('error')") 48 | return value 49 | 50 | model_config = { 51 | "populate_by_name": True, 52 | "validate_assignment": True, 53 | "protected_namespaces": (), 54 | } 55 | 56 | 57 | def to_str(self) -> str: 58 | """Returns the string representation of the model using alias""" 59 | return pprint.pformat(self.model_dump(by_alias=True)) 60 | 61 | def to_json(self) -> str: 62 | """Returns the JSON representation of the model using alias""" 63 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 64 | return json.dumps(self.to_dict()) 65 | 66 | @classmethod 67 | def from_json(cls, json_str: str) -> Self: 68 | """Create an instance of RunError from a JSON string""" 69 | return cls.from_dict(json.loads(json_str)) 70 | 71 | def to_dict(self) -> Dict[str, Any]: 72 | """Return the dictionary representation of the model using alias. 73 | 74 | This has the following differences from calling pydantic's 75 | `self.model_dump(by_alias=True)`: 76 | 77 | * `None` is only added to the output dict for nullable fields that 78 | were set at model initialization. Other fields with value `None` 79 | are ignored. 80 | """ 81 | _dict = self.model_dump( 82 | by_alias=True, 83 | exclude={ 84 | }, 85 | exclude_none=True, 86 | ) 87 | return _dict 88 | 89 | @classmethod 90 | def from_dict(cls, obj: Dict) -> Self: 91 | """Create an instance of RunError from a dict""" 92 | if obj is None: 93 | return None 94 | 95 | if not isinstance(obj, dict): 96 | return cls.model_validate(obj) 97 | 98 | _obj = cls.model_validate({ 99 | "type": obj.get("type"), 100 | "run_id": obj.get("run_id"), 101 | "errcode": obj.get("errcode"), 102 | "description": obj.get("description") 103 | }) 104 | return _obj 105 | 106 | 107 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/models/run_interrupt.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Connect Protocol 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.2.2 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator 27 | from typing import Any, ClassVar, Dict, List, Optional 28 | try: 29 | from typing import Self 30 | except ImportError: 31 | from typing_extensions import Self 32 | 33 | class RunInterrupt(BaseModel): 34 | """ 35 | Interrupt occurred during a Run 36 | """ # noqa: E501 37 | type: StrictStr 38 | interrupt: Optional[Any] = Field(description="This schema describes the interrupt payload. Actual schema describes a polimorphic object, which means a schema structured with `oneOf` and `discriminator`. The discriminator is the `interrupt_type`, while the schemas will be the ones defined in the agent spec under `interrupts`/`interrupt_payload` For example: oneOf: - $ref: '#/components/schemas/ApprovalInterruptPayload' - $ref: '#/components/schemas/QuestionInterruptPayload' discriminator: propertyName: interruput_type mapping: approval: '#/components/schemas/ApprovalInterruptPayload' question: '#/components/schemas/QuestionInterruptPayload'") 39 | __properties: ClassVar[List[str]] = ["type", "interrupt"] 40 | 41 | @field_validator('type') 42 | def type_validate_enum(cls, value): 43 | """Validates the enum""" 44 | if value not in ('interrupt',): 45 | raise ValueError("must be one of enum values ('interrupt')") 46 | return value 47 | 48 | model_config = { 49 | "populate_by_name": True, 50 | "validate_assignment": True, 51 | "protected_namespaces": (), 52 | } 53 | 54 | 55 | def to_str(self) -> str: 56 | """Returns the string representation of the model using alias""" 57 | return pprint.pformat(self.model_dump(by_alias=True)) 58 | 59 | def to_json(self) -> str: 60 | """Returns the JSON representation of the model using alias""" 61 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 62 | return json.dumps(self.to_dict()) 63 | 64 | @classmethod 65 | def from_json(cls, json_str: str) -> Self: 66 | """Create an instance of RunInterrupt from a JSON string""" 67 | return cls.from_dict(json.loads(json_str)) 68 | 69 | def to_dict(self) -> Dict[str, Any]: 70 | """Return the dictionary representation of the model using alias. 71 | 72 | This has the following differences from calling pydantic's 73 | `self.model_dump(by_alias=True)`: 74 | 75 | * `None` is only added to the output dict for nullable fields that 76 | were set at model initialization. Other fields with value `None` 77 | are ignored. 78 | """ 79 | _dict = self.model_dump( 80 | by_alias=True, 81 | exclude={ 82 | }, 83 | exclude_none=True, 84 | ) 85 | # set to None if interrupt (nullable) is None 86 | # and model_fields_set contains the field 87 | if self.interrupt is None and "interrupt" in self.model_fields_set: 88 | _dict['interrupt'] = None 89 | 90 | return _dict 91 | 92 | @classmethod 93 | def from_dict(cls, obj: Dict) -> Self: 94 | """Create an instance of RunInterrupt from a dict""" 95 | if obj is None: 96 | return None 97 | 98 | if not isinstance(obj, dict): 99 | return cls.model_validate(obj) 100 | 101 | _obj = cls.model_validate({ 102 | "type": obj.get("type"), 103 | "interrupt": obj.get("interrupt") 104 | }) 105 | return _obj 106 | 107 | 108 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/models/run_output_stream.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Connect Protocol 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.2.2 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator 27 | from typing import Any, ClassVar, Dict, List 28 | from agent_workflow_server.generated.models.stream_event_payload import StreamEventPayload 29 | try: 30 | from typing import Self 31 | except ImportError: 32 | from typing_extensions import Self 33 | 34 | class RunOutputStream(BaseModel): 35 | """ 36 | Server-sent event containing one agent output event. Actual event type is carried inside the data. 37 | """ # noqa: E501 38 | id: StrictStr = Field(description="Unique identifier of the event") 39 | event: StrictStr = Field(description="Event type. This is the constant string `agent_event` to be compatible with SSE spec. The actual type differentiation is done in the event itself.") 40 | data: StreamEventPayload 41 | __properties: ClassVar[List[str]] = ["id", "event", "data"] 42 | 43 | @field_validator('event') 44 | def event_validate_enum(cls, value): 45 | """Validates the enum""" 46 | if value not in ('agent_event',): 47 | raise ValueError("must be one of enum values ('agent_event')") 48 | return value 49 | 50 | model_config = { 51 | "populate_by_name": True, 52 | "validate_assignment": True, 53 | "protected_namespaces": (), 54 | } 55 | 56 | 57 | def to_str(self) -> str: 58 | """Returns the string representation of the model using alias""" 59 | return pprint.pformat(self.model_dump(by_alias=True)) 60 | 61 | def to_json(self) -> str: 62 | """Returns the JSON representation of the model using alias""" 63 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 64 | return json.dumps(self.to_dict()) 65 | 66 | @classmethod 67 | def from_json(cls, json_str: str) -> Self: 68 | """Create an instance of RunOutputStream from a JSON string""" 69 | return cls.from_dict(json.loads(json_str)) 70 | 71 | def to_dict(self) -> Dict[str, Any]: 72 | """Return the dictionary representation of the model using alias. 73 | 74 | This has the following differences from calling pydantic's 75 | `self.model_dump(by_alias=True)`: 76 | 77 | * `None` is only added to the output dict for nullable fields that 78 | were set at model initialization. Other fields with value `None` 79 | are ignored. 80 | """ 81 | _dict = self.model_dump( 82 | by_alias=True, 83 | exclude={ 84 | }, 85 | exclude_none=True, 86 | ) 87 | # override the default output from pydantic by calling `to_dict()` of data 88 | if self.data: 89 | _dict['data'] = self.data.to_dict() 90 | return _dict 91 | 92 | @classmethod 93 | def from_dict(cls, obj: Dict) -> Self: 94 | """Create an instance of RunOutputStream from a dict""" 95 | if obj is None: 96 | return None 97 | 98 | if not isinstance(obj, dict): 99 | return cls.model_validate(obj) 100 | 101 | _obj = cls.model_validate({ 102 | "id": obj.get("id"), 103 | "event": obj.get("event"), 104 | "data": StreamEventPayload.from_dict(obj.get("data")) if obj.get("data") is not None else None 105 | }) 106 | return _obj 107 | 108 | 109 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/models/run_search_request.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Connect Protocol 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.2.2 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, Field, StrictStr 27 | from typing import Any, ClassVar, Dict, List, Optional 28 | from typing_extensions import Annotated 29 | from agent_workflow_server.generated.models.run_status import RunStatus 30 | try: 31 | from typing import Self 32 | except ImportError: 33 | from typing_extensions import Self 34 | 35 | class RunSearchRequest(BaseModel): 36 | """ 37 | Payload for listing runs. 38 | """ # noqa: E501 39 | agent_id: Optional[StrictStr] = Field(default=None, description="Matches all the Runs associated with the specified Agent ID.") 40 | status: Optional[RunStatus] = Field(default=None, description="Matches all the Runs associated with the specified status. One of 'pending', 'error', 'success', 'timeout', 'interrupted'.") 41 | metadata: Optional[Dict[str, Any]] = Field(default=None, description="Matches all threads for which metadata has keys and values equal to those specified in this object.") 42 | limit: Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]] = Field(default=10, description="Maximum number to return.") 43 | offset: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=0, description="Offset to start from.") 44 | __properties: ClassVar[List[str]] = ["agent_id", "status", "metadata", "limit", "offset"] 45 | 46 | model_config = { 47 | "populate_by_name": True, 48 | "validate_assignment": True, 49 | "protected_namespaces": (), 50 | } 51 | 52 | 53 | def to_str(self) -> str: 54 | """Returns the string representation of the model using alias""" 55 | return pprint.pformat(self.model_dump(by_alias=True)) 56 | 57 | def to_json(self) -> str: 58 | """Returns the JSON representation of the model using alias""" 59 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 60 | return json.dumps(self.to_dict()) 61 | 62 | @classmethod 63 | def from_json(cls, json_str: str) -> Self: 64 | """Create an instance of RunSearchRequest from a JSON string""" 65 | return cls.from_dict(json.loads(json_str)) 66 | 67 | def to_dict(self) -> Dict[str, Any]: 68 | """Return the dictionary representation of the model using alias. 69 | 70 | This has the following differences from calling pydantic's 71 | `self.model_dump(by_alias=True)`: 72 | 73 | * `None` is only added to the output dict for nullable fields that 74 | were set at model initialization. Other fields with value `None` 75 | are ignored. 76 | """ 77 | _dict = self.model_dump( 78 | by_alias=True, 79 | exclude={ 80 | }, 81 | exclude_none=True, 82 | ) 83 | return _dict 84 | 85 | @classmethod 86 | def from_dict(cls, obj: Dict) -> Self: 87 | """Create an instance of RunSearchRequest from a dict""" 88 | if obj is None: 89 | return None 90 | 91 | if not isinstance(obj, dict): 92 | return cls.model_validate(obj) 93 | 94 | _obj = cls.model_validate({ 95 | "agent_id": obj.get("agent_id"), 96 | "status": obj.get("status"), 97 | "metadata": obj.get("metadata"), 98 | "limit": obj.get("limit") if obj.get("limit") is not None else 10, 99 | "offset": obj.get("offset") if obj.get("offset") is not None else 0 100 | }) 101 | return _obj 102 | 103 | 104 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/models/run_status.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Connect Protocol 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.2.2 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import json 20 | import pprint 21 | import re # noqa: F401 22 | from enum import Enum 23 | 24 | 25 | 26 | try: 27 | from typing import Self 28 | except ImportError: 29 | from typing_extensions import Self 30 | 31 | 32 | class RunStatus(str, Enum): 33 | """ 34 | RunStatus 35 | """ 36 | 37 | """ 38 | allowed enum values 39 | """ 40 | PENDING = 'pending' 41 | ERROR = 'error' 42 | SUCCESS = 'success' 43 | TIMEOUT = 'timeout' 44 | INTERRUPTED = 'interrupted' 45 | 46 | @classmethod 47 | def from_json(cls, json_str: str) -> Self: 48 | """Create an instance of RunStatus from a JSON string""" 49 | return cls(json.loads(json_str)) 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/models/run_wait_response_stateful.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Connect Protocol 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.2.2 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, Field 27 | from typing import Any, ClassVar, Dict, List, Optional 28 | from agent_workflow_server.generated.models.run_output import RunOutput 29 | from agent_workflow_server.generated.models.run_stateful import RunStateful 30 | try: 31 | from typing import Self 32 | except ImportError: 33 | from typing_extensions import Self 34 | 35 | class RunWaitResponseStateful(BaseModel): 36 | """ 37 | RunWaitResponseStateful 38 | """ # noqa: E501 39 | run: Optional[RunStateful] = Field(default=None, description="The run information.") 40 | output: Optional[RunOutput] = None 41 | __properties: ClassVar[List[str]] = ["run", "output"] 42 | 43 | model_config = { 44 | "populate_by_name": True, 45 | "validate_assignment": True, 46 | "protected_namespaces": (), 47 | } 48 | 49 | 50 | def to_str(self) -> str: 51 | """Returns the string representation of the model using alias""" 52 | return pprint.pformat(self.model_dump(by_alias=True)) 53 | 54 | def to_json(self) -> str: 55 | """Returns the JSON representation of the model using alias""" 56 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 57 | return json.dumps(self.to_dict()) 58 | 59 | @classmethod 60 | def from_json(cls, json_str: str) -> Self: 61 | """Create an instance of RunWaitResponseStateful from a JSON string""" 62 | return cls.from_dict(json.loads(json_str)) 63 | 64 | def to_dict(self) -> Dict[str, Any]: 65 | """Return the dictionary representation of the model using alias. 66 | 67 | This has the following differences from calling pydantic's 68 | `self.model_dump(by_alias=True)`: 69 | 70 | * `None` is only added to the output dict for nullable fields that 71 | were set at model initialization. Other fields with value `None` 72 | are ignored. 73 | """ 74 | _dict = self.model_dump( 75 | by_alias=True, 76 | exclude={ 77 | }, 78 | exclude_none=True, 79 | ) 80 | # override the default output from pydantic by calling `to_dict()` of run 81 | if self.run: 82 | _dict['run'] = self.run.to_dict() 83 | # override the default output from pydantic by calling `to_dict()` of output 84 | if self.output: 85 | _dict['output'] = self.output.to_dict() 86 | return _dict 87 | 88 | @classmethod 89 | def from_dict(cls, obj: Dict) -> Self: 90 | """Create an instance of RunWaitResponseStateful from a dict""" 91 | if obj is None: 92 | return None 93 | 94 | if not isinstance(obj, dict): 95 | return cls.model_validate(obj) 96 | 97 | _obj = cls.model_validate({ 98 | "run": RunStateful.from_dict(obj.get("run")) if obj.get("run") is not None else None, 99 | "output": RunOutput.from_dict(obj.get("output")) if obj.get("output") is not None else None 100 | }) 101 | return _obj 102 | 103 | 104 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/models/run_wait_response_stateless.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Connect Protocol 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.2.2 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, Field 27 | from typing import Any, ClassVar, Dict, List, Optional 28 | from agent_workflow_server.generated.models.run_output import RunOutput 29 | from agent_workflow_server.generated.models.run_stateless import RunStateless 30 | try: 31 | from typing import Self 32 | except ImportError: 33 | from typing_extensions import Self 34 | 35 | class RunWaitResponseStateless(BaseModel): 36 | """ 37 | RunWaitResponseStateless 38 | """ # noqa: E501 39 | run: Optional[RunStateless] = Field(default=None, description="The run information.") 40 | output: Optional[RunOutput] = None 41 | __properties: ClassVar[List[str]] = ["run", "output"] 42 | 43 | model_config = { 44 | "populate_by_name": True, 45 | "validate_assignment": True, 46 | "protected_namespaces": (), 47 | } 48 | 49 | 50 | def to_str(self) -> str: 51 | """Returns the string representation of the model using alias""" 52 | return pprint.pformat(self.model_dump(by_alias=True)) 53 | 54 | def to_json(self) -> str: 55 | """Returns the JSON representation of the model using alias""" 56 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 57 | return json.dumps(self.to_dict()) 58 | 59 | @classmethod 60 | def from_json(cls, json_str: str) -> Self: 61 | """Create an instance of RunWaitResponseStateless from a JSON string""" 62 | return cls.from_dict(json.loads(json_str)) 63 | 64 | def to_dict(self) -> Dict[str, Any]: 65 | """Return the dictionary representation of the model using alias. 66 | 67 | This has the following differences from calling pydantic's 68 | `self.model_dump(by_alias=True)`: 69 | 70 | * `None` is only added to the output dict for nullable fields that 71 | were set at model initialization. Other fields with value `None` 72 | are ignored. 73 | """ 74 | _dict = self.model_dump( 75 | by_alias=True, 76 | exclude={ 77 | }, 78 | exclude_none=True, 79 | ) 80 | # override the default output from pydantic by calling `to_dict()` of run 81 | if self.run: 82 | _dict['run'] = self.run.to_dict() 83 | # override the default output from pydantic by calling `to_dict()` of output 84 | if self.output: 85 | _dict['output'] = self.output.to_dict() 86 | return _dict 87 | 88 | @classmethod 89 | def from_dict(cls, obj: Dict) -> Self: 90 | """Create an instance of RunWaitResponseStateless from a dict""" 91 | if obj is None: 92 | return None 93 | 94 | if not isinstance(obj, dict): 95 | return cls.model_validate(obj) 96 | 97 | _obj = cls.model_validate({ 98 | "run": RunStateless.from_dict(obj.get("run")) if obj.get("run") is not None else None, 99 | "output": RunOutput.from_dict(obj.get("output")) if obj.get("output") is not None else None 100 | }) 101 | return _obj 102 | 103 | 104 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/models/streaming_mode.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Connect Protocol 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.2.2 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import json 20 | import pprint 21 | import re # noqa: F401 22 | from enum import Enum 23 | 24 | 25 | 26 | try: 27 | from typing import Self 28 | except ImportError: 29 | from typing_extensions import Self 30 | 31 | 32 | class StreamingMode(str, Enum): 33 | """ 34 | StreamingMode 35 | """ 36 | 37 | """ 38 | allowed enum values 39 | """ 40 | VALUES = 'values' 41 | CUSTOM = 'custom' 42 | 43 | @classmethod 44 | def from_json(cls, json_str: str) -> Self: 45 | """Create an instance of StreamingMode from a JSON string""" 46 | return cls(json.loads(json_str)) 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/models/streaming_modes.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Connect Protocol 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.2.2 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, Field, StrictBool 27 | from typing import Any, ClassVar, Dict, List, Optional 28 | try: 29 | from typing import Self 30 | except ImportError: 31 | from typing_extensions import Self 32 | 33 | class StreamingModes(BaseModel): 34 | """ 35 | Supported streaming modes. If missing, streaming is not supported. If no mode is supported attempts to stream output will result in an error. 36 | """ # noqa: E501 37 | values: Optional[StrictBool] = Field(default=None, description="This is `true` if the agent supports values streaming. If `false` or missing, values streaming is not supported. Values streaming consists of a stream of objects of type `ValueRunResultUpdate`, where each one sent over the stream fully replace the previous one.") 38 | custom: Optional[StrictBool] = Field(default=None, description="This is `true` if the agent supports custom objects streaming. If `false` or missing, custom streaming is not supported. Custom Objects streaming consists of a stream of object whose schema is specified by the agent ACP descriptor under `specs.custom_streaming_update`.") 39 | __properties: ClassVar[List[str]] = ["values", "custom"] 40 | 41 | model_config = { 42 | "populate_by_name": True, 43 | "validate_assignment": True, 44 | "protected_namespaces": (), 45 | } 46 | 47 | 48 | def to_str(self) -> str: 49 | """Returns the string representation of the model using alias""" 50 | return pprint.pformat(self.model_dump(by_alias=True)) 51 | 52 | def to_json(self) -> str: 53 | """Returns the JSON representation of the model using alias""" 54 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 55 | return json.dumps(self.to_dict()) 56 | 57 | @classmethod 58 | def from_json(cls, json_str: str) -> Self: 59 | """Create an instance of StreamingModes from a JSON string""" 60 | return cls.from_dict(json.loads(json_str)) 61 | 62 | def to_dict(self) -> Dict[str, Any]: 63 | """Return the dictionary representation of the model using alias. 64 | 65 | This has the following differences from calling pydantic's 66 | `self.model_dump(by_alias=True)`: 67 | 68 | * `None` is only added to the output dict for nullable fields that 69 | were set at model initialization. Other fields with value `None` 70 | are ignored. 71 | """ 72 | _dict = self.model_dump( 73 | by_alias=True, 74 | exclude={ 75 | }, 76 | exclude_none=True, 77 | ) 78 | return _dict 79 | 80 | @classmethod 81 | def from_dict(cls, obj: Dict) -> Self: 82 | """Create an instance of StreamingModes from a dict""" 83 | if obj is None: 84 | return None 85 | 86 | if not isinstance(obj, dict): 87 | return cls.model_validate(obj) 88 | 89 | _obj = cls.model_validate({ 90 | "values": obj.get("values"), 91 | "custom": obj.get("custom") 92 | }) 93 | return _obj 94 | 95 | 96 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/models/thread_checkpoint.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Connect Protocol 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.2.2 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, Field, StrictStr 27 | from typing import Any, ClassVar, Dict, List 28 | try: 29 | from typing import Self 30 | except ImportError: 31 | from typing_extensions import Self 32 | 33 | class ThreadCheckpoint(BaseModel): 34 | """ 35 | Structured identifier for a thread checkpoint, ie. an entry in the thread's history. 36 | """ # noqa: E501 37 | checkpoint_id: StrictStr = Field(description="The ID of the checkpoint.") 38 | __properties: ClassVar[List[str]] = ["checkpoint_id"] 39 | 40 | model_config = { 41 | "populate_by_name": True, 42 | "validate_assignment": True, 43 | "protected_namespaces": (), 44 | } 45 | 46 | 47 | def to_str(self) -> str: 48 | """Returns the string representation of the model using alias""" 49 | return pprint.pformat(self.model_dump(by_alias=True)) 50 | 51 | def to_json(self) -> str: 52 | """Returns the JSON representation of the model using alias""" 53 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 54 | return json.dumps(self.to_dict()) 55 | 56 | @classmethod 57 | def from_json(cls, json_str: str) -> Self: 58 | """Create an instance of ThreadCheckpoint from a JSON string""" 59 | return cls.from_dict(json.loads(json_str)) 60 | 61 | def to_dict(self) -> Dict[str, Any]: 62 | """Return the dictionary representation of the model using alias. 63 | 64 | This has the following differences from calling pydantic's 65 | `self.model_dump(by_alias=True)`: 66 | 67 | * `None` is only added to the output dict for nullable fields that 68 | were set at model initialization. Other fields with value `None` 69 | are ignored. 70 | """ 71 | _dict = self.model_dump( 72 | by_alias=True, 73 | exclude={ 74 | }, 75 | exclude_none=True, 76 | ) 77 | return _dict 78 | 79 | @classmethod 80 | def from_dict(cls, obj: Dict) -> Self: 81 | """Create an instance of ThreadCheckpoint from a dict""" 82 | if obj is None: 83 | return None 84 | 85 | if not isinstance(obj, dict): 86 | return cls.model_validate(obj) 87 | 88 | _obj = cls.model_validate({ 89 | "checkpoint_id": obj.get("checkpoint_id") 90 | }) 91 | return _obj 92 | 93 | 94 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/models/thread_create.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Connect Protocol 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.2.2 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator 27 | from typing import Any, ClassVar, Dict, List, Optional 28 | try: 29 | from typing import Self 30 | except ImportError: 31 | from typing_extensions import Self 32 | 33 | class ThreadCreate(BaseModel): 34 | """ 35 | Detail of an empty thread to be created. 36 | """ # noqa: E501 37 | thread_id: Optional[StrictStr] = Field(default=None, description="The ID of the thread. If not provided, a random UUID will be generated.") 38 | metadata: Optional[Dict[str, Any]] = Field(default=None, description="Free form metadata for this thread") 39 | if_exists: Optional[StrictStr] = Field(default='raise', description="How to handle duplicate creation. Must be either 'raise' (raise error if duplicate), or 'do_nothing' (return existing thread).") 40 | __properties: ClassVar[List[str]] = ["thread_id", "metadata", "if_exists"] 41 | 42 | @field_validator('if_exists') 43 | def if_exists_validate_enum(cls, value): 44 | """Validates the enum""" 45 | if value is None: 46 | return value 47 | 48 | if value not in ('raise', 'do_nothing',): 49 | raise ValueError("must be one of enum values ('raise', 'do_nothing')") 50 | return value 51 | 52 | model_config = { 53 | "populate_by_name": True, 54 | "validate_assignment": True, 55 | "protected_namespaces": (), 56 | } 57 | 58 | 59 | def to_str(self) -> str: 60 | """Returns the string representation of the model using alias""" 61 | return pprint.pformat(self.model_dump(by_alias=True)) 62 | 63 | def to_json(self) -> str: 64 | """Returns the JSON representation of the model using alias""" 65 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 66 | return json.dumps(self.to_dict()) 67 | 68 | @classmethod 69 | def from_json(cls, json_str: str) -> Self: 70 | """Create an instance of ThreadCreate from a JSON string""" 71 | return cls.from_dict(json.loads(json_str)) 72 | 73 | def to_dict(self) -> Dict[str, Any]: 74 | """Return the dictionary representation of the model using alias. 75 | 76 | This has the following differences from calling pydantic's 77 | `self.model_dump(by_alias=True)`: 78 | 79 | * `None` is only added to the output dict for nullable fields that 80 | were set at model initialization. Other fields with value `None` 81 | are ignored. 82 | """ 83 | _dict = self.model_dump( 84 | by_alias=True, 85 | exclude={ 86 | }, 87 | exclude_none=True, 88 | ) 89 | return _dict 90 | 91 | @classmethod 92 | def from_dict(cls, obj: Dict) -> Self: 93 | """Create an instance of ThreadCreate from a dict""" 94 | if obj is None: 95 | return None 96 | 97 | if not isinstance(obj, dict): 98 | return cls.model_validate(obj) 99 | 100 | _obj = cls.model_validate({ 101 | "thread_id": obj.get("thread_id"), 102 | "metadata": obj.get("metadata"), 103 | "if_exists": obj.get("if_exists") if obj.get("if_exists") is not None else 'raise' 104 | }) 105 | return _obj 106 | 107 | 108 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/models/thread_search_request.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Connect Protocol 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.2.2 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, Field 27 | from typing import Any, ClassVar, Dict, List, Optional 28 | from typing_extensions import Annotated 29 | from agent_workflow_server.generated.models.thread_status import ThreadStatus 30 | try: 31 | from typing import Self 32 | except ImportError: 33 | from typing_extensions import Self 34 | 35 | class ThreadSearchRequest(BaseModel): 36 | """ 37 | Payload for listing threads. 38 | """ # noqa: E501 39 | metadata: Optional[Dict[str, Any]] = Field(default=None, description="Matches all threads for which metadata has keys and values equal to those specified in this object.") 40 | values: Optional[Dict[str, Any]] = Field(default=None, description="State values to filter on.") 41 | status: Optional[ThreadStatus] = None 42 | limit: Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]] = Field(default=10, description="Maximum number to return.") 43 | offset: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=0, description="Offset to start from.") 44 | __properties: ClassVar[List[str]] = ["metadata", "values", "status", "limit", "offset"] 45 | 46 | model_config = { 47 | "populate_by_name": True, 48 | "validate_assignment": True, 49 | "protected_namespaces": (), 50 | } 51 | 52 | 53 | def to_str(self) -> str: 54 | """Returns the string representation of the model using alias""" 55 | return pprint.pformat(self.model_dump(by_alias=True)) 56 | 57 | def to_json(self) -> str: 58 | """Returns the JSON representation of the model using alias""" 59 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 60 | return json.dumps(self.to_dict()) 61 | 62 | @classmethod 63 | def from_json(cls, json_str: str) -> Self: 64 | """Create an instance of ThreadSearchRequest from a JSON string""" 65 | return cls.from_dict(json.loads(json_str)) 66 | 67 | def to_dict(self) -> Dict[str, Any]: 68 | """Return the dictionary representation of the model using alias. 69 | 70 | This has the following differences from calling pydantic's 71 | `self.model_dump(by_alias=True)`: 72 | 73 | * `None` is only added to the output dict for nullable fields that 74 | were set at model initialization. Other fields with value `None` 75 | are ignored. 76 | """ 77 | _dict = self.model_dump( 78 | by_alias=True, 79 | exclude={ 80 | }, 81 | exclude_none=True, 82 | ) 83 | return _dict 84 | 85 | @classmethod 86 | def from_dict(cls, obj: Dict) -> Self: 87 | """Create an instance of ThreadSearchRequest from a dict""" 88 | if obj is None: 89 | return None 90 | 91 | if not isinstance(obj, dict): 92 | return cls.model_validate(obj) 93 | 94 | _obj = cls.model_validate({ 95 | "metadata": obj.get("metadata"), 96 | "values": obj.get("values"), 97 | "status": obj.get("status"), 98 | "limit": obj.get("limit") if obj.get("limit") is not None else 10, 99 | "offset": obj.get("offset") if obj.get("offset") is not None else 0 100 | }) 101 | return _obj 102 | 103 | 104 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/models/thread_status.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Connect Protocol 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.2.2 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import json 20 | import pprint 21 | import re # noqa: F401 22 | from enum import Enum 23 | 24 | 25 | 26 | try: 27 | from typing import Self 28 | except ImportError: 29 | from typing_extensions import Self 30 | 31 | 32 | class ThreadStatus(str, Enum): 33 | """ 34 | ThreadStatus 35 | """ 36 | 37 | """ 38 | allowed enum values 39 | """ 40 | IDLE = 'idle' 41 | BUSY = 'busy' 42 | INTERRUPTED = 'interrupted' 43 | ERROR = 'error' 44 | 45 | @classmethod 46 | def from_json(cls, json_str: str) -> Self: 47 | """Create an instance of ThreadStatus from a JSON string""" 48 | return cls(json.loads(json_str)) 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/agent_workflow_server/generated/models/value_run_error_update.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | # coding: utf-8 5 | 6 | """ 7 | Agent Connect Protocol 8 | 9 | No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) 10 | 11 | The version of the OpenAPI document: 0.2.2 12 | Generated by OpenAPI Generator (https://openapi-generator.tech) 13 | 14 | Do not edit the class manually. 15 | """ # noqa: E501 16 | 17 | 18 | from __future__ import annotations 19 | import pprint 20 | import re # noqa: F401 21 | import json 22 | 23 | 24 | 25 | 26 | from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator 27 | from typing import Any, ClassVar, Dict, List 28 | from agent_workflow_server.generated.models.run_status import RunStatus 29 | try: 30 | from typing import Self 31 | except ImportError: 32 | from typing_extensions import Self 33 | 34 | class ValueRunErrorUpdate(BaseModel): 35 | """ 36 | Partial result provided as value through streaming. 37 | """ # noqa: E501 38 | type: StrictStr 39 | run_id: StrictStr = Field(description="The ID of the run.") 40 | errcode: StrictInt = Field(description="code of the error") 41 | description: StrictStr = Field(description="description of the error") 42 | status: RunStatus = Field(description="Status of the Run when this result was generated. This is particularly useful when this data structure is used for streaming results. As the server can indicate an interrupt or an error condition while streaming the result.") 43 | __properties: ClassVar[List[str]] = ["type", "run_id", "errcode", "description", "status"] 44 | 45 | @field_validator('type') 46 | def type_validate_enum(cls, value): 47 | """Validates the enum""" 48 | if value not in ('error',): 49 | raise ValueError("must be one of enum values ('error')") 50 | return value 51 | 52 | model_config = { 53 | "populate_by_name": True, 54 | "validate_assignment": True, 55 | "protected_namespaces": (), 56 | } 57 | 58 | 59 | def to_str(self) -> str: 60 | """Returns the string representation of the model using alias""" 61 | return pprint.pformat(self.model_dump(by_alias=True)) 62 | 63 | def to_json(self) -> str: 64 | """Returns the JSON representation of the model using alias""" 65 | # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 66 | return json.dumps(self.to_dict()) 67 | 68 | @classmethod 69 | def from_json(cls, json_str: str) -> Self: 70 | """Create an instance of ValueRunErrorUpdate from a JSON string""" 71 | return cls.from_dict(json.loads(json_str)) 72 | 73 | def to_dict(self) -> Dict[str, Any]: 74 | """Return the dictionary representation of the model using alias. 75 | 76 | This has the following differences from calling pydantic's 77 | `self.model_dump(by_alias=True)`: 78 | 79 | * `None` is only added to the output dict for nullable fields that 80 | were set at model initialization. Other fields with value `None` 81 | are ignored. 82 | """ 83 | _dict = self.model_dump( 84 | by_alias=True, 85 | exclude={ 86 | }, 87 | exclude_none=True, 88 | ) 89 | return _dict 90 | 91 | @classmethod 92 | def from_dict(cls, obj: Dict) -> Self: 93 | """Create an instance of ValueRunErrorUpdate from a dict""" 94 | if obj is None: 95 | return None 96 | 97 | if not isinstance(obj, dict): 98 | return cls.model_validate(obj) 99 | 100 | _obj = cls.model_validate({ 101 | "type": obj.get("type"), 102 | "run_id": obj.get("run_id"), 103 | "errcode": obj.get("errcode"), 104 | "description": obj.get("description"), 105 | "status": obj.get("status") 106 | }) 107 | return _obj 108 | 109 | 110 | -------------------------------------------------------------------------------- /src/agent_workflow_server/logging/logger.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | import logging 5 | import os 6 | 7 | from uvicorn.logging import ColourizedFormatter 8 | 9 | handler = logging.StreamHandler() 10 | colorformatter = ColourizedFormatter( 11 | fmt="%(levelprefix)s %(name)s %(message)s ", use_colors=True 12 | ) 13 | handler.setFormatter(colorformatter) 14 | 15 | CustomLoggerHandler = handler 16 | 17 | LOG_LEVEL = os.getenv("LOG_LEVEL", "INFO").upper() 18 | logging.basicConfig(level=LOG_LEVEL, handlers=[CustomLoggerHandler], force=True) 19 | -------------------------------------------------------------------------------- /src/agent_workflow_server/main.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | import asyncio 4 | import logging 5 | import os 6 | import signal 7 | import sys 8 | 9 | import uvicorn 10 | from dotenv import find_dotenv, load_dotenv 11 | from fastapi import Depends, FastAPI 12 | from fastapi.middleware.cors import CORSMiddleware 13 | 14 | from agent_workflow_server.agents.load import load_agents 15 | from agent_workflow_server.apis.agents import public_router as PublicAgentsApiRouter 16 | from agent_workflow_server.apis.agents import router as AgentsApiRouter 17 | from agent_workflow_server.apis.authentication import ( 18 | authentication_with_api_key, 19 | setup_api_key_auth, 20 | ) 21 | from agent_workflow_server.apis.stateless_runs import router as StatelessRunsApiRouter 22 | from agent_workflow_server.apis.threads import router as ThreadsApiRouter 23 | from agent_workflow_server.apis.threads_runs import router as ThreadRunsApiRouter 24 | from agent_workflow_server.services.queue import start_workers 25 | 26 | load_dotenv(dotenv_path=find_dotenv(usecwd=True)) 27 | 28 | DEFAULT_HOST = "127.0.0.1" 29 | DEFAULT_PORT = 8000 30 | DEFAULT_NUM_WORKERS = 5 31 | DEFAULT_AGENT_MANIFEST_PATH = "manifest.json" 32 | 33 | logger = logging.getLogger(__name__) 34 | 35 | app = FastAPI( 36 | title="Agent Workflow Server", 37 | version="0.1", 38 | ) 39 | 40 | setup_api_key_auth(app) 41 | 42 | app.include_router( 43 | router=AgentsApiRouter, 44 | dependencies=[Depends(authentication_with_api_key)], 45 | ) 46 | app.include_router( 47 | router=PublicAgentsApiRouter, 48 | ) 49 | app.include_router( 50 | router=StatelessRunsApiRouter, 51 | dependencies=[Depends(authentication_with_api_key)], 52 | ) 53 | 54 | app.include_router( 55 | router=ThreadsApiRouter, 56 | dependencies=[Depends(authentication_with_api_key)], 57 | ) 58 | 59 | app.include_router( 60 | router=ThreadRunsApiRouter, 61 | dependencies=[Depends(authentication_with_api_key)], 62 | ) 63 | 64 | app.add_middleware( 65 | CORSMiddleware, 66 | allow_origins=os.getenv("CORS_ALLOWED_ORIGINS", "*").split(","), 67 | allow_credentials=True, 68 | allow_methods=["*"], 69 | allow_headers=["*"], 70 | ) 71 | 72 | 73 | def signal_handler(sig, frame): 74 | logger.warning(f"Received {signal.Signals(sig).name}. Exiting...") 75 | sys.exit(0) 76 | 77 | 78 | def start(): 79 | try: 80 | signal.signal(signal.SIGINT, signal_handler) 81 | signal.signal(signal.SIGTERM, signal_handler) 82 | 83 | agents_ref = os.getenv("AGENTS_REF", None) 84 | agent_manifest_path = os.getenv( 85 | "AGENT_MANIFEST_PATH", DEFAULT_AGENT_MANIFEST_PATH 86 | ) 87 | load_agents(agents_ref, [agent_manifest_path]) 88 | n_workers = int(os.getenv("NUM_WORKERS", DEFAULT_NUM_WORKERS)) 89 | 90 | try: 91 | loop = asyncio.get_running_loop() 92 | except RuntimeError: 93 | loop = asyncio.new_event_loop() 94 | asyncio.set_event_loop(loop) 95 | 96 | loop.create_task(start_workers(n_workers)) 97 | 98 | # use module import method to support reload argument 99 | config = uvicorn.Config( 100 | "agent_workflow_server.main:app", 101 | host=os.getenv("API_HOST", DEFAULT_HOST) or DEFAULT_HOST, 102 | port=int(os.getenv("API_PORT", DEFAULT_PORT)) or DEFAULT_PORT, 103 | loop="asyncio", 104 | ) 105 | server = uvicorn.Server(config) 106 | loop.run_until_complete(server.serve()) 107 | except SystemExit as e: 108 | logger.warning(f"Agent Workflow Server exited with code: {e}") 109 | except Exception as e: 110 | logger.error(f"Exiting due to an unexpected error: {e}") 111 | 112 | 113 | if __name__ == "__main__": 114 | start() 115 | -------------------------------------------------------------------------------- /src/agent_workflow_server/services/message.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | from typing import Any, Literal, Optional 5 | 6 | type MessageType = Literal["control", "message", "interrupt"] 7 | 8 | 9 | class Message: 10 | def __init__( 11 | self, 12 | type: MessageType, 13 | data: Any, 14 | event: Optional[str] = None, 15 | interrupt_name: Optional[str] = None, 16 | ): 17 | self.type = type 18 | self.data = data 19 | self.event = event 20 | self.interrupt_name = interrupt_name 21 | -------------------------------------------------------------------------------- /src/agent_workflow_server/services/stream.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | from typing import AsyncGenerator, List 5 | 6 | import jsonschema 7 | 8 | from agent_workflow_server.agents.load import get_agent_info 9 | from agent_workflow_server.generated.models.agent_acp_spec_interrupts_inner import ( 10 | AgentACPSpecInterruptsInner, 11 | ) 12 | from agent_workflow_server.storage.models import Run 13 | 14 | from .runs import Message 15 | 16 | 17 | def _insert_interrupt_name( 18 | interrupts: List[AgentACPSpecInterruptsInner], interrupt_message: Message 19 | ): 20 | """ 21 | Iterates over the 'interrupt' schema in the ACP Descriptor to find the interrupt name, and inserts it into the Message. 22 | """ 23 | for interrupt in interrupts: 24 | # Return the first interrupt_type that validates the json schema 25 | try: 26 | jsonschema.validate( 27 | instance=interrupt_message.data, schema=interrupt.interrupt_payload 28 | ) 29 | interrupt_message.interrupt_name = interrupt.interrupt_type 30 | break 31 | except jsonschema.ValidationError: 32 | # If the validation fails, continue and try the next one 33 | continue 34 | else: 35 | raise ValueError( 36 | f"Interrupt schemas mismatch: could not find matching interrupt type for the received interrupt payload: {interrupt_message.data}. Check the interrupts schemas in the ACP Descriptor." 37 | ) 38 | 39 | return interrupt_message 40 | 41 | 42 | async def stream_run(run: Run) -> AsyncGenerator[Message, None]: 43 | agent_info = get_agent_info(run["agent_id"]) 44 | agent = agent_info.agent 45 | async for message in agent.astream(run=run): 46 | if message.type == "interrupt": 47 | message = _insert_interrupt_name( 48 | agent_info.acp_descriptor.specs.interrupts, message 49 | ) 50 | yield message 51 | -------------------------------------------------------------------------------- /src/agent_workflow_server/services/thread_state.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | from typing import Any, Dict, Optional, TypedDict 5 | 6 | 7 | class ThreadState(TypedDict): 8 | """Definition of a ThreadState record""" 9 | 10 | checkpoint_id: str 11 | values: Dict[str, Any] 12 | metadata: Optional[Dict[str, Any]] 13 | -------------------------------------------------------------------------------- /src/agent_workflow_server/services/utils.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | from agent_workflow_server.storage.models import Run 5 | 6 | 7 | def check_run_is_interrupted(run: Run): 8 | if run is None: 9 | raise ValueError("Run not found") 10 | if run["status"] != "interrupted": 11 | raise ValueError("Run is not in interrupted state") 12 | if run.get("interrupt") is None: 13 | raise ValueError(f"No interrupt found for run {run['run_id']}") 14 | -------------------------------------------------------------------------------- /src/agent_workflow_server/storage/models.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | from datetime import datetime 5 | from typing import Any, Dict, List, Literal, Optional, TypedDict 6 | 7 | RunStatus = Literal["pending", "error", "success", "timeout", "interrupted"] 8 | 9 | 10 | class Interrupt(TypedDict): 11 | """Definition for an Interrupt message""" 12 | 13 | event: str 14 | name: str 15 | ai_data: Any 16 | user_data: Optional[Any] 17 | 18 | 19 | class Config(TypedDict): 20 | tags: Optional[List[str]] 21 | recursion_limit: Optional[int] 22 | configurable: Optional[Any] 23 | 24 | 25 | class Run(TypedDict): 26 | """Definition for a Run record""" 27 | 28 | run_id: str 29 | agent_id: str 30 | thread_id: str 31 | input: Optional[Any] 32 | config: Optional[Config] 33 | metadata: Optional[Dict[str, Any]] 34 | webhook: Optional[str] 35 | created_at: datetime 36 | updated_at: datetime 37 | status: RunStatus 38 | interrupt: Optional[Interrupt] # last interrupt (if any) 39 | 40 | 41 | class RunInfo(TypedDict): 42 | """Definition of statistics information about a Run""" 43 | 44 | run_id: str 45 | queued_at: datetime 46 | attempts: Optional[int] 47 | started_at: Optional[datetime] 48 | ended_at: Optional[datetime] 49 | exec_s: Optional[float] 50 | queue_s: Optional[float] 51 | 52 | 53 | class Thread(TypedDict): 54 | """Definition of a Thread record""" 55 | 56 | thread_id: str 57 | metadata: Optional[Dict[str, Any]] 58 | status: str 59 | created_at: datetime 60 | updated_at: datetime 61 | -------------------------------------------------------------------------------- /src/agent_workflow_server/storage/storage.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | import atexit 5 | import logging 6 | import os 7 | import pickle 8 | from typing import Any, Dict 9 | 10 | from dotenv import load_dotenv 11 | 12 | import agent_workflow_server.logging.logger # noqa: F401 13 | 14 | from .models import Run, RunInfo 15 | from .service import DBOperations 16 | 17 | logger = logging.getLogger(__name__) 18 | 19 | load_dotenv() 20 | 21 | 22 | class InMemoryDB(DBOperations): 23 | """In-memory database with file persistence""" 24 | 25 | def __init__(self): 26 | self._runs: Dict[str, Run] = {} 27 | self._runs_info: Dict[str, RunInfo] = {} 28 | self._runs_output: Dict[str, Any] = {} 29 | self._threads: Dict[str, Any] = {} 30 | self._presist_threads: bool = False 31 | 32 | use_fs_storage = os.getenv("AGWS_STORAGE_PERSIST", "True") == "True" 33 | if use_fs_storage: 34 | storage_file = os.getenv("AGWS_STORAGE_PATH") or "agws_storage.pkl" 35 | self.storage_file = storage_file 36 | self._load_from_file() 37 | # Register save on exit 38 | logger.debug("Registering database save handler on exit") 39 | atexit.register(self._save_to_file) 40 | 41 | super().__init__(self._runs, self._runs_info, self._runs_output, self._threads) 42 | logger.debug("InMemoryDB initialization complete") 43 | 44 | def set_persist_threads(self, persist: bool) -> None: 45 | """Set whether to persiss threads to file""" 46 | self._presist_threads = persist 47 | logger.info("Set persist_threads to %s", persist) 48 | 49 | def _save_to_file(self) -> None: 50 | """Save the current state to file""" 51 | try: 52 | logger.debug( 53 | "Runs: %d, Infos: %d, Outputs: %d, Threads: %d", 54 | len(self._runs), 55 | len(self._runs_info), 56 | len(self._runs_output), 57 | len(self._threads), 58 | ) 59 | data = { 60 | "runs": self._runs, 61 | "runs_info": self._runs_info, 62 | "runs_output": self._runs_output, 63 | } 64 | if self._presist_threads: 65 | data["threads"] = self._threads 66 | 67 | with open(self.storage_file, "wb") as f: 68 | pickle.dump(data, f) 69 | logger.info("Database state saved successfully to %s", self.storage_file) 70 | except Exception as e: 71 | logger.error("Failed to save database state: %s", str(e)) 72 | 73 | def _load_from_file(self) -> None: 74 | """Load the state from file if it exists""" 75 | if not os.path.exists(self.storage_file): 76 | logger.debug("No existing database file found at %s", self.storage_file) 77 | return 78 | 79 | try: 80 | logger.debug("Loading database state") 81 | with open(self.storage_file, "rb") as f: 82 | data = pickle.load(f) 83 | 84 | logger.debug( 85 | "Processing state: %d runs, %d runs_info records, %d runs_output, %d threads", 86 | len(data.get("runs", {})), 87 | len(data.get("runs_info", {})), 88 | len(data.get("runs_output", {})), 89 | len(data.get("threads", {})), 90 | ) 91 | 92 | self._runs = data.get("runs", {}) 93 | self._runs_info = data.get("runs_info", {}) 94 | self._runs_output = data.get("runs_output", {}) 95 | self._threads = data.get("threads", {}) 96 | logger.info( 97 | f"Database state loaded successfully from {os.path.abspath(self.storage_file)}" 98 | ) 99 | 100 | except Exception as e: 101 | logger.error("Failed to load database state: %s", str(e)) 102 | self._runs = {} 103 | self._runs_info = {} 104 | self._runs_output = {} 105 | self._threads = {} 106 | 107 | 108 | # Global instance of the database 109 | logger.debug("Creating global InMemoryDB instance") 110 | DB = InMemoryDB() 111 | -------------------------------------------------------------------------------- /src/agent_workflow_server/utils/tools.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | import importlib 5 | import uuid 6 | from enum import Enum 7 | from typing import Any 8 | from urllib.parse import urlparse 9 | 10 | from pydantic import BaseModel 11 | 12 | 13 | def is_valid_uuid(val): 14 | try: 15 | uuid.UUID(str(val)) 16 | return True 17 | except ValueError: 18 | return False 19 | 20 | 21 | def is_valid_url(val): 22 | try: 23 | parsed = urlparse(val) 24 | # Check if the URL has a scheme and netloc 25 | return bool(parsed.scheme) and bool(parsed.netloc) 26 | except Exception: 27 | return False 28 | 29 | 30 | def make_serializable(v: Any): 31 | if isinstance(v, list): 32 | return [make_serializable(vv) for vv in v] 33 | elif isinstance(v, dict): 34 | return {kk: make_serializable(vv) for kk, vv in v.items()} 35 | elif ( 36 | isinstance(v, BaseModel) and hasattr(v, "model_dump") and callable(v.model_dump) 37 | ): 38 | return v.model_dump(mode="json") 39 | elif isinstance(v, BaseModel) and hasattr(v, "dict") and callable(v.dict): 40 | return v.dict() 41 | elif isinstance(v, Enum): 42 | return v.value 43 | else: 44 | return v 45 | 46 | 47 | def load_from_module(module: str, obj: str) -> object: 48 | """ 49 | Dynamically loads a class, variable, or object from a given module. 50 | 51 | Args: 52 | module (str): The module path where the import resides (e.g., 'myapp.mymodule'). 53 | obj (str): The name of the object to import from the module (e.g., 'MyObject'). 54 | 55 | Returns: 56 | object: The imported class, variable, or object. 57 | 58 | Raises: 59 | ModuleNotFoundError: If the module cannot be found. 60 | AttributeError: If the obj is not found in the module. 61 | """ 62 | try: 63 | # Dynamically import the module 64 | imported_module = importlib.import_module(module) 65 | 66 | # Retrieve the specified object from the module 67 | return getattr(imported_module, obj) 68 | except ModuleNotFoundError as e: 69 | raise ModuleNotFoundError(f"Module '{module}' could not be found.") from e 70 | except AttributeError as e: 71 | raise AttributeError( 72 | f"'{obj}' could not be found in the module '{module}'." 73 | ) from e 74 | -------------------------------------------------------------------------------- /tests/.env.test: -------------------------------------------------------------------------------- 1 | AGENTS_REF='{"3f1e2549-5799-4321-91ae-2a4881d55526": "tests.mock:mock_agent"}' 2 | AGENT_MANIFEST_PATH=tests/mock_manifest.json 3 | AGWS_STORAGE_PERSIST= False 4 | ACP_SPEC_PATH=tests/test_openapi.json -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | -------------------------------------------------------------------------------- /tests/agents/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | -------------------------------------------------------------------------------- /tests/agents/jokeflow.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | import asyncio 5 | 6 | from llama_index.core.workflow import ( 7 | Event, 8 | StartEvent, 9 | StopEvent, 10 | Workflow, 11 | step, 12 | ) 13 | 14 | 15 | class JokeEvent(Event): 16 | joke: str 17 | 18 | 19 | class JokeFlow(Workflow): 20 | @step 21 | async def generate_joke(self, ev: StartEvent) -> JokeEvent: 22 | topic = ev.topic 23 | 24 | response = "this is a joke about " + topic 25 | asyncio.sleep(1) 26 | return JokeEvent(joke=str(response)) 27 | 28 | @step 29 | async def critique_joke(self, ev: JokeEvent) -> StopEvent: 30 | joke = ev.joke 31 | 32 | response = "this is a critique of the joke: " + joke 33 | return StopEvent(result=str(response)) 34 | 35 | 36 | async def main(): 37 | w = JokeFlow(timeout=60, verbose=False) 38 | result = await w.run(topic="pirates") 39 | print(str(result)) 40 | 41 | 42 | if __name__ == "__main__": 43 | asyncio.run(main()) 44 | -------------------------------------------------------------------------------- /tests/agents/jokeflow_manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "authors": ["Cisco Systems Inc."], 3 | "annotations": { 4 | "type": "llama-index" 5 | }, 6 | "created_at": "2025-05-21T00:00:00Z", 7 | "name": "org.agntcy.jokeflow", 8 | "description": "create and review Jokes", 9 | "version": "0.0.1", 10 | "schema_version": "0.3.1", 11 | "skills": [], 12 | "locators": [], 13 | "extensions": [{ 14 | "name": "oasf.agntcy.org/feature/runtime/manifest", 15 | "data": { 16 | "acp": { 17 | "capabilities": { 18 | "threads": false, 19 | "interrupts": false, 20 | "callbacks": false 21 | }, 22 | "input": { 23 | "properties": { 24 | "topic": { 25 | "description": "The topic of the Joke", 26 | "title": "topic", 27 | "type": "string" 28 | } 29 | }, 30 | "required": ["topic"], 31 | "title": "StartEvent", 32 | "type": "object" 33 | }, 34 | "output": { 35 | "properties": { 36 | "joke": { 37 | "description": "the created Joke", 38 | "title": "joke", 39 | "type": "string" 40 | } 41 | }, 42 | "required": ["joke"], 43 | "title": "JokeEvent", 44 | "type": "object" 45 | }, 46 | "config": { 47 | "properties": {}, 48 | "title": "ConfigSchema", 49 | "type": "object" 50 | } 51 | }, 52 | "deployment": { 53 | "deployment_options": [{ 54 | "type": "source_code", 55 | "name": "source_code_local", 56 | "url": "./../", 57 | "framework_config": { 58 | "framework_type": "llamaindex", 59 | "path": "jokeflow:jokeflow_workflow" 60 | } 61 | } 62 | ], 63 | "env_vars": [], 64 | "dependencies": [] 65 | } 66 | }, 67 | "version": "v0.2.2" 68 | } 69 | ] 70 | } 71 | -------------------------------------------------------------------------------- /tests/agents/jokereviewer.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | import asyncio 4 | 5 | from dotenv import find_dotenv, load_dotenv 6 | from llama_index.core.workflow import ( 7 | Context, 8 | Event, 9 | StartEvent, 10 | StopEvent, 11 | Workflow, 12 | step, 13 | ) 14 | 15 | load_dotenv(dotenv_path=find_dotenv(usecwd=True)) 16 | 17 | 18 | class SecondEvent(Event): 19 | joke: str 20 | ai_answer: str 21 | 22 | 23 | class FirstInterruptEvent(Event): 24 | joke: str 25 | first_question: str 26 | needs_answer: bool 27 | 28 | 29 | class InterruptResponseEvent(Event): 30 | answer: str 31 | 32 | 33 | class JokeEvent(Event): 34 | joke: str 35 | 36 | 37 | class JokeReviewer(Workflow): 38 | @step 39 | async def generate_joke(self, ev: StartEvent) -> JokeEvent: 40 | topic = ev.topic 41 | response = "this is a joke about " + topic 42 | await asyncio.sleep(1) 43 | return JokeEvent(joke=str(response)) 44 | 45 | @step 46 | async def step_interrupt_one(self, ctx: Context, ev: JokeEvent) -> SecondEvent: 47 | print(f"> step_interrupt_one input : {ev.joke}") 48 | await asyncio.sleep(1) 49 | # wait until we see a HumanResponseEvent 50 | needs_answer = True 51 | response = await ctx.wait_for_event( 52 | InterruptResponseEvent, 53 | waiter_id="waiter_step_interrupt_one", 54 | waiter_event=FirstInterruptEvent( 55 | joke=ev.joke, 56 | first_question=f"What is your review about the Joke '{ev.joke}'?", 57 | needs_answer=needs_answer, 58 | ), 59 | ) 60 | 61 | print(f"> receive response : {response.answer}") 62 | if needs_answer and not response.answer: 63 | raise ValueError("This needs a non-empty answer") 64 | 65 | return SecondEvent( 66 | joke=ev.joke, ai_answer=f"Received human answer: {response.answer}" 67 | ) 68 | 69 | @step 70 | async def critique_joke(self, ev: SecondEvent) -> StopEvent: 71 | joke = ev.joke 72 | 73 | await asyncio.sleep(1) 74 | response = "this is a review for the joke: " + joke + "\n" + ev.ai_answer 75 | result = { 76 | joke: joke, 77 | "review": str(response), 78 | } 79 | return StopEvent(result=result) 80 | 81 | 82 | def interrupt_workflow() -> JokeReviewer: 83 | joke_reviewer = JokeReviewer(timeout=None, verbose=True) 84 | return joke_reviewer 85 | 86 | 87 | async def main(): 88 | print("Joke Reviewer with Interrupts") 89 | workflow = interrupt_workflow() 90 | 91 | handler = workflow.run(topic="pirates") 92 | 93 | print("Reading events from the workflow...") 94 | async for ev in handler.stream_events(): 95 | if isinstance(ev, FirstInterruptEvent): 96 | # capture keyboard input 97 | response = input(ev.first_question) 98 | print("Sending response event...") 99 | handler.ctx.send_event( 100 | InterruptResponseEvent( 101 | answer=response, 102 | ) 103 | ) 104 | 105 | print("waiting for final result...") 106 | final_result = await handler 107 | print("Final result: ", final_result) 108 | 109 | 110 | if __name__ == "__main__": 111 | asyncio.run(main()) 112 | -------------------------------------------------------------------------------- /tests/conftest.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | import os 5 | from pathlib import Path 6 | 7 | import pytest 8 | from dotenv import load_dotenv 9 | 10 | 11 | @pytest.fixture(autouse=True) 12 | def load_test_env(): 13 | """Load test environment variables before each test""" 14 | # Store original environment 15 | original_env = dict(os.environ) 16 | 17 | # Load test environment 18 | env_path = Path(__file__).parent / ".env.test" 19 | load_dotenv(env_path, override=True) 20 | 21 | yield 22 | 23 | # Restore original environment instead of clearing everything 24 | os.environ.clear() 25 | os.environ.update(original_env) 26 | -------------------------------------------------------------------------------- /tests/test_load.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | import os 4 | 5 | import pytest 6 | from pytest_mock import MockerFixture 7 | 8 | from agent_workflow_server.agents.load import ( 9 | AGENTS, 10 | get_agent, 11 | get_agent_info, 12 | load_agents, 13 | search_for_agents, 14 | ) 15 | from agent_workflow_server.generated.models.agent_search_request import ( 16 | AgentSearchRequest, 17 | ) 18 | from tests.mock import ( 19 | MOCK_AGENT_ID, 20 | MockAdapter, 21 | MockAgent, 22 | ) 23 | 24 | 25 | def _env_load_agents(): 26 | agent_ref = os.getenv("AGENTS_REF") 27 | manifest_path = os.getenv("AGENT_MANIFEST_PATH") 28 | load_agents(agents_ref=agent_ref, add_manifest_paths=[manifest_path]) 29 | 30 | 31 | def test_load_agents(mocker: MockerFixture): 32 | mocker.patch("agent_workflow_server.agents.load.ADAPTERS", [MockAdapter()]) 33 | 34 | _env_load_agents() 35 | 36 | assert len(AGENTS) == 1 37 | assert isinstance(AGENTS[MOCK_AGENT_ID].agent, MockAgent) 38 | 39 | 40 | @pytest.mark.parametrize( 41 | "agent_id, expected", 42 | [(MOCK_AGENT_ID, True), ("another_id", False)], 43 | ) 44 | def test_get_agent_info(mocker: MockerFixture, agent_id: str, expected: bool): 45 | mocker.patch("agent_workflow_server.agents.load.ADAPTERS", [MockAdapter()]) 46 | 47 | _env_load_agents() 48 | 49 | assert len(AGENTS) == 1 50 | 51 | try: 52 | _ = get_agent_info(agent_id) 53 | assert expected 54 | except Exception: 55 | assert not expected 56 | 57 | 58 | @pytest.mark.parametrize( 59 | "agent_id, expected", 60 | [(MOCK_AGENT_ID, True), ("another_id", False)], 61 | ) 62 | def test_get_agent(mocker: MockerFixture, agent_id: str, expected: bool): 63 | mocker.patch("agent_workflow_server.agents.load.ADAPTERS", [MockAdapter()]) 64 | 65 | _env_load_agents() 66 | 67 | assert len(AGENTS) == 1 68 | 69 | try: 70 | agent = get_agent(agent_id) 71 | assert expected 72 | assert agent.agent_id == agent_id 73 | assert agent.metadata == AGENTS[agent_id].acp_descriptor.metadata 74 | except Exception: 75 | assert not expected 76 | 77 | 78 | @pytest.mark.parametrize( 79 | "name, version, expected, exception", 80 | [ 81 | ("org.agntcy.mock_agent", None, 1, False), 82 | ("org.agntcy.mock_agent", "0.0.1", 1, False), 83 | (None, "0.0.1", 1, False), 84 | ("another_id", None, 0, False), 85 | ("mock_agent", None, 0, False), 86 | ("another_id", "0.0.1", 0, False), 87 | (None, None, 0, True), 88 | ("org.agntcy.mock_agent", "0.0.2", 0, False), 89 | (None, "0.0.2", 0, False), 90 | ], 91 | ) 92 | def test_search_agents( 93 | mocker: MockerFixture, name: str, version: str, expected: int, exception: bool 94 | ): 95 | mocker.patch("agent_workflow_server.agents.load.ADAPTERS", [MockAdapter()]) 96 | 97 | _env_load_agents() 98 | 99 | assert len(AGENTS) == 1 100 | 101 | try: 102 | agents = search_for_agents(AgentSearchRequest(name=name, version=version)) 103 | assert not exception 104 | assert len(agents) == expected 105 | except Exception: 106 | assert exception 107 | -------------------------------------------------------------------------------- /tests/tools.py: -------------------------------------------------------------------------------- 1 | # Copyright AGNTCY Contributors (https://github.com/agntcy) 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | import json 5 | import logging 6 | import os 7 | 8 | from agent_workflow_server.generated.manifest.models.agent_manifest import AgentManifest 9 | 10 | logger = logging.getLogger(__name__) 11 | 12 | 13 | def _read_manifest(path: str) -> AgentManifest: 14 | if os.path.isfile(path): 15 | with open(path, "r") as file: 16 | try: 17 | manifest_data = json.load(file) 18 | except json.JSONDecodeError as e: 19 | raise ValueError( 20 | f"Invalid JSON format in manifest file: {path}. Error: {e}" 21 | ) 22 | # print full path 23 | logger.info(f"Loaded Agent Manifest from {os.path.abspath(path)}") 24 | return AgentManifest.model_validate(manifest_data) 25 | return None 26 | --------------------------------------------------------------------------------