databricks-agentbricks 0.8.0__tar.gz → 0.9.0__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.
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/PKG-INFO +69 -18
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/README.md +68 -17
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/pyproject.toml +1 -1
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/cli/dev.py +4 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/clients/apps_client.py +4 -1
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/clients/apps_user_auth_client.py +13 -1
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/clients/databricks_cli.py +11 -2
- databricks_agentbricks-0.9.0/src/databricks_agentbricks/clients/terminal_relay.py +203 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/presentation/dev.py +21 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/presentation/help.py +2 -2
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/services/dev_service.py +19 -3
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-bricks-workflow/references/state-and-tools.md +22 -3
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-langgraph/AGENTKIT_CONTRACT.md +2 -2
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-langgraph/README.md +20 -4
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-langgraph/agent/agent.py +6 -1
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-langgraph/pyproject.toml +1 -1
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-langgraph/runtime/adapter.py +9 -4
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-openai/AGENTKIT_CONTRACT.md +2 -2
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-openai/README.md +20 -3
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-openai/agent/agent.py +4 -2
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-openai/pyproject.toml +1 -1
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/custom-agent-langgraph/pyproject.toml +1 -1
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/custom-agent-openai/pyproject.toml +1 -1
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/ui/agent-langgraph/CHAT_APP.md +15 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/ui/agent-langgraph/runtime/ui.py +116 -5
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/ui/agent-langgraph/tests/test_demo_ui.py +73 -16
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/ui/agent-langgraph/ui/app.js +496 -58
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/ui/agent-langgraph/ui/index.html +47 -21
- {databricks_agentbricks-0.8.0/src/databricks_agentbricks/templates/ui/agent-openai → databricks_agentbricks-0.9.0/src/databricks_agentbricks/templates/ui/agent-langgraph}/ui/styles.css +471 -79
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/ui/agent-openai/CHAT_APP.md +15 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/ui/agent-openai/runtime/ui.py +116 -5
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/ui/agent-openai/tests/test_demo_ui.py +70 -15
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/ui/agent-openai/ui/app.js +496 -58
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/ui/agent-openai/ui/index.html +47 -21
- {databricks_agentbricks-0.8.0/src/databricks_agentbricks/templates/ui/agent-langgraph → databricks_agentbricks-0.9.0/src/databricks_agentbricks/templates/ui/agent-openai}/ui/styles.css +471 -79
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/langgraph/history.py +6 -2
- databricks_agentbricks-0.9.0/src/databricks_agentkit/langgraph/messages.py +168 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/model_upgrades/optimization.py +7 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/openai/__init__.py +4 -0
- databricks_agentbricks-0.9.0/src/databricks_agentkit/openai/models.py +27 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/runtime/tool_manifest.py +3 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/.gitignore +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/NOTICE +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/__init__.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/agent_hint.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/cli/__init__.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/cli/__main__.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/cli/app.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/cli/auth.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/cli/deploy.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/cli/doctor.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/cli/endpoint.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/cli/experimental.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/cli/init.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/cli/mcp.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/cli/memory.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/cli/models.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/cli/permissions.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/cli/pipeline.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/cli/prompts.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/cli/sandbox.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/cli/sessions.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/cli/telemetry.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/cli/tools.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/cli/tracing.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/clients/__init__.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/clients/api_client_provider.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/clients/app_probe.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/clients/conversation_store_client.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/clients/legacy_runtime_store.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/clients/local_ports.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/clients/local_tracing_client.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/clients/managed_runtime_store.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/clients/mlflow_trace_client.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/clients/tracing_client.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/errors.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/model_upgrade.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/presentation/__init__.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/presentation/deploy.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/presentation/endpoint.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/presentation/group.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/presentation/loadtest.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/presentation/permissions.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/presentation/render.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/presentation/reporter.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/presentation/theme.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/presentation/tracing.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/projects/__init__.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/projects/agent_project.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/projects/app_manifest.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/projects/config.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/projects/resolver.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/projects/types.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/py.typed +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/reporting.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/services/__init__.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/services/deploy_service.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/services/deployment/__init__.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/services/deployment/app_provisioner.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/services/deployment/config.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/services/deployment/deploy_state.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/services/deployment/model_binding_provisioner.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/services/deployment/names.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/services/deployment/provisioners.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/services/deployment/tool_access.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/services/deployment/tool_access_provisioner.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/services/endpoint_service.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/services/invoke/__init__.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/services/invoke/auth.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/services/invoke/request.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/services/invoke/transport.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/services/loadtest/__init__.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/services/loadtest/_locustfile.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/services/loadtest/plan.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/services/loadtest/request.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/services/loadtest/runner.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/services/loadtest/streaming.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/services/tracing/__init__.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/services/tracing/targets.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/services/tracing_service.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/skills.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-bricks-migrate/SKILL.md +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-bricks-workflow/SKILL.md +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-bricks-workflow/references/deployment.md +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-langgraph/.env.example +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-langgraph/.gitignore +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-langgraph/AGENTS.md +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-langgraph/CLAUDE.md +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-langgraph/agent/__init__.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-langgraph/agent/mcps.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-langgraph/agent/tools/__init__.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-langgraph/agent/tools/sample_tool.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-langgraph/agent/tools/send_message.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-langgraph/app.yaml +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-langgraph/runtime/__init__.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-langgraph/runtime/main.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-langgraph/tests/__init__.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-langgraph/tests/test_agent.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-langgraph/tests/test_runtime.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-langgraph/tests/test_workspace.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-openai/.env.example +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-openai/.gitignore +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-openai/AGENTS.md +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-openai/CLAUDE.md +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-openai/agent/__init__.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-openai/agent/checkpoints.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-openai/agent/mcps.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-openai/agent/tools/__init__.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-openai/agent/tools/sample_tool.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-openai/agent/tools/send_message.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-openai/app.yaml +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-openai/runtime/__init__.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-openai/runtime/adapter.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-openai/runtime/main.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-openai/tests/__init__.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-openai/tests/test_agent.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-openai/tests/test_checkpoints.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-openai/tests/test_runtime.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/agent-openai/tests/test_workspace.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/custom-agent-langgraph/.env.example +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/custom-agent-langgraph/.gitignore +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/custom-agent-langgraph/README.md +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/custom-agent-langgraph/agent/__init__.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/custom-agent-langgraph/agent/agent.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/custom-agent-langgraph/app.yaml +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/custom-agent-langgraph/runtime/__init__.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/custom-agent-langgraph/runtime/main.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/custom-agent-langgraph/tests/test_runtime.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/custom-agent-openai/.env.example +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/custom-agent-openai/.gitignore +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/custom-agent-openai/README.md +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/custom-agent-openai/agent/__init__.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/custom-agent-openai/agent/agent.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/custom-agent-openai/app.yaml +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/custom-agent-openai/runtime/__init__.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/custom-agent-openai/runtime/main.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/custom-agent-openai/tests/test_runtime.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/sandbox_mcp.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/sandbox_mcp_langgraph.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/ui/agent-langgraph/runtime/main.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/ui/agent-langgraph/ui/agentbricks-mark.png +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/ui/agent-langgraph/ui/markdown-it-15.0.2.min.js +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/ui/agent-openai/runtime/main.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/ui/agent-openai/ui/agentbricks-mark.png +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/templates/ui/agent-openai/ui/markdown-it-15.0.2.min.js +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/__init__.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/_api_client.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/_pagination.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/_permissions.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/client.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/langgraph/__init__.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/langgraph/genie.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/langgraph/mcp.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/langgraph/memory.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/langgraph/responses.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/langgraph/session_store.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/memory_store.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/model_upgrades/__init__.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/models.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/openai/genie.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/openai/history.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/openai/mcp.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/openai/memory.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/openai/sessions.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/py.typed +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/runtime/ARCHITECTURE.md +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/runtime/README.md +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/runtime/__init__.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/runtime/app.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/runtime/auth.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/runtime/cors.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/runtime/durability/__init__.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/runtime/durability/execution.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/runtime/durability/heartbeat.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/runtime/durability/lakebase_runtime_store.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/runtime/durability/recovery.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/runtime/durability/store.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/runtime/errors.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/runtime/execution.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/runtime/genie.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/runtime/mcp_auth.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/runtime/model_services.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/runtime/prompt_registry.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/runtime/runtime.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/runtime/session_store_client.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/runtime/store.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/runtime/tracing.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/runtime/types.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/runtime/workspace.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/session_store.py +0 -0
- {databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentkit/timefmt.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: databricks-agentbricks
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.0
|
|
4
4
|
Summary: Agent Bricks CLI and AgentKit SDK for custom agents on Databricks
|
|
5
5
|
Author-email: Databricks <agent-feedback@databricks.com>
|
|
6
6
|
License-File: NOTICE
|
|
@@ -208,6 +208,12 @@ agentbricks deploy # deploy to Databricks as agent-bricks-my-agent
|
|
|
208
208
|
`agentbricks dev` runs the agent locally on `http://localhost:8000`, wrapping the Databricks Apps
|
|
209
209
|
local runtime so local behavior matches a deployment.
|
|
210
210
|
|
|
211
|
+
Memory and session stores are off by default in `agentbricks dev`, even when a store is bound in
|
|
212
|
+
`agent.toml`: the chat app shows "Not connected" for memory, and conversation state stays in
|
|
213
|
+
process. They connect after `agentbricks deploy`. To use real stores locally, set
|
|
214
|
+
`AGENT_MEMORY_STORE` (the Store ID) and `AGENT_SESSION_STORE` (the store name) in the project's
|
|
215
|
+
`.env`.
|
|
216
|
+
|
|
211
217
|
`agentbricks init` records the deployment name in `agent.toml`, so `agentbricks deploy` from the
|
|
212
218
|
project directory deploys a Databricks App named `agent-bricks-my-agent`, provisions the
|
|
213
219
|
stores declared in `agent.toml`, and grants the app's service principal access to the stores and
|
|
@@ -670,8 +676,9 @@ it in `recall` and `list_memories`. `memory_tools` resolves the store from the `
|
|
|
670
676
|
binding, carried to the runtime by the `AGENT_MEMORY_STORE` env var that `agentbricks deploy`
|
|
671
677
|
injects, and returns no tools when no store is set, so the agent runs unchanged.
|
|
672
678
|
That "no store set" path is also how it runs under `agentbricks dev`, which runs locally: memory is off
|
|
673
|
-
there (the store is provisioned and used only at deploy)
|
|
674
|
-
|
|
679
|
+
by default there (the store is provisioned and used only at deploy), even when a store is bound in
|
|
680
|
+
`agent.toml`. Setting `AGENT_MEMORY_STORE` in the project's `.env` uses that store locally. The
|
|
681
|
+
OpenAI Agents adapter exposes the same tools as `databricks_agentkit.openai.memory_tools(actor)`:
|
|
675
682
|
|
|
676
683
|
```python
|
|
677
684
|
from databricks_agentkit.langgraph import memory_tools
|
|
@@ -754,8 +761,8 @@ trusted application context. The chat app sends the signed-in user; HTTP clients
|
|
|
754
761
|
`agentbricks endpoint invoke`, have to send it themselves. With a request-user (`auth = "user"`) tool
|
|
755
762
|
bound, the runtime also namespaces a supplied `actor` to the signed-in user.
|
|
756
763
|
|
|
757
|
-
Memory is off under `agentbricks dev`, so try this against a deployed agent: two
|
|
758
|
-
actor.
|
|
764
|
+
Memory is off by default under `agentbricks dev`, so try this against a deployed agent: two
|
|
765
|
+
conversations, one actor.
|
|
759
766
|
|
|
760
767
|
```sh
|
|
761
768
|
ask() { agentbricks --profile <profile> endpoint invoke agent-bricks-my-agent --path /api/invocations \
|
|
@@ -764,6 +771,37 @@ ask "Remember that I prefer answers as bullet points." # conversation 1 saves a
|
|
|
764
771
|
ask "How do I like my answers formatted?" # conversation 2 recalls it
|
|
765
772
|
```
|
|
766
773
|
|
|
774
|
+
### Seeding and using memory from the CLI
|
|
775
|
+
|
|
776
|
+
There are two ways to get a memory store behind a deployed agent. Both end with
|
|
777
|
+
`agentbricks deploy`, which creates the store if it doesn't exist and grants the app access to it.
|
|
778
|
+
|
|
779
|
+
**Start with an empty store.** Bind the store name, then deploy:
|
|
780
|
+
|
|
781
|
+
```sh
|
|
782
|
+
agentbricks memory bind support-agent-memory
|
|
783
|
+
agentbricks deploy my-agent
|
|
784
|
+
```
|
|
785
|
+
|
|
786
|
+
**Start with memories already in the store.** Create the store, add entries, then bind and deploy:
|
|
787
|
+
|
|
788
|
+
```sh
|
|
789
|
+
agentbricks memory stores create --name support-agent-memory # prints a Store ID
|
|
790
|
+
agentbricks memory entries create --store <Store ID> \
|
|
791
|
+
--actor-id you@example.com \
|
|
792
|
+
--path /preferences/style.md \
|
|
793
|
+
--content "Prefers Python and concise answers with code examples."
|
|
794
|
+
agentbricks memory bind support-agent-memory
|
|
795
|
+
agentbricks deploy my-agent
|
|
796
|
+
```
|
|
797
|
+
|
|
798
|
+
`--path` is the entry's key inside the store, written like a file path; it isn't a file on your
|
|
799
|
+
machine. `--actor-id` is the user the memory belongs to. In the deployed chat app, the actor is the
|
|
800
|
+
signed-in user's email, so seed entries under your own email to see them recalled. `--store` takes
|
|
801
|
+
the Store ID that `memory stores create` (or `memory stores list`) prints, while `bind` takes the
|
|
802
|
+
store name. Check what you seeded with
|
|
803
|
+
`agentbricks memory entries list --store <Store ID> --actor-id you@example.com`.
|
|
804
|
+
|
|
767
805
|
### Declaring and provisioning stores
|
|
768
806
|
|
|
769
807
|
For a deployed agent, `agent.toml` declares which stores it uses and `agentbricks deploy` provisions them —
|
|
@@ -785,6 +823,13 @@ agentbricks memory bind support-agent-memory
|
|
|
785
823
|
agentbricks deploy my-agent
|
|
786
824
|
```
|
|
787
825
|
|
|
826
|
+
A store that already exists is reused as is: `deploy` doesn't create a second one or change who else
|
|
827
|
+
can access it. Its only permission change is a WRITE grant for the app's service principal, which
|
|
828
|
+
needs you to be the store's creator or a workspace admin; if you aren't, the deploy still succeeds
|
|
829
|
+
and reports the missing grant. In a shared workspace, give teammates access with
|
|
830
|
+
`agentbricks memory stores permissions grant` (or `agentbricks sessions stores permissions grant`);
|
|
831
|
+
see [Managing store permissions](#managing-store-permissions).
|
|
832
|
+
|
|
788
833
|
Memory and session stores are independent resources: deleting one never affects the other.
|
|
789
834
|
For projects with `agent.toml`, unbinding either store removes its declaration; the next deploy
|
|
790
835
|
removes the corresponding `AGENT_MEMORY_STORE` or `AGENT_SESSION_STORE` entry from `app.yaml`.
|
|
@@ -805,7 +850,7 @@ and declares the Prompt Registry prompts it loads so the search can rewrite them
|
|
|
805
850
|
|
|
806
851
|
```sh
|
|
807
852
|
agentbricks experimental models bind main.my_agent.router_llm --role router --default system.ai.claude-haiku-4-5
|
|
808
|
-
agentbricks experimental models bind main.my_agent.writer_llm --role writer --default system.ai.claude-sonnet-
|
|
853
|
+
agentbricks experimental models bind main.my_agent.writer_llm --role writer --default system.ai.claude-sonnet-5-5
|
|
809
854
|
agentbricks experimental prompts bind main.my_agent.writer
|
|
810
855
|
agentbricks deploy my-agent # creates the services and grants the app access to them and the prompt
|
|
811
856
|
agentbricks experimental models upgrade -c router=claude-haiku-4-5,gpt-5-4-nano -c writer=claude-haiku-4-5 \
|
|
@@ -847,7 +892,7 @@ result = optimize_prompts_and_models(
|
|
|
847
892
|
prompt_uris=["prompts:/main.my_agent.router@production"],
|
|
848
893
|
gateway_endpoints={
|
|
849
894
|
"main.my_agent.router_llm": ["claude-haiku-4-5", "gpt-5-4-mini"],
|
|
850
|
-
"main.my_agent.writer_llm": ["claude-sonnet-
|
|
895
|
+
"main.my_agent.writer_llm": ["claude-sonnet-5-5", "claude-haiku-4-5"],
|
|
851
896
|
},
|
|
852
897
|
scorers=scorers, # MLflow scorers, or (inputs, expectations, answer) -> float
|
|
853
898
|
max_metric_calls=200,
|
|
@@ -1272,7 +1317,7 @@ Deploy derives Apps user scopes from explicit `auth = "user"` bindings and union
|
|
|
1272
1317
|
| UC function | `mcp.functions` |
|
|
1273
1318
|
| Sandbox with a Volume downscope | `ai-gateway`, `files` |
|
|
1274
1319
|
| First-class Genie One or Genie Agent | `genie` |
|
|
1275
|
-
| Sandbox with token injection | `ai-gateway`, `workspace.workspace` |
|
|
1320
|
+
| Sandbox with token injection | `ai-gateway`, `workspace.workspace`, `files`, `sql`, `catalog.catalogs:read`, `catalog.schemas:read`, `catalog.tables:read` |
|
|
1276
1321
|
| Sandbox with token injection disabled | `ai-gateway` |
|
|
1277
1322
|
|
|
1278
1323
|
For example, bind Genie tools in a current project with `server = "agentbricks"`:
|
|
@@ -1300,15 +1345,20 @@ The `system.ai.dbsql` managed MCP additionally requests the Apps `sql` user scop
|
|
|
1300
1345
|
API consent, not `sql:restricted-query`; read-only enforcement remains the service policy plus the
|
|
1301
1346
|
requesting user's Unity Catalog grants. DBSQL does not use Databricks Connect.
|
|
1302
1347
|
|
|
1303
|
-
When a user-auth sandbox has `databricks_access_token_included = true`,
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
Unity Catalog
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
the
|
|
1348
|
+
When a user-auth sandbox has `databricks_access_token_included = true`, the injected credential
|
|
1349
|
+
carries only the App's user API scopes, so the sandbox requests `workspace.workspace` (workspace
|
|
1350
|
+
files), `files` (Volume files through the Files API), `sql` (SQL warehouses through the Statement
|
|
1351
|
+
Execution API), and `catalog.catalogs:read`, `catalog.schemas:read`, and `catalog.tables:read`
|
|
1352
|
+
(Unity Catalog metadata). Apps has no user API scope for Databricks Connect, clusters, jobs, or
|
|
1353
|
+
secrets, so sandbox code cannot call those APIs as the request user; use `auth = "app"` for them.
|
|
1354
|
+
An existing App deployed before these defaults needs `--allow-user-scope-update` once. A sandbox
|
|
1355
|
+
binding with a Volume downscope also requests the Apps `files` user scope.
|
|
1356
|
+
OAuth consent does not grant data access: the requesting user still needs the corresponding
|
|
1357
|
+
Unity Catalog and warehouse privileges, and the sandbox downscope remains authoritative. A sandbox
|
|
1358
|
+
binding with token injection disabled requests none of these credential scopes; its other
|
|
1359
|
+
resource-derived scopes still apply. Databricks Apps rejects the legacy bare `workspace` scope, so
|
|
1360
|
+
Agent Bricks requests `workspace.workspace`. These scopes are requested only for `auth = "user"`;
|
|
1361
|
+
`auth = "app"` uses the App service principal's permissions instead.
|
|
1312
1362
|
|
|
1313
1363
|
Review the target App's scopes and coordinate with its other owners before allowing the update. Once
|
|
1314
1364
|
those scopes are present, later deploys do not need the flag. The CLI preserves unrelated scopes,
|
|
@@ -1537,7 +1587,8 @@ agentbricks --profile <profile> deploy agent-bricks-agent-demo --source .
|
|
|
1537
1587
|
(`bind` declares the store name in `agent.toml`; `agentbricks deploy` creates any declared-but-missing
|
|
1538
1588
|
store and grants the app's service principal access to it. The memory store id flows to the runtime
|
|
1539
1589
|
via the `AGENT_MEMORY_STORE` env var that `deploy` injects; `agentbricks dev` runs locally with memory off
|
|
1540
|
-
and does not inject it
|
|
1590
|
+
and does not inject it, so the chat app shows "Not connected" for memory until you deploy. The id is
|
|
1591
|
+
not persisted in `agent.toml`.)
|
|
1541
1592
|
|
|
1542
1593
|
The chat UI generates a stable application session UUID in browser local storage, sends it as the
|
|
1543
1594
|
invocation's top-level `session_id`, sends the signed-in user as `input.actor`, and creates a fresh
|
|
@@ -165,6 +165,12 @@ agentbricks deploy # deploy to Databricks as agent-bricks-my-agent
|
|
|
165
165
|
`agentbricks dev` runs the agent locally on `http://localhost:8000`, wrapping the Databricks Apps
|
|
166
166
|
local runtime so local behavior matches a deployment.
|
|
167
167
|
|
|
168
|
+
Memory and session stores are off by default in `agentbricks dev`, even when a store is bound in
|
|
169
|
+
`agent.toml`: the chat app shows "Not connected" for memory, and conversation state stays in
|
|
170
|
+
process. They connect after `agentbricks deploy`. To use real stores locally, set
|
|
171
|
+
`AGENT_MEMORY_STORE` (the Store ID) and `AGENT_SESSION_STORE` (the store name) in the project's
|
|
172
|
+
`.env`.
|
|
173
|
+
|
|
168
174
|
`agentbricks init` records the deployment name in `agent.toml`, so `agentbricks deploy` from the
|
|
169
175
|
project directory deploys a Databricks App named `agent-bricks-my-agent`, provisions the
|
|
170
176
|
stores declared in `agent.toml`, and grants the app's service principal access to the stores and
|
|
@@ -627,8 +633,9 @@ it in `recall` and `list_memories`. `memory_tools` resolves the store from the `
|
|
|
627
633
|
binding, carried to the runtime by the `AGENT_MEMORY_STORE` env var that `agentbricks deploy`
|
|
628
634
|
injects, and returns no tools when no store is set, so the agent runs unchanged.
|
|
629
635
|
That "no store set" path is also how it runs under `agentbricks dev`, which runs locally: memory is off
|
|
630
|
-
there (the store is provisioned and used only at deploy)
|
|
631
|
-
|
|
636
|
+
by default there (the store is provisioned and used only at deploy), even when a store is bound in
|
|
637
|
+
`agent.toml`. Setting `AGENT_MEMORY_STORE` in the project's `.env` uses that store locally. The
|
|
638
|
+
OpenAI Agents adapter exposes the same tools as `databricks_agentkit.openai.memory_tools(actor)`:
|
|
632
639
|
|
|
633
640
|
```python
|
|
634
641
|
from databricks_agentkit.langgraph import memory_tools
|
|
@@ -711,8 +718,8 @@ trusted application context. The chat app sends the signed-in user; HTTP clients
|
|
|
711
718
|
`agentbricks endpoint invoke`, have to send it themselves. With a request-user (`auth = "user"`) tool
|
|
712
719
|
bound, the runtime also namespaces a supplied `actor` to the signed-in user.
|
|
713
720
|
|
|
714
|
-
Memory is off under `agentbricks dev`, so try this against a deployed agent: two
|
|
715
|
-
actor.
|
|
721
|
+
Memory is off by default under `agentbricks dev`, so try this against a deployed agent: two
|
|
722
|
+
conversations, one actor.
|
|
716
723
|
|
|
717
724
|
```sh
|
|
718
725
|
ask() { agentbricks --profile <profile> endpoint invoke agent-bricks-my-agent --path /api/invocations \
|
|
@@ -721,6 +728,37 @@ ask "Remember that I prefer answers as bullet points." # conversation 1 saves a
|
|
|
721
728
|
ask "How do I like my answers formatted?" # conversation 2 recalls it
|
|
722
729
|
```
|
|
723
730
|
|
|
731
|
+
### Seeding and using memory from the CLI
|
|
732
|
+
|
|
733
|
+
There are two ways to get a memory store behind a deployed agent. Both end with
|
|
734
|
+
`agentbricks deploy`, which creates the store if it doesn't exist and grants the app access to it.
|
|
735
|
+
|
|
736
|
+
**Start with an empty store.** Bind the store name, then deploy:
|
|
737
|
+
|
|
738
|
+
```sh
|
|
739
|
+
agentbricks memory bind support-agent-memory
|
|
740
|
+
agentbricks deploy my-agent
|
|
741
|
+
```
|
|
742
|
+
|
|
743
|
+
**Start with memories already in the store.** Create the store, add entries, then bind and deploy:
|
|
744
|
+
|
|
745
|
+
```sh
|
|
746
|
+
agentbricks memory stores create --name support-agent-memory # prints a Store ID
|
|
747
|
+
agentbricks memory entries create --store <Store ID> \
|
|
748
|
+
--actor-id you@example.com \
|
|
749
|
+
--path /preferences/style.md \
|
|
750
|
+
--content "Prefers Python and concise answers with code examples."
|
|
751
|
+
agentbricks memory bind support-agent-memory
|
|
752
|
+
agentbricks deploy my-agent
|
|
753
|
+
```
|
|
754
|
+
|
|
755
|
+
`--path` is the entry's key inside the store, written like a file path; it isn't a file on your
|
|
756
|
+
machine. `--actor-id` is the user the memory belongs to. In the deployed chat app, the actor is the
|
|
757
|
+
signed-in user's email, so seed entries under your own email to see them recalled. `--store` takes
|
|
758
|
+
the Store ID that `memory stores create` (or `memory stores list`) prints, while `bind` takes the
|
|
759
|
+
store name. Check what you seeded with
|
|
760
|
+
`agentbricks memory entries list --store <Store ID> --actor-id you@example.com`.
|
|
761
|
+
|
|
724
762
|
### Declaring and provisioning stores
|
|
725
763
|
|
|
726
764
|
For a deployed agent, `agent.toml` declares which stores it uses and `agentbricks deploy` provisions them —
|
|
@@ -742,6 +780,13 @@ agentbricks memory bind support-agent-memory
|
|
|
742
780
|
agentbricks deploy my-agent
|
|
743
781
|
```
|
|
744
782
|
|
|
783
|
+
A store that already exists is reused as is: `deploy` doesn't create a second one or change who else
|
|
784
|
+
can access it. Its only permission change is a WRITE grant for the app's service principal, which
|
|
785
|
+
needs you to be the store's creator or a workspace admin; if you aren't, the deploy still succeeds
|
|
786
|
+
and reports the missing grant. In a shared workspace, give teammates access with
|
|
787
|
+
`agentbricks memory stores permissions grant` (or `agentbricks sessions stores permissions grant`);
|
|
788
|
+
see [Managing store permissions](#managing-store-permissions).
|
|
789
|
+
|
|
745
790
|
Memory and session stores are independent resources: deleting one never affects the other.
|
|
746
791
|
For projects with `agent.toml`, unbinding either store removes its declaration; the next deploy
|
|
747
792
|
removes the corresponding `AGENT_MEMORY_STORE` or `AGENT_SESSION_STORE` entry from `app.yaml`.
|
|
@@ -762,7 +807,7 @@ and declares the Prompt Registry prompts it loads so the search can rewrite them
|
|
|
762
807
|
|
|
763
808
|
```sh
|
|
764
809
|
agentbricks experimental models bind main.my_agent.router_llm --role router --default system.ai.claude-haiku-4-5
|
|
765
|
-
agentbricks experimental models bind main.my_agent.writer_llm --role writer --default system.ai.claude-sonnet-
|
|
810
|
+
agentbricks experimental models bind main.my_agent.writer_llm --role writer --default system.ai.claude-sonnet-5-5
|
|
766
811
|
agentbricks experimental prompts bind main.my_agent.writer
|
|
767
812
|
agentbricks deploy my-agent # creates the services and grants the app access to them and the prompt
|
|
768
813
|
agentbricks experimental models upgrade -c router=claude-haiku-4-5,gpt-5-4-nano -c writer=claude-haiku-4-5 \
|
|
@@ -804,7 +849,7 @@ result = optimize_prompts_and_models(
|
|
|
804
849
|
prompt_uris=["prompts:/main.my_agent.router@production"],
|
|
805
850
|
gateway_endpoints={
|
|
806
851
|
"main.my_agent.router_llm": ["claude-haiku-4-5", "gpt-5-4-mini"],
|
|
807
|
-
"main.my_agent.writer_llm": ["claude-sonnet-
|
|
852
|
+
"main.my_agent.writer_llm": ["claude-sonnet-5-5", "claude-haiku-4-5"],
|
|
808
853
|
},
|
|
809
854
|
scorers=scorers, # MLflow scorers, or (inputs, expectations, answer) -> float
|
|
810
855
|
max_metric_calls=200,
|
|
@@ -1229,7 +1274,7 @@ Deploy derives Apps user scopes from explicit `auth = "user"` bindings and union
|
|
|
1229
1274
|
| UC function | `mcp.functions` |
|
|
1230
1275
|
| Sandbox with a Volume downscope | `ai-gateway`, `files` |
|
|
1231
1276
|
| First-class Genie One or Genie Agent | `genie` |
|
|
1232
|
-
| Sandbox with token injection | `ai-gateway`, `workspace.workspace` |
|
|
1277
|
+
| Sandbox with token injection | `ai-gateway`, `workspace.workspace`, `files`, `sql`, `catalog.catalogs:read`, `catalog.schemas:read`, `catalog.tables:read` |
|
|
1233
1278
|
| Sandbox with token injection disabled | `ai-gateway` |
|
|
1234
1279
|
|
|
1235
1280
|
For example, bind Genie tools in a current project with `server = "agentbricks"`:
|
|
@@ -1257,15 +1302,20 @@ The `system.ai.dbsql` managed MCP additionally requests the Apps `sql` user scop
|
|
|
1257
1302
|
API consent, not `sql:restricted-query`; read-only enforcement remains the service policy plus the
|
|
1258
1303
|
requesting user's Unity Catalog grants. DBSQL does not use Databricks Connect.
|
|
1259
1304
|
|
|
1260
|
-
When a user-auth sandbox has `databricks_access_token_included = true`,
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
Unity Catalog
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
the
|
|
1305
|
+
When a user-auth sandbox has `databricks_access_token_included = true`, the injected credential
|
|
1306
|
+
carries only the App's user API scopes, so the sandbox requests `workspace.workspace` (workspace
|
|
1307
|
+
files), `files` (Volume files through the Files API), `sql` (SQL warehouses through the Statement
|
|
1308
|
+
Execution API), and `catalog.catalogs:read`, `catalog.schemas:read`, and `catalog.tables:read`
|
|
1309
|
+
(Unity Catalog metadata). Apps has no user API scope for Databricks Connect, clusters, jobs, or
|
|
1310
|
+
secrets, so sandbox code cannot call those APIs as the request user; use `auth = "app"` for them.
|
|
1311
|
+
An existing App deployed before these defaults needs `--allow-user-scope-update` once. A sandbox
|
|
1312
|
+
binding with a Volume downscope also requests the Apps `files` user scope.
|
|
1313
|
+
OAuth consent does not grant data access: the requesting user still needs the corresponding
|
|
1314
|
+
Unity Catalog and warehouse privileges, and the sandbox downscope remains authoritative. A sandbox
|
|
1315
|
+
binding with token injection disabled requests none of these credential scopes; its other
|
|
1316
|
+
resource-derived scopes still apply. Databricks Apps rejects the legacy bare `workspace` scope, so
|
|
1317
|
+
Agent Bricks requests `workspace.workspace`. These scopes are requested only for `auth = "user"`;
|
|
1318
|
+
`auth = "app"` uses the App service principal's permissions instead.
|
|
1269
1319
|
|
|
1270
1320
|
Review the target App's scopes and coordinate with its other owners before allowing the update. Once
|
|
1271
1321
|
those scopes are present, later deploys do not need the flag. The CLI preserves unrelated scopes,
|
|
@@ -1494,7 +1544,8 @@ agentbricks --profile <profile> deploy agent-bricks-agent-demo --source .
|
|
|
1494
1544
|
(`bind` declares the store name in `agent.toml`; `agentbricks deploy` creates any declared-but-missing
|
|
1495
1545
|
store and grants the app's service principal access to it. The memory store id flows to the runtime
|
|
1496
1546
|
via the `AGENT_MEMORY_STORE` env var that `deploy` injects; `agentbricks dev` runs locally with memory off
|
|
1497
|
-
and does not inject it
|
|
1547
|
+
and does not inject it, so the chat app shows "Not connected" for memory until you deploy. The id is
|
|
1548
|
+
not persisted in `agent.toml`.)
|
|
1498
1549
|
|
|
1499
1550
|
The chat UI generates a stable application session UUID in browser local storage, sends it as the
|
|
1500
1551
|
invocation's top-level `session_id`, sends the signed-in user as `input.actor`, and creates a fresh
|
{databricks_agentbricks-0.8.0 → databricks_agentbricks-0.9.0}/src/databricks_agentbricks/cli/dev.py
RENAMED
|
@@ -23,6 +23,7 @@ from databricks_agentbricks.presentation.dev import (
|
|
|
23
23
|
announce_bound_resources,
|
|
24
24
|
announce_starting,
|
|
25
25
|
local_trace_label,
|
|
26
|
+
starting_status,
|
|
26
27
|
)
|
|
27
28
|
from databricks_agentbricks.presentation.dev import (
|
|
28
29
|
announce_local_url as _announce_local_url,
|
|
@@ -112,6 +113,9 @@ def dev(
|
|
|
112
113
|
local_trace_label(plan.preview),
|
|
113
114
|
has_chat_ui=plan.preview.has_chat_ui,
|
|
114
115
|
),
|
|
116
|
+
# A spinner in the quiet stretches before the agent answers (e.g. while it imports
|
|
117
|
+
# its libraries), so a long wait doesn't look like a hang.
|
|
118
|
+
quiet_status=starting_status,
|
|
115
119
|
)
|
|
116
120
|
except AgentCliError:
|
|
117
121
|
# Separate the error from the run-local logs it follows.
|
|
@@ -544,6 +544,7 @@ class AppsClient:
|
|
|
544
544
|
port: int,
|
|
545
545
|
app_port: int,
|
|
546
546
|
on_ready: Optional[Callable[[], None]] = None,
|
|
547
|
+
quiet_status: Optional[Callable[[float], str]] = None,
|
|
547
548
|
) -> None:
|
|
548
549
|
"""Run an app locally from a prepared manifest, streaming its output.
|
|
549
550
|
|
|
@@ -553,7 +554,8 @@ class AppsClient:
|
|
|
553
554
|
With ``on_ready``, it is called once the app itself answers on ``app_port`` (the proxy on
|
|
554
555
|
``port`` listens before the app is up), so the caller can report success only when the app
|
|
555
556
|
is actually up. A failure is then reported as "could not start" or "stopped" depending on
|
|
556
|
-
whether it got that far.
|
|
557
|
+
whether it got that far. ``quiet_status`` (given the seconds since start) is the line to
|
|
558
|
+
show while the output is quiet before then, where the terminal supports it.
|
|
557
559
|
"""
|
|
558
560
|
args = ["apps", "run-local"]
|
|
559
561
|
if prepare_environment:
|
|
@@ -586,6 +588,7 @@ class AppsClient:
|
|
|
586
588
|
env=_get_run_local_env(),
|
|
587
589
|
ready_probe=lambda: accepts_connections(app_port),
|
|
588
590
|
on_ready=_on_ready,
|
|
591
|
+
quiet_status=quiet_status,
|
|
589
592
|
)
|
|
590
593
|
if result.returncode != 0:
|
|
591
594
|
if started:
|
|
@@ -15,6 +15,18 @@ from databricks_agentbricks.projects.agent_project import AgentProject
|
|
|
15
15
|
from databricks_agentbricks.projects.types import AgentServer
|
|
16
16
|
|
|
17
17
|
_IDENTITY_DEFAULT_SCOPES = frozenset({"iam.access-control:read", "iam.current-user:read"})
|
|
18
|
+
# A user-auth sandbox credential carries only the App's user API scopes, so sandbox code can call
|
|
19
|
+
# just the APIs they cover: workspace files, Volume files, SQL warehouses, and UC metadata reads.
|
|
20
|
+
_SANDBOX_TOKEN_SCOPES = frozenset(
|
|
21
|
+
{
|
|
22
|
+
"workspace.workspace",
|
|
23
|
+
"files",
|
|
24
|
+
"sql",
|
|
25
|
+
"catalog.catalogs:read",
|
|
26
|
+
"catalog.schemas:read",
|
|
27
|
+
"catalog.tables:read",
|
|
28
|
+
}
|
|
29
|
+
)
|
|
18
30
|
|
|
19
31
|
|
|
20
32
|
def _validate_forwarding(app: App) -> None:
|
|
@@ -117,7 +129,7 @@ def required_user_api_scopes(project: AgentProject | None) -> set[str]:
|
|
|
117
129
|
):
|
|
118
130
|
scopes.add("files")
|
|
119
131
|
if tool.source.kind == "sandbox" and tool.policy.databricks_access_token_included:
|
|
120
|
-
scopes.
|
|
132
|
+
scopes.update(_SANDBOX_TOKEN_SCOPES)
|
|
121
133
|
return scopes
|
|
122
134
|
|
|
123
135
|
|
|
@@ -16,6 +16,7 @@ import time
|
|
|
16
16
|
from collections.abc import Callable, Mapping
|
|
17
17
|
from typing import Optional
|
|
18
18
|
|
|
19
|
+
from databricks_agentbricks.clients import terminal_relay
|
|
19
20
|
from databricks_agentbricks.errors import AgentCliError
|
|
20
21
|
|
|
21
22
|
# Lines of relayed output a `tee` run keeps for callers that inspect a failure.
|
|
@@ -39,6 +40,7 @@ def _databricks(
|
|
|
39
40
|
tee: bool = False,
|
|
40
41
|
ready_probe: Optional[Callable[[], bool]] = None,
|
|
41
42
|
on_ready: Optional[Callable[[], None]] = None,
|
|
43
|
+
quiet_status: Optional[Callable[[float], str]] = None,
|
|
42
44
|
) -> subprocess.CompletedProcess:
|
|
43
45
|
"""Run one ``databricks`` command.
|
|
44
46
|
|
|
@@ -50,12 +52,19 @@ def _databricks(
|
|
|
50
52
|
``ready_probe`` is for a long-running server command such as ``apps run-local``: its output
|
|
51
53
|
streams as usual, the probe is polled while the command runs, and ``on_ready`` is called once
|
|
52
54
|
the probe first succeeds. A command that exits before it is ready never triggers ``on_ready``,
|
|
53
|
-
so the caller can hold back a success message until the server actually answers.
|
|
55
|
+
so the caller can hold back a success message until the server actually answers. With
|
|
56
|
+
``quiet_status`` too, on a terminal that supports it, the output is relayed through a
|
|
57
|
+
pseudo-terminal and that status line is drawn whenever the output goes quiet before then (see
|
|
58
|
+
``terminal_relay``); otherwise the output streams as usual.
|
|
54
59
|
"""
|
|
55
60
|
cmd = ["databricks", *args]
|
|
56
61
|
if profile:
|
|
57
62
|
cmd += ["--profile", profile]
|
|
58
|
-
if ready_probe is not None:
|
|
63
|
+
if ready_probe is not None and quiet_status is not None and terminal_relay.supported():
|
|
64
|
+
result = terminal_relay.run(
|
|
65
|
+
cmd, cwd=cwd, env=env, probe=ready_probe, on_ready=on_ready, quiet_status=quiet_status
|
|
66
|
+
)
|
|
67
|
+
elif ready_probe is not None:
|
|
59
68
|
result = _run_until_ready(cmd, cwd=cwd, env=env, probe=ready_probe, on_ready=on_ready)
|
|
60
69
|
elif tee:
|
|
61
70
|
result = _run_tee(cmd, cwd=cwd, env=env)
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"""Relay a command's output through a pseudo-terminal, with a status line in the quiet gaps.
|
|
2
|
+
|
|
3
|
+
``agentbricks dev`` runs ``databricks apps run-local``, which builds the environment and then starts
|
|
4
|
+
the agent's server. Between the last install line and the server answering there can be a long,
|
|
5
|
+
silent stretch (the agent importing its libraries) where the terminal shows only a static cursor.
|
|
6
|
+
Drawing a spinner there without it overwriting the logs means knowing when the output goes quiet, so
|
|
7
|
+
the output has to pass through us. A pseudo-terminal keeps that invisible to the tools: they still
|
|
8
|
+
see a terminal, so colors, uv's own progress display, and interactive prompts (a ``breakpoint()``)
|
|
9
|
+
behave exactly as when they write to the terminal directly. Every byte is passed through unchanged;
|
|
10
|
+
the status line is only ever drawn on an empty line and erased before more output is written.
|
|
11
|
+
|
|
12
|
+
POSIX only: callers check :func:`supported` and fall back to plain streaming elsewhere.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import errno
|
|
18
|
+
import os
|
|
19
|
+
import select
|
|
20
|
+
import signal
|
|
21
|
+
import subprocess
|
|
22
|
+
import sys
|
|
23
|
+
import time
|
|
24
|
+
from collections.abc import Callable, Mapping
|
|
25
|
+
from typing import Optional
|
|
26
|
+
|
|
27
|
+
# Seconds without output before the status line appears.
|
|
28
|
+
_QUIET_AFTER_S = 1.0
|
|
29
|
+
# Seconds between select() wakeups: how often the status line animates and the probe can run.
|
|
30
|
+
_TICK_S = 0.1
|
|
31
|
+
# Seconds between readiness probes.
|
|
32
|
+
_READY_POLL_S = 0.25
|
|
33
|
+
# Seconds an interrupted command gets to exit on its own before it is killed (as `subprocess.run`).
|
|
34
|
+
_SIGINT_WAIT_S = 0.25
|
|
35
|
+
# Seconds to keep relaying output after the command exits or is interrupted, so a server's shutdown
|
|
36
|
+
# logs still reach the terminal (and its writes don't fail), without waiting on it forever.
|
|
37
|
+
_OUTPUT_GRACE_S = 3.0
|
|
38
|
+
# Return to the start of the line and clear it: erases the status line.
|
|
39
|
+
_CLEAR_LINE = b"\r\x1b[2K"
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def supported() -> bool:
|
|
43
|
+
"""Whether output can be relayed: a POSIX system with stdout and stderr on a terminal.
|
|
44
|
+
|
|
45
|
+
Both streams must be the terminal, since the command's stdout and stderr share one
|
|
46
|
+
pseudo-terminal; with either redirected, merging them would change where output lands.
|
|
47
|
+
"""
|
|
48
|
+
if sys.platform == "win32":
|
|
49
|
+
return False
|
|
50
|
+
try:
|
|
51
|
+
return os.isatty(1) and os.isatty(2)
|
|
52
|
+
except OSError:
|
|
53
|
+
return False
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def run(
|
|
57
|
+
cmd: list[str],
|
|
58
|
+
*,
|
|
59
|
+
cwd: Optional[str],
|
|
60
|
+
env: Optional[Mapping[str, str]],
|
|
61
|
+
probe: Callable[[], bool],
|
|
62
|
+
on_ready: Optional[Callable[[], None]],
|
|
63
|
+
quiet_status: Callable[[float], str],
|
|
64
|
+
) -> subprocess.CompletedProcess:
|
|
65
|
+
"""Run ``cmd`` on a pseudo-terminal, relaying its output to ours unchanged.
|
|
66
|
+
|
|
67
|
+
``probe`` is polled until it first succeeds, then ``on_ready`` is called. Until then, whenever
|
|
68
|
+
the output has been quiet for a moment at the start of a line, the line ``quiet_status(elapsed)``
|
|
69
|
+
returns is drawn in place (``elapsed`` is seconds since the command started) and erased as soon
|
|
70
|
+
as more output arrives or the command is ready.
|
|
71
|
+
"""
|
|
72
|
+
import pty # POSIX only; imported here so the module still loads on Windows
|
|
73
|
+
|
|
74
|
+
master, slave = pty.openpty()
|
|
75
|
+
_copy_window_size(master)
|
|
76
|
+
previous_winch = signal.signal(signal.SIGWINCH, lambda *_: _copy_window_size(master))
|
|
77
|
+
try:
|
|
78
|
+
# stdin stays the real terminal, so typed input (e.g. at a debugger prompt) still reaches
|
|
79
|
+
# the app; the process group is unchanged, so Ctrl+C reaches it as before.
|
|
80
|
+
proc = subprocess.Popen(cmd, cwd=cwd, env=env, stdout=slave, stderr=slave)
|
|
81
|
+
except BaseException:
|
|
82
|
+
os.close(master)
|
|
83
|
+
os.close(slave)
|
|
84
|
+
signal.signal(signal.SIGWINCH, previous_winch)
|
|
85
|
+
raise
|
|
86
|
+
os.close(slave)
|
|
87
|
+
relay = _Relay(master)
|
|
88
|
+
try:
|
|
89
|
+
start = time.monotonic()
|
|
90
|
+
ready = False
|
|
91
|
+
last_probe = 0.0
|
|
92
|
+
exited_at: Optional[float] = None
|
|
93
|
+
while True:
|
|
94
|
+
relay.pump(_TICK_S)
|
|
95
|
+
now = time.monotonic()
|
|
96
|
+
if proc.poll() is not None:
|
|
97
|
+
exited_at = exited_at or now
|
|
98
|
+
if relay.closed or now - exited_at > _OUTPUT_GRACE_S:
|
|
99
|
+
break
|
|
100
|
+
continue
|
|
101
|
+
if not ready and now - last_probe >= _READY_POLL_S:
|
|
102
|
+
last_probe = now
|
|
103
|
+
if probe():
|
|
104
|
+
ready = True
|
|
105
|
+
relay.clear_status()
|
|
106
|
+
if on_ready is not None:
|
|
107
|
+
on_ready()
|
|
108
|
+
if not ready and relay.quiet_for(now) >= _QUIET_AFTER_S:
|
|
109
|
+
relay.show_status(quiet_status(now - start))
|
|
110
|
+
relay.clear_status()
|
|
111
|
+
except KeyboardInterrupt:
|
|
112
|
+
relay.clear_status()
|
|
113
|
+
# Ctrl+C reaches the child too. Keep relaying its shutdown output, give it a moment to exit
|
|
114
|
+
# cleanly as `subprocess.run` does, then make sure it is gone.
|
|
115
|
+
deadline = time.monotonic() + _SIGINT_WAIT_S
|
|
116
|
+
while proc.poll() is None and time.monotonic() < deadline:
|
|
117
|
+
relay.pump(_TICK_S)
|
|
118
|
+
if proc.poll() is None:
|
|
119
|
+
proc.kill()
|
|
120
|
+
relay.drain(_OUTPUT_GRACE_S)
|
|
121
|
+
raise
|
|
122
|
+
except BaseException:
|
|
123
|
+
relay.clear_status()
|
|
124
|
+
proc.kill()
|
|
125
|
+
raise
|
|
126
|
+
finally:
|
|
127
|
+
signal.signal(signal.SIGWINCH, previous_winch)
|
|
128
|
+
os.close(master)
|
|
129
|
+
proc.wait()
|
|
130
|
+
return subprocess.CompletedProcess(cmd, proc.returncode)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
class _Relay:
|
|
134
|
+
"""Copies the pseudo-terminal's output to our stdout and owns the in-place status line."""
|
|
135
|
+
|
|
136
|
+
def __init__(self, master: int) -> None:
|
|
137
|
+
self._master = master
|
|
138
|
+
self.closed = False
|
|
139
|
+
self._status_shown = False
|
|
140
|
+
self._at_line_start = True
|
|
141
|
+
self._last_output = time.monotonic()
|
|
142
|
+
|
|
143
|
+
def pump(self, timeout: float) -> None:
|
|
144
|
+
"""Relay whatever output arrives within ``timeout`` seconds."""
|
|
145
|
+
if self.closed:
|
|
146
|
+
time.sleep(timeout)
|
|
147
|
+
return
|
|
148
|
+
readable, _, _ = select.select([self._master], [], [], timeout)
|
|
149
|
+
if not readable:
|
|
150
|
+
return
|
|
151
|
+
try:
|
|
152
|
+
data = os.read(self._master, 65536)
|
|
153
|
+
except OSError as exc:
|
|
154
|
+
# Every writer has closed its end: EIO on Linux, EOF (b"") on macOS.
|
|
155
|
+
if exc.errno != errno.EIO:
|
|
156
|
+
raise
|
|
157
|
+
data = b""
|
|
158
|
+
if not data:
|
|
159
|
+
self.closed = True
|
|
160
|
+
return
|
|
161
|
+
self.clear_status()
|
|
162
|
+
_write(data)
|
|
163
|
+
self._last_output = time.monotonic()
|
|
164
|
+
self._at_line_start = data.endswith(b"\n")
|
|
165
|
+
|
|
166
|
+
def drain(self, timeout: float) -> None:
|
|
167
|
+
"""Relay output until the pseudo-terminal closes, for at most ``timeout`` seconds."""
|
|
168
|
+
deadline = time.monotonic() + timeout
|
|
169
|
+
while not self.closed and time.monotonic() < deadline:
|
|
170
|
+
self.pump(_TICK_S)
|
|
171
|
+
|
|
172
|
+
def quiet_for(self, now: float) -> float:
|
|
173
|
+
"""Seconds since the last output, or 0 when the cursor is mid-line (a prompt, a progress bar)."""
|
|
174
|
+
return now - self._last_output if self._at_line_start else 0.0
|
|
175
|
+
|
|
176
|
+
def show_status(self, line: str) -> None:
|
|
177
|
+
_write(_CLEAR_LINE + line.encode())
|
|
178
|
+
self._status_shown = True
|
|
179
|
+
|
|
180
|
+
def clear_status(self) -> None:
|
|
181
|
+
if self._status_shown:
|
|
182
|
+
_write(_CLEAR_LINE)
|
|
183
|
+
self._status_shown = False
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def _write(data: bytes) -> None:
|
|
187
|
+
sys.stdout.flush() # keep our own buffered output in order with the raw writes
|
|
188
|
+
view = memoryview(data)
|
|
189
|
+
while view:
|
|
190
|
+
written = os.write(1, view)
|
|
191
|
+
view = view[written:]
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def _copy_window_size(master: int) -> None:
|
|
195
|
+
"""Give the pseudo-terminal our terminal's size, so the tools wrap lines where it does."""
|
|
196
|
+
import fcntl
|
|
197
|
+
import termios
|
|
198
|
+
|
|
199
|
+
try:
|
|
200
|
+
size = fcntl.ioctl(1, termios.TIOCGWINSZ, b"\0" * 8)
|
|
201
|
+
fcntl.ioctl(master, termios.TIOCSWINSZ, size)
|
|
202
|
+
except OSError:
|
|
203
|
+
pass
|