agentenv-framework-protocol 0.1.667__tar.gz → 0.1.669__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/PKG-INFO +40 -16
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/README.md +39 -15
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/pyproject.toml +1 -1
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/__init__.py +14 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/proxy.py +8 -4
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/tasks/v1.py +110 -16
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/__init__.py +3 -2
- agentenv_framework_protocol-0.1.669/src/agentenv_protocol/computer/_adb.py +143 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/card.py +4 -5
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/checks.py +20 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/conformance/checks.py +24 -2
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/dataplane.py +33 -8
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/driver.py +25 -4
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/operations.py +3 -1
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/platform.py +1 -1
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/recording.py +1 -2
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/skill.py +6 -1
- agentenv_framework_protocol-0.1.669/tests/fake_adb.py +46 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_a2a_proxy.py +4 -1
- agentenv_framework_protocol-0.1.669/tests/test_computer_beside.py +215 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_computer_driver.py +9 -3
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_usage.py +53 -1
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/.gitignore +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/LICENSE +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/NOTICE +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/THIRD_PARTY_NOTICES.md +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/examples/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/examples/advanced_agent.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/examples/basic_agent.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/examples/custom_extensions_agent.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/examples/multimodal_agent.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/examples/reference_model.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/examples/streaming_agent.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/examples/website/notes/.gitignore +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/examples/website/notes/Dockerfile +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/examples/website/notes/Dockerfile.dockerignore +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/examples/website/notes/README.md +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/examples/website/notes/data/seed.json +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/examples/website/notes/env.toml +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/examples/website/notes/site.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/examples/website/notes/web/index.html +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/examples/website/notes/web/package-lock.json +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/examples/website/notes/web/package.json +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/examples/website/notes/web/src/main.js +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/examples/website/notes/web/src/style.css +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/examples/website/notes/web/vite.config.js +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/_atif_copy.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/_media_spool.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/_secrets.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/_snapshot_state.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/_trajectory_log.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/_triggers.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/_turn_index.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/clock.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/control_token.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/extensions.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/framework.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/peer_agents.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/registry.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/staging.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/a2a_agent/tasks/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/agent_env_environment.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/PROFILE.md +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/__main__.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/_image_size.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/adapter.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/builder.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/fixtures/coding.json +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/fixtures/coding.stripped.json +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/fixtures/computer_use.json +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/fixtures/late_result.json +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/fixtures/media/482405b002a62efa8516c36709a7a100637507670576fa73a20ad5420d55c66f.png +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/fixtures/media/55c64d0fcd6f9d5f7c828093857e3fdfda68478bb4e9bd24d481ef391c7804e8.heic +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/fixtures/media/67905ad3cc2dd52b1f5f6a6d2814de0396618b29b4238b9af5207aeb69936e6d.mp4 +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/fixtures/media/69a8aa01fe5537076d023dd5e9cc4275b39fc0434aa6483a9f58b66ef2f3c896.png +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/fixtures/media/82e60066a2de261b6653bcdda90d1cb9a7af2f474cecd82e8d371e8384d72315.png +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/fixtures/media/845e91831319e89c4d656bdb80c278ac09a7230d61e5dfd2e1b1fbb436ac8917.pdf +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/fixtures/multi_agent.json +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/fixtures/odd_parts.json +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/fixtures/subagent.json +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/fixtures/two_turns.json +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/kit.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/models/LICENSE +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/models/VENDORED.md +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/models/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/models/agent.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/models/content.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/models/final_metrics.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/models/metrics.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/models/observation.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/models/observation_result.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/models/step.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/models/subagent_trajectory_ref.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/models/tool_call.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/models/trajectory.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/profile.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/reader.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/runner.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/served.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/atif/validator.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/client.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/_declare.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/_desktop.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/_job.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/_linux.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/_load.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/_macos.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/_reaping.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/_session_posix.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/_session_windows.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/_windows.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/_with_fds.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/_x11.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/annotate.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/app.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/app_data.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/app_runtime.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/apps.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/clock.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/conformance/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/conformance/__main__.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/conformance/client.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/conformance/desk.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/conformance/fixture.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/conformance/mp4.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/conformance/page_fixture.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/conformance/report.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/conformance/wayland_fixture.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/errors.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/extensions.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/frames.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/keys.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/launch.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/manifest.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/prefix.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/queue.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/results.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/run_install_step.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/runtime.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/seed.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/serve.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/serve_app.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/served.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/session.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/settings.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/spaces.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/svc.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/computer/tools.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/errors.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/manifest.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/passthrough.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/preflight.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/tool_access.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/tool_client.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/tool_context.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/transfers.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/types.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website/clock.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website/conformance.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website/environment.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website/errors.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website/forwarding.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website/readiness.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website/routes.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website/session.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website_browser/__init__.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website_browser/cdp.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website_browser/contexts.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website_browser/control.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website_browser/data.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website_browser/devtools.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website_browser/environment.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website_browser/log.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website_browser/network.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website_browser/recording.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website_browser/scope.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website_browser/shapes.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/src/agentenv_protocol/website_browser/stream.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/atif_cases.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/computer_fake.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/conftest.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/probe_fake.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_a2a_agent.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_a2a_agent_clock.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_a2a_agent_examples.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_a2a_atif_media.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_a2a_atif_prescribe.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_a2a_atif_scrubbing.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_a2a_atif_serving.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_a2a_atif_turns.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_a2a_cdp_config.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_a2a_object_transfers.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_a2a_peer_agents.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_a2a_staging.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_a2a_trajectory_log.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_agent_env_environment.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_atif_builder.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_atif_fixtures.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_atif_kit.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_atif_profile.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_atif_reader.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_atif_validator.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_atif_vendored.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_browser_cdp.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_browser_contexts.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_browser_data.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_browser_log.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_browser_network.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_browser_recording.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_browser_state.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_client.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_computer_app_data.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_computer_app_server.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_computer_clock.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_computer_conformance.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_computer_conformance_attempts.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_computer_conformance_checks.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_computer_conformance_page.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_computer_conformance_recording.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_computer_dataplane.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_computer_declare.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_computer_driver_keys.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_computer_extensions.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_computer_frames.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_computer_macos.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_computer_page.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_computer_queue.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_computer_recording.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_computer_recording_annotate.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_computer_screenshot_delay.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_computer_seed.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_computer_serve.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_computer_served.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_computer_session_windows.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_computer_spaces.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_computer_svc_forward.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_computer_tool_prefix.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_computer_windows_driver.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_control_token.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_data_objects.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_devtools_pipe.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_errors.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_extension_methods.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_intake.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_manifest.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_preflight.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_rpc_keepalive.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_tool_access.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_tool_annotations.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_tool_client.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_tool_context.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_tool_context_fastmcp.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_tool_context_injection.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_tool_defers.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_usage_models.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_website_api.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_website_browser.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_website_conformance.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_website_environment.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_website_forwarding.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_website_live.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_website_mcp.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_website_notes_example.py +0 -0
- {agentenv_framework_protocol-0.1.667 → agentenv_framework_protocol-0.1.669}/tests/test_website_readiness.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: agentenv-framework-protocol
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.669
|
|
4
4
|
Summary: Open data-plane protocol and server SDK for agent environments.
|
|
5
5
|
Project-URL: Homepage, https://www.agentenvframework.com
|
|
6
6
|
Project-URL: Documentation, https://www.agentenvframework.com/docs
|
|
@@ -722,7 +722,8 @@ class Store(ForwardingSite):
|
|
|
722
722
|
|
|
723
723
|
## Computer drivers
|
|
724
724
|
|
|
725
|
-
A computer driver is what runs inside a computer an agent uses through screenshots and input
|
|
725
|
+
A computer driver is what runs inside a computer an agent uses through screenshots and input, or
|
|
726
|
+
beside a device it reaches (see Where it runs below). Write
|
|
726
727
|
one as a `ComputerDriverEnvironment` subclass from `agentenv_protocol.computer`, which needs the
|
|
727
728
|
`computer` extra (`pip install 'agentenv-framework-protocol[computer]'`: mcp, uvicorn, Pillow and PyAV).
|
|
728
729
|
The driver marks the methods that capture the screen and send input; the base class serves the
|
|
@@ -775,8 +776,9 @@ pixels), at the display's size times its scale. Input operations may return an `
|
|
|
775
776
|
| `@pointer_move`, `@pointer_down`, `@pointer_up`, `@pointer_position` | all or none | `computer-pointer/v1` and its five tools; click and scroll at the pointer |
|
|
776
777
|
| `@key_down`, `@key_up` | both or none | `computer-keyboard/v1` and its two tools |
|
|
777
778
|
| `@navigate`, `@history`, `@tabs`, `@dialog`, `@upload`, `@page_state` | all or none, for a screen that is a website browser's page | `computer-page/v1` and its five tools; the `page` of every frame |
|
|
778
|
-
| `@run_in_session` | no; a Linux
|
|
779
|
-
| `@write_files` | no; a Linux
|
|
779
|
+
| `@run_in_session` | no; a default on Linux, macOS, Windows and Android | `computer-exec/v1` |
|
|
780
|
+
| `@write_files` | no; a default on Linux, macOS, Windows and Android | `data/add` |
|
|
781
|
+
| `@read_files` | no; a default on Android | what `data/get` reads in place of the driver's own home |
|
|
780
782
|
| `@record` | no | the stream `computer-recording/v1` records from; without it the base class polls `@capture` |
|
|
781
783
|
|
|
782
784
|
The class is checked when it is defined: a missing required operation, half a group, two methods
|
|
@@ -784,13 +786,23 @@ for one operation that some platform could both match, or features that don't ma
|
|
|
784
786
|
decorators raise `TypeError`. Predicates (`os`, `distribution`, `version`, `arch`, `display`)
|
|
785
787
|
choose a method per platform, read from `/etc/os-release`, the machine and `XDG_SESSION_TYPE` or
|
|
786
788
|
`DISPLAY`: `@capture(display="x11")` and `@capture(display="wayland")` can sit side by side. A
|
|
787
|
-
driver's own `@run_in_session` or `@
|
|
788
|
-
as the driver's user inside the desktop
|
|
789
|
+
driver's own `@run_in_session`, `@write_files` or `@read_files` replaces the base class's default for
|
|
790
|
+
its OS. On Linux, macOS and Windows that default acts as the driver's user inside the desktop
|
|
791
|
+
session. On Android it goes through adb (`AGENTENV_ADB`, else the `adb` on `PATH`, with adb's own
|
|
792
|
+
`ANDROID_SERIAL` and `ADB_SERVER_SOCKET`) as the device's `shell` user under `/sdcard`, and a written
|
|
793
|
+
file is announced to the media scanner. The base class keeps its state in `self._computer`
|
|
789
794
|
and names its own members `_computer_*` and `computer_*`; a driver that redefines one of them, or
|
|
790
795
|
another private member of the base class, is refused when it is defined, so a helper of the
|
|
791
796
|
driver's can't silently replace one. What the optional operations give is served only when the
|
|
792
797
|
driver has them, through the `served_tools`, `served_extensions` and `served_operations` hooks.
|
|
793
798
|
|
|
799
|
+
**Where it runs.** A driver runs `inside` its computer, as the session user, unless its class says
|
|
800
|
+
`placement = "beside"`. It then runs next to a device it reaches, such as an Android phone over
|
|
801
|
+
adb, and passes `__init__` the device's `Platform`, since what it would detect is its own host's.
|
|
802
|
+
`computer/v1`'s params carry `placement`. `provider`, a driver the device's provider serves, is
|
|
803
|
+
reserved, and a class that names it is refused. agent-env's `computer_driver` env names the placement in its
|
|
804
|
+
`env.toml` too, and a put where the two differ is refused.
|
|
805
|
+
|
|
794
806
|
**What the base class serves:**
|
|
795
807
|
|
|
796
808
|
- **Tools.** `computer_screenshot` (a frame: `frame_id`, image size, display resolution and scale;
|
|
@@ -839,9 +851,13 @@ driver has them, through the `served_tools`, `served_extensions` and `served_ope
|
|
|
839
851
|
user's home, under the `data-objects/v1` marker (`{"path": ...}`), as inline bytes, an https URL,
|
|
840
852
|
or a `transfers.ReadObject` read grant under the marker's `read`, and writes them atomically.
|
|
841
853
|
`data/get` returns the files under the `paths` it's given, relative to the home, or under the
|
|
842
|
-
card's `default_data_paths`
|
|
843
|
-
|
|
844
|
-
|
|
854
|
+
card's `default_data_paths` when it's given none, inline or uploaded under a `write_namespace`
|
|
855
|
+
grant, leaving out the paths its apps keep their data in. The default paths are `Desktop`,
|
|
856
|
+
`Documents` and `Downloads`, unless the driver class declares its own
|
|
857
|
+
(`default_data_paths = ("Download", "DCIM")`): a tuple of normalized relative paths, checked when
|
|
858
|
+
the class is defined. With `@read_files`, `data/get` reads the files through it. A beside
|
|
859
|
+
driver's recordings, under `.agentenv-recordings`, still come from its own home. An environment
|
|
860
|
+
whose `@get_data` hook takes no `paths` refuses them.
|
|
845
861
|
- **The card** (the name from `ENVIRONMENT_NAME`, then `@computer_driver`'s), and per-role tool
|
|
846
862
|
access (`tool_access` is on).
|
|
847
863
|
|
|
@@ -1559,8 +1575,12 @@ cannot drift.
|
|
|
1559
1575
|
`cache_read_tokens` and `cache_write_tokens`, and `input_includes_cache`, which
|
|
1560
1576
|
says whether `input_tokens` counts both cache counts (`True`), neither
|
|
1561
1577
|
(`False`), or is unknown (`None`, the default). Set the flag whenever you set
|
|
1562
|
-
the cache counts: a price can't read them without it.
|
|
1563
|
-
|
|
1578
|
+
the cache counts: a price can't read them without it. `cache_write_ttl_tokens`
|
|
1579
|
+
counts the cache writes by how long they were kept, by a time of one unit
|
|
1580
|
+
(`{"5m": 200, "1h": 300}`; `s`, `m`, `h` or `d`), which a price charges at each
|
|
1581
|
+
time's rate; writes it doesn't count are taken as kept the provider's default
|
|
1582
|
+
time. Runtime-specific counts go in `provider_details`, but cache counts go in
|
|
1583
|
+
their own fields. `Usage.from_dict`
|
|
1564
1584
|
reads what `to_dict` wrote under any protocol version, a field it leaves out
|
|
1565
1585
|
being `None` and a key it doesn't know ignored, and `TaskResult.failure(...,
|
|
1566
1586
|
usage=...)` carries usage on a failure as `success` does.
|
|
@@ -1568,7 +1588,8 @@ usage=...)` carries usage on a failure as `success` does.
|
|
|
1568
1588
|
An agent that knows each call's model gives a turn's counts by model in
|
|
1569
1589
|
`Usage.models`, on every turn: one `ModelUsage` per model, with the model's
|
|
1570
1590
|
name as called, its `calls`, its token and cache counts read as `Usage`'s are,
|
|
1571
|
-
|
|
1591
|
+
its cache writes by time when the agent knows them, and the agent's own
|
|
1592
|
+
`cost_usd` for them when it has one. That prices a
|
|
1572
1593
|
subagent on a smaller model, a side call for a title, or a whole turn a CLI
|
|
1573
1594
|
ran on another model at that model's own rate. The rows cover every call the
|
|
1574
1595
|
turn counted; a call the agent can't name goes under the model it was
|
|
@@ -1586,10 +1607,13 @@ and Responses (`input_tokens`) shapes and Anthropic's:
|
|
|
1586
1607
|
- Anthropic's `input_tokens` counts neither `cache_read_input_tokens` nor
|
|
1587
1608
|
`cache_creation_input_tokens`, and neither does the `prompt_tokens` a LiteLLM
|
|
1588
1609
|
proxy sends with those two beside it, so they're added, to `total_tokens` too.
|
|
1589
|
-
- A provider's split of its cache writes by how long they're kept
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1610
|
+
- A provider's split of its cache writes by how long they're kept (Anthropic's
|
|
1611
|
+
`cache_creation`, OpenAI's `cache_write_tokens_details`) is kept in
|
|
1612
|
+
`provider_details` and read into `cache_write_ttl_tokens`, by the time each
|
|
1613
|
+
count's name holds (`ephemeral_1h_input_tokens`, `ttl_12h_tokens`); so are the
|
|
1614
|
+
keys of a usage in none of these shapes, as `unrecognized`. A value that isn't
|
|
1615
|
+
a count is left out. A `Usage` built or read without `cache_write_ttl_tokens`
|
|
1616
|
+
takes it from such a split in its `provider_details`, else from its rows.
|
|
1593
1617
|
|
|
1594
1618
|
Through a gateway, whether a response's input counts the cache depends on the
|
|
1595
1619
|
model behind it: a LiteLLM proxy's Claude answers through Chat Completions leave
|
|
@@ -651,7 +651,8 @@ class Store(ForwardingSite):
|
|
|
651
651
|
|
|
652
652
|
## Computer drivers
|
|
653
653
|
|
|
654
|
-
A computer driver is what runs inside a computer an agent uses through screenshots and input
|
|
654
|
+
A computer driver is what runs inside a computer an agent uses through screenshots and input, or
|
|
655
|
+
beside a device it reaches (see Where it runs below). Write
|
|
655
656
|
one as a `ComputerDriverEnvironment` subclass from `agentenv_protocol.computer`, which needs the
|
|
656
657
|
`computer` extra (`pip install 'agentenv-framework-protocol[computer]'`: mcp, uvicorn, Pillow and PyAV).
|
|
657
658
|
The driver marks the methods that capture the screen and send input; the base class serves the
|
|
@@ -704,8 +705,9 @@ pixels), at the display's size times its scale. Input operations may return an `
|
|
|
704
705
|
| `@pointer_move`, `@pointer_down`, `@pointer_up`, `@pointer_position` | all or none | `computer-pointer/v1` and its five tools; click and scroll at the pointer |
|
|
705
706
|
| `@key_down`, `@key_up` | both or none | `computer-keyboard/v1` and its two tools |
|
|
706
707
|
| `@navigate`, `@history`, `@tabs`, `@dialog`, `@upload`, `@page_state` | all or none, for a screen that is a website browser's page | `computer-page/v1` and its five tools; the `page` of every frame |
|
|
707
|
-
| `@run_in_session` | no; a Linux
|
|
708
|
-
| `@write_files` | no; a Linux
|
|
708
|
+
| `@run_in_session` | no; a default on Linux, macOS, Windows and Android | `computer-exec/v1` |
|
|
709
|
+
| `@write_files` | no; a default on Linux, macOS, Windows and Android | `data/add` |
|
|
710
|
+
| `@read_files` | no; a default on Android | what `data/get` reads in place of the driver's own home |
|
|
709
711
|
| `@record` | no | the stream `computer-recording/v1` records from; without it the base class polls `@capture` |
|
|
710
712
|
|
|
711
713
|
The class is checked when it is defined: a missing required operation, half a group, two methods
|
|
@@ -713,13 +715,23 @@ for one operation that some platform could both match, or features that don't ma
|
|
|
713
715
|
decorators raise `TypeError`. Predicates (`os`, `distribution`, `version`, `arch`, `display`)
|
|
714
716
|
choose a method per platform, read from `/etc/os-release`, the machine and `XDG_SESSION_TYPE` or
|
|
715
717
|
`DISPLAY`: `@capture(display="x11")` and `@capture(display="wayland")` can sit side by side. A
|
|
716
|
-
driver's own `@run_in_session` or `@
|
|
717
|
-
as the driver's user inside the desktop
|
|
718
|
+
driver's own `@run_in_session`, `@write_files` or `@read_files` replaces the base class's default for
|
|
719
|
+
its OS. On Linux, macOS and Windows that default acts as the driver's user inside the desktop
|
|
720
|
+
session. On Android it goes through adb (`AGENTENV_ADB`, else the `adb` on `PATH`, with adb's own
|
|
721
|
+
`ANDROID_SERIAL` and `ADB_SERVER_SOCKET`) as the device's `shell` user under `/sdcard`, and a written
|
|
722
|
+
file is announced to the media scanner. The base class keeps its state in `self._computer`
|
|
718
723
|
and names its own members `_computer_*` and `computer_*`; a driver that redefines one of them, or
|
|
719
724
|
another private member of the base class, is refused when it is defined, so a helper of the
|
|
720
725
|
driver's can't silently replace one. What the optional operations give is served only when the
|
|
721
726
|
driver has them, through the `served_tools`, `served_extensions` and `served_operations` hooks.
|
|
722
727
|
|
|
728
|
+
**Where it runs.** A driver runs `inside` its computer, as the session user, unless its class says
|
|
729
|
+
`placement = "beside"`. It then runs next to a device it reaches, such as an Android phone over
|
|
730
|
+
adb, and passes `__init__` the device's `Platform`, since what it would detect is its own host's.
|
|
731
|
+
`computer/v1`'s params carry `placement`. `provider`, a driver the device's provider serves, is
|
|
732
|
+
reserved, and a class that names it is refused. agent-env's `computer_driver` env names the placement in its
|
|
733
|
+
`env.toml` too, and a put where the two differ is refused.
|
|
734
|
+
|
|
723
735
|
**What the base class serves:**
|
|
724
736
|
|
|
725
737
|
- **Tools.** `computer_screenshot` (a frame: `frame_id`, image size, display resolution and scale;
|
|
@@ -768,9 +780,13 @@ driver has them, through the `served_tools`, `served_extensions` and `served_ope
|
|
|
768
780
|
user's home, under the `data-objects/v1` marker (`{"path": ...}`), as inline bytes, an https URL,
|
|
769
781
|
or a `transfers.ReadObject` read grant under the marker's `read`, and writes them atomically.
|
|
770
782
|
`data/get` returns the files under the `paths` it's given, relative to the home, or under the
|
|
771
|
-
card's `default_data_paths`
|
|
772
|
-
|
|
773
|
-
|
|
783
|
+
card's `default_data_paths` when it's given none, inline or uploaded under a `write_namespace`
|
|
784
|
+
grant, leaving out the paths its apps keep their data in. The default paths are `Desktop`,
|
|
785
|
+
`Documents` and `Downloads`, unless the driver class declares its own
|
|
786
|
+
(`default_data_paths = ("Download", "DCIM")`): a tuple of normalized relative paths, checked when
|
|
787
|
+
the class is defined. With `@read_files`, `data/get` reads the files through it. A beside
|
|
788
|
+
driver's recordings, under `.agentenv-recordings`, still come from its own home. An environment
|
|
789
|
+
whose `@get_data` hook takes no `paths` refuses them.
|
|
774
790
|
- **The card** (the name from `ENVIRONMENT_NAME`, then `@computer_driver`'s), and per-role tool
|
|
775
791
|
access (`tool_access` is on).
|
|
776
792
|
|
|
@@ -1488,8 +1504,12 @@ cannot drift.
|
|
|
1488
1504
|
`cache_read_tokens` and `cache_write_tokens`, and `input_includes_cache`, which
|
|
1489
1505
|
says whether `input_tokens` counts both cache counts (`True`), neither
|
|
1490
1506
|
(`False`), or is unknown (`None`, the default). Set the flag whenever you set
|
|
1491
|
-
the cache counts: a price can't read them without it.
|
|
1492
|
-
|
|
1507
|
+
the cache counts: a price can't read them without it. `cache_write_ttl_tokens`
|
|
1508
|
+
counts the cache writes by how long they were kept, by a time of one unit
|
|
1509
|
+
(`{"5m": 200, "1h": 300}`; `s`, `m`, `h` or `d`), which a price charges at each
|
|
1510
|
+
time's rate; writes it doesn't count are taken as kept the provider's default
|
|
1511
|
+
time. Runtime-specific counts go in `provider_details`, but cache counts go in
|
|
1512
|
+
their own fields. `Usage.from_dict`
|
|
1493
1513
|
reads what `to_dict` wrote under any protocol version, a field it leaves out
|
|
1494
1514
|
being `None` and a key it doesn't know ignored, and `TaskResult.failure(...,
|
|
1495
1515
|
usage=...)` carries usage on a failure as `success` does.
|
|
@@ -1497,7 +1517,8 @@ usage=...)` carries usage on a failure as `success` does.
|
|
|
1497
1517
|
An agent that knows each call's model gives a turn's counts by model in
|
|
1498
1518
|
`Usage.models`, on every turn: one `ModelUsage` per model, with the model's
|
|
1499
1519
|
name as called, its `calls`, its token and cache counts read as `Usage`'s are,
|
|
1500
|
-
|
|
1520
|
+
its cache writes by time when the agent knows them, and the agent's own
|
|
1521
|
+
`cost_usd` for them when it has one. That prices a
|
|
1501
1522
|
subagent on a smaller model, a side call for a title, or a whole turn a CLI
|
|
1502
1523
|
ran on another model at that model's own rate. The rows cover every call the
|
|
1503
1524
|
turn counted; a call the agent can't name goes under the model it was
|
|
@@ -1515,10 +1536,13 @@ and Responses (`input_tokens`) shapes and Anthropic's:
|
|
|
1515
1536
|
- Anthropic's `input_tokens` counts neither `cache_read_input_tokens` nor
|
|
1516
1537
|
`cache_creation_input_tokens`, and neither does the `prompt_tokens` a LiteLLM
|
|
1517
1538
|
proxy sends with those two beside it, so they're added, to `total_tokens` too.
|
|
1518
|
-
- A provider's split of its cache writes by how long they're kept
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1539
|
+
- A provider's split of its cache writes by how long they're kept (Anthropic's
|
|
1540
|
+
`cache_creation`, OpenAI's `cache_write_tokens_details`) is kept in
|
|
1541
|
+
`provider_details` and read into `cache_write_ttl_tokens`, by the time each
|
|
1542
|
+
count's name holds (`ephemeral_1h_input_tokens`, `ttl_12h_tokens`); so are the
|
|
1543
|
+
keys of a usage in none of these shapes, as `unrecognized`. A value that isn't
|
|
1544
|
+
a count is left out. A `Usage` built or read without `cache_write_ttl_tokens`
|
|
1545
|
+
takes it from such a split in its `provider_details`, else from its rows.
|
|
1522
1546
|
|
|
1523
1547
|
Through a gateway, whether a response's input counts the cache depends on the
|
|
1524
1548
|
model behind it: a LiteLLM proxy's Claude answers through Chat Completions leave
|
|
@@ -135,6 +135,13 @@ from .tasks.v1 import (
|
|
|
135
135
|
ModelUsage,
|
|
136
136
|
Usage,
|
|
137
137
|
WriteOnly,
|
|
138
|
+
TOKEN_COUNTS,
|
|
139
|
+
TTL_UNIT_PATTERN,
|
|
140
|
+
TTL_UNITS,
|
|
141
|
+
ttl_counts_in_seconds,
|
|
142
|
+
ttl_label,
|
|
143
|
+
ttl_seconds,
|
|
144
|
+
ttl_sum,
|
|
138
145
|
)
|
|
139
146
|
from ..transfers import (
|
|
140
147
|
HttpGetGrant,
|
|
@@ -277,6 +284,13 @@ __all__ = [
|
|
|
277
284
|
"Uploaded",
|
|
278
285
|
"ModelUsage",
|
|
279
286
|
"Usage",
|
|
287
|
+
"TOKEN_COUNTS",
|
|
288
|
+
"TTL_UNIT_PATTERN",
|
|
289
|
+
"TTL_UNITS",
|
|
290
|
+
"ttl_counts_in_seconds",
|
|
291
|
+
"ttl_label",
|
|
292
|
+
"ttl_seconds",
|
|
293
|
+
"ttl_sum",
|
|
280
294
|
"WriteNamespaceGrant",
|
|
281
295
|
"WriteObject",
|
|
282
296
|
"WriteOnly",
|
|
@@ -19,7 +19,7 @@ import shutil
|
|
|
19
19
|
import signal
|
|
20
20
|
from collections import defaultdict
|
|
21
21
|
from collections.abc import AsyncIterator, Mapping
|
|
22
|
-
from dataclasses import dataclass, field,
|
|
22
|
+
from dataclasses import dataclass, field, replace
|
|
23
23
|
from datetime import datetime, timezone
|
|
24
24
|
from pathlib import Path
|
|
25
25
|
from typing import Any
|
|
@@ -58,7 +58,9 @@ from .extensions import (
|
|
|
58
58
|
extension,
|
|
59
59
|
)
|
|
60
60
|
from .framework import AgentEnvAgent, AgentIdentity, a2a_agent
|
|
61
|
-
from .tasks.v1 import
|
|
61
|
+
from .tasks.v1 import (
|
|
62
|
+
TOKEN_COUNTS, AgentConfig, ModelUsage, TaskRequest, TaskResult, TextPart, TrajectoryLog, Usage, ttl_sum,
|
|
63
|
+
)
|
|
62
64
|
from ..tool_client import ToolResult, ToolSession, ToolSessionError
|
|
63
65
|
from ..transfers import download
|
|
64
66
|
from ..types import EnvironmentTool
|
|
@@ -522,7 +524,7 @@ def _tool_error(message: str) -> ProxyToolResult:
|
|
|
522
524
|
return ProxyToolResult(content=[{"type": "text", "text": f"error: {message}"}], is_error=True)
|
|
523
525
|
|
|
524
526
|
|
|
525
|
-
_USAGE_SUMS = (*
|
|
527
|
+
_USAGE_SUMS = (*TOKEN_COUNTS, "cost_usd")
|
|
526
528
|
# Each provider's split of its cache writes by how long they're kept, which ``Usage.from_model_response`` keeps.
|
|
527
529
|
_CACHE_WRITE_SPLITS = ("cache_creation", "cache_write_tokens_details")
|
|
528
530
|
|
|
@@ -560,7 +562,8 @@ def _turn_usage(turn: _Turn) -> Usage:
|
|
|
560
562
|
as the lower bound it is; how many had cache counts with no word on whether their input held them
|
|
561
563
|
(``cache_unsettled``), which leaves the turn's flag unknown; how many usages were in a shape none of the readers
|
|
562
564
|
know (``unrecognized``); and each provider's split of the cache writes, summed, a reported ``Usage``'s split
|
|
563
|
-
counted only where it holds counts, as its ``provider_details`` may hold anything.
|
|
565
|
+
counted only where it holds counts, as its ``provider_details`` may hold anything. Its writes by how long they
|
|
566
|
+
were kept are the calls' summed."""
|
|
564
567
|
calls = [usage for _, usage in turn.model_calls]
|
|
565
568
|
sums, unreported = {}, {}
|
|
566
569
|
for name in _USAGE_SUMS:
|
|
@@ -581,6 +584,7 @@ def _turn_usage(turn: _Turn) -> Usage:
|
|
|
581
584
|
**({"cache_unsettled": unsettled} if unsettled else {}),
|
|
582
585
|
**({"unrecognized": unrecognized} if unrecognized else {}), **splits}
|
|
583
586
|
return Usage(tool_call_count=len(turn.actions), **sums,
|
|
587
|
+
cache_write_ttl_tokens=ttl_sum(call.cache_write_ttl_tokens for call in calls),
|
|
584
588
|
input_includes_cache=True if sums["input_tokens"] is not None and not unsettled else None,
|
|
585
589
|
models=_by_model(turn), provider_details=details if calls else {})
|
|
586
590
|
|
|
@@ -10,6 +10,7 @@ from __future__ import annotations
|
|
|
10
10
|
|
|
11
11
|
import json
|
|
12
12
|
import logging
|
|
13
|
+
import re
|
|
13
14
|
from collections.abc import AsyncIterator, Awaitable, Iterable, Mapping
|
|
14
15
|
from dataclasses import dataclass, field, fields
|
|
15
16
|
from enum import Enum
|
|
@@ -364,14 +365,9 @@ class NativeTrajectory:
|
|
|
364
365
|
object.__setattr__(self, "payload", _copy_json_value(self.payload))
|
|
365
366
|
|
|
366
367
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
"output_tokens",
|
|
371
|
-
"total_tokens",
|
|
372
|
-
"cache_read_tokens",
|
|
373
|
-
"cache_write_tokens",
|
|
374
|
-
)
|
|
368
|
+
#: ``Usage``'s token counts, each an integer a turn's calls sum.
|
|
369
|
+
TOKEN_COUNTS = ("input_tokens", "output_tokens", "total_tokens", "cache_read_tokens", "cache_write_tokens")
|
|
370
|
+
_USAGE_COUNTERS = ("tool_call_count", *TOKEN_COUNTS)
|
|
375
371
|
|
|
376
372
|
|
|
377
373
|
# The keys a model response's usage is read by, in any of the shapes ``Usage.from_model_response`` reads.
|
|
@@ -385,6 +381,86 @@ def _count(value: Any) -> int | None:
|
|
|
385
381
|
return value if isinstance(value, int) and not isinstance(value, bool) and value >= 0 else None
|
|
386
382
|
|
|
387
383
|
|
|
384
|
+
#: The seconds in each unit a time a cache write was kept may be written in, however it's spelled.
|
|
385
|
+
TTL_UNITS = {"s": 1, "sec": 1, "m": 60, "min": 60, "h": 3600, "hr": 3600, "hour": 3600, "d": 86400, "day": 86400}
|
|
386
|
+
#: A pattern for any of ``TTL_UNITS``' spellings, the longest first so a pattern that ends there matches it whole.
|
|
387
|
+
TTL_UNIT_PATTERN = "|".join(sorted(TTL_UNITS, key=len, reverse=True))
|
|
388
|
+
# How long cache writes were kept, as ``cache_write_ttl_tokens`` names it: a count of one unit, ``5m``, ``1h``, ``90s``.
|
|
389
|
+
_TTL_LABEL = re.compile(r"^(\d+)([smhd])$")
|
|
390
|
+
# A provider's count of cache writes kept a while, named for the time: Anthropic's ``ephemeral_1h_input_tokens``,
|
|
391
|
+
# OpenAI's ``ttl_12h_tokens``.
|
|
392
|
+
_TTL_COUNT = re.compile(rf"^(?:ephemeral_|ttl_)?(\d+)({TTL_UNIT_PATTERN})(?:_input)?_tokens$")
|
|
393
|
+
#: Where ``Usage.from_model_response`` keeps each provider's split of its cache writes by how long they were kept.
|
|
394
|
+
CACHE_WRITE_SPLITS = ("cache_creation", "cache_write_tokens_details")
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
_Time = TypeVar("_Time", str, int)
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
def ttl_seconds(label: Any) -> int | None:
|
|
401
|
+
"""The seconds a ``cache_write_ttl_tokens`` label names, ``1h`` as 3600; None for one that names no time."""
|
|
402
|
+
match = _TTL_LABEL.match(label) if isinstance(label, str) else None
|
|
403
|
+
return int(match[1]) * TTL_UNITS[match[2]] if match and int(match[1]) > 0 else None
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
def ttl_label(seconds: int) -> str:
|
|
407
|
+
"""A time as ``cache_write_ttl_tokens`` names it, in the largest unit it's a whole number of: ``1h``, ``90m``,
|
|
408
|
+
``1d``, ``45s``."""
|
|
409
|
+
for unit, size in (("d", 86400), ("h", 3600), ("m", 60)):
|
|
410
|
+
if seconds % size == 0:
|
|
411
|
+
return f"{seconds // size}{unit}"
|
|
412
|
+
return f"{seconds}s"
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
def _ttl_counts(value: Any) -> dict[str, int] | None:
|
|
416
|
+
"""A ``cache_write_ttl_tokens`` value with each time named as ``ttl_label`` names it; raises for a key that names no
|
|
417
|
+
time or a count that isn't a non-negative integer."""
|
|
418
|
+
if value is None:
|
|
419
|
+
return None
|
|
420
|
+
if not isinstance(value, Mapping):
|
|
421
|
+
raise TypeError("cache_write_ttl_tokens must map times to counts")
|
|
422
|
+
counts: dict[str, int] = {}
|
|
423
|
+
for label, count in value.items():
|
|
424
|
+
if (seconds := ttl_seconds(label)) is None:
|
|
425
|
+
raise ValueError(f"cache_write_ttl_tokens: {label!r} names no time, as 5m or 1h do")
|
|
426
|
+
if _count(count) is None:
|
|
427
|
+
raise ValueError(f"cache_write_ttl_tokens: {label}'s count must be a non-negative integer")
|
|
428
|
+
counts[ttl_label(seconds)] = counts.get(ttl_label(seconds), 0) + count
|
|
429
|
+
return counts
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
def _ttl_from_splits(details: Mapping[str, Any]) -> dict[str, int] | None:
|
|
433
|
+
"""The writes by time a provider's split in ``details`` (``CACHE_WRITE_SPLITS``) counts, by each count's name; a
|
|
434
|
+
count that isn't a positive integer is left out, and None when none is left."""
|
|
435
|
+
counts: dict[str, int] = {}
|
|
436
|
+
for name in CACHE_WRITE_SPLITS:
|
|
437
|
+
split = details.get(name)
|
|
438
|
+
for key, value in split.items() if isinstance(split, Mapping) else ():
|
|
439
|
+
if (match := _TTL_COUNT.match(str(key))) and (count := _count(value)):
|
|
440
|
+
label = ttl_label(int(match[1]) * TTL_UNITS[match[2]])
|
|
441
|
+
counts[label] = counts.get(label, 0) + count
|
|
442
|
+
return counts or None
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
def ttl_sum(parts: Iterable[Mapping[_Time, int] | None]) -> dict[_Time, int] | None:
|
|
446
|
+
"""Counts by how long cache writes were kept (``cache_write_ttl_tokens``, by label or by seconds) summed by time;
|
|
447
|
+
None when none of ``parts`` gives one."""
|
|
448
|
+
total: dict[_Time, int] = {}
|
|
449
|
+
for part in parts:
|
|
450
|
+
for time, count in (part or {}).items():
|
|
451
|
+
total[time] = total.get(time, 0) + count
|
|
452
|
+
return total or None
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
def ttl_counts_in_seconds(value: Any) -> dict[int, int]:
|
|
456
|
+
"""A ``cache_write_ttl_tokens`` value as stored, by seconds, each time that can't be read or count that isn't a
|
|
457
|
+
positive integer left out, as a reader of records another version wrote must take them."""
|
|
458
|
+
if not isinstance(value, Mapping):
|
|
459
|
+
return {}
|
|
460
|
+
return ttl_sum({seconds: count} for label, count in value.items()
|
|
461
|
+
if (seconds := ttl_seconds(label)) is not None and _count(count)) or {}
|
|
462
|
+
|
|
463
|
+
|
|
388
464
|
def _check_counts(record: Any, names: Iterable[str]) -> None:
|
|
389
465
|
for name in names:
|
|
390
466
|
value = getattr(record, name)
|
|
@@ -414,11 +490,13 @@ class ModelUsage:
|
|
|
414
490
|
cache_write_tokens: int | None = None
|
|
415
491
|
input_includes_cache: bool | None = None
|
|
416
492
|
cost_usd: float | None = None
|
|
493
|
+
cache_write_ttl_tokens: Mapping[str, int] | None = None
|
|
417
494
|
|
|
418
495
|
def __post_init__(self) -> None:
|
|
419
496
|
if not isinstance(self.model, str) or not self.model:
|
|
420
497
|
raise ValueError("a model's usage must name the model")
|
|
421
498
|
_check_counts(self, _MODEL_COUNTERS)
|
|
499
|
+
object.__setattr__(self, "cache_write_ttl_tokens", _ttl_counts(self.cache_write_ttl_tokens))
|
|
422
500
|
|
|
423
501
|
@classmethod
|
|
424
502
|
def of(cls, model: str, usages: Iterable["Usage"]) -> "ModelUsage":
|
|
@@ -435,7 +513,8 @@ class ModelUsage:
|
|
|
435
513
|
flags = {usage.input_includes_cache for usage in usages if usage.input_tokens is not None}
|
|
436
514
|
return cls(model=model, calls=len(usages), **{name: total(name) for name in _MODEL_COUNTERS[1:]},
|
|
437
515
|
input_includes_cache=flags.pop() if len(flags) == 1 else None,
|
|
438
|
-
cost_usd=sum(costs) if costs and None not in costs else None
|
|
516
|
+
cost_usd=sum(costs) if costs and None not in costs else None,
|
|
517
|
+
cache_write_ttl_tokens=ttl_sum(usage.cache_write_ttl_tokens for usage in usages))
|
|
439
518
|
|
|
440
519
|
@classmethod
|
|
441
520
|
def from_dict(cls, data: Mapping[str, Any]) -> "ModelUsage":
|
|
@@ -445,7 +524,8 @@ class ModelUsage:
|
|
|
445
524
|
return cls(**{f.name: data[f.name] for f in fields(cls) if data.get(f.name) is not None})
|
|
446
525
|
|
|
447
526
|
def to_dict(self) -> dict[str, Any]:
|
|
448
|
-
return {f.name: value
|
|
527
|
+
return {f.name: dict(value) if isinstance(value, Mapping) else value
|
|
528
|
+
for f in fields(self) if (value := getattr(self, f.name)) is not None}
|
|
449
529
|
|
|
450
530
|
|
|
451
531
|
@dataclass(frozen=True, slots=True, kw_only=True)
|
|
@@ -455,7 +535,11 @@ class Usage:
|
|
|
455
535
|
``input_includes_cache`` says whether ``input_tokens`` counts both of them (True), neither (False), or is unknown
|
|
456
536
|
(None), which a price needs to read the counts. ``models`` is the counts by model, from an agent that knows each
|
|
457
537
|
call's model: it covers every call the turn counted, so a price can charge each model at its own rate. A count
|
|
458
|
-
the turn leaves out that every row gives is the rows' sum, and so is the includes-cache flag the rows agree on.
|
|
538
|
+
the turn leaves out that every row gives is the rows' sum, and so is the includes-cache flag the rows agree on.
|
|
539
|
+
``cache_write_ttl_tokens`` is the cache writes by how long they were kept (``ttl_label``'s ``5m``, ``1h``, ``12h``),
|
|
540
|
+
which a price charges at each time's rate; left out, it's what a provider's split in ``provider_details``
|
|
541
|
+
(``CACHE_WRITE_SPLITS``) counts, else the rows' sum when every row gives one. Writes it doesn't count weren't
|
|
542
|
+
said how long they were kept."""
|
|
459
543
|
|
|
460
544
|
tool_call_count: int | None = None
|
|
461
545
|
input_tokens: int | None = None
|
|
@@ -463,6 +547,7 @@ class Usage:
|
|
|
463
547
|
total_tokens: int | None = None
|
|
464
548
|
cache_read_tokens: int | None = None
|
|
465
549
|
cache_write_tokens: int | None = None
|
|
550
|
+
cache_write_ttl_tokens: Mapping[str, int] | None = None
|
|
466
551
|
input_includes_cache: bool | None = None
|
|
467
552
|
cost_usd: float | None = None
|
|
468
553
|
models: tuple[ModelUsage, ...] = ()
|
|
@@ -486,6 +571,13 @@ class Usage:
|
|
|
486
571
|
object.__setattr__(
|
|
487
572
|
self, "provider_details", _copy_json_value(self.provider_details)
|
|
488
573
|
)
|
|
574
|
+
rows = [model.cache_write_ttl_tokens for model in self.models]
|
|
575
|
+
ttl = _ttl_counts(self.cache_write_ttl_tokens)
|
|
576
|
+
if ttl is None:
|
|
577
|
+
ttl = _ttl_from_splits(self.provider_details)
|
|
578
|
+
if ttl is None and rows and None not in rows:
|
|
579
|
+
ttl = ttl_sum(rows)
|
|
580
|
+
object.__setattr__(self, "cache_write_ttl_tokens", ttl)
|
|
489
581
|
|
|
490
582
|
@classmethod
|
|
491
583
|
def from_dict(cls, data: Mapping[str, Any]) -> "Usage":
|
|
@@ -511,9 +603,10 @@ class Usage:
|
|
|
511
603
|
``cached_tokens`` it counts, and ``cache_write_tokens`` with them. Anthropic's ``input_tokens``, and the
|
|
512
604
|
``prompt_tokens`` a LiteLLM proxy sends with Anthropic's ``cache_read_input_tokens`` and
|
|
513
605
|
``cache_creation_input_tokens`` beside it, count neither, so they're added, to ``total_tokens`` too. A
|
|
514
|
-
provider's split of its cache writes by how long they're kept (Anthropic's ``cache_creation``,
|
|
515
|
-
``
|
|
516
|
-
|
|
606
|
+
provider's split of its cache writes by how long they're kept (Anthropic's ``cache_creation``, which a LiteLLM
|
|
607
|
+
client's ``cache_creation_token_details`` is kept as, and OpenAI's ``cache_write_tokens_details``) is kept in
|
|
608
|
+
``provider_details``, and read into ``cache_write_ttl_tokens``; so are the keys of a usage in none of these
|
|
609
|
+
shapes, as ``unrecognized``. A value that isn't a count is left out."""
|
|
517
610
|
key = "prompt_tokens" if "prompt_tokens" in usage else "input_tokens"
|
|
518
611
|
details = usage.get(f"{key}_details")
|
|
519
612
|
details = details if isinstance(details, Mapping) else {}
|
|
@@ -532,7 +625,7 @@ class Usage:
|
|
|
532
625
|
total += missing
|
|
533
626
|
elif input_tokens is not None and output is not None:
|
|
534
627
|
total = input_tokens + output
|
|
535
|
-
kept = {"cache_creation": usage.get("cache_creation"),
|
|
628
|
+
kept = {"cache_creation": usage.get("cache_creation") or details.get("cache_creation_token_details"),
|
|
536
629
|
"cache_write_tokens_details": details.get("cache_write_tokens_details")}
|
|
537
630
|
provider_details: dict[str, Any] = {
|
|
538
631
|
name: counts for name, split in kept.items() if isinstance(split, Mapping)
|
|
@@ -549,7 +642,8 @@ class Usage:
|
|
|
549
642
|
and not self.provider_details)
|
|
550
643
|
|
|
551
644
|
def to_dict(self) -> dict[str, Any]:
|
|
552
|
-
result = {name: value
|
|
645
|
+
result = {name: dict(value) if isinstance(value, Mapping) else value
|
|
646
|
+
for name, value in self._values().items() if value is not None}
|
|
553
647
|
if self.models:
|
|
554
648
|
result["models"] = [model.to_dict() for model in self.models]
|
|
555
649
|
if self.provider_details:
|
|
@@ -71,6 +71,7 @@ from .operations import (
|
|
|
71
71
|
pointer_position,
|
|
72
72
|
pointer_up,
|
|
73
73
|
press,
|
|
74
|
+
read_files,
|
|
74
75
|
record,
|
|
75
76
|
run_in_session,
|
|
76
77
|
scroll,
|
|
@@ -138,8 +139,8 @@ __all__ = [
|
|
|
138
139
|
"display", "set_display", "capture", "click", "drag", "scroll", "type_text", "press",
|
|
139
140
|
"pointer_move", "pointer_down", "pointer_up", "pointer_position", "key_down", "key_up",
|
|
140
141
|
"navigate", "history", "tabs", "dialog", "upload", "page_state",
|
|
141
|
-
"run_in_session", "write_files", "record", "Recording", "RecordHints", "RecordedFrame",
|
|
142
|
-
"frames_in_thread", "RecordingManifest", "ManifestSegment",
|
|
142
|
+
"run_in_session", "write_files", "read_files", "record", "Recording", "RecordHints", "RecordedFrame",
|
|
143
|
+
"RecordedSegment", "frames_in_thread", "RecordingManifest", "ManifestSegment",
|
|
143
144
|
"ComputerError", "InvalidArgument", "OutOfBounds", "StaleFrame", "InputBusy", "PermissionDenied", "Unsupported",
|
|
144
145
|
"BackgroundUnavailable", "TargetUnavailable", "DeviceUnavailable", "DialogOpen", "LimitExceeded", "Timeout",
|
|
145
146
|
"DeliveryFailed",
|