# Create Session Source: https://docs.apowerb.com/api-reference/adk/create-session /api-reference/openapi.json post /api/adk/sessions Endpoint to create an ADK agent session. # Delete Session Source: https://docs.apowerb.com/api-reference/adk/delete-session /api-reference/openapi.json delete /api/adk/sessions/{agent_name}/{user_id}/{session_id} Endpoint to delete an ADK agent session. # Generate Title Endpoint Source: https://docs.apowerb.com/api-reference/adk/generate-title-endpoint /api-reference/openapi.json post /api/adk/generate_title Génère un titre court de conversation à partir de son premier message. Best-effort : renvoie toujours un titre (fallback déterministe si le LLM est indisponible) pour ne jamais bloquer le front. # Get Session History Source: https://docs.apowerb.com/api-reference/adk/get-session-history /api-reference/openapi.json get /api/adk/sessions/{agent_name}/{user_id}/{session_id} Retrieve message history from an ADK session. # Get Session Trace Source: https://docs.apowerb.com/api-reference/adk/get-session-trace /api-reference/openapi.json get /api/adk/sessions/{agent_name}/{user_id}/{session_id}/trace Retrieve a structured trace of an ADK session for supervision. # List All Sessions Source: https://docs.apowerb.com/api-reference/adk/list-all-sessions /api-reference/openapi.json get /api/adk/sessions/list List all ADK sessions across all agents for the current user. # Run Agent Source: https://docs.apowerb.com/api-reference/adk/run-agent /api-reference/openapi.json post /api/adk/run Endpoint to run an ADK agent with comprehensive error handling. # Run Agent From Jwt Endpoint Source: https://docs.apowerb.com/api-reference/adk/run-agent-from-jwt-endpoint /api-reference/openapi.json post /api/adk/run_from_jwt Execute an agent using JWT token (called by Mage AI). Automatically rotates the token in the trigger after each successful run so the jwt_token stored in Mage never expires (self-healing schedule). # Run Agent From Refresh Token Endpoint Source: https://docs.apowerb.com/api-reference/adk/run-agent-from-refresh-token-endpoint /api-reference/openapi.json post /api/adk/run_from_refresh_token Execute agent using refresh token with TOKEN ROTATION. # Run Agent Now Endpoint Source: https://docs.apowerb.com/api-reference/adk/run-agent-now-endpoint /api-reference/openapi.json post /api/adk/run_now Trigger an immediate Mage pipeline run for an agent. If the agent doesn't have a schedule trigger yet, one is created first with a default @daily interval (inactive), then a run is triggered. # Run Agent Sse Source: https://docs.apowerb.com/api-reference/adk/run-agent-sse /api-reference/openapi.json post /api/adk/run_sse Endpoint to run an ADK agent with SSE streaming. # Schedule Agent Run Endpoint Source: https://docs.apowerb.com/api-reference/adk/schedule-agent-run-endpoint /api-reference/openapi.json post /api/adk/schedule_run Schedule an agent to run via Mage AI. - Creates a SCHEDULE trigger (time-based) if it doesn't exist - Supports cron expressions and presets (@hourly, @daily, @weekly, @monthly) - Lazily creates triggers on first schedule (not during agent creation) Request body: { "agent_id": "agent95", "user_id": "user@example.com", "session_id": "session_abc", "new_message": {"content": "Hello", "role": "user"}, "run_mode": "single", # optional "streaming": false, # optional "agent_metadata": {}, # optional "schedule_interval": "@hourly", # NEW: @hourly, @daily, @weekly, @monthly, or cron "start_time": "2026-02-13T10:30:00" } Returns: Schedule information including run_id and status # Set Session Title Source: https://docs.apowerb.com/api-reference/adk/set-session-title /api-reference/openapi.json put /api/adk/sessions/{agent_name}/{user_id}/{session_id}/title Store a conversation's title on the session, so every screen shows it. Until now the chat generated a title and kept it in the browser's local storage. Another browser, or a cleared cache, and the conversation was back to being named by its id -- which is exactly what the evaluation screen ran into. Written into ADK's own `state` column with the jsonb merge operator, which is the very semantics ADK uses itself (`storage_session.state | state_delta`). The key therefore survives every later turn, and no ADK write is lost either. `list_sessions` already returns the state, so nothing has to change on the read side. # Update Session Source: https://docs.apowerb.com/api-reference/adk/update-session /api-reference/openapi.json patch /api/adk/sessions/{agent_name}/{user_id}/{session_id} Endpoint to update an ADK agent session. # Create Agent Source: https://docs.apowerb.com/api-reference/agents/create-agent /api-reference/openapi.json post /api/agents Endpoint to create a new agent. - No Mage triggers are created during agent creation - Triggers are lazily created when first scheduling a run via /schedule_run - This allows for flexible scheduling (cron expressions, @hourly, @daily, etc.) # Hot-reload an agent's module and runner Source: https://docs.apowerb.com/api-reference/agents/hot-reload-an-agents-module-and-runner /api-reference/openapi.json post /api/agents/{agent_id}/reload Invalidate the ADK caches for ``agent_id`` so the next run rebuilds it. # List Agents Source: https://docs.apowerb.com/api-reference/agents/list-agents /api-reference/openapi.json get /api/agents Endpoint to list all agents. # Read Agent Source: https://docs.apowerb.com/api-reference/agents/read-agent /api-reference/openapi.json get /api/agents/{agent_id} Endpoint to get a specific agent by ID. # Remove Agent Source: https://docs.apowerb.com/api-reference/agents/remove-agent /api-reference/openapi.json delete /api/agents/{agent_id} Endpoint to delete an agent by ID. # Resync Template Source: https://docs.apowerb.com/api-reference/agents/resync-template /api-reference/openapi.json post /api/agents/{agent_id}/resync-template Overwrite the agent's hash-relevant fields with the live template. Touches only ``agent_instruction``, ``agent_tools`` and ``tags`` — user-owned knobs (model, model_params, mcp_servers, guardrails, artifacts/memory toggles, agent_skills) are left untouched. Returns the post-resync ``template-status`` report (which should now show ``is_in_sync: true``). # Template Status Source: https://docs.apowerb.com/api-reference/agents/template-status /api-reference/openapi.json get /api/agents/{agent_id}/template-status Compare the agent's stored template snapshot with the live template. Returned shape:: { "agent_id": 6, "template_id": "scei_ar_assistant" | null, "is_in_sync": true | false, "stored_hash": "abc..." | null, "current_hash": "def..." | null, "drift_fields": ["agent_instruction", "agent_tools", ...] } The frontend uses this to surface a "template updated, click to sync" banner on the agent's edit page. # Update Agent Source: https://docs.apowerb.com/api-reference/agents/update-agent /api-reference/openapi.json put /api/agents/{agent_id} Endpoint to update an existing agent. # Create Key Source: https://docs.apowerb.com/api-reference/api-keys/create-key /api-reference/openapi.json post /api/saved-api-keys Save a new API key. # List Keys Source: https://docs.apowerb.com/api-reference/api-keys/list-keys /api-reference/openapi.json get /api/saved-api-keys List saved API keys for the current user. # Remove Key Source: https://docs.apowerb.com/api-reference/api-keys/remove-key /api-reference/openapi.json delete /api/saved-api-keys/{api_key_id} Delete a saved API key. # Execute Artifact Endpoint Source: https://docs.apowerb.com/api-reference/artifacts/execute-artifact-endpoint /api-reference/openapi.json post /api/artifacts/{agent_name}/{user_id}/{session_id}/{filename}/execute Execute an artifact in a Docker container. # Get Artifact Source: https://docs.apowerb.com/api-reference/artifacts/get-artifact /api-reference/openapi.json get /api/artifacts/{agent_name}/{user_id}/{session_id}/{filename} Get a specific artifact's content. # List Artifact Library Source: https://docs.apowerb.com/api-reference/artifacts/list-artifact-library /api-reference/openapi.json get /api/artifacts/library Every artifact the caller owns, in one call. Declared before the "/{agent_name}/{user_id}/{session_id}" route on purpose: FastAPI matches in declaration order, and "library" would otherwise be read as an agent name. The tab used to ask once per session plus once per agent — 386 sessions on a real dev account, ~200 ms each even when the session held nothing, so about fifteen seconds of waiting. Everything it displays is already in the S3 keys, so this builds the whole answer from listings and downloads no object body at all. # List Artifacts Source: https://docs.apowerb.com/api-reference/artifacts/list-artifacts /api-reference/openapi.json get /api/artifacts/{agent_name}/{user_id}/{session_id} List all artifacts for a session. # Forgot Password Source: https://docs.apowerb.com/api-reference/auth/forgot-password /api-reference/openapi.json post /api/auth/forgot-password Kick off a password-reset email for ``body.email``. Always returns 200 — success/failure is indistinguishable to avoid enumerating accounts. # Login Source: https://docs.apowerb.com/api-reference/auth/login /api-reference/openapi.json post /api/auth/token # Logout Source: https://docs.apowerb.com/api-reference/auth/logout /api-reference/openapi.json post /api/auth/logout Clear the refresh token cookie. # Refresh Token Source: https://docs.apowerb.com/api-reference/auth/refresh-token /api-reference/openapi.json post /api/auth/refresh-token # Resend Verification Source: https://docs.apowerb.com/api-reference/auth/resend-verification /api-reference/openapi.json post /api/auth/resend-verification Re-send a verification email. Always 200 (no account-existence leak). # Reset Password Source: https://docs.apowerb.com/api-reference/auth/reset-password /api-reference/openapi.json post /api/auth/reset-password Consume a reset token and rotate the user's password hash. # Verify Email Source: https://docs.apowerb.com/api-reference/auth/verify-email /api-reference/openapi.json post /api/auth/verify-email Consume an email-verification token and mark the account verified. # Authentication Source: https://docs.apowerb.com/api-reference/authentication Obtaining and using a token. All endpoints except health, config and provider callbacks require a bearer token. ## Getting a token ```bash theme={null} curl -X POST https://YOUR_DOMAIN/api/auth/token \ -H "Content-Type: application/json" \ -d '{"email": "user@example.com", "password": "..."}' ``` Use it on every subsequent call: ``` Authorization: Bearer ``` Tokens are signed with `ENCRYPT_KEY` and expire after `ACCESS_TOKEN_EXPIRE_MINUTES` (120 by default). Refresh with `POST /api/auth/refresh-token`; `POST /api/auth/logout` clears the refresh cookie. ## Revoking a session A token is not valid until it expires, whatever happens in between. Every user row carries a `sessions_valid_from` cut-off, and any access token minted before it is refused with `session_revoked` — a distinctive code, not a plain `401`, so a forced sign-out is never mistaken for a bad password. The refresh cookie is checked against the same cut-off. Revoking access while leaving a thirty-day cookie able to mint fresh tokens would turn "sign in again" into "wait a few minutes". > [!NOTE] > > The `agent_refresh` tokens the Orchestrator stores for scheduled runs are deliberately > exempt: they never reach the user-facing guard. Forcing a human to sign in again must > not stop their agents from running at 4 a.m. Raising the cut-off is an administrative action, so the endpoint that does it belongs to the admin brick, not to this core. What the core holds is the enforcement. ## Account lifecycle | Method | Endpoint | Description | | - | - | - | | POST | `/api/auth/forgot-password` | Start a password reset | | POST | `/api/auth/reset-password` | Complete it with the emailed token | | POST | `/api/auth/verify-email` | Confirm an address | | POST | `/api/auth/resend-verification` | Send the confirmation again | ## What is not here Two things belong to commercial editions and are **absent** from this build: * **Signing in with an identity provider** — GitHub, Google, Microsoft, LinkedIn. The open-source core authenticates with email and password only. * **Multi-factor authentication.** `/api/auth/mfa/*` does not exist; it answers `404`. The core can still *enforce* a second factor once a brick provides one: a request from someone who owes an enrolment is refused with `mfa_enrolment_required`, except on the routes that let them enrol. Without the brick, nobody owes one and nothing is refused. See [Editions](/concepts/editions). Do not read those `404`s as a missing object — they mean the capability is not in this edition. > [!WARNING] > > `ENCRYPT_KEY` signs tokens. If it is empty, token verification degenerates: a required > secret that receives an empty string can make forged tokens acceptable. Refuse to boot > without it rather than defaulting it. # Delete an uploaded dataset Source: https://docs.apowerb.com/api-reference/bi-datasets/delete-an-uploaded-dataset /api-reference/openapi.json delete /api/v1/bi/datasets/{file_id} # List database tool configurations Source: https://docs.apowerb.com/api-reference/bi-datasets/list-database-tool-configurations /api-reference/openapi.json get /api/v1/bi/tool-configs/database # List uploaded datasets Source: https://docs.apowerb.com/api-reference/bi-datasets/list-uploaded-datasets /api-reference/openapi.json get /api/v1/bi/datasets # Preview a dataset Source: https://docs.apowerb.com/api-reference/bi-datasets/preview-a-dataset /api-reference/openapi.json get /api/v1/bi/datasets/{file_id}/preview # Preview a OneDrive spreadsheet (xlsx/xls/xlsm/ods/csv/tsv) Source: https://docs.apowerb.com/api-reference/bi-datasets/preview-a-onedrive-spreadsheet-xlsxxlsxlsmodscsvtsv /api-reference/openapi.json post /api/v1/bi/onedrive/preview Download a OneDrive tabular file and return a CSV-preview-shaped response so the frontend wizard can share its rendering logic. Response body:: { "columns": [{"name": str, "type": str}, ...], "row_count": int, "sample_rows": [ {col: value, ...}, ... ], # ≤ 10 rows "sheet_name": str | None # echo of the active sheet (null for csv/tsv) } Error codes: - 400 — neither ``item_path`` nor ``item_id`` was provided - 401 — user has no OneDrive integration - 404 — file does not exist on the drive - 415 — file extension not supported - 500 — any other parse failure # BI module statistics Source: https://docs.apowerb.com/api-reference/bi-stats/bi-module-statistics /api-reference/openapi.json get /api/v1/bi/stats Returns the current count of dashboards and charts. # Import a Google Drive file for BI analysis Source: https://docs.apowerb.com/api-reference/bi-upload/import-a-google-drive-file-for-bi-analysis /api-reference/openapi.json post /api/v1/bi/import/google-drive # List user's connected Google Drive tool configurations Source: https://docs.apowerb.com/api-reference/bi-upload/list-users-connected-google-drive-tool-configurations /api-reference/openapi.json get /api/v1/bi/tool-configs/google-drive # Upload a CSV file for BI analysis Source: https://docs.apowerb.com/api-reference/bi-upload/upload-a-csv-file-for-bi-analysis /api-reference/openapi.json post /api/v1/bi/upload-csv Accepts a CSV file, validates the content, parses headers and row count, stores the file in S3, and returns metadata including the first 5 rows as a sample. Separator is auto-detected or can be set explicitly via the 'separator' form field (comma, semicolon, tab, pipe, or auto). # Fetch paginated data for a chart Source: https://docs.apowerb.com/api-reference/chart-data/fetch-paginated-data-for-a-chart /api-reference/openapi.json get /api/v1/charts/{chart_id}/data Resolves the chart config by ID, executes its query, applies filters and sorting, then returns a paginated raw-data response. The frontend is responsible for mapping this to an ECharts option. # Get chart data (public access) Source: https://docs.apowerb.com/api-reference/chart-data/get-chart-data-public-access /api-reference/openapi.json get /api/v1/public/charts/{chart_id}/data # Schedule automatic refresh of a chart via an agent Source: https://docs.apowerb.com/api-reference/chart-refresh/schedule-automatic-refresh-of-a-chart-via-an-agent /api-reference/openapi.json post /api/v1/charts/{chart_id}/schedule-refresh Create a cron-based schedule that triggers an agent to refresh a chart. # Add a chart to the user's chat dashboard (user-triggered) Source: https://docs.apowerb.com/api-reference/charts/add-a-chart-to-the-users-chat-dashboard-user-triggered /api-reference/openapi.json post /api/v1/charts/{chart_id}/send-to-dashboard Add ``chart_id`` to the current chat's dashboard (created on first use). Backs the "Send to dashboard" button on an inline chart card: charts are no longer added automatically, so the user triggers this explicitly. The dashboard is scoped to ``session_id`` (the conversation) when provided. # Create a chart Source: https://docs.apowerb.com/api-reference/charts/create-a-chart /api-reference/openapi.json post /api/v1/charts # Create a KPI stat card Source: https://docs.apowerb.com/api-reference/charts/create-a-kpi-stat-card /api-reference/openapi.json post /api/v1/charts/shortcuts/kpi # Create a time-series chart Source: https://docs.apowerb.com/api-reference/charts/create-a-time-series-chart /api-reference/openapi.json post /api/v1/charts/shortcuts/timeseries # Delete a chart Source: https://docs.apowerb.com/api-reference/charts/delete-a-chart /api-reference/openapi.json delete /api/v1/charts/{chart_id} # Get a single chart Source: https://docs.apowerb.com/api-reference/charts/get-a-single-chart /api-reference/openapi.json get /api/v1/charts/{chart_id} # List charts Source: https://docs.apowerb.com/api-reference/charts/list-charts /api-reference/openapi.json get /api/v1/charts Returns a paginated list of charts. Filter by viewer role to enforce visibility. # Partially update a chart Source: https://docs.apowerb.com/api-reference/charts/partially-update-a-chart /api-reference/openapi.json patch /api/v1/charts/{chart_id} # Get Public Config Source: https://docs.apowerb.com/api-reference/config/get-public-config /api-reference/openapi.json get /api/config Return public configuration (no auth required). # Create Session Source: https://docs.apowerb.com/api-reference/create-session /api-reference/openapi.json post /apps/{app_name}/users/{user_id}/sessions # Create Session With Id Source: https://docs.apowerb.com/api-reference/create-session-with-id /api-reference/openapi.json post /apps/{app_name}/users/{user_id}/sessions/{session_id} # Delete a dashboard refresh schedule Source: https://docs.apowerb.com/api-reference/dashboard-refresh/delete-a-dashboard-refresh-schedule /api-reference/openapi.json delete /api/v1/dashboards/{dashboard_id}/schedules/{schedule_id} Delete a Mage schedule trigger by ID. # List refresh schedules for a dashboard Source: https://docs.apowerb.com/api-reference/dashboard-refresh/list-refresh-schedules-for-a-dashboard /api-reference/openapi.json get /api/v1/dashboards/{dashboard_id}/schedules List all Mage schedules associated with agents for this dashboard. # Schedule automatic refresh of a dashboard via an agent Source: https://docs.apowerb.com/api-reference/dashboard-refresh/schedule-automatic-refresh-of-a-dashboard-via-an-agent /api-reference/openapi.json post /api/v1/dashboards/{dashboard_id}/schedule-refresh Create a cron-based schedule that triggers an agent to refresh a dashboard. # Add a component to a dashboard Source: https://docs.apowerb.com/api-reference/dashboards/add-a-component-to-a-dashboard /api-reference/openapi.json post /api/v1/dashboards/{dashboard_id}/components # Create a dashboard Source: https://docs.apowerb.com/api-reference/dashboards/create-a-dashboard /api-reference/openapi.json post /api/v1/dashboards # Delete a dashboard Source: https://docs.apowerb.com/api-reference/dashboards/delete-a-dashboard /api-reference/openapi.json delete /api/v1/dashboards/{dashboard_id} # Get a dashboard by ID Source: https://docs.apowerb.com/api-reference/dashboards/get-a-dashboard-by-id /api-reference/openapi.json get /api/v1/dashboards/{dashboard_id} # Get a dashboard by slug Source: https://docs.apowerb.com/api-reference/dashboards/get-a-dashboard-by-slug /api-reference/openapi.json get /api/v1/dashboards/by-slug/{slug} # Get agent linked to dashboard Source: https://docs.apowerb.com/api-reference/dashboards/get-agent-linked-to-dashboard /api-reference/openapi.json get /api/v1/dashboards/{dashboard_id}/agent Get the agent associated with a dashboard. # Get published dashboard by slug (public access) Source: https://docs.apowerb.com/api-reference/dashboards/get-published-dashboard-by-slug-public-access /api-reference/openapi.json get /api/v1/dashboards/public/{slug} # Link or unlink an agent to a dashboard Source: https://docs.apowerb.com/api-reference/dashboards/link-or-unlink-an-agent-to-a-dashboard /api-reference/openapi.json patch /api/v1/dashboards/{dashboard_id}/agent Associate an agent with a dashboard for traceability and refresh scheduling. # List dashboards Source: https://docs.apowerb.com/api-reference/dashboards/list-dashboards /api-reference/openapi.json get /api/v1/dashboards # List published dashboards shared with the current user Source: https://docs.apowerb.com/api-reference/dashboards/list-published-dashboards-shared-with-the-current-user /api-reference/openapi.json get /api/v1/dashboards/shared # Move a component to a new grid position Source: https://docs.apowerb.com/api-reference/dashboards/move-a-component-to-a-new-grid-position /api-reference/openapi.json patch /api/v1/dashboards/{dashboard_id}/components/{component_id}/position # Partially update a dashboard Source: https://docs.apowerb.com/api-reference/dashboards/partially-update-a-dashboard /api-reference/openapi.json patch /api/v1/dashboards/{dashboard_id} # Publish a dashboard Source: https://docs.apowerb.com/api-reference/dashboards/publish-a-dashboard /api-reference/openapi.json post /api/v1/dashboards/{dashboard_id}/publish # Remove a component from a dashboard Source: https://docs.apowerb.com/api-reference/dashboards/remove-a-component-from-a-dashboard /api-reference/openapi.json delete /api/v1/dashboards/{dashboard_id}/components/{component_id} # Unpublish a dashboard Source: https://docs.apowerb.com/api-reference/dashboards/unpublish-a-dashboard /api-reference/openapi.json post /api/v1/dashboards/{dashboard_id}/unpublish # Update a key-value component's content Source: https://docs.apowerb.com/api-reference/dashboards/update-a-key-value-components-content /api-reference/openapi.json patch /api/v1/dashboards/{dashboard_id}/components/{component_id} # List Pins Source: https://docs.apowerb.com/api-reference/data-lake/list-pins /api-reference/openapi.json post /api/data-lake/pins/list List all pins available in a storage board. # Read Pin Source: https://docs.apowerb.com/api-reference/data-lake/read-pin /api-reference/openapi.json post /api/data-lake/pins/read Read a specific pin from the storage board. The pin_name is passed as a query parameter, board config in the body. # Write Pin Source: https://docs.apowerb.com/api-reference/data-lake/write-pin /api-reference/openapi.json post /api/data-lake/pins/write Write data to a pin in the storage board. # Delete Artifact Source: https://docs.apowerb.com/api-reference/delete-artifact /api-reference/openapi.json delete /apps/{app_name}/users/{user_id}/sessions/{session_id}/artifacts/{artifact_name} # Delete Session Source: https://docs.apowerb.com/api-reference/delete-session /api-reference/openapi.json delete /apps/{app_name}/users/{user_id}/sessions/{session_id} # Connection Status Source: https://docs.apowerb.com/api-reference/emailing/connection-status /api-reference/openapi.json get /api/emailing/microsoft/status Check whether the current user has an active Outlook Mail connection. # Get Auth Url Source: https://docs.apowerb.com/api-reference/emailing/get-auth-url /api-reference/openapi.json get /api/emailing/microsoft/auth-url Generate the Microsoft OAuth consent URL for Outlook Mail access. # Oauth Callback Source: https://docs.apowerb.com/api-reference/emailing/oauth-callback /api-reference/openapi.json post /api/emailing/microsoft/callback Exchange the authorization code for tokens and persist as tool_config. # Errors Source: https://docs.apowerb.com/api-reference/errors Status codes and what they mean here. | Code | Meaning | | - | - | | `400` | Bad request — check the body | | `401` | Unauthorized — missing or invalid token | | `403` | Forbidden — the resource exists but is not yours | | `404` | Not found — or the capability is absent from this edition | | `413` | File too large — 50 MB per file maximum | | `422` | Unprocessable — for example, a query that returned no data | | `500` | Internal server error | | `503` | Service temporarily unavailable | ## Distinctive authentication codes A `401` on a protected route carries a code when the reason is not simply a bad or expired token: | Code | Meaning | | - | - | | `session_revoked` | The token predates the account's `sessions_valid_from` cut-off — someone forced a re-login. Sign in again; refreshing will not help, the cookie is checked against the same cut-off. | | `mfa_enrolment_required` | A second factor is demanded of this account and not yet enrolled. Only the enrolment routes answer until it is done. Requires the auth brick — see [Editions](/concepts/editions). | See [Authentication](/api-reference/authentication) for how both are enforced. > [!NOTE] > > `404` is overloaded: it means either "this object does not exist" or "this endpoint > does not exist in this edition". Check [Editions](/concepts/editions) before > investigating a `404` on billing, usage or MFA routes. # Download File Source: https://docs.apowerb.com/api-reference/files/download-file /api-reference/openapi.json get /api/files/{agent_id}/{filename} Download a file. Requires either Bearer auth + agent ownership, or a scoped download token bound to this `agent_id`/`filename`. # List Files Source: https://docs.apowerb.com/api-reference/files/list-files /api-reference/openapi.json get /api/files/{agent_id} List all uploaded files for an agent. Merges three sources so nothing already on record goes missing: input artifacts on S3 (this PR), the legacy ``uploads/{agent}/{file}`` S3 key (still real data -- 454 objects on the dev bucket, unmigrated), and local disk (files that never made it to S3 -- David's counts: 214 dev / 60 prod). This endpoint has no session_id, so the S3 input-artifact lookup is scoped to ``_shared`` -- the same scope an unsessioned upload writes to. # Upload Chunk Source: https://docs.apowerb.com/api-reference/files/upload-chunk /api-reference/openapi.json post /api/files/upload-chunk Upload a single chunk of a large file. # Upload Complete Source: https://docs.apowerb.com/api-reference/files/upload-complete /api-reference/openapi.json post /api/files/upload-complete Assemble all uploaded chunks into the final file. # Upload File Source: https://docs.apowerb.com/api-reference/files/upload-file /api-reference/openapi.json post /api/files/upload Upload a file for an agent to access. Written as an input artifact (``artifacts/{agent}/{session-or-_shared} /input/...``) when S3 storage is active, alongside the existing output artifacts (#28/#29) in the same bucket. ``session_id`` is optional -- no current caller sends one -- and an absent one scopes the upload to a shared, agent-wide namespace rather than a real session (Option C). # Finalize Agent Identity Credentials Source: https://docs.apowerb.com/api-reference/finalize-agent-identity-credentials /api-reference/openapi.json post /agent-identity/finalize # Get Adk App Info Source: https://docs.apowerb.com/api-reference/get-adk-app-info /api-reference/openapi.json get /apps/{app_name}/app-info Returns the detailed info for a given ADK app. # Get Agent Status Source: https://docs.apowerb.com/api-reference/get-agent-status /api-reference/openapi.json get /api/agents/{agent_id}/status Get the run status of an agent. # Get Artifact Version Metadata Source: https://docs.apowerb.com/api-reference/get-artifact-version-metadata /api-reference/openapi.json get /apps/{app_name}/users/{user_id}/sessions/{session_id}/artifacts/{artifact_name}/versions/{version_id}/metadata # Get Models Source: https://docs.apowerb.com/api-reference/get-models /api-reference/openapi.json get /api/models # Get Session Source: https://docs.apowerb.com/api-reference/get-session /api-reference/openapi.json get /apps/{app_name}/users/{user_id}/sessions/{session_id} # Get File Content Source: https://docs.apowerb.com/api-reference/google-drive-browser/get-file-content /api-reference/openapi.json get /api/googledrivebrowser/content Fetch a Google Drive file by ID and return its contents as a base64 data-URI so the browser can construct a File object. Google Workspace files (Docs, Sheets, Slides) are exported to their equivalent portable format before encoding. Size limit: 20 MB. # List Files Source: https://docs.apowerb.com/api-reference/google-drive-browser/list-files /api-reference/openapi.json get /api/googledrivebrowser/list Return files in a Google Drive folder (root by default). # Search Files Source: https://docs.apowerb.com/api-reference/google-drive-browser/search-files /api-reference/openapi.json get /api/googledrivebrowser/search Search for files across Google Drive by keyword. # Google Verification Source: https://docs.apowerb.com/api-reference/google-verification /api-reference/openapi.json get /google3c3f80c61f9d38d4.html # Health Legacy Alias Source: https://docs.apowerb.com/api-reference/health-legacy-alias /api-reference/openapi.json get /health Backward-compatible alias for the old ``/health`` endpoint. Prefer ``/health/live`` (fast) or ``/health/ready`` (dependency aware) for new probes. # Liveness Source: https://docs.apowerb.com/api-reference/health/liveness /api-reference/openapi.json get /health/live # Notifier Health Endpoint Source: https://docs.apowerb.com/api-reference/health/notifier-health-endpoint /api-reference/openapi.json get /health/notifier Owner-integration health for the system mailer. 503 when the shared mailbox owner integration is missing/revoked (system emails would fail). # Readiness Source: https://docs.apowerb.com/api-reference/health/readiness /api-reference/openapi.json get /health/ready # Clone Source: https://docs.apowerb.com/api-reference/hub/clone /api-reference/openapi.json post /api/hub/clone Clone an agent from the Hub into your own agent store. # Get Hub Source: https://docs.apowerb.com/api-reference/hub/get-hub /api-reference/openapi.json get /api/hub/{hub_id} Get a specific hub agent by ID. # List Hub Source: https://docs.apowerb.com/api-reference/hub/list-hub /api-reference/openapi.json get /api/hub List all agents published in the Hub. # Publish Source: https://docs.apowerb.com/api-reference/hub/publish /api-reference/openapi.json post /api/hub/publish Publish an agent to the Hub. # Remove From Hub Source: https://docs.apowerb.com/api-reference/hub/remove-from-hub /api-reference/openapi.json delete /api/hub/{hub_id} Remove an agent from the Hub (publisher only). # Add Shared Mailbox Source: https://docs.apowerb.com/api-reference/integrations/add-shared-mailbox /api-reference/openapi.json post /api/integrations/microsoft/outlook/shared-mailboxes # Debug Outlook Token Scopes Source: https://docs.apowerb.com/api-reference/integrations/debug-outlook-token-scopes /api-reference/openapi.json get /api/integrations/microsoft/outlook/debug/token-scopes Decode the stored access token and return its scopes (debug). Auto-refreshes if the token is expired. # Disconnect Integration Source: https://docs.apowerb.com/api-reference/integrations/disconnect-integration /api-reference/openapi.json delete /api/integrations/{provider} Disconnect (delete) a specific integration for the authenticated user. # Github Callback Source: https://docs.apowerb.com/api-reference/integrations/github-callback /api-reference/openapi.json post /api/integrations/github/callback Complete the GitHub OAuth flow. The frontend calls this after GitHub redirects back to the callback page with a temporary `code`. This endpoint: 1. Validates the CSRF ``state`` against the server-side store 2. Exchanges the code for an access token 3. Fetches the GitHub user profile 4. Upserts the integration row for the current user 5. Returns basic integration info (never the raw token) # Github Connect Source: https://docs.apowerb.com/api-reference/integrations/github-connect /api-reference/openapi.json get /api/integrations/github/connect Generate the GitHub OAuth authorisation URL for the authenticated user. The ``state`` parameter is persisted server-side (``oauth_states`` table) so the callback can validate it and prevent CSRF-based binding of an attacker-controlled GitHub account onto the authenticated user. # Google Callback Source: https://docs.apowerb.com/api-reference/integrations/google-callback /api-reference/openapi.json post /api/integrations/google/callback Complete the Google OAuth flow for a specific Google service. The frontend calls this after Google redirects back to the callback page with a temporary ``code``. This endpoint: 1. Validates the requested service 2. Validates the CSRF ``state`` against the server-side store 3. Exchanges the code for access + refresh tokens 4. Fetches the Google user profile 5. Upserts the integration row with provider=service 6. Resets the in-memory token state for that service module 7. Returns basic integration info (never the raw token) # Google Connect Source: https://docs.apowerb.com/api-reference/integrations/google-connect /api-reference/openapi.json get /api/integrations/google/connect Generate the Google OAuth authorisation URL for a specific Google service. Query params: service: One of "google_drive", "google_gmail", "google_calendar", "google_sheets", "google_docs". redirect_uri: Optional override for the callback URL. # List Integrations Source: https://docs.apowerb.com/api-reference/integrations/list-integrations /api-reference/openapi.json get /api/integrations/ Return all active integrations for the authenticated user (tokens excluded). # List Shared Mailboxes Source: https://docs.apowerb.com/api-reference/integrations/list-shared-mailboxes /api-reference/openapi.json get /api/integrations/microsoft/outlook/shared-mailboxes Return the shared mailboxes currently configured for this user. # Microsoft Service Callback Source: https://docs.apowerb.com/api-reference/integrations/microsoft-service-callback /api-reference/openapi.json post /api/integrations/microsoft/{service}/callback Complete the Microsoft OAuth flow for a specific service. The frontend calls this after Microsoft redirects back to the callback page with a temporary ``code``. This endpoint: 1. Validates the service key 2. Validates the CSRF ``state`` against the server-side store 3. Exchanges the code for an access + refresh token (service-specific scopes) 4. Fetches the Microsoft Graph user profile 5. Upserts the integration row under provider='microsoft_{service}' 6. Returns basic integration info (never the raw token) # Microsoft Service Connect Source: https://docs.apowerb.com/api-reference/integrations/microsoft-service-connect /api-reference/openapi.json get /api/integrations/microsoft/{service}/connect Generate the Microsoft OAuth authorisation URL for a specific service. Args: service: One of 'outlook', 'teams', 'sharepoint', 'onedrive'. Determines which Graph API scopes are requested. # Odoo Connect Source: https://docs.apowerb.com/api-reference/integrations/odoo-connect /api-reference/openapi.json post /api/integrations/odoo/connect Authenticate against the user-provided Odoo instance and persist the credentials (api_key is encrypted at rest). On success the integration row is upserted under provider='odoo'. Returns the same shape as the other integration connect endpoints. # Remove Shared Mailbox Source: https://docs.apowerb.com/api-reference/integrations/remove-shared-mailbox /api-reference/openapi.json delete /api/integrations/microsoft/outlook/shared-mailboxes/{email} # Set Active Shared Mailbox Source: https://docs.apowerb.com/api-reference/integrations/set-active-shared-mailbox /api-reference/openapi.json put /api/integrations/microsoft/outlook/shared-mailboxes/active Mark one of the configured shared mailboxes as the active default. # Suggest Shared Mailboxes Source: https://docs.apowerb.com/api-reference/integrations/suggest-shared-mailboxes /api-reference/openapi.json get /api/integrations/microsoft/outlook/shared-mailboxes/suggestions Best-effort discovery of shared mailboxes via /me/memberOf. Microsoft Graph doesn't expose the list of mailboxes a user has delegate access to without admin scopes. As a fallback, we list the user's Microsoft 365 groups — they are mail-enabled and often represent shared team mailboxes. The user can still add any address manually. # API reference Source: https://docs.apowerb.com/api-reference/introduction How to read this reference, and where the schema comes from. Every endpoint on the following pages is generated from the OpenAPI schema the server publishes at `/openapi.json`. It is therefore exactly what the running instance serves — including endpoints that predate this documentation. A live instance also serves interactive documentation at `/docs`. ## Base URL ``` https://YOUR_DOMAIN ``` For a local stack, `http://localhost:8000`. ## Editions The schema published here is the **open-source** edition. A deployment that loads commercial extensions serves additional endpoints — billing, usage quotas, MFA — which are absent here. See [Editions](/concepts/editions). ## Conventions * Request and response bodies are JSON. * List endpoints that can grow are paginated; pagination parameters are shown per endpoint. * Timestamps are ISO 8601. Server-side, deployments run in UTC — convert for display. # List Apps Source: https://docs.apowerb.com/api-reference/list-apps /api-reference/openapi.json get /list-apps # List Artifact Names Source: https://docs.apowerb.com/api-reference/list-artifact-names /api-reference/openapi.json get /apps/{app_name}/users/{user_id}/sessions/{session_id}/artifacts # List Artifact Versions Source: https://docs.apowerb.com/api-reference/list-artifact-versions /api-reference/openapi.json get /apps/{app_name}/users/{user_id}/sessions/{session_id}/artifacts/{artifact_name}/versions # List Artifact Versions Metadata Source: https://docs.apowerb.com/api-reference/list-artifact-versions-metadata /api-reference/openapi.json get /apps/{app_name}/users/{user_id}/sessions/{session_id}/artifacts/{artifact_name}/versions/metadata # List Sessions Source: https://docs.apowerb.com/api-reference/list-sessions /api-reference/openapi.json get /apps/{app_name}/users/{user_id}/sessions # Load Artifact Source: https://docs.apowerb.com/api-reference/load-artifact /api-reference/openapi.json get /apps/{app_name}/users/{user_id}/sessions/{session_id}/artifacts/{artifact_name} # Load Artifact Version Source: https://docs.apowerb.com/api-reference/load-artifact-version /api-reference/openapi.json get /apps/{app_name}/users/{user_id}/sessions/{session_id}/artifacts/{artifact_name}/versions/{version_id} # List Notifications Source: https://docs.apowerb.com/api-reference/notifications/list-notifications /api-reference/openapi.json get /api/notifications Return the current user's notifications, most recent first. Supports pagination via ``limit`` / ``offset`` and an optional ``unread_only`` filter for showing only unread notifications. # Mark All As Read Source: https://docs.apowerb.com/api-reference/notifications/mark-all-as-read /api-reference/openapi.json post /api/notifications/read-all Mark all of the current user's notifications as read. # Mark As Read Source: https://docs.apowerb.com/api-reference/notifications/mark-as-read /api-reference/openapi.json patch /api/notifications/{notification_id}/read Mark a single notification as read. # Notification Stream Source: https://docs.apowerb.com/api-reference/notifications/notification-stream /api-reference/openapi.json get /api/notifications/stream Server-Sent Events stream that pushes notifications in real time. # Unread Count Source: https://docs.apowerb.com/api-reference/notifications/unread-count /api-reference/openapi.json get /api/notifications/unread-count Return the number of unread notifications for badge display. # Get Excel Preview Source: https://docs.apowerb.com/api-reference/onedrive-browser/get-excel-preview /api-reference/openapi.json get /api/onedrivebrowser/excel-preview Download a OneDrive Excel/CSV file and return its column names plus the first ``limit`` rows. Used by the frontend chart wizard to render a tabular preview *before* a chart is created. Graph credentials follow the same pattern as the other routes in this router: resolve the user's OneDrive ``Integration`` row, acquire a short-lived bearer header under :func:`env_scope`, then call :func:`shared_download_and_parse` off the event loop. # Get File Content Source: https://docs.apowerb.com/api-reference/onedrive-browser/get-file-content /api-reference/openapi.json get /api/onedrivebrowser/content Fetch a OneDrive file by item ID and return its contents as a base64 data-URI so the browser can construct a File object without exposing the pre-authenticated download URL. Size limit: 20 MB. Larger files should be downloaded via tool_download_file instead. # List Files Source: https://docs.apowerb.com/api-reference/onedrive-browser/list-files /api-reference/openapi.json get /api/onedrivebrowser/list Return files/folders in a OneDrive directory (root by default). # Search Files Source: https://docs.apowerb.com/api-reference/onedrive-browser/search-files /api-reference/openapi.json get /api/onedrivebrowser/search Search for files across the drive by keyword. # Patch Memory Source: https://docs.apowerb.com/api-reference/patch-memory /api-reference/openapi.json patch /apps/{app_name}/users/{user_id}/memory Adds all events from a given session to the memory service. Args: app_name: The name of the application. user_id: The ID of the user. update_memory_request: The memory request for the update Raises: HTTPException: If the memory service is not configured or the request is invalid. # Get Knowledge Map Source: https://docs.apowerb.com/api-reference/rag/get-knowledge-map /api-reference/openapi.json get /api/rag/knowledge/{agent_id} Read the knowledge map for an agent (or session), refreshing statuses of pending sources. # Get Status Source: https://docs.apowerb.com/api-reference/rag/get-status /api-reference/openapi.json get /api/rag/status/{knowledge_id} Get the processing status of a specific knowledge base. # Index Db Source: https://docs.apowerb.com/api-reference/rag/index-db /api-reference/openapi.json post /api/rag/index-db Execute a SQL query and index the results into a RAG knowledge base. # Index Db Nl Source: https://docs.apowerb.com/api-reference/rag/index-db-nl /api-reference/openapi.json post /api/rag/index-db-nl Explore a DB schema, generate SQL from natural language, and index results into RAG. # Index Files Source: https://docs.apowerb.com/api-reference/rag/index-files /api-reference/openapi.json post /api/rag/index-files Upload and index one or more files into a RAG knowledge base. # Index S3 Source: https://docs.apowerb.com/api-reference/rag/index-s3 /api-reference/openapi.json post /api/rag/index-s3 Download files from S3 and index them into a RAG knowledge base. # Index Url Source: https://docs.apowerb.com/api-reference/rag/index-url /api-reference/openapi.json post /api/rag/index-url Download a URL and index its content into a RAG knowledge base. # Rag Stream Source: https://docs.apowerb.com/api-reference/rag/rag-stream /api-reference/openapi.json get /api/rag/stream/{agent_id} SSE endpoint streaming RAG indexation progress for an agent's sources. Opens a server-sent event stream that: - Sends current source statuses on connect. - Pushes real-time updates from th2llm webhooks. - Falls back to polling every 10s if webhooks are slow. - Sends keep-alive comments every 2s. - Auto-closes when all sources are complete or after 5 minutes. Requires authentication (JWT via current_user). # Rag Webhook Source: https://docs.apowerb.com/api-reference/rag/rag-webhook /api-reference/openapi.json post /api/rag/webhook Receive indexation status updates from th2llm via webhook. This endpoint is NOT behind auth middleware — it uses HMAC-SHA256 signature verification instead. th2llm signs the payload with the shared secret and sends the signature in the ``X-Webhook-Signature`` header. # Run Adk Agent Source: https://docs.apowerb.com/api-reference/run-adk-agent /api-reference/openapi.json post /api/agents/{agent_id}/run Start running an agent in the background. # Run Agent Source: https://docs.apowerb.com/api-reference/run-agent /api-reference/openapi.json post /run # Run Agent Sse Source: https://docs.apowerb.com/api-reference/run-agent-sse /api-reference/openapi.json post /run_sse # Save Artifact Source: https://docs.apowerb.com/api-reference/save-artifact /api-reference/openapi.json post /apps/{app_name}/users/{user_id}/sessions/{session_id}/artifacts Request payload for saving a new artifact. # Cancel Pipeline Run Source: https://docs.apowerb.com/api-reference/scheduler/cancel-pipeline-run /api-reference/openapi.json put /api/pipelines/runs/{run_id}/cancel Cancel a pipeline run. # Create Agent Trigger Source: https://docs.apowerb.com/api-reference/scheduler/create-agent-trigger /api-reference/openapi.json post /api/pipelines/agents/triggers Create a Mage trigger for an existing agent. Used for agents that were created when Mage was down, or old agents that don't have triggers yet. # Get Pipeline Run Source: https://docs.apowerb.com/api-reference/scheduler/get-pipeline-run /api-reference/openapi.json get /api/pipelines/runs/{run_id} Get details for a specific pipeline run. # Get Pipeline Run Logs Source: https://docs.apowerb.com/api-reference/scheduler/get-pipeline-run-logs /api-reference/openapi.json get /api/pipelines/runs/{run_id}/logs Structured, step-by-step log for a run, so the Orchestrator UI can show a run's execution narrative instead of just its status. Backed by th2etl's ``/runs/{id}/logs``; an empty list under the default Mage orchestrator. # List Pipeline Schedules Source: https://docs.apowerb.com/api-reference/scheduler/list-pipeline-schedules /api-reference/openapi.json get /api/pipelines/{pipeline_uuid}/schedules List triggers/schedules for a pipeline, filtered to only the current user's agents. # List Pipelines Source: https://docs.apowerb.com/api-reference/scheduler/list-pipelines /api-reference/openapi.json get /api/pipelines Endpoint to list all available pipelines. # List Schedule Runs Source: https://docs.apowerb.com/api-reference/scheduler/list-schedule-runs /api-reference/openapi.json get /api/pipelines/{pipeline_uuid}/schedules/{schedule_id}/runs List runs for a specific schedule, after verifying it belongs to the user. # Update Pipeline Schedule Source: https://docs.apowerb.com/api-reference/scheduler/update-pipeline-schedule /api-reference/openapi.json put /api/pipelines/{pipeline_uuid}/schedules/{schedule_id} Update a pipeline schedule (status, interval, start_time). # Create Share Source: https://docs.apowerb.com/api-reference/share/create-share /api-reference/openapi.json post /api/conversations/share # Delete Share Source: https://docs.apowerb.com/api-reference/share/delete-share /api-reference/openapi.json delete /api/conversations/share/{share_id} # Get Share Source: https://docs.apowerb.com/api-reference/share/get-share /api-reference/openapi.json get /api/conversations/share/{share_id} # Create Skill Source: https://docs.apowerb.com/api-reference/skills/create-skill /api-reference/openapi.json post /api/skills Create a new custom skill. # Delete Skill Source: https://docs.apowerb.com/api-reference/skills/delete-skill /api-reference/openapi.json delete /api/skills/{skill_id} Delete a custom skill. # Export Portfolio Skill Source: https://docs.apowerb.com/api-reference/skills/export-portfolio-skill /api-reference/openapi.json get /api/skills/portfolio/{skill_name}/export Export a built-in portfolio skill as JSON or ADK ZIP. # Export Skill Source: https://docs.apowerb.com/api-reference/skills/export-skill /api-reference/openapi.json get /api/skills/{skill_id}/export Export a custom skill as JSON or ADK ZIP. # Get Portfolio Skills Source: https://docs.apowerb.com/api-reference/skills/get-portfolio-skills /api-reference/openapi.json get /api/skills/portfolio List built-in portfolio skills only. # Get Skill Source: https://docs.apowerb.com/api-reference/skills/get-skill /api-reference/openapi.json get /api/skills/{skill_id} Get a specific custom skill by ID. # Import Skill Source: https://docs.apowerb.com/api-reference/skills/import-skill /api-reference/openapi.json post /api/skills/import Import a skill from a JSON or ADK ZIP file. # List Skills Source: https://docs.apowerb.com/api-reference/skills/list-skills /api-reference/openapi.json get /api/skills List all skills (portfolio + user's custom skills). # Update Skill Source: https://docs.apowerb.com/api-reference/skills/update-skill /api-reference/openapi.json put /api/skills/{skill_id} Update an existing custom skill. # Get Template Source: https://docs.apowerb.com/api-reference/superagents/get-template /api-reference/openapi.json get /api/superagents/{template_id} Get a specific SuperAgent template by id. Returns the legacy ``{"message": ...}`` payload both when the template does not exist and when it exists but is restricted to an org the caller does not belong to — the two cases are intentionally indistinguishable so org membership is not leaked through the response shape. # List Templates Source: https://docs.apowerb.com/api-reference/superagents/list-templates /api-reference/openapi.json get /api/superagents List SuperAgent templates visible to the authenticated user. Templates marked ``visible_to_orgs`` are filtered out for callers outside those orgs (e.g. ``scei_ar_assistant`` is hidden from non-SCEI users). # List Supervision Sessions Source: https://docs.apowerb.com/api-reference/supervision/list-supervision-sessions /api-reference/openapi.json get /api/supervision/sessions Sessions to supervise: every agent's for an admin, one's own otherwise. Reads `sessions`/`events` directly instead of fanning out one ADK HTTP call per agent. Two queries total, whatever the number of agents -- the N+1 shape this codebase has paid for more than once. # Get Tool Params Source: https://docs.apowerb.com/api-reference/tools/get-tool-params /api-reference/openapi.json get /api/tools/{tool_name}/params Return expected configuration parameters (env vars) for a tool. # Get Tools Docs Source: https://docs.apowerb.com/api-reference/tools/get-tools-docs /api-reference/openapi.json get /api/tools/docs Return documentation for all available tools. # List Mcp Configs Source: https://docs.apowerb.com/api-reference/tools/list-mcp-configs /api-reference/openapi.json get /api/mcp_configs List saved MCP server configurations for the current user. # List Tools Source: https://docs.apowerb.com/api-reference/tools/list-tools /api-reference/openapi.json get /api/tools Endpoint to list all available tools. # Reload Mcp Toolbox Source: https://docs.apowerb.com/api-reference/tools/reload-mcp-toolbox /api-reference/openapi.json post /api/mcp_configs/reload Regenerate tools.dynamic.yaml from active configs and restart the toolbox. # Save Mcp Config Source: https://docs.apowerb.com/api-reference/tools/save-mcp-config /api-reference/openapi.json post /api/mcp_configs Save an MCP server configuration as a reusable tool_config. # Update Mcp Config Source: https://docs.apowerb.com/api-reference/tools/update-mcp-config /api-reference/openapi.json put /api/mcp_configs/{mcp_config_id} Update an existing MCP config (rebuilds tool_config_params from the payload, re-encrypts, and refreshes the toolbox if it is a DB config). # Create Tool Configs Source: https://docs.apowerb.com/api-reference/tools_config/create-tool-configs /api-reference/openapi.json post /api/tools_config Endpoint to create a new tool config. # Delete Tool Configs Source: https://docs.apowerb.com/api-reference/tools_config/delete-tool-configs /api-reference/openapi.json delete /api/tools_config/{tool_config_id} Endpoint to delete a tool config by ID (scoped to current user). # Get Tool Configs Source: https://docs.apowerb.com/api-reference/tools_config/get-tool-configs /api-reference/openapi.json get /api/tools_config/{tool_config_id} Endpoint to get a specific tool config by ID (scoped to current user). # List Tool Configs Source: https://docs.apowerb.com/api-reference/tools_config/list-tool-configs /api-reference/openapi.json get /api/tools_config Endpoint to list all tool configs for the current user. # Update Tool Configs Source: https://docs.apowerb.com/api-reference/tools_config/update-tool-configs /api-reference/openapi.json put /api/tools_config/{tool_config_id} Update a tool config's name and/or parameters (scoped to current user). # Transcribe Audio Source: https://docs.apowerb.com/api-reference/transcribe-audio /api-reference/openapi.json post /api/audio/transcribe One-shot transcription of an uploaded audio blob via Gemini. Used by the chat textarea mic button (dictation). The frontend records a chunk via MediaRecorder and POSTs it here; we return plain text. # Update Session Source: https://docs.apowerb.com/api-reference/update-session /api-reference/openapi.json patch /apps/{app_name}/users/{user_id}/sessions/{session_id} Updates session state without running the agent. Args: app_name: The name of the application. user_id: The ID of the user. session_id: The ID of the session to update. req: The patch request containing state changes. Returns: The updated session. Raises: HTTPException: If the session is not found. # Create User Source: https://docs.apowerb.com/api-reference/users/create-user /api-reference/openapi.json post /api/users/ # Delete User Source: https://docs.apowerb.com/api-reference/users/delete-user /api-reference/openapi.json delete /api/users/{user_id} # Delete User By Email Source: https://docs.apowerb.com/api-reference/users/delete-user-by-email /api-reference/openapi.json delete /api/users/email/{user_email} # Get All Users Source: https://docs.apowerb.com/api-reference/users/get-all-users /api-reference/openapi.json get /api/users/ # Get Current User Route Source: https://docs.apowerb.com/api-reference/users/get-current-user-route /api-reference/openapi.json get /api/users/me # Get User By Email Source: https://docs.apowerb.com/api-reference/users/get-user-by-email /api-reference/openapi.json get /api/users/email/{user_email} # Get User By Id Source: https://docs.apowerb.com/api-reference/users/get-user-by-id /api-reference/openapi.json get /api/users/{user_id} # Update User Source: https://docs.apowerb.com/api-reference/users/update-user /api-reference/openapi.json patch /api/users/{user_id} Update user profile fields. # Version Source: https://docs.apowerb.com/api-reference/version /api-reference/openapi.json get /version # Create Subscription Source: https://docs.apowerb.com/api-reference/webhooks/create-subscription /api-reference/openapi.json post /api/webhooks/subscriptions Create a new webhook subscription. Supports both Microsoft Outlook (via Graph API) and Google Gmail (via Pub/Sub watch). The ``provider`` field in the request body determines which path is taken. 1. Verifies the user has an active integration for the provider. 2. Obtains a fresh access token via the stored refresh token. 3. Registers the push subscription with the provider. 4. Persists a ``WebhookSubscription`` row in the database. # Delete Subscription Source: https://docs.apowerb.com/api-reference/webhooks/delete-subscription /api-reference/openapi.json delete /api/webhooks/subscriptions/{subscription_db_id} Delete a webhook subscription from both the provider and the database. # Get Webhook Log Attachment Source: https://docs.apowerb.com/api-reference/webhooks/get-webhook-log-attachment /api-reference/openapi.json get /api/webhooks/logs/{log_id}/attachments/{filename} Serve one attachment captured at webhook reception time. Defence layers, in order: 1. Ownership check — log must belong to the current user (404 otherwise; no enumeration oracle). 2. DB cross-check — the requested filename must appear in the ``attachments`` JSONB column of that log row. Prevents serving a residual file someone else dropped in the per-log directory. 3. ``resolve_attachment_path`` — path-traversal-safe lookup that confirms the file lives inside ATTACHMENT_ROOT. 4. ``Content-Type`` taken from the JSONB row (set by the Graph metadata at capture time), not re-guessed from the extension. 5. ``Content-Disposition: inline`` only for PDF and images, so the dashboard can iframe-preview them; everything else downloads to disk. # Get Webhook Log Body Source: https://docs.apowerb.com/api-reference/webhooks/get-webhook-log-body /api-reference/openapi.json get /api/webhooks/logs/{log_id}/body Return the captured HTML body of a webhook-driven email. Returned with ``Content-Type: text/html``. The dashboard renders this in a sandboxed iframe (``sandbox=""`` — no scripts, no navigation) to defuse XSS from third-party email content. 404 (not 403) on logs that belong to a different user — no enumeration oracle. # Get Webhook Log By Id Source: https://docs.apowerb.com/api-reference/webhooks/get-webhook-log-by-id /api-reference/openapi.json get /api/webhooks/logs/{log_id} Return one webhook log by id, scoped to the current user. Used by the dashboard deep-link ``/webhooks?log=`` so the Activity tab can expand a specific row even when it is not in the currently loaded page. # List Subscriptions Source: https://docs.apowerb.com/api-reference/webhooks/list-subscriptions /api-reference/openapi.json get /api/webhooks/subscriptions Return all webhook subscriptions owned by the current user. # List Webhook Logs Source: https://docs.apowerb.com/api-reference/webhooks/list-webhook-logs /api-reference/openapi.json get /api/webhooks/logs Return webhook execution logs for the current user. Supports optional filtering by ``subscription_id`` and pagination via ``limit`` / ``offset``. Results are ordered newest-first. # Receive Notification Source: https://docs.apowerb.com/api-reference/webhooks/receive-notification /api-reference/openapi.json post /api/webhooks/{service}/notifications Unified webhook notification receiver. **This endpoint is publicly accessible** -- providers (Microsoft Graph, Google Pub/Sub, etc.) call it directly. The ``{service}`` path segment selects the handler: - ``outlook`` -- Microsoft Graph push notifications - ``gmail`` -- Google Cloud Pub/Sub push notifications - (extensible: add new handlers in ``webhook_handlers/``) Unknown services receive a ``200 OK`` (to prevent provider retries). # Renew Subscription Source: https://docs.apowerb.com/api-reference/webhooks/renew-subscription /api-reference/openapi.json post /api/webhooks/subscriptions/{subscription_db_id}/renew Renew (extend) a webhook subscription on the provider. # Retrigger Webhook Log Source: https://docs.apowerb.com/api-reference/webhooks/retrigger-webhook-log /api-reference/openapi.json post /api/webhooks/logs/{log_id}/retrigger Re-queue a webhook log for processing. Resets a log row to pending=0 attempts so the backlog worker picks it up again. Atomic UPDATE WHERE status NOT IN ('in_progress', 'pending') prevents double-queueing. Returns 202 on success. 409 detail='already_running_or_queued' if the UPDATE touches no row. 404 if the log does not belong to the current user. 409 detail='subscription_inactive' if the linked subscription is not active. # Update Subscription Source: https://docs.apowerb.com/api-reference/webhooks/update-subscription /api-reference/openapi.json patch /api/webhooks/subscriptions/{subscription_db_id} Update a webhook subscription (agent, template, change_type). # Cancel Workflow Source: https://docs.apowerb.com/api-reference/workflows/cancel-workflow /api-reference/openapi.json post /api/workflows/{wid}/cancel Signal a live run to terminate. # Run Workflow Sse Source: https://docs.apowerb.com/api-reference/workflows/run-workflow-sse /api-reference/openapi.json post /api/workflows/run-sse Start a workflow run and stream its events back as SSE. # Agents Source: https://docs.apowerb.com/concepts/agents How an agent is defined, stored and materialised. An agent is a database record. At startup — and whenever an agent changes — the server generates a Python module for it under `agents_pool/`, which Google ADK then executes. ## Creating an agent ```json theme={null} POST /api/agents { "agent_name": "My Assistant", "agent_model": "anthropic/claude-sonnet-4-5-20250929", "agent_description": "Specialized agent for data analysis", "agent_instruction": "You are an expert data analyst.", "agent_type": "llm", "agent_tools": ["tool_config_id_1", "tool_config_id_2"], "sub_agents": [], "memory_enabled": false, "artifacts_enabled": false, "tags": ["analytics"] } ``` ![Agent factory with the agent list, the workflow canvas and the agent creation form](https://mintcdn.com/thaink2-445e19b2/01sXtdZdZRmlIMtW/images/agents.jpg?fit=max\&auto=format\&n=01sXtdZdZRmlIMtW\&q=85\&s=68bd82e1647cb3f2a0e1e0c6346d8260) ## Fields | Field | Description | | - | - | | `agent_name` | Display name, also the ADK application name | | `agent_model` | LiteLLM model string, e.g. `anthropic/claude-sonnet-4-5-20250929`. A gateway id keeps its own provider, as in `edenai/anthropic/claude-haiku-5-5` | | `agent_instruction` | System instruction | | `agent_type` | Execution pattern — see [Orchestration](/concepts/orchestration) | | `agent_tools` | Tool **config** ids, not tool names — see [Tools](/concepts/tools) | | `sub_agents` | Child agents, for the composite patterns | | `memory_enabled` | Persist and search user memory across sessions | | `artifacts_enabled` | Allow the agent to write and execute files | > [!WARNING] > > `memory_enabled` is **off** unless you turn it on. An agent that seems to lose the > thread between sessions is usually an agent whose memory was never enabled — check > this field before looking for a bug. ## Endpoints | Method | Endpoint | Description | | - | - | - | | GET | `/api/agents` | List the caller's agents | | POST | `/api/agents` | Create | | GET | `/api/agents/{agent_id}` | Details | | PUT | `/api/agents/{agent_id}` | Update | | DELETE | `/api/agents/{agent_id}` | Delete | | POST | `/api/agents/{agent_id}/run` | Start a background run | | GET | `/api/agents/{agent_id}/status` | Run status | # Architecture Source: https://docs.apowerb.com/concepts/architecture How the package is laid out and what happens when the server starts. ## Package layout ``` src/apowerb/ ├── main.py FastAPI entry point, middleware, startup ├── models.py SQLAlchemy ORM models │ ├── auth/ Authentication and MFA ├── users/ User management ├── routers/ API endpoints │ └── webhook_handlers/ Gmail and Outlook push handlers ├── integrations/ Third-party OAuth (Google, Microsoft, GitHub, Slack) ├── core/ Business logic — agents, ADK execution, hub, RAG streaming │ └── extensions/ Extension loader and registry ├── tools_store/ Tool registry and the tool portfolio ├── skills_store/ Skills ├── agent_store/ Agent persistence ├── sqlgen/ Text-to-SQL generation ├── bi/ Datasets, charts, dashboards ├── scheduler/ Orchestrator clients (Mage, th2etl), webhook renewal, │ background runs, backlog worker ├── storage/ S3 abstraction ├── helpers/ Database, security, encryption, notification bus, migrations ├── schema/ Pydantic schemas ├── configs/ Settings, model pricing, logging ├── middleware/ └── cli/ Typer commands ``` At runtime the server also creates `agents_pool/`, `artifacts_store/` and `uploads/`. ## Runtime architecture ```mermaid theme={null} flowchart LR Client[Clients / API consumers] --> API[FastAPI application] API --> Core[Core services\nagents, RAG, tools, scheduler] API --> ADK[Google ADK runtime] Core --> DB[(Relational database)] Core --> Store[(Artifacts / uploads storage)] Core --> Pool[agents_pool/] ADK --> Tools[Tools store + skills store] Core --> Ext[Extensions] Webhooks[Webhook providers] --> API OAuth[OAuth providers] --> API ``` This runtime view highlights the main execution path: incoming requests reach the FastAPI entry point, the app bootstraps the internal services and ADK runtime, and persistence is kept in the database plus the artifact storage layer. ## Startup sequence **1. Create runtime directories** `agents_pool/`, `artifacts_store/`, `uploads/`. **2. Run auto-migrations** `ensure_*` functions bring every table up to date. There is no separate migration command — the schema converges at boot. **3. Generate agent modules** Each agent stored in the database is materialised as a Python module under `agents_pool/`. **4. Start background tasks** Webhook renewal runs every six hours. **5. Mount the ADK sub-application** The Google ADK FastAPI application is mounted into the main app. **6. Load extensions** Modules named in `TH2_EXTENSIONS` register their routers, which are mounted after the core's. See [Editions](/concepts/editions). > [!WARNING] > > Migrations run at boot. Rolling the application back to a previous release does **not** > roll the schema back — plan a database backup before upgrading a production instance. ## Database models | Table | Description | | - | - | | `user` | Accounts — email, password, credits, OAuth identities, role | | `integrations` | Connected OAuth services, with encrypted access and refresh tokens | | `webhook_subscriptions` | Active watches — provider, subscription id, resource, agent, expiration | | `webhook_logs` | Execution history — trigger event, agent response, duration, status | | `notifications` | Per-user notifications, read state | | `transactions` | Credit movements — purchase, usage, refund, bonus | ## Supported models Model access goes through LiteLLM, so provider strings follow its convention: * **Anthropic** — `anthropic/claude-sonnet-4-5-20250929` * **OpenAI** — `openai/gpt-4o` * **Mistral** — `mistral/mistral-large-latest` * **Google** — `gemini/gemini-pro` * **OVHcloud** — `ovhcloud/DeepSeek-R1-Distill-Llama-70B` * **Eden AI** — `edenai/anthropic/claude-haiku-5-5` Eden AI is a gateway, so its ids already name the downstream provider. The `edenai/` prefix keeps that id whole and sends the call to `https://api.edenai.run/v3`, so an agent needs only its Eden AI key and no endpoint. Set `model_api_base` to point elsewhere, for instance `https://api.eu.edenai.run/v3` for the EU region. # Editions and extensions Source: https://docs.apowerb.com/concepts/editions How the open-source core stays complete on its own, and how commercial bricks plug into it. apowerb is an open core. The published package is a complete, generic server — not a crippled build waiting for a licence key. ## Absent, not disabled Commercial capabilities — identity-provider login, multi-factor authentication, token accounting and quotas, billing, B2B prospecting, agent evaluation, the administration panel — are **not present** in the open-source build. There is no feature flag to flip and no dead code in the image. Two of them are recent, and worth naming because the core keeps a *hook* where the brick used to be the whole answer: * **Agent evaluation** left the core in `0.2.0`. The eval routes and the judge logic belong to the evaluation brick; the core no longer serves the ADK `eval_sets` / `eval_results` routes. * **Supervision across accounts** stays in the core, but *who may cross accounts* is answered by a brick. With none registered, each person sees only their own sessions — see [Supervision](/monitoring/supervision). > [!WARNING] > > The evaluation brick and an older core do not coexist: the brick redefines model > metadata the core also declares. Pin the brick against the core release it was built > for rather than mixing versions. That distinction is observable on a running stack: ``` GET /api/config → no "billing_enabled" key GET /api/usage/quota → 404 GET /api/billing/packages → 404 GET /api/auth/mfa/status → 404 GET /apps/demo/eval_sets → 404 ``` > [!NOTE] > > A **missing** key and a key set to `false` do not say the same thing. The first says > the capability does not exist in this edition. Client code should treat an absent key > as "not in this edition", never as "disabled". ## The extension mechanism Bricks are plugged in by naming their Python module in `TH2_EXTENSIONS`, as a comma-separated list. Each module exposes a `register(registry)` function — or, historically, `init_overlay(registry)`. Both entry-point names are accepted. ```bash theme={null} TH2_EXTENSIONS=mycompany_pack.entrypoint,mycompany_connector ``` At startup the loader imports each module in order and calls its entry point, letting it register routers, tools and services against the core registry. Registered routers are mounted after the core's own. `TH2_OVERLAY_MODULE` is the older single-module form. It is still honoured and is loaded after everything listed in `TH2_EXTENSIONS`. With neither variable set, no extension loads and the core stays generic and complete in itself. That property is what makes publishing the core alone possible. ### Failures are loud Any error while loading an extension propagates and stops startup. A broken extension must be visible to the healthcheck, never degrade the service silently. An extension that exposes neither `register` nor `init_overlay` raises at load time. ## Writing an extension ```python theme={null} # mycompany_pack/entrypoint.py from fastapi import APIRouter router = APIRouter(prefix="/api/mycompany", tags=["mycompany"]) @router.get("/ping") def ping() -> dict[str, str]: return {"status": "ok"} def register(registry) -> None: registry.add_router(router) ``` > [!WARNING] > > Installing an extension and **loading** it are two different steps. Adding the package > to the environment does nothing on its own — the module must also be named in > `TH2_EXTENSIONS`. A stack that installs the brick but forgets the variable starts > healthy, answers `200`, and silently lacks the capability. ## Interface slots The web interface has the same arrangement, in JavaScript. The core declares named **slots** and never imports what fills them; a brick registers a component for a slot at startup. With no brick, a slot renders `null` — that is the open-source product, not a degraded mode. Three slots exist today: | Slot | Where it renders | Empty by default means | | - | - | - | | `auth.providers` | Under the sign-in buttons | Only the credentials form is offered | | `auth.legal` | Footer of the sign-in screen | No legal notice is shown | | `sidebar.footer` | Bottom of the navigation sidebar | Nothing below the navigation | A brick is an object with a `name` and a `register(registry)` function, listed in `src/extensions/installed.js`: ```jsx theme={null} // src/extensions/mycompany-legal.jsx export const legalNotice = { name: "mycompany-legal", register(registry) { registry.registerSlot("auth.legal", () => (

By continuing you accept our{" "} privacy policy{" "} and terms of use.

)); }, }; ``` ```js theme={null} // src/extensions/installed.js import { legalNotice } from "./mycompany-legal"; export const bricks = [legalNotice]; ``` The list is read at build time, so a brick means building your own image of the interface. The catalogue keys `AuthScreen.legalPrefix`, `AuthScreen.privacyPolicy`, `AuthScreen.legalAnd` and `AuthScreen.termsOfUse` stay in the core for a brick that wants the translated wording rather than its own. > [!WARNING] > > **Your terms, not someone else's.** Up to interface `0.1.22` the sign-in screen linked > `agent-dev.thaink2.fr/legal` — the vendor's own development instance — from every > published build. Any self-hosted install therefore pointed its visitors at a third > party's privacy policy and terms. Since `0.1.23` the core renders nothing there. If > your deployment needs a legal notice, it is yours to provide, through this slot. > [!NOTE] > > A flag would not have been enough. `NEXT_PUBLIC_OAUTH_EXCLUDE_PROVIDERS` hides sign-in > buttons, and the code for them still ships in the published bundle. An empty slot has > nothing to hide — the component was never imported. # Orchestration Source: https://docs.apowerb.com/concepts/orchestration The five execution patterns and how sub-agents compose. `agent_type` selects how an agent executes. | Type | Behaviour | | - | - | | `llm` / `base` | A single agent, executed directly | | `parallel` | Sub-agents run concurrently, results are combined | | `sequential` | Sub-agents run one after another, each seeing the previous output | | `loop` | Iterative execution until a stop condition is met | | `router` | Picks which sub-agent to hand the request to, instead of running them all | ## Sub-agents Composite agents reference children through `sub_agents`. Children are themselves agents — they can carry their own tools, model and instruction, and can be composite in turn, which is how hierarchies are built. ```json theme={null} { "agent_name": "Research pipeline", "agent_type": "sequential", "sub_agents": ["collector_agent_id", "analyst_agent_id", "writer_agent_id"] } ``` > [!NOTE] > > Under Google ADK, sub-agents of one invocation share an execution tree. When reading > traces, do not assume one identifier per agent — correlate on the agent name as well. # Sessions and runs Source: https://docs.apowerb.com/concepts/sessions-and-runs Conversation state, blocking runs, streaming runs and traces. A session holds conversation context for one agent and one user. Runs happen inside a session. ## Endpoints | Method | Endpoint | Description | | - | - | - | | POST | `/api/adk/sessions` | Create a session | | GET | `/api/adk/sessions/list` | List sessions | | GET | `/api/adk/sessions/{agent}/{user}/{session}` | Conversation history | | GET | `/api/adk/sessions/{agent}/{user}/{session}/trace` | Execution trace | | PATCH | `/api/adk/sessions/{agent}/{user}/{session}` | Update session state | | DELETE | `/api/adk/sessions/{agent}/{user}/{session}` | Delete | | POST | `/api/adk/run` | Run, blocking | | POST | `/api/adk/run_sse` | Run, streamed over SSE | | POST | `/api/adk/schedule_run` | Schedule a recurring run | | POST | `/api/adk/run_now` | Trigger immediately | ## Running an agent ```json theme={null} POST /api/adk/run { "agent_name": "My Assistant", "user_id": "user@example.com", "session_id": "session_001", "new_message": { "role": "user", "parts": [{ "text": "What is the forecast for next month?" }] }, "streaming": false } ``` For token-by-token output, post the same body to `/api/adk/run_sse` — see [Streaming](/guides/streaming). # Tools Source: https://docs.apowerb.com/concepts/tools The tool portfolio, and the difference between a tool and a tool config. A **tool** is a capability module shipped with the framework. A **tool config** is an instance of one, holding your credentials and parameters. Agents reference tool config ids, never tool names. ``` GET /api/tools list available tools GET /api/tools/{tool_name}/params parameters a config must provide POST /api/tools_config create a configured instance ``` The portfolio ships **32 modules**, together exposing over a hundred callable tools. ![Tool box listing available tools, tool categories, MCP servers and skills](https://mintcdn.com/thaink2-445e19b2/01sXtdZdZRmlIMtW/images/toolbox.jpg?fit=max\&auto=format\&n=01sXtdZdZRmlIMtW\&q=85\&s=07cd2805ee15166bfa2191576b96deed) ## Portfolio ### Google Workspace | Module | Covers | | - | - | | `google_auth` | The OAuth handshake shared by the Google modules | | `google_drive` | List, search, read, download files | | `google_gmail` | List, search, read, send email | | `google_calendar` | List, search, create events | | `google_sheets` | Spreadsheet info, read and write cells | | `google_docs` | Create, read, append | ### Microsoft 365 | Module | Covers | | - | - | | `microsoft_auth` | The OAuth handshake shared by the Microsoft modules | | `outlook_mail` | List, search, read, send, folders, attachments | | `onedrive_core` | Shared OneDrive plumbing | | `onedrive_read` | List, search, read, download, shared files | | `onedrive_write` | Upload, create folders, delete | | `teams` | Chats, messages, replies, search, group chats, members | ### Data and databases | Module | Covers | | - | - | | `database` | Generic queries and SQL execution | | `database_mcp` | Database access over MCP | | `text_to_sql` | Natural language to SQL, schema introspection | | `db_to_rag` | Index query results into RAG | | `data_handler` | Filtering, aggregation, transformation | | `business_intelligence` | Datasets, charts and dashboards | ### Knowledge and memory | Module | Covers | | - | - | | `rag` | Create, list, search and delete knowledge bases | | `memory` | Save and search user memory and tool usage patterns | ### Business systems | Module | Covers | | - | - | | `odoo` | Search, create and update CRM/ERP records on an Odoo instance | | `marketing` | HubSpot integration, sales leads | ### Content and media | Module | Covers | | - | - | | `artifacts` | Files an agent produces during a run | | `audio` | Audio handling | | `image_generation` | Image generation | | `visualization` | Chart generation, CSV to chart export | ### Utilities | Module | Covers | | - | - | | `basic` | Read files, load data, convert images, bearer tokens | | `api_call` | Generic API calls | | `s3_tools` | Read and search S3 files | | `web_search_mcp` | Web search over MCP | | `integration_status` | Whether a given integration is connected and healthy | | `thaink2` | thaink2 platform utilities | ## Skills Beyond tools, the framework ships **skills** — packaged procedures an agent can follow, each one a `SKILL.md` with its references: `dashboard-builder` · `data-visualization` · `email-campaign` · `error-recovery` · `onedrive-navigation` · `rag-search` · `report-generation` · `text-to-sql` ## MCP servers Tools can also come from an MCP server declared per workspace. `GET /api/mcp_configs` lists the configured servers; the modules suffixed `_mcp` above reach their capabilities through that channel. > [!NOTE] > > A module being present does not mean it is usable: most need a tool config carrying > credentials, and the Workspace modules need the matching > [integration](/guides/integrations) connected first. # Configuration Source: https://docs.apowerb.com/configuration Every environment variable read by the apowerb server. Configuration is read from the environment, usually through a `.env` file created from `.env.example`. ## What this server has configured apowerb starts with almost nothing configured and **says so** rather than failing. A feature nobody has set up answers « not configured yet, contact your administrator » — never a 4xx or a 5xx. The server is the source of truth about its own state: ```bash theme={null} curl -H "Authorization: Bearer " https://your-host/api/config/setup ``` ```json theme={null} { "items": [ { "key": "orchestration", "configured": false, "optional": false, "blocks": ["orchestrator"], "missing": ["TH2ETL_BASE_URL", "TH2ETL_API_KEY"], "docs_url": "https://docs.apowerb.com/configuration/orchestration" } ], "missing_count": 1 } ``` The same answer feeds the interface: **Admin → Configuration** lists every capability, and the sidebar badge counts what is still missing. | Capability | Blocks | How to configure it | | - | - | - | | `default_llm` | agents carrying no key of their own | [Shared model](/configuration/default-llm) | | `object_storage` | *nothing* — a local directory is the fallback | [File storage](/configuration/storage) | | `microsoft_integration` | Outlook, OneDrive, Outlook triggers, campaigns | [Microsoft](/configuration/microsoft) | | `google_integration` | Drive, Gmail, Calendar and their triggers | [Google](/configuration/google) | | `orchestration` | the Orchestrator screen, scheduled pipelines | [Orchestrator](/configuration/orchestration) | | `observability` | the Logging screen | [Logs and traces](/configuration/observability) | | `system_mail` | address verification, password reset | [System mail](/configuration/mail) | > [!NOTE] > > `missing` holds variable **names**, never values, and the server sends it to > administrators only. Everyone else sees which features work — enough to know > it is not their mistake, and nothing that helps an attacker. > [!WARNING] > > Every setting below is read at startup. Restart the backend after changing > one, then reload **Admin → Configuration**. A value written where the process > never reads it changes nothing — check the environment of the container, not > the shell that started it. ## Required Five settings, and the server refuses to boot without them — the list is `RUNTIME_REQUIRED_FIELDS` in `configs/settings.py`, which the boot check reads. | Variable | Description | | - | - | | `DB_HOST` | PostgreSQL host | | `DB_NAME` | Database name | | `DB_USER` | Database user | | `DB_PASSWORD` | Database password | | `ENCRYPT_KEY` | Fernet key used for encryption at rest **and** JWT signing. Must be a urlsafe-base64 32-byte key — `Fernet.generate_key()` | > [!NOTE] > > On the [Quickstart](/quickstart) path, none of these are yours to fill in: the > Compose stack runs its own Postgres and `generate-secrets.sh` writes the key. > This page is for an installation that brings its own database. Two neighbours in the same block are **not** required, each carrying a default: `DB_PORT` (`5432`) and `DB_SCHEMA` (`public`). > [!NOTE] > > `.env.example` may still carry `TEST_TOKEN`. It is **not required**: the only code > that reads it is a middleware mounted nowhere. Setting it changes nothing, leaving it > out breaks nothing. > > Earlier versions did refuse to start without it, which meant inventing a "test token" > to run in production. That requirement is gone. > [!WARNING] > > `ENCRYPT_KEY` encrypts the OAuth tokens of every connected integration. Changing it > makes all previously connected integrations unreadable. Back it up with your other > secrets — see [Secrets](/deployment/introduction#secrets). ## Security and JWT | Variable | Default | Description | | - | - | - | | `WORKING_MODE` | `development` | `development` or `production` | | `ALGORITHM` | `HS256` | JWT signing algorithm | | `ACCESS_TOKEN_EXPIRE_MINUTES` | `120` | Access token lifetime | | `ENCRYPT_PASS` | — | Encryption password | ## API schema | Variable | Default | Description | | - | - | - | | `PUBLISH_API_SCHEMA` | unset (`false`) | Serve `/docs`, `/redoc` and `/openapi.json` | FastAPI serves these three routes to anyone by default, with the full inventory of paths, parameters and response shapes — no credentials required, since Swagger UI cannot send a bearer token on its first load. apowerb removes them instead of guarding them, unless this flag is set. > [!WARNING] > > Since `0.1.18`, `/docs` and `/openapi.json` answer **404 by default**. Set > `PUBLISH_API_SCHEMA=true` to get a browsable schema back — typically for local > development only. `WORKING_MODE=production` hides the schema regardless of this > flag. ## CORS | Variable | Default | Description | | - | - | - | | `CORS_ALLOWED_ORIGINS` | `http://localhost:3000` | Comma-separated list of allowed origins. Supersedes `FRONTEND_URLS` when set. | | `FRONTEND_URLS` | `["http://localhost:3000"]` | Allowed origins, as a JSON array — used when `CORS_ALLOWED_ORIGINS` is not set | > [!WARNING] > > **Set `CORS_ALLOWED_ORIGINS` whenever the front end lives on a different domain than > the API.** ADK 2.6 added an origin-check middleware that rejects any state-changing > request (POST, PUT, PATCH, DELETE) carrying an `Origin` header it was not told about > — with a **403 raised before authentication runs**. GET requests are unaffected, > which makes the symptom easy to misread: the app looks half-broken (browsing works, > every submit fails) rather than looking like a CORS problem. List every origin the > browser will call the API from directly, comma-separated. ## OAuth — workspace integrations These OAuth applications carry the scopes agents need to read Drive, send mail, or list Teams chats. They authorise an agent to act on a service — they are not how a user signs in. | Variable | Description | | - | - | | `GOOGLE_INTEGRATION_CLIENT_ID` / `_SECRET` / `_REDIRECT_URI` | Google Workspace — Drive, Gmail, Calendar, Sheets, Docs | | `MICROSOFT_INTEGRATION_CLIENT_ID` / `_SECRET` / `_TENANT_ID` / `_REDIRECT_URI` | Microsoft 365 — Outlook, Teams, OneDrive, SharePoint | | `GITHUB_INTEGRATION_CLIENT_ID` / `_SECRET` / `_REDIRECT_URI` | GitHub workspace integration | > [!NOTE] > > Signing in **with** an identity provider — GitHub, Google, Microsoft, LinkedIn — is > part of a commercial edition and is absent here. The open-source build authenticates > with email and password. See [Editions](/concepts/editions). ## Gmail Pub/Sub webhooks | Variable | Description | | - | - | | `GMAIL_PUBSUB_PROJECT_ID` | Google Cloud project hosting the topic | | `GMAIL_PUBSUB_TOPIC` | Topic name only, not the full path | | `GOOGLE_WEBHOOK_AUDIENCE` | Expected `aud` claim of the JWT Google signs its push with. The handler verifies that token before acting on the notification | See [Gmail webhooks](/guides/integrations/google) for the full setup. ## RAG and webhooks | Variable | Default | Description | | - | - | - | | `PUBLIC_BASE_URL` | `http://localhost:8000` | Public URL of this apowerb instance | | `RAG_WEBHOOK_SECRET` | `th2-webhook-default-secret` | HMAC-SHA256 secret for RAG webhooks | | `RAG_BASE_URL` | — | Base URL of the RAG service ([th2rag](/ecosystem/th2rag)) | > [!WARNING] > > `POST /rag/webhook` sits outside the auth middleware and trusts this HMAC signature > instead — it is the only credential guarding the route. Since `0.1.8`, the server > **refuses to start** when `WORKING_MODE=production` and `RAG_WEBHOOK_SECRET` is > still empty or the shipped placeholder. Generate one before deploying: > `openssl rand -hex 32`. ## Notifications | Variable | Default | Description | | - | - | - | | `NOTIFICATION_EMAIL` | empty | Shared mailbox used as the `From` for system emails | | `NOTIFICATION_EMAIL_PROVIDER` | `outlook` | Provider serving `NOTIFICATION_EMAIL` | | `NOTIFICATION_INTEGRATION_OWNER` | empty | Login owning the mailbox integration whose refresh token sends the mail | | `SUPER_ADMIN_EMAIL` | empty | Recipient of ETL and system alerts | > [!NOTE] > > All four default to empty, and the mailer is simply off until they are set — one log > line, no error, no email. There is no hardcoded fallback address: an installation > that leaves these unset sends nothing, rather than mailing a third party by default. ## Storage (optional) | Variable | Description | | - | - | | `STORAGE_MODE` | `local`, `s3` (or any S3-compatible storage), or `azure` (coming soon) | | `S3_REGION`, `S3_ENDPOINT`, `S3_BUCKET_NAME` | Bucket location for S3-compatible storage | | `S3_ACCESS_KEY`, `S3_ACCESS_KEY_SECRET` | Credentials for S3-compatible storage | ## Orchestrator | Variable | Default | Description | | - | - | - | | `ORCHESTRATOR` | `mage` | Which orchestrator runs the schedules — `mage` or `th2etl` | With `ORCHESTRATOR=mage` (the default), the server talks to Mage AI: | Variable | Default | Description | | - | - | - | | `BASE_URL` | `http://localhost:6789` | Mage AI URL | | `API_KEY` | — | Mage API key | | `OAUTH_TOKEN` | — | Mage OAuth token | | `PROJECT_NAME` | `default_repo` | Mage project | With `ORCHESTRATOR=th2etl`, it talks to [th2etl](/ecosystem/th2etl) instead: | Variable | Default | Description | | - | - | - | | `TH2ETL_BASE_URL` | `http://localhost:8009` | th2etl instance | | `TH2ETL_API_KEY` | — | Must equal that instance's own `API_KEY`: its business routes require `Authorization: Bearer ` | Both clients expose the same surface, so only these settings change. See [Orchestrator](/guides/orchestrator). | Variable | Default | Description | | - | - | - | | `SCHEDULER_ENABLED` | `true` | Set to `false` to drop the scheduler integration entirely | | `MAGE_PIPELINE_UUID` | `agents` | Pipeline the Mage backend triggers | > [!WARNING] > > Unset means `mage`. A deployment meant to run on th2etl must say so explicitly — > silence selects the other backend, and the schedules land where nobody is looking. ## Default LLM provider Agents with no model of their own fall back to this provider. | Variable | Default | Description | | - | - | - | | `DEFAULT_LLM_MODEL` | — | LiteLLM model id used when an agent names none | | `DEFAULT_LLM_API_KEY` | — | Key for that model | | `DEFAULT_LLM_API_BASE` | — | Base URL, for self-hosted or proxied providers | | `DEFAULT_LLM_MONTHLY_TOKEN_QUOTA` | `1000000` | Monthly token allowance on the default provider | | `DEFAULT_LLM_PLAN_QUOTAS` | `{}` | Per-plan overrides, as JSON | | `CREDIT_TOKEN_VALUE` | `100000` | Tokens one credit is worth | ## Sign-up and sign-in | Variable | Default | Description | | - | - | - | | `AUTH_REGISTER_ENABLED` | `true` | Allow self-service account creation | | `AUTH_BASIC_ENABLED` | `true` | Allow email/password sign-in | | `AUTH_EMAIL_VERIFICATION_ENABLED` | `false` | Require a confirmed address before use | | `EMAIL_VERIFY_TOKEN_EXPIRE_HOURS` | `24` | Lifetime of the confirmation token | | `APP_PUBLIC_URL` | `http://localhost:3000` | Public URL of the **front** app, used to build verify and reset links | ## Database, beyond the required settings | Variable | Default | Description | | - | - | - | | `DB_TYPE` | `postgresql` | Database backend | | `DB_SSLMODE` | `require` | libpq SSL mode | | `DB_AGENT_STORE_TABLE_NAME` | `th2agents_store` | Table holding agent definitions | | `ECHO_SQL` | `false` | Log every SQL statement — noisy, for debugging only | ## Runtime directories Where the server writes on disk. S3 keys keep their own namespace and are unaffected. | Variable | Default | Description | | - | - | - | | `RUNTIME_ROOT` | — | Root for the directories below; empty means the working directory | | `AGENTS_POOL_DIR` | `agents_pool` | Generated agent modules | | `ARTIFACTS_STORE_DIR` | `artifacts_store` | Artifacts, in local storage mode | | `UPLOADS_DIR` | `uploads` | Uploaded files, in local storage mode | | `BI_STORE_DIR` | `bi_store` | CSV and Excel files imported into BI, when S3 is not configured | | `TOOLBOX_DIR` | — | MCP toolbox location; empty means `RUNTIME_ROOT` | | `ROOT_PATH` | `http://localhost:8000` | Mount prefix when served behind a path-rewriting proxy | ## Organisations | Variable | Default | Description | | - | - | - | | `ORG_DOMAIN_SLUGS` | `{}` | JSON map of email domain to organisation slug, e.g. `{"example.com": "example"}`. Membership is computed from it | | `ETL_ALERT_RECIPIENTS` | — | Recipients of ETL and system alerts | ## Development-only switches > [!WARNING] > > Both must stay `false` in production. The first is refused at boot when > `WORKING_MODE` is production; the second must never run unattended — use the > migration CLI explicitly instead. | Variable | Default | Description | | - | - | - | | `WEBHOOK_DEV_SKIP_SIG` | `false` | Skip signature verification on the Gmail webhook, so local testing needs no Google Cloud project | | `ENCRYPT_LEGACY_ON_BOOT` | `false` | Run the legacy integration-token encryption migration at startup | ## Declared here, used by bricks The core declares these so a brick can read them. In a core-only install they are inert: setting them changes nothing, and the matching routes still answer `404`. | Variable | Brick | | - | - | | `STRIPE_SECRET_KEY`, `STRIPE_PUBLISHABLE_KEY`, `STRIPE_WEBHOOK_SECRET` | billing | | `EVALUATION_ENABLED`, `EVALUATION_JUDGE_MODEL`, `EVALUATION_JUDGE_API_KEY`, `EVALUATION_PASS_THRESHOLD_*`, `EVALUATION_MIN_RERUN_INTERVAL_SECONDS`, `EVALUATION_TOOL_USAGE_TOKENS_PER_CALL_SOFT_CAP` | evaluation | | `GITHUB_CLIENT_ID`, `GITHUB_CLIENT_SECRET`, `GITHUB_REDIRECT_URI`, `GOOGLE_CLIENT_ID`, `GOOGLE_CLIENT_SECRET`, `GOOGLE_REDIRECT_URI`, `MICROSOFT_CLIENT_ID`, `MICROSOFT_CLIENT_SECRET`, `MICROSOFT_TENANT_ID`, `LINKEDIN_CLIENT_ID`, `LINKEDIN_CLIENT_SECRET` | auth (identity-provider sign-in) | > [!NOTE] > > These are the **sign-in** credentials, not the workspace ones. Connecting Google Drive or > Outlook for an agent uses the `*_INTEGRATION_*` variables above, which are part of this > edition. ## Extensions | Variable | Description | | - | - | | `TH2_EXTENSIONS` | Comma-separated list of modules to plug in at startup | | `TH2_OVERLAY_MODULE` | Legacy single-module form, still honoured, loaded last | Empty means no extension: the core runs on its own. See [Editions](/concepts/editions). # Shared model Source: https://docs.apowerb.com/configuration/default-llm The model agents fall back on when they carry no key of their own. Without it, every agent needs its own API key before it can answer, and the model picker offers nothing by default. ## Variables | Variable | Required | Description | | - | - | - | | `DEFAULT_LLM_MODEL` | yes | LiteLLM model id — `gemini/gemini-2.5-flash`, `openai/gpt-4o-mini`, `anthropic/claude-sonnet-4-5`… | | `DEFAULT_LLM_API_KEY` | yes | Key for that provider | | `DEFAULT_LLM_API_BASE` | no | Base URL, for a self-hosted or proxied provider | | `DEFAULT_LLM_USER_TOKEN_CAP` | no | Tokens one user may spend on the shared model per window. Default `1000000`; `0` removes the cap. | | `DEFAULT_LLM_GLOBAL_TOKEN_CAP` | no | Tokens the whole deployment may spend per window. Default `20000000`; `0` removes it. | | `DEFAULT_LLM_CAP_WINDOW_HOURS` | no | Length of the rolling window. Default `24`. | The checklist reports `default_llm` as configured only when **both** the model id and the key are set — a key alone points at nothing. ## The cap The shared model is a key **you** pay for, and `/api/config` announces it to anonymous callers. So the open-source build caps it by default rather than leaving that to whoever installs a brick: one million tokens per user and twenty million for the deployment, over a rolling 24-hour window. Only consumption billed to the shared key counts. A user who brings their own API key pays for it themselves and is never capped by these settings. The window **rolls**; it does not reset on the hour or at midnight. A calendar reset would let one account spend a full allowance at 23:59 and another at 00:01 — the ceiling that matters is what can be spent in any 24 hours, not what a counter reads. The second cap exists because the first one is only worth as much as the number of accounts is bounded. Self-registration is open by default (`AUTH_REGISTER_ENABLED`), so a per-user cap is one signup away from being lifted. The deployment cap is not. A refused run answers **402** before anything starts, with a body an interface can use: ```json theme={null} { "code": "TOKEN_QUOTA_EXCEEDED", "scope": "user", "used": 1002340, "cap": 1000000, "window_hours": 24, "retry_after_seconds": 3540 } ``` `scope` is `user` or `deployment`, and `retry_after_seconds` is the wait until the oldest counted consumption leaves the window — the first moment budget comes back. Set a cap to `0` to remove it. If a commercial brick supplies its own ceiling, it takes over entirely and these settings are ignored: the core steps aside for the dedicated extension point, not for any add-on that happens to register a run guard. Should the consumption table be unreadable, the run is **allowed** and a warning is logged. A hiccup in accounting must not make the product mute — but the opening has to be audible. ## What users see The counter under the sidebar shows the tokens spent this month on the shared model. The bar and percentage come from a commercial brick, which supplies a monthly ceiling per user or per plan; without it the sidebar shows a counter only. That gauge and the cap above are separate: the cap protects the bill, the gauge tells a customer where they stand in their plan. ## Check ```bash theme={null} curl https://your-host/api/config ``` `default_llm_available: true` and a `default_llm_model_id` mean agents can run with no key of their own. This endpoint is public and deliberately says nothing about the key itself. # Google Source: https://docs.apowerb.com/configuration/google One OAuth client for Drive, Gmail, Calendar and their triggers. The Google integrations and their triggers share one OAuth client. Push notifications from Gmail need one variable more. ## Variables | Variable | Required | Description | | - | - | - | | `GOOGLE_INTEGRATION_CLIENT_ID` | yes | OAuth 2.0 client ID | | `GOOGLE_INTEGRATION_CLIENT_SECRET` | yes | Client secret | | `GOOGLE_INTEGRATION_REDIRECT_URI` | no | Defaults to `/integrations/google/callback` | | `GOOGLE_WEBHOOK_AUDIENCE` | for triggers | Expected `aud` of the JWT Google signs its push with | The checklist lists `GOOGLE_WEBHOOK_AUDIENCE` among the missing names as long as it is empty: connections work without it, incoming Gmail notifications do not. ## Creating the client 1. **Google Cloud Console** → a project → *APIs & Services*. 2. Enable what your agents will use: Drive API, Gmail API, Calendar API, Sheets API, Docs API. 3. *OAuth consent screen*: External unless everyone is in your Workspace. While the app is in *Testing*, only listed test users can connect, and refresh tokens expire after seven days — publish it before rolling it out. 4. *Credentials* → *Create credentials* → *OAuth client ID* → *Web application*. Authorised redirect URI: `https://your-host/integrations/google/callback`. 5. Copy the client ID and secret. ## Gmail push notifications Beyond the client, Gmail triggers need a Pub/Sub topic — `GMAIL_PUBSUB_PROJECT_ID` and `GMAIL_PUBSUB_TOPIC` — and `GOOGLE_WEBHOOK_AUDIENCE`, the value the handler verifies before acting on a notification. Full walkthrough: [Gmail webhooks](/guides/integrations/google). ## Check **Integrations** → *Google Drive* → *Connect*. `redirect_uri_mismatch` means the URI registered in the console differs from the one the server sends — compare them character for character, including the scheme. # System mail Source: https://docs.apowerb.com/configuration/mail Address verification and password reset. These are the messages apowerb sends on its own behalf — not the mail an agent sends through a connected mailbox, which belongs to [Microsoft](/configuration/microsoft) or [Google](/configuration/google). ## Variables | Variable | Required | Description | | - | - | - | | `SMTP_HOST` | yes | Relay host | | `SMTP_PORT` | yes | `587` for STARTTLS, `465` for implicit TLS | | `SMTP_FROM` | yes | Sender address | | `SMTP_USER` | no | Login, if the relay requires one | | `SMTP_PASSWORD` | no | Its password | | `APP_PUBLIC_URL` | yes in practice | Public URL of the **front** app: verification and reset links are built from it | The checklist looks at the first three. A relay that needs authentication but gets none will refuse the message at send time, not at startup. > [!NOTE] > > Without SMTP the mailer is simply off: one log line, no error. Sign-up still > works as long as `AUTH_EMAIL_VERIFICATION_ENABLED` is `false` — which it is by > default. Turn verification on and the accounts of an installation with no > relay are stuck unverified, which is why the checklist names this capability. ## Check Trigger a password reset from the sign-in screen and read the backend logs. A line naming the relay means the message left; the absence of any line means no mailer was configured. > [!WARNING] > > `APP_PUBLIC_URL` pointing at `localhost` produces links that work on the > server and nowhere else — the classic « the mail arrived but the link is > broken ». # Microsoft Source: https://docs.apowerb.com/configuration/microsoft One app registration for Outlook, OneDrive, Teams, Outlook triggers and campaigns. Three features share one set of credentials: the Microsoft integrations, the Outlook triggers, and e-mail campaigns. None of them is available until the app registration exists. ## Variables | Variable | Required | Description | | - | - | - | | `MICROSOFT_INTEGRATION_CLIENT_ID` | yes | Application (client) ID | | `MICROSOFT_INTEGRATION_CLIENT_SECRET` | yes | Client secret **value** — not its ID | | `MICROSOFT_INTEGRATION_TENANT_ID` | no | `common` for any account, or your tenant to restrict it | | `MICROSOFT_INTEGRATION_REDIRECT_URI` | no | Defaults to `/integrations/microsoft/callback` | ## Creating the registration 1. **Microsoft Entra admin center** → *App registrations* → *New registration*. 2. Supported account types: *Accounts in any organizational directory and personal Microsoft accounts* unless you mean to restrict it. 3. Redirect URI, platform **Web**: `https://your-host/integrations/microsoft/callback`. It must match `MICROSOFT_INTEGRATION_REDIRECT_URI` character for character — a trailing slash is a different URI. 4. *Certificates & secrets* → *New client secret*. Copy the **Value** column immediately; it is shown once, and the *Secret ID* is not the secret. 5. *API permissions* → *Microsoft Graph* → *Delegated*, then grant consent: `offline_access`, `User.Read`, `Mail.Read`, `Mail.Send`, `Files.ReadWrite.All`, `Calendars.ReadWrite`, `Chat.Read`. > [!WARNING] > > Client secrets expire — six or twenty-four months, chosen at creation. > When one expires, every connected integration stops refreshing its token and > users are asked to reconnect, with no other symptom. Note the date somewhere > that will outlive the session that created it. ## Check Restart the backend, then **Integrations** → *Outlook* → *Connect*. The consent screen means the registration is right; an `AADSTS` error names what is wrong — usually the redirect URI. # Logs and traces Source: https://docs.apowerb.com/configuration/observability What feeds the Logging screen. The **Logging** screen reads a store, `th2pulse`, which is fed by an OpenTelemetry collector, which is fed by the backend. Any link missing and the screen says it is not configured yet. ``` apowerb ──OTLP──▶ otel-collector ──▶ th2pulse ◀── the interface reads, server-side ``` ## Backend | Variable | Required | Description | | - | - | - | | `OTEL_EXPORTER_OTLP_ENDPOINT` | yes | The collector — `http://otel-collector:4318` | | `OTEL_SERVICE_NAME` | no | Name traces are attributed to, default `apowerb` | | `OTEL_METRICS_EXPORTER` | no | `none` unless you collect metrics as well | This single variable is what the checklist looks at for `observability`. ## The store | Variable | Description | | - | - | | `TH2PULSE_DB_DSN` | Same database as apowerb | | `TH2PULSE_DB_SCHEMA` | A schema of its own, `th2pulse` | | `TH2PULSE_INGEST_TOKEN` | Presented by the collector on every export | | `TH2PULSE_QUERY_TOKEN` | Presented by the interface when it reads | > [!WARNING] > > Both tokens are mandatory: th2pulse refuses to start without them. Generate > each with `openssl rand -hex 32`. ## Interface | Variable | Description | | - | - | | `PULSE_API_URL` | The store — `http://th2pulse:4319` | | `PULSE_QUERY_TOKEN` | Same value as the store's query token | Both are read **server-side** by the route handlers and never reach the browser. Unset, the interface falls back to its own loopback where nothing listens, and the screen reports an unreachable store. ## Check Run an agent, then open **Logging**. The run appears within a few seconds. An empty screen with no error usually means the collector is exporting to the wrong address — check its logs before suspecting the backend. # Orchestrator Source: https://docs.apowerb.com/configuration/orchestration Scheduled pipelines, served by th2etl. Without it, the **Orchestrator** screen has nothing to list and says so — it does not call an address where nothing answers. ## Variables | Variable | Required | Description | | - | - | - | | `ORCHESTRATOR` | yes | `th2etl`. Unset means `mage`, the older backend | | `TH2ETL_BASE_URL` | yes | The instance — `http://th2etl:8000` inside a Compose network | | `TH2ETL_API_KEY` | yes | Must equal that instance's own `API_KEY` | > [!WARNING] > > Silence selects `mage`. A deployment meant to run on th2etl must say so > explicitly, or the schedules land where nobody is looking. ## Running th2etl The instance needs the same database as apowerb and the same `ENCRYPT_KEY`, so that credentials written by one are readable by the other: | Variable | Description | | - | - | | `DATABASE_HOST` / `_PORT` / `_NAME` / `_USER` / `_PASSWORD` | The apowerb database | | `API_KEY` | The key the backend presents — generate with `openssl rand -hex 32` | | `ADK_BASE_URL` | The apowerb backend, so a pipeline can call an agent | | `ENCRYPT_KEY` | Identical to apowerb's | Both the Compose stack and the Helm chart ship it; see [Docker Compose](/deployment/dockercompose) and [Helm chart](/deployment/helmchart). ## The seed Default pipelines are posted by a one-shot command, `python -m th2etl.seeds.default_pipelines`. It is **idempotent** — running it again does not duplicate anything — and it must be run as a task that ends: in Kubernetes it is a `Job`, in Compose a service with `restart: "no"`. As a long-running service it would exit 0 and be restarted forever. > [!NOTE] > > Image tags do not travel between namespaces. `apowerb/th2etl:0.0.11` and > `th2farid/th2etl:0.0.11` are different images with different digests. Compare > digests, not version numbers. ## Check ```bash theme={null} curl -H "Authorization: Bearer " https://your-host/api/pipelines ``` A `200` with a list means the whole chain works. A `503` carrying `{"code": "NOT_CONFIGURED"}` means the backend knows it has no orchestrator — that is the checklist talking, not a failure. # File storage Source: https://docs.apowerb.com/configuration/storage Where uploaded files go: a local directory by default, S3 once configured. This is the one capability that is **optional**: uploads work with nothing configured. The checklist reports `mode: "local"` and lists the S3 variables as missing — information, not a fault. ## Local directory (default) Files land under the runtime root: | Directory | Variable | Holds | | - | - | - | | `bi_store` | `BI_STORE_DIR` | CSV and Excel files imported into BI | | `uploads` | `UPLOADS_DIR` | files attached to an agent or a chat session | | `artifacts_store` | `ARTIFACTS_STORE_DIR` | artifacts produced by runs | All three are resolved against `RUNTIME_ROOT` when they are relative — a single setting moves everything the server writes to disk. > [!WARNING] > > A local directory lives inside the container. Without a mounted volume, an > imported CSV disappears at the next restart — and so does the dashboard that > reads it. On Docker Compose, mount a volume; on Kubernetes, the chart's > `persistence.enabled` claims one and points `RUNTIME_ROOT` at it. See > [Helm chart](/deployment/helmchart). ## S3, or any S3-compatible storage | Variable | Description | | - | - | | `STORAGE_MODE` | Set to `S3` | | `S3_BUCKET_NAME` | Bucket | | `S3_ENDPOINT` | Endpoint URL — required for a non-AWS provider | | `S3_REGION` | Region | | `S3_ACCESS_KEY` / `S3_ACCESS_KEY_SECRET` | Credentials | The capability flips to `mode: "s3"` only when **all six** are set: a bucket without credentials would fail on the first upload, which is exactly the failure this checklist exists to prevent. S3 keys keep their own namespace (`uploads/{agent}/{file}`); `RUNTIME_ROOT` and the directory settings do not affect them. ## Check Import a CSV under **BI → Data**. In local mode the file appears under `bi_store`; in S3 mode it appears in the bucket, and the banner about the local directory disappears from the screen. # Contributing Source: https://docs.apowerb.com/contributing/contributing How to propose a change. Contributions go through pull requests on the relevant repository. The core is [`apowerb/apowerb`](https://github.com/apowerb/apowerb); documentation lives in [`apowerb/apowerb-docs`](https://github.com/apowerb/apowerb-docs). ## Before you open a pull request **1. Open an issue first for anything non-trivial** A bug report with a reproduction, or a short design note for a feature. It is cheaper to disagree about the approach before the code exists. **2. Keep the change scoped** One concern per pull request. Refactors that ride along with a fix make both harder to review and to revert. **3. Write the test with the change** A bug fix comes with a test that fails before it and passes after. **4. Run the checks the CI will run** The core ([`apowerb/apowerb`](https://github.com/apowerb/apowerb)): ```bash theme={null} ruff check . ruff format . DB_SCHEMA="" uv run pytest -q -m "not integration" ``` This documentation site ([`apowerb/apowerb-docs`](https://github.com/apowerb/apowerb-docs)): ```bash theme={null} mint validate mint broken-links ``` ## Conventions * **Everything in the codebase is written in English** — code, comments, commit messages, pull request descriptions, documentation. * Branches are named `/`, matching the commit type: `fix/sync-engines-pre-ping`, `docs/kubernetes-step-by-step`. * Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/). The types in use are `feat`, `fix`, `docs`, `chore`, `test`, `refactor`, `perf`, `ci` and `style`; append `!` for a breaking change. Subjects describe the behaviour that now holds rather than the edit that was made. * Python is type-annotated; new modules should pass `ruff` without exemptions. Each repository states its own specifics in a `CONTRIBUTING.md` at its root: [the core](https://github.com/apowerb/apowerb/blob/main/CONTRIBUTING.md), [this site](https://github.com/apowerb/apowerb-docs/blob/main/CONTRIBUTING.md). ## Reporting a security issue Do not open a public issue or a pull request for a vulnerability. Submit a private report through [GitHub Security Advisories](https://github.com/apowerb/apowerb/security/advisories/new), which keeps it confidential until a fix ships. The full policy is in [SECURITY.md](https://github.com/apowerb/apowerb/blob/main/SECURITY.md). # Development setup Source: https://docs.apowerb.com/contributing/development Running the core locally with tests and linting. ```bash theme={null} git clone https://github.com/apowerb/apowerb.git cd apowerb pip install uv uv venv && source .venv/bin/activate uv sync --group dev cp .env.example .env ``` Fill in at least the `DB_*` variables and `ENCRYPT_KEY`, then: ```bash theme={null} uv run uvicorn apowerb.main:app --reload ``` ## Tests and linting ```bash theme={null} pytest ruff check . ruff format . ``` Hooks are configured in `.pre-commit-config.yaml`: ```bash theme={null} pre-commit install ``` ## Documentation The documentation site lives in `apowerb-docs`. From a clone of it: ```bash theme={null} npm i -g mint mint dev ``` It serves on `http://localhost:3000` and reloads on save. # Release process Source: https://docs.apowerb.com/contributing/releases How the Python package and the TypeScript SDK are published. ## Python — PyPI `apowerb` is published to [PyPI](https://pypi.org/project/apowerb/) from GitHub Actions using **trusted publishing** (OIDC): the workflow authenticates as the repository itself, so no long-lived API token is stored in the project. The workflow lives in `.github/workflows/pypi-publish.yml` and runs on a release. ## npm — the TypeScript SDK The SDK is published from GitHub Actions with npm **trusted publishing**, and the resulting package carries a provenance attestation naming the repository, the workflow, the tag and the runner. > [!WARNING] > > Two things are easy to get wrong here: > > * npm refuses to declare a trusted publisher for a package that **does not exist > yet**. The very first publish has to happen another way; only then can trusted > publishing be configured. PyPI does not have this constraint. > * `--provenance` does not work from a local machine. Provenance requires a hosted CI > runner. ## Documentation — before the deployment, not after The hosting platform deploys this repository on its own, and `docs-live` checks that it actually did: after every push to `main`, it looks for a word the commit just wrote **on the served page**. It tests the result, not the mechanism. > [!NOTE] > > Triggering the deployment from CI was the first design, and it does not work > here: the platform's update API answers > `401 {"error":"Please upgrade to access this route."}` on this plan. Checking > the outcome turned out to be the better question anyway — it stays true > whatever the plan, and it catches a deployment that silently did not happen. Two guards keep the site from drifting behind what is actually deployed: **1. apowerb-hosting refuses a change its documentation contradicts** `docs-in-sync` reads `helm/apowerb-chart/Chart.yaml` and compares its name, version and path with every OCI address and `--version` written in these pages. A pull request that moves the chart fails until the matching docs pull request exists — an **open** one is enough, it does not have to be merged first. **2. This repository proves the site caught up** `docs-live` picks a word each changed page gained, then polls the live page for up to ten minutes. A merge is not a publication, and a publication that never lands has to be visible. When it fails, look at the platform's project log first: an invalid page stops the deployment, and that is the most common cause here — it is exactly what happened on 8 September, when a `` closed too early made `mint validate` fail and three merges never went live. > [!WARNING] > > On 8 September 2026 this site served, for an hour after the chart had moved > to `apowerb/apowerb-chart` 0.4.1, the command it used to carry: > > `helm install apowerb oci://registry-1.docker.io/apowerb/apowerb --version 0.2.0` > > The reason it went unnoticed is worth remembering: **the stale command still > worked**. The old chart is still pullable, so a reader got a silent, > successful install of the stack from before th2etl, th2pulse, the persistent > volume and 27 environment variables. No error, no red build, nothing to > notice. That is what these guards exist to make impossible. ## Versioning Versions follow [semantic versioning](https://semver.org/). The changelog is the GitHub releases page of each repository. # Azure App Service Source: https://docs.apowerb.com/deployment/azure-app-service Deploy apowerb on Azure from the portal: a managed PostgreSQL server, and one Web App that runs the interface and the API side by side. This page deploys the full apowerb application on Azure, from the portal: * an **Azure Database for PostgreSQL flexible server** holds the data; * one **Web App** runs two containers: the interface (`apowerb-ui`) as the main container, which receives the traffic, and the API (`apowerb`) as a **sidecar** next to it. ```text theme={null} Browser ──HTTPS──▶ Web App ┬─ main apowerb/apowerb-ui:0.1.35 port 3000 └─ sidecar apowerb/apowerb:0.2.57 port 8000 │ (localhost only) ▼ Azure Database for PostgreSQL flexible server ``` The interface reaches the API over `localhost` and proxies every `/api` call. The API therefore has **no public address**, which keeps the same layout as the [Docker Compose stack](/deployment/dockercompose). Every step below was run end to end on **8 October 2026** on a new Azure free account, in the France Central region, with the portal in English and Azure CLI 2.91.0: sign-up, sign-in, an agent created, then read back from the database. > [!NOTE] > > Older guides use the App Service **Docker Compose** (multi-container) mode. > Microsoft's quickstart for that mode now redirects to the > [sidecar tutorial](https://learn.microsoft.com/en-us/azure/app-service/tutorial-custom-container-sidecar). > This page uses sidecars. ## Start with free credits New Azure customers can open an [Azure free account](https://azure.microsoft.com/en-us/free/): * **\$200 of credit** to use on Azure services within **30 days**. The French page shows the same amount in US dollars, not in euros. * To sign up you need a phone number, a non-prepaid credit or debit card, and a Microsoft or GitHub account. Azure places a temporary \$1 authorization on the card. * After 30 days, Azure asks whether you want to move to pay-as-you-go pricing. If you don't, your account and services are disabled. * App Service also has a **Free (F1)** tier: up to 10 web or API apps with 1 GB of storage and 1 hour of compute per day. It is a shared tier with no scale-out. This guide was tested on **Basic B1**, not on F1. * Full-time university students can use [Azure for Students](https://azure.microsoft.com/en-us/free/students/) instead: \$100 of credit for 12 months, no credit card required. Checked on 2 October 2026 on [azure.microsoft.com/free](https://azure.microsoft.com/en-us/free/) and the [App Service plans overview](https://learn.microsoft.com/en-us/azure/app-service/overview-hosting-plans). Offers change: check the linked pages before you sign up. ## What it costs Estimates shown by the portal on 8 October 2026, in France Central: | Resource | Size | Estimate | | - | - | - | | App Service plan | Basic B1 (1 vCPU, 1.75 GB) | 13.14 USD/month | | PostgreSQL flexible server | Burstable B1ms (1 vCore, 2 GiB) | 13.50 USD/month | | PostgreSQL storage | 32 GiB, Premium SSD | 4.06 USD/month | On a free account, the portal marks the B1ms compute **"Free up to 750 hours"** and the storage **"Free up to 32 GB"**. The \$200 credit covers the rest of a test comfortably. > [!WARNING] > > The PostgreSQL form does **not** start on these sizes. Its defaults are > *Production*, General Purpose **D4ds\_v5**, 128 GiB and **high availability > enabled**: about **609 to 635 USD/month**. [Step 2](#2-create-the-postgresql-server) > shows the three changes that bring it down. ## Before you start Choose the names and prepare two secrets. Keep them in a password manager, not in a file you commit. | Value | Example | Rule | | - | - | - | | Resource group | `rg-apowerb` | Groups everything, and deletes everything at the end | | PostgreSQL server | `pg-apowerb-7f3a` | Globally unique: add a suffix of your own | | Web App | `apowerb-7f3a` | Same | | PostgreSQL admin login | `apowerbadmin` | Letters and digits, must not start with `pg_` | | PostgreSQL password | — | 8 to 128 characters, mixing upper case, lower case, digits and symbols | | `ENCRYPT_KEY` | — | `openssl rand -base64 32` | `ENCRYPT_KEY` encrypts the credentials of the integrations you connect later. **Back it up**: if it is lost or changed, those credentials can no longer be read. ## 1. Register the resource providers On the new subscription used for this guide, the two resource providers needed here were **not registered**. Register them once, from [Azure Cloud Shell](https://shell.azure.com) or a terminal where `az login` has run: ```bash theme={null} az provider register -n Microsoft.Web --wait az provider register -n Microsoft.DBforPostgreSQL --wait az provider show -n Microsoft.Web --query registrationState -o tsv az provider show -n Microsoft.DBforPostgreSQL --query registrationState -o tsv ``` Both last commands must print `Registered`. ## 2. Create the PostgreSQL server In the portal search bar, type `postgresql flexible` and open **Azure Database for PostgreSQL Flexible Server** under *Marketplace*. **1. Basics: project and server** * **Resource group**: click **Create new** and type `rg-apowerb`. * **Server name**: your unique name, for example `pg-apowerb-7f3a`. * **Region**: the region you will also use for the Web App. * **PostgreSQL version**: **16**, the version the apowerb stack is tested with. The form offers 18 by default. ![PostgreSQL form, resource group field with the Create new dialog open](https://mintcdn.com/thaink2-445e19b2/joECzbNObvq6juN9/images/azure/pg-resource-group.png?fit=max\&auto=format\&n=joECzbNObvq6juN9\&q=85\&s=151a21e5ac5f474b2833764cfe41045b) **2. Basics: size and cost** * **Workload type**: **Dev/Test**. * **Zonal resiliency** (under *High Availability*): **Disabled**. * **Compute + storage**: click **Configure server**, keep **Burstable**, choose **Standard\_B1ms** and keep **32 GiB** of storage, then **Save**. ![Compute + storage page with the Burstable tier and Standard\_B1ms selected](https://mintcdn.com/thaink2-445e19b2/joECzbNObvq6juN9/images/azure/pg-compute.png?fit=max\&auto=format\&n=joECzbNObvq6juN9\&q=85\&s=f7024da1a0550f2c54985a8b92d9f4e2) Back on *Basics*, the summary must read **Burstable, B1ms** and high availability **Disabled**: ![Basics tab showing Burstable B1ms and zonal resiliency disabled](https://mintcdn.com/thaink2-445e19b2/joECzbNObvq6juN9/images/azure/pg-basics-summary.png?fit=max\&auto=format\&n=joECzbNObvq6juN9\&q=85\&s=587c603bdb174e7294312779129013f7) **3. Basics: authentication** * **Authentication method**: **PostgreSQL authentication only**. * **Administrator login**: `apowerbadmin`. * **Password** and **Confirm password**: the password you prepared. **4. Networking** * Keep **Public access (allowed IP addresses)**. * Tick **Allow public access from any Azure service within Azure to this server**. This is what lets the Web App reach the database. * Do **not** add the `0.0.0.0 - 255.255.255.255` rule: it opens the database to the whole internet. ![Networking tab with the Allow public access from any Azure service checkbox highlighted](https://mintcdn.com/thaink2-445e19b2/joECzbNObvq6juN9/images/azure/pg-networking.png?fit=max\&auto=format\&n=joECzbNObvq6juN9\&q=85\&s=e356f3169dda612417d2c30e28f406e8) **5. Create** Click **Review + create**, check the estimate, then **Create**. The server takes several minutes to deploy. ## 3. Create the `th2agent` database The server comes with a `postgres` database only. apowerb expects a database of its own. In the portal, open the server once its status is **Ready**, then **Settings** › **Databases** › **+ Add**. Type `th2agent` in **Name**, keep the default character set and collation, and click **Save**. The database appears in the list a few seconds later. Or in Cloud Shell: ```bash theme={null} az postgres flexible-server db create \ -g rg-apowerb -s pg-apowerb-7f3a -n th2agent az postgres flexible-server db list \ -g rg-apowerb -s pg-apowerb-7f3a --query "[].name" -o tsv ``` The list must contain `th2agent`. > [!NOTE] > > `az postgres flexible-server create --database-name th2agent` is refused by > Azure CLI 2.91: the option now only applies to elastic clusters. Create the > database with the separate command above. ## 4. Create the Web App In the portal, **Create a resource** › **Web App**. **1. Basics** | Field | Value | | - | - | | Resource group | `rg-apowerb` | | Name | your unique name, for example `apowerb-7f3a` | | Publish | **Container** | | Operating System | **Linux** | | Region | the region of the database | | Linux Plan | **Create new**, for example `plan-apowerb` | | Pricing plan | **Basic B1** | **2. Container: the interface** | Field | Value | | - | - | | Sidecar support | **on** (*Enhanced configuration with sidecar support*) | | Image Source | **Other container registries** | | Name | `main` (keep it) | | Access Type | **Public** | | Registry server URL | `https://index.docker.io` | | Image and tag | `apowerb/apowerb-ui:0.1.35` | | Port | `3000` | The image and its tag go in **one field**. Without `:0.1.35` you get `latest`, and the interface and the API are only guaranteed to work together at the pinned pair. The form proposes port **80**: replace it with `3000`, or App Service probes a port where nothing listens. ![Container tab with sidecar support on, Docker Hub image apowerb/apowerb-ui:0.1.35 and port 3000](https://mintcdn.com/thaink2-445e19b2/joECzbNObvq6juN9/images/azure/webapp-container.png?fit=max\&auto=format\&n=joECzbNObvq6juN9\&q=85\&s=ad62b1f6de668be102d51c8fb103ffbb) **3. Monitor + secure** **Enable Application Insights**: **No**. It is not needed for this setup and it costs credit. **4. Create** Click **Review + create**, check that the summary shows **Basic B1** and `apowerb/apowerb-ui:0.1.35` on port `3000`, then **Create**. **5. Note the default domain** Open the Web App, **Overview**, and copy **Default domain**. Azure adds a suffix to the name, for example `apowerb-7f3a-abc123def456ghij.francecentral-01.azurewebsites.net`: the address is **not** simply `.azurewebsites.net`. You need the exact value in the next step. ## 5. Set the environment variables In the Web App, **Settings** › **Environment variables** › **App settings**. App settings are shared by every container of the app, the sidecar included. | Name | Value | | - | - | | `API_URL` | `http://localhost:8000` | | `DB_HOST` | `pg-apowerb-7f3a.postgres.database.azure.com` | | `DB_PORT` | `5432` | | `DB_NAME` | `th2agent` | | `DB_USER` | `apowerbadmin` | | `DB_SSLMODE` | `require` | | `APP_PUBLIC_URL` | `https://` followed by the default domain from step 4 | | `DB_PASSWORD` | the PostgreSQL password | | `ENCRYPT_KEY` | the key you generated | Add each one with **+ Add**. The **Value** field of that panel is masked, which is what you want for `DB_PASSWORD` and `ENCRYPT_KEY`. ![Add/Edit application setting panel with Name and a masked Value field](https://mintcdn.com/thaink2-445e19b2/joECzbNObvq6juN9/images/azure/app-setting-add.png?fit=max\&auto=format\&n=joECzbNObvq6juN9\&q=85\&s=2d1065f2f1d4fd559209bb62faef6fe4) > [!WARNING] > > **Advanced edit** shows every value in clear text, secrets included. Use it for > the non-secret settings only, and never share a screenshot of it. Click **Apply** at the bottom of the page, then **Confirm**: the app restarts. Azure also adds `WEBSITES_ENABLE_APP_SERVICE_STORAGE` on its own; leave it. ## 6. Add the API as a sidecar In the Web App, **Deployment** › **Deployment Center** › **Containers** › **+ Add** › **Custom container**. | Field | Value | | - | - | | Name | `apowerb` | | Image source | **Other container registries** | | Image type | **Public** | | Registry server URL | `https://index.docker.io` | | Image and tag | `apowerb/apowerb:0.2.57` | | Port | `8000` | | Allow access to all app settings | **ticked** | ![Add container panel with registry, image, port and the Allow access to all app settings checkbox highlighted](https://mintcdn.com/thaink2-445e19b2/joECzbNObvq6juN9/images/azure/sidecar-add.png?fit=max\&auto=format\&n=joECzbNObvq6juN9\&q=85\&s=ef819291b17b85e7d387954ad49a9b69) Click **Apply**. The list now shows two containers: `main` (*Main*) and `apowerb` (*Sidecar*). The first start takes a few minutes: the API image is about 250 MB, and it creates its tables on first boot. ## 7. Check the deployment A page that answers `200` only proves that the interface is up. Check the API through the interface, then the real path. ```bash theme={null} APP=https:// curl -s -o /dev/null -w '%{http_code}\n' $APP/ # 200: the interface answers curl -s -o /dev/null -w '%{http_code}\n' $APP/api/agents # 401: the API answers and asks you to sign in ``` * `502` on `/api/agents`: the API is not reachable yet. It is either still starting (wait two or three minutes, especially after a settings change) or it failed to start: check the variables of step 5. * `404` on `/api/health` is normal: the API health route is not published through the interface. Then open the address in a browser: 1. **Create Account** with an e-mail and a password. You are signed in and land on the dashboard, which shows no agent yet. 2. Click **Create starter agent**. apowerb opens **Agent Factory**, and a `starter_agent_…` is listed: the API is writing to the database. 3. **Reload** the page. The agent must still be listed. ## Clean up Everything lives in one resource group. To stop all charges, delete it: ```bash theme={null} az group delete -n rg-apowerb --yes ``` In the portal: **Resource groups** › `rg-apowerb` › **Delete resource group**. The database, its data and the accounts created in the app are deleted with it. ## Troubleshooting | Symptom | Cause | Fix | | - | - | - | | The PostgreSQL estimate shows more than 600 USD/month | The form defaults: Production, D4ds\_v5, high availability | Dev/Test, zonal resiliency **Disabled**, **Burstable B1ms** ([step 2](#2-create-the-postgresql-server)) | | `The --database-name argument can only be used when --node-count is present` | Azure CLI 2.91 | Create the database with `db create` ([step 3](#3-create-the-th2agent-database)) | | The app shows a default Azure page, or never starts | Port `80` kept, or no tag on the image | Port `3000`, image `apowerb/apowerb-ui:0.1.35` | | `/api/agents` answers `502` for a few minutes after a change | Both containers restart after every settings change | Wait, then check again | | The API cannot reach the database | The Azure services rule is missing, or a `DB_*` value is wrong | Tick **Allow public access from any Azure service**; check `DB_HOST`, `DB_USER`, `DB_SSLMODE=require` | | Links built by the app point to the wrong address | `APP_PUBLIC_URL` was set to `.azurewebsites.net` | Use the exact **Default domain**, suffix included | ## Not covered by this page * **A language model.** Agents can be created, but not run, until you set `DEFAULT_LLM_MODEL`, `DEFAULT_LLM_API_KEY` and, if needed, `DEFAULT_LLM_API_BASE`. * **Workflows.** They rely on the `th2etl` service, which this setup does not deploy. * **Uploaded files.** No volume is mounted on `/app/data`: files stored there are lost when the containers restart. Agents themselves are stored in PostgreSQL and survive. * **Logs and traces** (`th2pulse`, OpenTelemetry collector), a custom domain, and the **Free (F1)** tier were not tested. Checked on 8 October 2026. Portal labels change: if one differs, the field it names is still the one to set. # DigitalOcean Source: https://docs.apowerb.com/deployment/digitalocean Deploy apowerb to DigitalOcean App Platform. ## Start with free credits New DigitalOcean accounts get a [signup credit](https://docs.digitalocean.com/platform/billing/signup-credit/): * **\$5 of credit**, applied automatically when you create your first team. No promo code is needed. * It expires **90 days** after signup and applies to all products except SaaS Add-Ons, so it covers App Platform. * You must add a valid payment method before you can create any resource. * The official pages checked list no standing offer above \$5. Larger amounts, when they exist, come from promo codes or campaigns. Checked on 2 October 2026 on the [signup credit page](https://docs.digitalocean.com/platform/billing/signup-credit/) (last verified by DigitalOcean on 15 July 2026). Offers change: check the linked page before you sign up. ## Deploy No procedure for this platform has been tested yet. What any deployment needs, taken from the [Docker Compose](/deployment/dockercompose) stack: * the published images [`apowerb/apowerb`](https://hub.docker.com/r/apowerb/apowerb) (API, port `8000`) and [`apowerb/apowerb-ui`](https://hub.docker.com/r/apowerb/apowerb-ui) (interface, port `3000`), at the tags pinned together in [`docker-compose/docker-compose.yml`](https://github.com/apowerb/apowerb-hosting/blob/main/docker-compose/docker-compose.yml); nothing has to be built; * a PostgreSQL database, passed to the API as `DB_HOST`, `DB_PORT`, `DB_NAME`, `DB_USER`, `DB_PASSWORD`; * `ENCRYPT_KEY`, a Fernet key: `openssl rand -base64 32 | tr '+/' '-_'`; * `API_URL` on the interface, set to the API's internal address. For a managed platform that runs a Compose file, the [Hostman](/deployment/hostman) page is the closest tested reference. # Docker Compose Source: https://docs.apowerb.com/deployment/dockercompose Install the API, the interface and PostgreSQL on one machine, in four commands. Count about 15 minutes, most of it downloading the images (about 3 GB). ## Requirements * Linux, macOS or Windows (WSL 2), `linux/amd64` or `linux/arm64` * Docker Engine with Compose v2: `docker compose version` must answer * 4 GB of free disk space * Ports `3000` and `8000` free ## 1. Download and configure ```bash theme={null} git clone https://github.com/apowerb/apowerb-hosting.git cd apowerb-hosting cp .env.example .env ./scripts/generate-secrets.sh ``` The script fills the database password, the encryption key and the service tokens with random values, and never overwrites a value already set. Keep `.env` safe: losing `ENCRYPT_KEY` makes every connected integration unreadable. ## 2. Name the first administrator Open `.env` and set: ```bash theme={null} DEFAULT_SUPERADMIN_EMAIL=you@example.com ``` Whoever signs up with this address becomes an administrator, with their own password. Without it, a new installation has no administrator at all. Optional, a model shared by every agent (otherwise each agent needs its own API key): ```bash theme={null} DEFAULT_LLM_MODEL= DEFAULT_LLM_API_KEY= ``` ## 3. Start ```bash theme={null} docker compose -f docker-compose/docker-compose.yml --env-file .env up -d ``` > [!WARNING] > > Always name the file. The `docker-compose.yml` at the root of the repository > is the [Hostman](/deployment/hostman) file: it has no PostgreSQL and stops on > `set DB_HOST`. ## 4. Check and sign up ```bash theme={null} docker compose -f docker-compose/docker-compose.yml --env-file .env ps curl -s http://localhost:8000/health ./scripts/check-deployment.sh http://localhost:3000 ``` Expected: three services running (`postgres` healthy), `{"status":"ok"}`, and every check `ok`. Then open [http://localhost:3000](http://localhost:3000) and sign up with the administrator e-mail from step 2. For HTTPS on a server, continue with [Single VM / HTTPS](/deployment/virtual-machine). ## Everyday commands Run from the `apowerb-hosting` folder. | Task | Command | | - | - | | Follow the API logs | `docker compose -f docker-compose/docker-compose.yml --env-file .env logs -f apowerb` | | Stop, keep the data | `docker compose -f docker-compose/docker-compose.yml --env-file .env down` | | Update to the latest tested pair | `git pull`, then the step 3 command again | | Back up the database | `docker compose -f docker-compose/docker-compose.yml --env-file .env exec -T postgres sh -c 'pg_dump -U "$POSTGRES_USER" "$POSTGRES_DB"' > backup.sql` | | Uninstall and erase all data | `docker compose -f docker-compose/docker-compose.yml --env-file .env down -v` | The images are pinned to an API and interface pair tested together. To change versions by hand, set `APOWERB_BACKEND_TAG` and `APOWERB_FRONTEND_TAG` in `.env`, always both: each one caps the other. ## Optional services Each one needs two lines in `.env`, then the step 3 command again. Profiles combine with a comma: `COMPOSE_PROFILES=pulse,etl`. | Service | Lines to add in `.env` | | - | - | | Logs and agent traces | `COMPOSE_PROFILES=pulse` and `OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318` | | Scheduled agent runs | `COMPOSE_PROFILES=etl` and `ORCHESTRATOR=th2etl` | | Forecasting | `COMPOSE_PROFILES=forecast` and `TH2FORECAST_URL=http://th2forecast:8000` | ## Troubleshooting | Symptom | Fix | | - | - | | `port is already allocated` on 3000 or 8000 | Prefix the step 3 command with `FRONT_PORT=3010 TH2AGENT_PORT=8010` | | `set DB_HOST` at start | You ran the root file: add `-f docker-compose/docker-compose.yml` | | No model in the agent list | Add a key on the agent, or set both `DEFAULT_LLM_MODEL` and `DEFAULT_LLM_API_KEY`, then restart | | Signed up but not administrator | `DEFAULT_SUPERADMIN_EMAIL` was empty at sign-up: set it, then restart the stack | ## Images The compose file pulls published images from Docker Hub, nothing is built: [`apowerb/apowerb`](https://hub.docker.com/r/apowerb/apowerb) (API) and [`apowerb/apowerb-ui`](https://hub.docker.com/r/apowerb/apowerb-ui) (interface). The full end-to-end test, account creation and an agent run included, is in [`docker-compose/TESTING.md`](https://github.com/apowerb/apowerb-hosting/blob/main/docker-compose/TESTING.md). # Google Cloud Run Source: https://docs.apowerb.com/deployment/google-cloud-run Deploy apowerb to Google Cloud Run. ## Before you deploy: account, project, billing and API Cloud Run needs a Google Cloud project with billing enabled. Do this once, in the [Google Cloud console](https://console.cloud.google.com/). 1. **Sign in.** Open [console.cloud.google.com](https://console.cloud.google.com/) and sign in with your Google account. If you are new to Google Cloud, create a Google Cloud account when prompted. 2. **Create or select a project.** Open the [project selector](https://console.cloud.google.com/projectselector2/home/dashboard). To create one, open the [Manage resources](https://console.cloud.google.com/cloud-resource-manager) page, click **Create Project**, fill in **Project name** (4 to 30 characters), then click **Create**. Keep the project selected in the drop-down at the top of the console for the next steps. 3. **Check or link billing.** Open the navigation menu (☰) and select **Billing**. If billing is active, the billing **Overview** page opens. If the console says **This project has no billing account**, click **Link a billing account** and choose an active billing account. 4. **Enable the Cloud Run Admin API.** Open the [Cloud Run Admin API](https://console.cloud.google.com/apis/library/run.googleapis.com) page of the API Library, check that your project is selected, then click **Enable**. If you push your image to Artifact Registry, enable the [Artifact Registry API](https://console.cloud.google.com/apis/library/artifactregistry.googleapis.com) the same way. 5. **Check your roles.** To deploy, your account needs **Cloud Run Admin** (`roles/run.admin`) and **Service Account User** (`roles/iam.serviceAccountUser`) on the project. The same steps with the `gcloud` CLI: ```bash theme={null} gcloud auth login gcloud projects create # or reuse an existing project gcloud config set project gcloud billing projects link --billing-account= gcloud services enable run.googleapis.com artifactregistry.googleapis.com ``` Sources: Google Cloud documentation, [Cloud Run quickstart](https://docs.cloud.google.com/run/docs/quickstarts/deploy-container), [creating projects](https://docs.cloud.google.com/resource-manager/docs/creating-managing-projects), [verifying billing](https://docs.cloud.google.com/billing/docs/how-to/verify-billing-enabled), [enabling APIs](https://docs.cloud.google.com/apis/docs/getting-started), all last updated on 30 September 2026. Console labels can change; if one differs, the linked page has the current wording. ## Deploy No procedure for this platform has been tested yet. What any deployment needs, taken from the [Docker Compose](/deployment/dockercompose) stack: * the published images [`apowerb/apowerb`](https://hub.docker.com/r/apowerb/apowerb) (API, port `8000`) and [`apowerb/apowerb-ui`](https://hub.docker.com/r/apowerb/apowerb-ui) (interface, port `3000`), at the tags pinned together in [`docker-compose/docker-compose.yml`](https://github.com/apowerb/apowerb-hosting/blob/main/docker-compose/docker-compose.yml); nothing has to be built; * a PostgreSQL database, passed to the API as `DB_HOST`, `DB_PORT`, `DB_NAME`, `DB_USER`, `DB_PASSWORD`; * `ENCRYPT_KEY`, a Fernet key: `openssl rand -base64 32 | tr '+/' '-_'`; * `API_URL` on the interface, set to the API's internal address. For a managed platform that runs a Compose file, the [Hostman](/deployment/hostman) page is the closest tested reference. # Helm Chart Source: https://docs.apowerb.com/deployment/helmchart Installing apowerb and the services around it on a prepared cluster with the Helm chart — and the traps, with their remedies. [![apowerb-chart on Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/apowerb)](https://artifacthub.io/packages/helm/apowerb/apowerb-chart) The chart is listed on [Artifact Hub](https://artifacthub.io/packages/helm/apowerb/apowerb-chart), with its values schema, its versions and its cosign signature. The chart deploys the backend, the interface and PostgreSQL, plus the three services the Compose stack runs — each behind a switch — and a volume for what the backend writes to disk. | Component | Default | Switch | | - | - | - | | backend, interface, PostgreSQL | on | — | | `th2etl` + its seed `Job` | on | `th2etl.enabled` | | `th2pulse` (log store) | on | `th2pulse.enabled` | | OpenTelemetry collector | on | `otelCollector.enabled` | | `PersistentVolumeClaim` on `/data` | on | `persistence.enabled` | | `th2forecast` (forecasting engine) | off | `th2forecast.enabled`, with `th2forecast.apiToken` required | ## Before you start The cluster must be ready first — a default storage class, an ingress controller and a certificate issuer. The [Kubernetes page](/deployment/kubernetes) prepares it with `kubectl` and plain manifests; come back here once its checks pass. You also need `helm` 3.8 or later, for OCI registry support. ## 1. Secrets Five values. Four of them are mandatory — the chart refuses to install without `postgres.password` and `backend.env.encryptKey` (no default, on purpose) and the two th2pulse tokens, because the backend and th2pulse do not start without them. ```bash theme={null} umask 077 cat > values-secrets.yaml < [!WARNING] > > Keep this file, out of version control, and pass it to **every** later > `helm upgrade`. Without it the Secret is rewritten with empty strings — and > a changed `ENCRYPT_KEY` makes every connected integration unreadable, since > it is the key their OAuth tokens were encrypted with. See > [Trap 2](#trap-2-an-upgrade-that-empties-the-secret). ## 2. Install Start without an Ingress: fewer moving parts, and a public name is not needed to know whether the stack runs. ```bash theme={null} helm upgrade --install apowerb \ oci://registry-1.docker.io/apowerb/apowerb-chart \ --namespace apowerb --create-namespace \ --values values-secrets.yaml --timeout 10m helm -n apowerb list ``` No `--version`: Helm installs the newest chart published on Docker Hub, so this page never lags behind a release. `helm -n apowerb list` shows the version you got; pass it as `--version` to any later command that must stay on it. Pulling the images takes a few minutes on a fresh cluster — the backend image alone is around 250 MB. From `0.4.22` the published chart is signed with cosign, keyless, by the publishing workflow. To check that a chart comes from `apowerb/apowerb-hosting`: ```bash theme={null} cosign verify registry-1.docker.io/apowerb/apowerb-chart:0.4.24 \ --certificate-oidc-issuer https://token.actions.githubusercontent.com \ --certificate-identity-regexp '^https://github.com/apowerb/apowerb-hosting/\.github/workflows/publish-dockerhub-helm\.yml@' ``` > [!NOTE] > > The chart moved to its own Docker Hub repository. It used to be pushed to > `apowerb/apowerb`, alongside the backend **images** — a repository cannot be > subdivided there, and `helm push` names it after the chart. Versions `0.2.0` > and `0.4.0` stay where they were published; nothing was deleted. Anything > > from `0.4.1` on lives at `apowerb/apowerb-chart`. > [!NOTE] > > First real install: OVH Managed Kubernetes (3 nodes, Cinder ext4 volumes) on > 29/09/26. It found two blockers — PostgreSQL failing on the volume's > `lost+found`, and upgrades stuck on `Multi-Attach` — both fixed in `0.4.21`. ## 3. Check what actually runs ```bash theme={null} kubectl -n apowerb get pods kubectl -n apowerb get pvc kubectl -n apowerb logs job/apowerb-th2etl-seed ``` What a healthy install looks like: * **six pods `Running`**: backend, frontend, postgres, th2etl, th2pulse, otel-collector; * **`apowerb-th2etl-seed` `Completed`** — it is a `Job`, so `0/1 Completed` is the success state, not a failure; * **two PVCs `Bound`**: the data volume and the database's. A couple of restarts on `th2etl` and `th2pulse` at first start are expected — [Trap 1](#trap-1-th2etl-and-th2pulse-restart-twice). Then reach the services: ```bash theme={null} kubectl -n apowerb port-forward svc/apowerb-backend 18000:8000 & kubectl -n apowerb port-forward svc/apowerb-frontend 13000:3000 & curl -s -o /dev/null -w "%{http_code}\n" localhost:18000/health # 200 curl -s localhost:18000/api/config # public flags curl -s -o /dev/null -w "%{http_code}\n" localhost:18000/api/config/setup # 401 curl -s -o /dev/null -w "%{http_code}\n" localhost:13000/ # 200 ``` `401` on `/api/config/setup` is the right answer: authentication comes before the checklist. A `404` there would mean the backend image predates it. These checks go through a port-forward on purpose. The backend is never published directly: once the site is public, the frontend proxies `/api/*` to it, and nothing else reaches it — `/health` included ([Trap 8](#trap-8-health-answers-200-in-the-cluster-and-404-on-the-domain)). > [!WARNING] > > The checklist reports what is **configured**, never what is **reachable**. A capability can > read `configured: true` while the provider refuses every call — see > [Trap 6](#trap-6-the-model-provider-refuses-the-clusters-outbound-address). The only proof > that a model answers is a real run. ## 4. Going public Point an **A record** at the `EXTERNAL-IP` of the ingress controller ([Kubernetes, step 3](/deployment/kubernetes#3-ingress-controller)), wait for it to resolve, then upgrade with the Ingress — with the **staging** issuer first ([Kubernetes, step 4](/deployment/kubernetes#4-cert-manager-and-an-issuer)): ```bash theme={null} helm upgrade --install apowerb \ oci://registry-1.docker.io/apowerb/apowerb-chart \ --namespace apowerb --values values-secrets.yaml \ --set ingress.enabled=true \ --set ingress.className=traefik \ --set ingress.host=apowerb.example.com \ --set ingress.tlsEnabled=true \ --set ingress.annotations."cert-manager\.io/cluster-issuer"=letsencrypt-staging ``` `tlsEnabled` writes the Ingress `tls` section; the secret name is derived (`apowerb-tls`) unless `ingress.tlsSecretName` names one, which is what cert-manager fills from the annotation above. > [!WARNING] > > Left at `false`, the interface is served in clear — and the address > verification links it builds would go out over `http://`. Nothing else to set for the public address: with an Ingress enabled, `publicUrls.appPublicUrl` and `publicUrls.publicBaseUrl` are derived from `ingress.host` and `ingress.tlsEnabled`. That one value feeds nine settings in the core — the CORS origins and the GitHub, Google and Outlook Mail callbacks — so setting them by hand is how they end up disagreeing. Watch the certificate being issued: ```bash theme={null} kubectl -n apowerb get certificate kubectl -n apowerb describe certificate apowerb-tls | tail -20 ``` Stuck at `READY: False`? See [Kubernetes, Trap 3](/deployment/kubernetes#trap-3-a-certificate-stuck-at-ready-false). Once `READY: True` with staging, swap the annotation to `letsencrypt-prod`, delete the staging secret so a real certificate is requested, and check the site in a browser: ```bash theme={null} kubectl -n apowerb delete secret apowerb-tls ``` ### Close port 80 The certificate does not close the clear-text entrance — [Trap 7](#trap-7-https-served-but-http-still-answers). With Traefik, apply the Middleware ([Kubernetes, step 5](/deployment/kubernetes#5-https-redirect-traefik)), then add one annotation: ```bash theme={null} helm upgrade apowerb oci://registry-1.docker.io/apowerb/apowerb-chart \ --namespace apowerb --values values-secrets.yaml --reuse-values \ --set ingress.annotations."traefik\.ingress\.kubernetes\.io/router\.middlewares"=apowerb-redirect-https@kubernetescrd ``` ```bash theme={null} curl -sI http://apowerb.example.com/ | head -2 # 308, Location: https://… ``` With ingress-nginx there is nothing to do: `ssl-redirect` applies as soon as a TLS section exists. Without an Ingress, nothing is exposed outside the cluster: since `0.4.0` the frontend Service is a `ClusterIP` — no provider load balancer, and no public IP billed for it. Set `service.frontend.type=LoadBalancer`, or reach it with `kubectl port-forward`. The install notes say which case you are in. ## 5. The first administrator A fresh database has no administrator, and no route creates one. Two settings do: ```bash theme={null} helm upgrade --install apowerb ... \ --set superadmin.email=admin@example.com \ --set superadmin.password='' ``` An unknown account with a password is **created** as admin; an existing one is **promoted**, and its password is never rewritten. Without a password, an unknown account produces nothing — an account nobody can sign into helps nobody. So on an installation where people register themselves, set `superadmin.email` alone: the person signs up, and the next backend start promotes them. Then sign in and open **Admin → Configuration**: the screen lists every capability this installation has, and the sidebar badge counts what is still missing. That is the shortest path to knowing what is left to configure — see [What needs configuring](/configuration). ## 6. Upgrading and removing ```bash theme={null} helm upgrade apowerb oci://registry-1.docker.io/apowerb/apowerb-chart \ --namespace apowerb --values values-secrets.yaml helm -n apowerb list ``` Without `--version` this moves to the newest published chart; add `--version ` to choose one. **Upgrading an existing install to 0.4.21: check where the database lives first.** Since 0.4.21, PostgreSQL writes to `/var/lib/postgresql/data/pgdata`, a subdirectory of its volume, instead of the volume's root: on ext4 volumes (OVH Cinder and most cloud block disks) the root holds a `lost+found` that made `initdb` fail. An install that already ran — so on a volume without `lost+found` (k3s `local-path`, kind, NFS) — keeps its database at the root. After the upgrade PostgreSQL would find `pgdata/` empty and create a fresh database: the old data stays on the volume, but out of sight. ```bash theme={null} kubectl -n apowerb exec apowerb-postgres-0 -- ls /var/lib/postgresql/data ``` If `PG_VERSION` shows at the root, back up with `pg_dumpall` before upgrading, then restore into the new database. A fresh install is not affected. From 0.4.21 the backend also uses `strategy: Recreate` (its volume is `ReadWriteOnce`): each upgrade stops the old pod before starting the new one, so expect a few seconds of downtime. Uninstalling leaves the data volume behind, on purpose — it carries `helm.sh/resource-policy: keep`: ```bash theme={null} helm -n apowerb uninstall apowerb kubectl -n apowerb get pvc # apowerb-data is still there ``` ## Storage `persistence.enabled` claims one volume, mounts it on `persistence.mountPath` (`/data`) and points `RUNTIME_ROOT` at it. Everything the backend writes lives under it: `bi_store`, `uploads`, `artifacts_store`, `agents_pool`. * Without it, an imported CSV is gone at the next restart of the backend pod, and the dashboard reading it dies with it. `agents_pool` is the exception — it is regenerated from the database. * The claim is `ReadWriteOnce`, so the backend stays at one replica unless the storage class offers `ReadWriteMany`. * It carries `helm.sh/resource-policy: keep`: `helm uninstall` leaves the files behind rather than deleting them with the release. Configuring [S3](/configuration/storage) makes BI files bypass the disk entirely. ## The seed is a Job `th2etl-seed` posts the default pipelines and exits. It runs as a `post-install,post-upgrade` hook and retries while th2etl migrates the database. As a Deployment, Kubernetes would restart a container that exited 0 — a crash loop on a success. ```bash theme={null} kubectl -n apowerb logs job/apowerb-th2etl-seed ``` ## A smaller stack Nothing beyond the product itself is mandatory. The `./helm/apowerb-chart` paths below are relative to a clone of [`apowerb-hosting`](https://github.com/apowerb/apowerb-hosting): ```bash theme={null} helm upgrade --install apowerb ./helm/apowerb-chart \ --set th2etl.enabled=false \ --set th2pulse.enabled=false \ --set otelCollector.enabled=false \ --set backend.env.encryptKey="$(openssl rand -base64 32)" \ --set postgres.password="$(openssl rand -hex 16)" ``` Eight objects instead of sixteen. The interface then reports those features as not configured instead of failing on them — see [What needs configuring](/configuration). ## From a checkout Installing from a clone of the hosting repository takes the same five values. The chart **refuses to install** without four of them: `postgres.password` and `backend.env.encryptKey`, which have no default on purpose — a secret shipped in a public repository is not one — and the two th2pulse tokens. The backend and th2pulse do not start without them. Failing at install time is the honest moment to say it. ```bash theme={null} helm upgrade --install apowerb ./helm/apowerb-chart \ --namespace apowerb --create-namespace \ --set backend.env.encryptKey="$(openssl rand -base64 32)" \ --set th2etl.apiKey="$(openssl rand -hex 32)" \ --set th2pulse.ingestToken="$(openssl rand -hex 32)" \ --set th2pulse.queryToken="$(openssl rand -hex 32)" \ --set postgres.password="$(openssl rand -hex 16)" ``` > [!WARNING] > > Keep those values. A later `helm upgrade` without them rewrites the Secret > with empty strings — and `ENCRYPT_KEY` changing makes every connected > integration unreadable. Put them in a `values-secrets.yaml` kept out of > version control and pass it with `--values`. ## Checks that need no cluster ```bash theme={null} helm lint helm/apowerb-chart helm template rel helm/apowerb-chart \ --set postgres.password=x --set backend.env.encryptKey=x \ --set th2pulse.ingestToken=x --set th2pulse.queryToken=y \ | kubeconform -strict -summary -kubernetes-version 1.30.0 ``` *** ## Traps ### Trap 1: th2etl and th2pulse restart twice **Symptom.** Right after install, both show `RESTARTS 2`, with `Connection refused` on port 5432 in the previous container's logs. **Cause.** They open the database before PostgreSQL accepts connections, exit, and are restarted. Up to chart 0.4.20, nothing waited on the database. **Remedy.** Chart 0.4.21 adds a `wait-for-postgres` init container to the backend, th2etl and th2pulse, which removes these restarts. On an older chart, none needed: Kubernetes recovers, and both reach `Running` within a couple of minutes. Worry only if the count keeps climbing — then read `kubectl -n apowerb logs --previous`, which will name a different cause. ### Trap 2: an upgrade that empties the Secret **Symptom.** After a `helm upgrade`, integrations no longer connect and agents lose their stored credentials. **Cause.** `helm upgrade` without `--values values-secrets.yaml` re-renders the Secret from the chart's defaults — empty strings. `ENCRYPT_KEY` is what the integrations' OAuth tokens were encrypted with; change it and they become unreadable. **Remedy.** Always pass the same values file. Back it up with your other secrets — it is not recoverable from the cluster once overwritten. ### Trap 3: a Service stuck in Pending **Symptom.** `kubectl get svc` shows `EXTERNAL-IP: ` forever. **Cause.** `service.frontend.type=LoadBalancer` on a cluster whose provider gives no load balancer. **Remedy.** The chart defaults to `ClusterIP` for exactly this reason. Reach the interface through the Ingress, or `kubectl port-forward`. ### Trap 4: pulling the chart from the old address **Symptom.** `helm install` succeeds and the stack comes up — without th2etl, th2pulse, the collector, or the data volume. **Cause.** The chart used to be published to `apowerb/apowerb`, next to the backend **images**, and those old versions are still pullable. A stale command line therefore *works*, which is what makes it dangerous: it silently installs the stack as it was several versions ago. **Remedy.** Pull from `apowerb/apowerb-chart`, and check what you got: ```bash theme={null} helm show chart oci://registry-1.docker.io/apowerb/apowerb-chart ``` The `name` must read `apowerb-chart`. ### Trap 5: removing a secret from the values does not remove it from the cluster **Symptom.** You delete a credential from `values-secrets.yaml`, run `helm upgrade`, and the Secret still holds it. **Cause.** The chart writes a credential only when it is non-empty (`{{- if .Values.defaultLlm.apiKey }}`). Dropping it from the values makes the template stop *rendering* the key — and Helm does not delete a key that is simply absent from the new render. Measured on 09/09/26: the shared-model API key was still in `apowerb-secrets`, 53 characters long, after an upgrade that no longer declared it. This is the mirror image of [Trap 2](#trap-2-an-upgrade-that-empties-the-secret), and the more dangerous of the two: there you lose a secret you meant to keep; here you keep a secret you meant to destroy. **Remedy.** Delete the key explicitly, then restart so the pods stop carrying it: ```bash theme={null} kubectl -n apowerb get secret apowerb-secrets \ -o go-template='{{range $k,$v := .data}}{{$k}}{{"\n"}}{{end}}' kubectl -n apowerb patch secret apowerb-secrets --type=json \ -p '[{"op":"remove","path":"/data/DEFAULT_LLM_API_KEY"}]' kubectl -n apowerb rollout restart deploy/apowerb-backend ``` The Deployment keeps referencing the key with `optional: true`, so nothing breaks once it is gone — but check that before deleting a key from any chart that does not. ### Trap 6: the model provider refuses the cluster's outbound address **Symptom.** The interface reports the shared model as **configured**, and every chat fails. The backend log names the provider, not the network: ``` GeminiException BadRequestError 400 FAILED_PRECONDITION "User location is not supported for the API use." ``` **Cause.** The provider geo-blocks the address the cluster leaves from — which is the hosting provider's NAT, not the region you picked. Measured on 09/09/26: the same key worked from one deployment and failed from a Kubernetes cluster **at the same host**, because the two products egress through different networks (`AS214504 Hostman LTD` versus `AS210976 Timeweb`), both geolocated in Germany. **Diagnosis.** Ask the pod, not your laptop — only its address matters: ```bash theme={null} kubectl -n apowerb exec deploy/ -- python -c \ "import urllib.request;print(urllib.request.urlopen('https://api.ipify.org').read())" ``` Then look that address up: the *autonomous system* tells you more than the country. Test the providers themselves the same way — `401` means reachable and merely unauthenticated, a `403` or a `400` mentioning *location* means blocked. > [!NOTE] > > Do not conclude "the key is invalid" from a 400 on Google's API before forcing IPv4: the same > key can answer 200 over IPv4 and 400 over IPv6, and the message is identical to the geo-block. > Check whether the pod even has IPv6 (`Network is unreachable` settles it). **Remedy.** Change provider — the fastest, and the checklist screen will tell users the truth meanwhile — or route the outbound traffic through an accepted address. Note that this affects **every** key: users' own keys hit the same wall, not just the shared one. ### Trap 7: HTTPS served, but HTTP still answers **Symptom.** `https://` works with a valid certificate, and `http://` returns **200** with the same page instead of a redirect. **Cause.** `ingress.tlsEnabled` adds the TLS section; it does not close port 80\. The controller keeps serving the site in clear text. **Remedy.** The Middleware above, or nginx's `ssl-redirect`. Check with `curl -sI http:///` — you want `308`, not `200`. This matters more than it looks: a visitor typing the address without `https://` submits their credentials unencrypted. ### Trap 8: /health answers 200 in the cluster and 404 on the domain **Symptom.** An external uptime monitor pointed at `https:///health` reports the service down, while every pod is `Running` and the site loads in a browser. **Cause.** The Ingress carries a single rule — `/` to the **frontend**. The backend is not published; the frontend proxies `/api/*` to it server-side. So `/api/config` reaches the backend through the domain, while `/health` sits outside `/api` and is answered by the SPA, which returns 404 for a route it does not know. **Remedy.** Nothing to repair — `/health` is the kubelet's liveness probe, and it answers where the probe runs. Verify it as in [step 3](#3-check-what-actually-runs), through a port-forward. For external monitoring, watch the site root (`200`) or `/api/config`, which is public and served by the backend: ```bash theme={null} kubectl -n apowerb port-forward svc/apowerb-backend 18000:8000 & curl -s -o /dev/null -w "%{http_code}\n" localhost:18000/health # 200 curl -s -o /dev/null -w "%{http_code}\n" https:///health # 404, expected curl -s -o /dev/null -w "%{http_code}\n" https:///api/config # 200 ``` # Hostman Source: https://docs.apowerb.com/deployment/hostman Deploy apowerb on Hostman App Platform with a managed PostgreSQL. App Platform reads the `docker-compose.yml` at the root of [`apowerb-hosting`](https://github.com/apowerb/apowerb-hosting). That file has no database: create one first. 1. In **Databases**, create a PostgreSQL cluster in the same region as the app, with a database used only by apowerb. A database whose tables were created by another role leaves the server running and unusable. 2. Create an App Platform app from your copy of `apowerb-hosting`, type Docker Compose. 3. Generate the secrets on your machine: ```bash theme={null} echo "ENCRYPT_KEY=$(openssl rand -base64 32 | tr '+/' '-_')" echo "TH2ETL_API_KEY=$(openssl rand -hex 32)" echo "TH2PULSE_INGEST_TOKEN=$(openssl rand -hex 32)" echo "TH2PULSE_QUERY_TOKEN=$(openssl rand -hex 32)" ``` 4. In the app's variables, set those four plus `DB_HOST` (the cluster's **private** address: the connection is not encrypted), `DB_NAME`, `DB_USER`, `DB_PASSWORD`, `APP_PUBLIC_URL` (the app's `https://` address) and `DEFAULT_SUPERADMIN_EMAIL`. 5. Deploy, then check from a clone of the repository: ```bash theme={null} ./scripts/check-deployment.sh https://your-app.example.com ``` Run the check after every deployment. The platform has twice redeployed the interface and left the backend on its old image; the check fails on that, and the remedy is to redeploy the backend service by hand. The root file publishes no backend port: the interface proxies `/api` over the internal network, and the platform serves the first service, the interface, on its domain. # Installation guide Source: https://docs.apowerb.com/deployment/install apowerb installs on a single machine or a cluster in a few minutes. Pick your flavor. **Docker** **1. Install with docker compose** ```bash theme={null} git clone https://github.com/apowerb/apowerb-hosting.git && cd apowerb-hosting cp .env.example .env && ./scripts/generate-secrets.sh docker compose -f docker-compose/docker-compose.yml --env-file .env up -d ``` **2. Create the first admin** Set `DEFAULT_SUPERADMIN_EMAIL=you@example.com` in `.env`, run the last command again, then sign up with that address at [http://localhost:3000](http://localhost:3000). Details: [Docker Compose](/deployment/dockercompose). **Docker + HTTPS** Needs a domain pointing at the server and ports 80 and 443 open. **1. Install with docker compose and Traefik** ```bash theme={null} git clone https://github.com/apowerb/apowerb-hosting.git && cd apowerb-hosting cp .env.example .env && ./scripts/generate-secrets.sh # set APP_HOST and ACME_EMAIL in .env docker compose -f docker-compose/docker-compose.yml -f docker-compose/docker-compose.traefik.yml --env-file .env up -d ``` **2. Create the first admin** Set `DEFAULT_SUPERADMIN_EMAIL=you@example.com` in `.env`, run the last command again, then sign up with that address at `https://`. Details: [Single VM / HTTPS](/deployment/virtual-machine). **Kubernetes** Needs a cluster with a default storage class. **1. Install with kubectl** ```bash theme={null} git clone https://github.com/apowerb/apowerb-hosting.git && cd apowerb-hosting ./scripts/generate-k8s-secret.sh kubectl apply -f k8s/apowerb/00-namespace.yaml -f k8s/secret.yaml kubectl apply -f k8s/apowerb/ ``` **2. Open the interface** ```bash theme={null} kubectl -n apowerb port-forward svc/apowerb-frontend 13000:3000 ``` Then sign up at [http://localhost:13000](http://localhost:13000). Keep `k8s/secret.yaml`: it holds the encryption key. Details: [Kubernetes](/deployment/kubernetes#install-without-helm). **Helm** Needs a cluster with a default storage class. **1. Install with Helm** ```bash theme={null} umask 077; cat > values-secrets.yaml < **[Installation guide](/deployment/install)** > > The commands only, for Docker, Docker + HTTPS, Kubernetes, Helm and Podman. > **[Docker Compose](/deployment/dockercompose)** > > The quickest path to bring the full stack up on a single host. > **[Kubernetes](/deployment/kubernetes)** > > Prepare a cluster, then install with kubectl alone or with the chart. > **[Helm chart](/deployment/helmchart)** > > Install the application on that cluster, configure it and upgrade it. > **[Single VM / HTTPS](/deployment/virtual-machine)** > > Expose the stack behind Traefik with TLS on a single VM. ## Deployment options Choose the operating model that fits your environment: * [Docker Compose](/deployment/dockercompose): best for local development, labs, and small production installs. * [Kubernetes](/deployment/kubernetes): prepares the cluster — storage class, ingress controller, certificate issuer — and can install the application with `kubectl` alone. * [Helm chart](/deployment/helmchart): installs and upgrades the application on that cluster; repeatable, and fits GitOps workflows. * [Single VM / HTTPS with Traefik](/deployment/virtual-machine): useful for self-hosted environments behind a public endpoint. ## Secrets Secrets are not a deployment model: every option above needs the same few values, and none of them ships with one — a value committed to a public repository is not a secret. * **Docker Compose**: `scripts/generate-secrets.sh` writes random values for `DB_PASSWORD`, `ENCRYPT_KEY` and the service tokens into `.env`. It never overwrites a value that is already set: a new `DB_PASSWORD` would no longer match the existing database volume, and a new `ENCRYPT_KEY` would make every connected integration unreadable. * **Kubernetes without Helm**: `scripts/generate-k8s-secret.sh` writes `k8s/secret.yaml` and refuses to overwrite an existing one. * **Helm chart**: pass `postgres.password`, `backend.env.encryptKey` and the service tokens as values; the chart stores them in a Kubernetes `Secret` and refuses to install without the mandatory ones. Keep `.env` and your values files out of source control, and back up `ENCRYPT_KEY` with them. ## Managed and hosted platforms The repository also includes references for common managed environments and platform-specific setups: * [DigitalOcean](/deployment/digitalocean) * [Azure App Service](/deployment/azure-app-service) * [Google Cloud Run](/deployment/google-cloud-run) * [Podman](/deployment/podman) * [Portainer](/deployment/portainer) * [Hostman](/deployment/hostman) ## Repository assets The deployment assets are concentrated in [`apowerb-hosting`](https://github.com/apowerb/apowerb-hosting), which assembles the API, the web interface, and the database into a consistent stack. The same repository publishes deployment configurations and scripts for the supported environment types, making it easier to move from development to production without rewriting the stack. # Kubernetes, step by step Source: https://docs.apowerb.com/deployment/kubernetes Preparing a cluster for apowerb with kubectl and plain manifests — storage, ingress, certificates — and the traps, with their remedies. This page prepares the **cluster**: everything here is `kubectl` and plain manifests, no Helm. The application itself is installed afterwards, either by the [Helm chart](/deployment/helmchart) or with `kubectl` alone ([Install without Helm](#install-without-helm)), once the cluster passes the checks below. The files cited below live in the hosting repository. Run the commands from a clone of it: ```bash theme={null} git clone https://github.com/apowerb/apowerb-hosting.git cd apowerb-hosting ``` Every step was run on a real cluster (k0s v1.36.3, three nodes) before being written down. The commands are the ones that worked; the **Traps** section at the end lists what went wrong on the way, with the symptom that gives each one away. ## What you need before starting | | | | - | - | | A Kubernetes cluster | 1.28 or later. Three nodes of 4 vCPU / 8 GB is comfortable for the full stack | | `kubectl` | within one minor version of the server | | A storage class | **the cluster does not necessarily have one** — [step 2](#2-storage) | | An ingress controller | for a public address — [step 3](#3-ingress-controller) | | A DNS name | pointed at the ingress load balancer | ## 1. Reach the cluster ```bash theme={null} export KUBECONFIG=~/.kube/config kubectl get nodes ``` Every node must be `Ready`. `kubectl version` should show a client at most one minor version away from the server; further apart, some commands fail in puzzling ways. ## 2. Storage **Check first — this is the single most common reason nothing starts.** ```bash theme={null} kubectl get storageclass ``` `No resources found` means no volume can ever be created: PostgreSQL and the data volume would stay `Pending` forever, and the pods with them. Managed clusters differ wildly here; some ship a class, some only offer object storage (which does **not** suit PostgreSQL). If the list is empty, `local-path-provisioner` gives you node-local volumes in one manifest: ```bash theme={null} curl -sL -o local-path-storage.yaml \ https://raw.githubusercontent.com/rancher/local-path-provisioner/v0.0.37/deploy/local-path-storage.yaml kubectl apply -f local-path-storage.yaml kubectl -n local-path-storage rollout status deploy/local-path-provisioner --timeout=120s ``` Make it the default, otherwise claims that name no class — the chart's — stay unbound: ```bash theme={null} kubectl patch storageclass local-path \ -p '{"metadata":{"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}' kubectl get storageclass ``` You want to read `local-path (default)`. > [!WARNING] > > A node-local volume lives on **one** node's disk. It is enough for a single > PostgreSQL replica and for `ReadWriteOnce` data, and it is not > highly available: losing the node loses the volume. Back the database up, or > use your provider's block CSI driver when it has one. Prove it works before going further — and mind that the check needs a **pod**, not just a claim ([Trap 1](#trap-1-a-pvc-that-stays-pending-on-purpose)): ```bash theme={null} kubectl apply -f - <<'YAML' apiVersion: v1 kind: PersistentVolumeClaim metadata: {name: probe-pvc} spec: accessModes: ["ReadWriteOnce"] resources: {requests: {storage: 1Gi}} --- apiVersion: v1 kind: Pod metadata: {name: probe-pod} spec: restartPolicy: Never containers: - name: writer image: busybox:1.37 command: ["sh","-c","echo ok > /data/marker && cat /data/marker && sleep 20"] volumeMounts: [{name: data, mountPath: /data}] volumes: - {name: data, persistentVolumeClaim: {claimName: probe-pvc}} YAML sleep 25 && kubectl get pvc probe-pvc && kubectl logs probe-pod kubectl delete pvc probe-pvc pod probe-pod ``` `Bound`, and `ok` in the logs. Anything else, stop here: the rest cannot work. ## 3. Ingress controller Needed only for a public address; skip it if you will use `port-forward`. Install **Traefik** or **ingress-nginx** — most managed Kubernetes offerings have both as a one-click add-on, which is the simplest path since the provider then also wires the load balancer. Then: ```bash theme={null} kubectl get ingressclass kubectl get svc -A | grep LoadBalancer ``` Note the class name (`traefik`, `nginx`…) and the `EXTERNAL-IP` of the controller's service: that address is what your DNS record will point to. ## 4. cert-manager and an issuer Installing cert-manager is not enough — **it issues nothing until an issuer exists**. ```bash theme={null} kubectl get pods -n cert-manager ``` Then create the issuers. Two of them: production, and staging — which you use first, because Let's Encrypt blocks an account for a week after five failures in an hour, and the first attempt rarely succeeds. ```yaml theme={null} apiVersion: cert-manager.io/v1 kind: ClusterIssuer metadata: name: letsencrypt-staging spec: acme: server: https://acme-staging-v02.api.letsencrypt.org/directory email: you@example.com # Let's Encrypt mails expiry notices here privateKeySecretRef: name: letsencrypt-staging-account-key solvers: - http01: ingress: ingressClassName: traefik # your class from step 3 ``` The production issuer is the same with `https://acme-v02.api.letsencrypt.org/directory` and its own key secret name. Both are ready-made in the hosting repository under `k8s/cert-manager/cluster-issuer-letsencrypt.yaml`. Replace the `email:` of **both** issuers with a mailbox you read before applying it: the file ships with a maintainer's address. ```bash theme={null} kubectl apply -f k8s/cert-manager/cluster-issuer-letsencrypt.yaml kubectl get clusterissuer ``` `READY: True` on both means cert-manager registered with the ACME servers. > [!WARNING] > > Use `ingressClassName`, **not** `class`. The latter goes through the legacy > `kubernetes.io/ingress.class` annotation and is only recommended for > ingress-gce. With it, the challenge Ingress is created without a recognised > class, the controller ignores it, and the certificate sits at > `Ready: False` while nothing reports an error. ## 5. HTTPS redirect (Traefik) A certificate does not close the clear-text entrance: once the site is public, `http://` keeps serving it unless something redirects. With Traefik, that something is a Middleware, cluster-side, ready-made in the hosting repository: ```bash theme={null} kubectl create namespace apowerb # the Middleware lives in the application's namespace kubectl apply -f k8s/traefik/redirect-https.yaml kubectl -n apowerb get middleware redirect-https ``` The application's Ingress opts into it with one annotation — see [Going public](/deployment/helmchart#4-going-public). With ingress-nginx there is nothing to apply: `ssl-redirect` acts as soon as the Ingress has a TLS section. ## The manifests in `k8s/` The hosting repository's `k8s/` folder holds four sets of manifests. Those under `k8s/apowerb/` are rendered from the chart, so both install paths deploy the same stack. | Path | What it is | | - | - | | `k8s/apowerb/` | the whole application: PostgreSQL, backend, interface, th2etl and its seed Job, th2pulse, the collector, the data volume | | `k8s/apowerb-public/` | the Ingress and a backend that knows its public URL, for `apowerb.example.com` | | `k8s/cert-manager/cluster-issuer-letsencrypt.yaml` | the staging and production issuers — [step 4](#4-cert-manager-and-an-issuer) | | `k8s/traefik/redirect-https.yaml` | the HTTP → HTTPS Middleware — [step 5](#5-https-redirect-traefik) | ## Install without Helm ```bash theme={null} ./scripts/generate-k8s-secret.sh # writes k8s/secret.yaml, mode 600 kubectl apply -f k8s/apowerb/00-namespace.yaml -f k8s/secret.yaml kubectl apply -f k8s/apowerb/ kubectl -n apowerb get pods ``` Expected: six pods `Running` and `apowerb-th2etl-seed` `Completed`. Back up `k8s/secret.yaml` and never regenerate it: a new `ENCRYPT_KEY` makes every connected integration unreadable. Reach the interface with `kubectl -n apowerb port-forward svc/apowerb-frontend 13000:3000`. **Public address.** Copy `apowerb-public/`, put your domain in, apply the copy: ```bash theme={null} cp -r k8s/apowerb-public my-public sed -i.bak 's/apowerb\.example\.com/apowerb.your-domain.tld/' my-public/*.yaml kubectl apply -f my-public/ kubectl -n apowerb get certificate ``` It uses the staging issuer. Once the certificate is `READY`, switch the `cert-manager.io/cluster-issuer` annotation to `letsencrypt-prod` and delete the `apowerb-tls` secret. **Upgrade.** Keep the same `secret.yaml`. The seed Job is immutable: delete it first. ```bash theme={null} git pull kubectl -n apowerb delete job apowerb-th2etl-seed --ignore-not-found kubectl apply -f k8s/apowerb/ ``` With a public address, skip `k8s/apowerb/backend-deployment.yaml` and apply `my-public/` instead: the plain backend has no public URL, and CORS and OAuth callbacks break until the public copy is back. **Remove.** `kubectl delete -f k8s/apowerb/` deletes the namespace and both volumes, the database included. Nothing protects them, unlike the chart. ## Next: install with Helm > **[Helm chart](/deployment/helmchart)** > > Secrets, install, checks, public address, first administrator, upgrades. *** ## Traps ### Trap 1: a PVC that stays Pending on purpose **Symptom.** You create a claim to test the storage; it stays `Pending`. It looks like the storage is broken. **Cause.** Storage classes with `volumeBindingMode: WaitForFirstConsumer` — `local-path` among them — only create the volume when a **pod** needs it. This is by design: the volume is placed on the node the pod is scheduled to. **Remedy.** Test with a claim *and* a pod, as in [step 2](#2-storage). `kubectl get storageclass` shows the mode. ### Trap 2: no storage class at all **Symptom.** Same `Pending`, but with a pod waiting too, and `kubectl describe pvc` says: `no persistent volumes available for this claim and no storage class is set`. **Cause.** The cluster has no default storage class — common on lean managed clusters. **Remedy.** [Step 2](#2-storage). Check `kubectl get storageclass` **before** installing, not after wondering why nothing starts. ### Trap 3: a certificate stuck at Ready: False **Symptom.** `kubectl get certificate` shows `READY: False` and stays there, without an obvious error. **Causes, in the order worth checking.** 1. The DNS name does not resolve to the ingress load balancer yet, or port 80 is closed — the HTTP-01 challenge needs both. 2. The issuer uses `class` instead of `ingressClassName` (see [step 4](#4-cert-manager-and-an-issuer)). 3. The Let's Encrypt rate limit has been hit — five failures in an hour blocks the account for a week. This is what the staging issuer is for. ```bash theme={null} kubectl -n apowerb describe certificate apowerb-tls kubectl -n apowerb get challenge ``` The `Challenge` object names the real reason. # Podman Source: https://docs.apowerb.com/deployment/podman Run the Docker Compose stack with Podman. > [!NOTE] > > Not tested yet. The commands use the same files as > [Docker Compose](/deployment/dockercompose); please report what you find. Requires Podman 4.7 or later, for `podman compose`. ```bash theme={null} git clone https://github.com/apowerb/apowerb-hosting.git cd apowerb-hosting cp .env.example .env ./scripts/generate-secrets.sh podman compose -f docker-compose/docker-compose.yml --env-file .env up -d ``` Set the first administrator first, as in [Docker Compose, step 2](/deployment/dockercompose#2-name-the-first-administrator), then open [http://localhost:3000](http://localhost:3000). A single `podman run apowerb/apowerb` is not enough: the API needs its database and its encryption key, which the compose file provides. # Portainer Source: https://docs.apowerb.com/deployment/portainer Deploy the Docker Compose stack as a Portainer stack. > [!NOTE] > > Not tested yet. The stack is the same as > [Docker Compose](/deployment/dockercompose); please report what you find. 1. Generate the secrets on your machine: ```bash theme={null} echo "DB_PASSWORD=$(openssl rand -hex 24)" echo "ENCRYPT_KEY=$(openssl rand -base64 32 | tr '+/' '-_')" ``` 2. In Portainer, open **Stacks** → **Add stack** and pick the **Repository** build method. 3. Repository URL `https://github.com/apowerb/apowerb-hosting`, compose path `docker-compose/docker-compose.yml`. 4. Under **Environment variables**, add `DB_NAME=th2agent`, `DB_USER=th2agent`, the two values from step 1 and `DEFAULT_SUPERADMIN_EMAIL=you@example.com`. 5. **Deploy the stack**, then open port `3000` of the host and sign up with the administrator e-mail. Keep `ENCRYPT_KEY`: losing it makes every connected integration unreadable. # Single VM / HTTPS Source: https://docs.apowerb.com/deployment/virtual-machine Serve the Docker Compose stack over HTTPS on one server, with Traefik and Let's Encrypt. Traefik takes ports 80 and 443 and gets the certificate from Let's Encrypt. ## Requirements * Everything from [Docker Compose](/deployment/dockercompose#requirements) * A domain name pointing at the server * Ports `80` and `443` open to the internet: Let's Encrypt validates through them, so this cannot be tested on a laptop ## 1. Download and configure ```bash theme={null} git clone https://github.com/apowerb/apowerb-hosting.git cd apowerb-hosting cp .env.example .env ./scripts/generate-secrets.sh ``` Then open `.env` and set: ```bash theme={null} APP_HOST=apowerb.example.com ACME_EMAIL=you@example.com DEFAULT_SUPERADMIN_EMAIL=you@example.com ``` ## 2. Start ```bash theme={null} docker compose -f docker-compose/docker-compose.yml -f docker-compose/docker-compose.traefik.yml --env-file .env up -d ``` Run it from the repository root and name both files: the root `docker-compose.yml` is the [Hostman](/deployment/hostman) file, not this stack. ## 3. Check ```bash theme={null} ./scripts/check-deployment.sh https://apowerb.example.com ``` Then open `https://apowerb.example.com` and sign up with the administrator e-mail. > [!WARNING] > > Before [apowerb-hosting#99](https://github.com/apowerb/apowerb-hosting/pull/99), > the overlay also left the interface on port `3000` and the API on port > `8000` in plain HTTP. Check with `docker compose ... ps`: only `traefik` > should publish ports. Otherwise, pull the repository or close 3000 and 8000 > in the server's firewall. Everyday commands, optional services and troubleshooting are the same as [Docker Compose](/deployment/dockercompose#everyday-commands), with the `-f docker-compose/docker-compose.traefik.yml` overlay added to each command. # apowerb Source: https://docs.apowerb.com/ecosystem/apowerb The open-source core: what the package is, and what it is not. [`apowerb`](https://github.com/apowerb/apowerb) is the core of the stack: a FastAPI server that stores agents, builds them on Google ADK, runs them, and exposes the whole thing over REST. It is published on [PyPI](https://pypi.org/project/apowerb/) under the MIT licence and installs on Python 3.10+. ```bash theme={null} pip install apowerb apowerb serve ``` It needs a PostgreSQL database and an `ENCRYPT_KEY`; everything else has a default. See [Installation](/installation) and [Configuration](/configuration). ## What it contains Agent CRUD and generation, ADK execution with streaming, sessions and traces, the [tool](/guides/tools) portfolio and [skills](/guides/skills), [RAG](/guides/rag) and [Text-to-SQL](/guides/text-to-sql) clients, [webhooks](/guides/webhooks), [integrations](/guides/integrations/overview), BI charts and dashboards, artifacts, the [Hub](/guides/hub), scheduled runs through an [orchestrator](/guides/orchestrator), and [supervision](/monitoring/supervision). ## What it does not contain Billing, usage metering and quotas, B2B prospecting, identity-provider sign-in, multi-factor authentication, agent evaluation and the administration panel are commercial bricks. They are **absent**, not disabled — their routes answer `404`. See [Editions and extensions](/concepts/editions). The core keeps hooks where a brick can answer, and holds a safe default when none does: without a brick, supervision shows each person only their own sessions. ## Versioning The published version is the git tag of the release, not the number in `pyproject.toml` — the release workflow injects it at build time, so the file itself lags. Read the version from [PyPI](https://pypi.org/project/apowerb/) or from the tags. # apowerb-ui Source: https://docs.apowerb.com/ecosystem/apowerb-ui The Next.js interface for the apowerb API. [`apowerb-ui`](https://github.com/apowerb/apowerb-ui) is the reference web interface: agent editor, conversations, tool configuration, integrations, webhook manager, and knowledge base management. It talks to the API over the same public REST surface documented here — nothing in it is privileged. Any other client can replace it. ```bash theme={null} git clone https://github.com/apowerb/apowerb-ui.git cd apowerb-ui npm install npm run dev ``` Point it at your API with the variables in `.env.example`, then open `http://localhost:3000`. # JavaScript SDK Source: https://docs.apowerb.com/ecosystem/javascript-sdk Drive the API from a browser or from Node, without writing fetch calls. [`@apowerb/apowerb-sdk`](https://www.npmjs.com/package/@apowerb/apowerb-sdk) is the JavaScript client for the apowerb backend: agents, tools, RAG, BI, webhooks, billing and skills. **143 functions, no dependencies, no React and no Next code** — it runs in a browser and in Node alike. ```bash theme={null} npm i @apowerb/apowerb-sdk ``` Published from GitHub Actions through npm trusted publishing, with a provenance attestation naming the repository, the workflow and the tag. ## Two ways to use it **Served by the app** With no configuration, requests go out relative to `/api/...` and the token is read from `localStorage`. This is what the reference interface does. ```js theme={null} import { listAgents } from "@apowerb/apowerb-sdk"; const agents = await listAgents(); // GET /api/agents ``` **Anywhere else** Point it at the backend of your choice and tell it where the token lives. ```js theme={null} import { configureClient, listAgents } from "@apowerb/apowerb-sdk"; configureClient({ baseUrl: "https://your-apowerb-host", storage: { getToken: () => process.env.APOWERB_TOKEN }, }); const agents = await listAgents(); // GET https://your-apowerb-host/api/agents ``` ## Configuration `configureClient(options)` — omitted keys keep their current value. | Option | Default | Role | | - | - | - | | `baseUrl` | `""` | Backend root. Empty means relative requests. A trailing slash is tolerated — `.../` + `/api/x` would otherwise produce `//api/x`, which some reverse proxies read as a protocol-relative host. | | `storage` | `localStorage` | Must expose `getToken()`, ideally `setToken()` and `clear()` | | `onUnauthorized` | an `auth:unauthorized` event on `window` | Called on a final 401. Outside a browser it does nothing rather than throwing. | Companion functions: `getClientConfig()` reads the current settings, `resetClientConfig()` restores the defaults — useful between tests — and `apiUrl(path)` builds the absolute URL of an API path. ## Entry points | Import | Contents | | - | - | | `@apowerb/apowerb-sdk` | everything: API calls, auth helpers, configuration | | `@apowerb/apowerb-sdk/config` | configuration only | | `@apowerb/apowerb-sdk/authStorage` | token storage and the auth calls | > [!NOTE] > > The SDK covers the endpoints of the [API reference](/api-reference/introduction) — the > same surface, one function per endpoint. Capabilities absent from your edition answer > `404`; see [Editions](/concepts/editions). # Overview Source: https://docs.apowerb.com/ecosystem/overview The repositories that make up the apowerb ecosystem. | Repository | What it is | Language | | - | - | - | | [`apowerb`](https://github.com/apowerb/apowerb) | The core — API, agents, tools, CLI | Python | | [`apowerb-ui`](https://github.com/apowerb/apowerb-ui) | The web interface | Next.js | | [`apowerb-hosting`](https://github.com/apowerb/apowerb-hosting) | Deployment configurations | Docker Compose | | [`th2rag`](https://github.com/apowerb/th2rag) | Retrieval-augmented generation backend | Python | | [`th2etl`](https://github.com/apowerb/th2etl) | ETL and automation library | Python | | [`th2pulse`](https://github.com/apowerb/th2pulse) | OpenTelemetry collection and observability | Python | The core depends on none of the satellites at import time. `th2rag` is reached over HTTP through `RAG_BASE_URL`; `th2pulse` and `th2etl` are optional. # th2etl Source: https://docs.apowerb.com/ecosystem/th2etl ETL and automation library. [`th2etl`](https://github.com/apowerb/th2etl) is an in-house ETL and automation library, published on PyPI. It is independent of the agent runtime: use it to build the pipelines that feed the data agents later query. ```bash theme={null} pip install th2etl ``` > [!WARNING] > > If you deploy th2etl next to the core, keep it on loopback behind your reverse proxy. > It has no authentication of its own. # th2pulse Source: https://docs.apowerb.com/ecosystem/th2pulse OpenTelemetry collection and observability. [`th2pulse`](https://github.com/apowerb/th2pulse) is a lightweight OpenTelemetry collection and observability library for the th2 and apowerb applications. It collects traces and metrics from the running services. For agent-level observability — which agent ran, with which tools, for how long — prefer the ADK callbacks, which see the agent tree; OpenTelemetry spans alone do not separate one agent's work from another's inside a shared invocation. # th2rag Source: https://docs.apowerb.com/ecosystem/th2rag The retrieval-augmented generation backend. [`th2rag`](https://github.com/apowerb/th2rag) is a FastAPI service handling document processing, vector search and conversational retrieval. The core delegates all indexing and search to it. Configure `RAG_BASE_URL` to point at the service, and `RAG_WEBHOOK_SECRET` to the shared HMAC secret used to sign completion callbacks. Its surface covers conversations, messages, knowledge bases and datasets. See [RAG](/guides/rag) for how the core drives it. # Artifacts Source: https://docs.apowerb.com/guides/artifacts Every file that enters or leaves an agent session, in one store. When `artifacts_enabled` is set on an agent, files it produces during a run — a chart, a CSV, a generated report — are kept per session. The same store also holds what a user uploads to that session. One bucket, one API, one tab. ## Layout Every artifact — generated or uploaded — lives under the same key scheme: ``` artifacts/{agent}/{session}/{input|output}/{filename}/{version}/{leaf} ``` `input` and `output` are the only two segments that matter to a reader: an upload and a generated file can share the same filename in the same session without colliding, because the segment tells them apart. Versions are integers, oldest first; the API always resolves the highest one unless told otherwise. A third kind, `legacy`, covers files written before this layout existed (`uploads/{agent}/{filename}`, no session). Nothing writes there any more, but existing files are not migrated — they stay reachable through the same endpoints, tagged accordingly. > [!NOTE] > > An upload sent without a session (an agent-wide attachment, not tied to a > conversation) is stored under the literal session `_shared` rather than left > unscoped. ## Tags Every entry the API returns carries a `kind`: | Tag | Meaning | | - | - | | `input` | Uploaded by a user | | `output` | Produced by the agent during a run | | `legacy` | Written before the layout above existed | ## Endpoints | Method | Endpoint | Description | | - | - | - | | GET | `/api/artifacts/library` | Every artifact the caller owns, across all agents and sessions, in one call | | GET | `/api/artifacts/{agent}/{user}/{session}` | List a session's artifacts | | GET | `/api/artifacts/{agent}/{user}/{session}/{filename}` | Get one artifact's content — `?kind=` disambiguates when the same filename exists as both an input and an output | | POST | `/api/artifacts/{agent}/{user}/{session}/{filename}/execute` | Execute an artifact | > [!NOTE] > > `/api/artifacts/library` only answers when the deployment stores artifacts on S3 > (`STORAGE_MODE=s3`, see [Configuration](/configuration)). On the local-disk backend it > returns `{"items": [], "supported": false}` — use the per-session endpoint instead. ## Previews The file extension decides how an artifact is rendered: syntax highlighting for code, a rendered preview for `.html`, and a PDF viewer for `.pdf`. Anything else falls back to plain text, or is reported as binary if it does not decode as UTF-8. > [!WARNING] > > Executing an artifact runs code the model produced. Enable `artifacts_enabled` only > for agents whose operators you trust, and isolate the runtime accordingly. # BI and dashboards Source: https://docs.apowerb.com/guides/bi Turn data into charts and dashboards, and let an agent keep them fresh. The BI module holds three things: **datasets** you bring in, **charts** built on them, and **dashboards** that arrange those charts. An agent can be attached to a dashboard so the figures refresh on their own. ![BI and reporting screen with dashboard and chart counters and the draft, published and shared filters](https://mintcdn.com/thaink2-445e19b2/01sXtdZdZRmlIMtW/images/bi.jpg?fit=max\&auto=format\&n=01sXtdZdZRmlIMtW\&q=85\&s=2400fb4a446a9614143e950627e30d39) ## Bringing data in | Method | Endpoint | Source | | - | - | - | | POST | `/api/v1/bi/upload-csv` | A CSV you upload | | POST | `/api/v1/bi/import/google-drive` | A file from a connected Google Drive | | POST | `/api/v1/bi/onedrive/preview` | A OneDrive spreadsheet — `xlsx`, `xls`, `xlsm`, `ods`, `csv`, `tsv` | | GET | `/api/v1/bi/tool-configs/database` | The database tool configs available as a source | `GET /api/v1/bi/datasets` lists what is loaded, `/{file_id}/preview` shows the first rows before you build anything on it, and `DELETE /{file_id}` removes it. The spreadsheet and Drive paths need the matching [integration](/guides/integrations) connected first. ## Charts | Method | Endpoint | Description | | - | - | - | | GET | `/api/v1/charts` | List | | POST | `/api/v1/charts` | Create | | GET | `/api/v1/charts/{chart_id}` | Read one | | PATCH | `/api/v1/charts/{chart_id}` | Update | | DELETE | `/api/v1/charts/{chart_id}` | Delete | | GET | `/api/v1/charts/{chart_id}/data` | Fetch its data, paginated | Two shortcuts skip the full chart definition for the common cases: ``` POST /api/v1/charts/shortcuts/kpi a single stat card POST /api/v1/charts/shortcuts/timeseries a time series ``` `POST /api/v1/charts/{chart_id}/send-to-dashboard` pushes a chart onto the caller's chat dashboard — it is meant to be triggered by the user, not by an agent acting alone. ### A chart whose data comes from an agent A chart can take `source_type: "agent"`, in which case its rows are whatever the agent answers. That answer has to be a JSON array of objects — one object per row — and nothing else. Two fields in `source.source_options` drive it: | Field | Description | | - | - | | `agent_ids` | The agents to run. Their rows are concatenated in order. | | `message` | What to ask them. Required in practice — see below. | ```json theme={null} { "source_type": "agent", "query": "", "source_options": { "agent_ids": [7], "message": "Monthly revenue by region for the last 12 months" } } ``` Without a `message`, the agent is only asked for the latest data with no indication of *which* data, and a capable agent answers with a question or an explanation rather than rows. `GET /api/v1/charts/{chart_id}/data` then returns **502**, and the message names the agent and points back at this field. In the interface, the instruction is the *What should the agent return?* box, next to the agent picker when you create the chart and in the edit panel afterwards. Reasoning is never mistaken for the answer: a model that emits a thinking summary alongside its reply has that summary discarded, and only the reply is read as data. ## Dashboards A dashboard is a grid of components. Charts are the usual ones, but a component can also hold a key-value block whose content is updated in place. | Method | Endpoint | Description | | - | - | - | | GET | `/api/v1/dashboards` | List | | POST | `/api/v1/dashboards` | Create | | GET | `/api/v1/dashboards/{dashboard_id}` | Read one — also `by-slug/{slug}` | | PATCH | `/api/v1/dashboards/{dashboard_id}` | Update | | DELETE | `/api/v1/dashboards/{dashboard_id}` | Delete | | POST | `/api/v1/dashboards/{dashboard_id}/components` | Add a component | | PATCH | `.../components/{component_id}` | Update a key-value component | | PATCH | `.../components/{component_id}/position` | Move it on the grid | | DELETE | `.../components/{component_id}` | Remove it | ## Publishing and sharing | Method | Endpoint | Effect | | - | - | - | | POST | `/api/v1/dashboards/{dashboard_id}/publish` | Makes it reachable by slug | | POST | `/api/v1/dashboards/{dashboard_id}/unpublish` | Takes it back private | | GET | `/api/v1/dashboards/shared` | Published dashboards shared with the caller | | GET | `/api/v1/dashboards/public/{slug}` | The published dashboard, for a logged-in viewer it admits | | GET | `/api/v1/public/charts/{chart_id}/data` | The data of a chart shown on such a dashboard, same rule | > [!NOTE] > > Both routes require a logged-in user. A published dashboard with `public` visibility is > readable by any logged-in user, one with `organization` visibility only by users of the > owner's email domain. Chart data answers only the chart's owner or a viewer of a published > dashboard that displays the chart; any other chart is a 404. The chart's source runs with > its owner's credentials, never the viewer's. Unpublish to withdraw access. ## Letting an agent refresh the figures A dashboard can be linked to an agent, which then becomes responsible for recomputing it. ``` PATCH /api/v1/dashboards/{dashboard_id}/agent link or unlink GET /api/v1/dashboards/{dashboard_id}/agent read the link POST /api/v1/dashboards/{dashboard_id}/schedule-refresh schedule the refresh GET /api/v1/dashboards/{dashboard_id}/schedules list the schedules POST /api/v1/charts/{chart_id}/schedule-refresh same, for one chart ``` Refreshes run through the [orchestrator](/guides/orchestrator), so they obey the same `ORCHESTRATOR` setting as every other recurring run. `GET /api/v1/bi/stats` returns the module's counters — what the screen above displays. # Agent Hub Source: https://docs.apowerb.com/guides/hub Publish an agent, let another workspace clone it. | Method | Endpoint | Description | | - | - | - | | GET | `/api/hub` | Browse published agents | | GET | `/api/hub/{hub_id}` | Details | | POST | `/api/hub/publish` | Publish — copies config, tools and instruction | | POST | `/api/hub/clone` | Clone into your workspace | | DELETE | `/api/hub/{hub_id}` | Remove from the Hub | Publishing copies the agent's configuration, not its data: sessions, indexed knowledge and connected integrations stay with the original workspace. A clone starts empty and needs its own tool configs. # Google Integration Source: https://docs.apowerb.com/guides/integrations/google Connecting Gmail, Google Drive, and other Google services. ``` Gmail ──push──▶ Google Pub/Sub ──HTTP POST──▶ apowerb (topic) /api/webhooks/gmail/notifications │ ▼ fetch new mail via the Gmail API │ ▼ run the associated agent ``` ## Prerequisites * A Google Cloud project with billing enabled * Gmail API, Google Drive API, and Cloud Pub/Sub API enabled * A publicly reachable HTTPS URL ## Register an Application To establish the connection, you first need to set up an OAuth application in the [Google Cloud Console](https://console.cloud.google.com/): **1. Configure OAuth Consent Screen** Go to **APIs & Services** > **OAuth consent screen**. Select **External** (or Internal), fill in required fields, and add the scopes needed: * Gmail: `https://www.googleapis.com/auth/gmail.readonly`, `https://www.googleapis.com/auth/gmail.send` * Drive: `https://www.googleapis.com/auth/drive.readonly`, `https://www.googleapis.com/auth/drive.file` **2. Create Credentials** Go to **APIs & Services** > **Credentials** > **Create Credentials** > **OAuth client ID**. * Type: **Web application** * Name: `apowerb-integration` * Authorized redirect URIs: `https://your-domain.com/api/v1/auth/callback` **3. Save Credentials** Download the JSON credentials or copy the **Client ID** and **Client Secret**. ## Infrastructure Setup **1. Enable the APIs** ```bash theme={null} gcloud services enable gmail.googleapis.com drive.googleapis.com pubsub.googleapis.com \ --project=YOUR_PROJECT_ID ``` **2. Create the topic** ```bash theme={null} gcloud pubsub topics create gmail-notifications \ --project=YOUR_PROJECT_ID ``` **3. Permissions** ```bash theme={null} gcloud pubsub topics add-iam-policy-binding gmail-notifications \ --project=YOUR_PROJECT_ID \ --member="serviceAccount:gmail-api-push@system.gserviceaccount.com" \ --role="roles/pubsub.publisher" ``` **4. Create the push subscription** ```bash theme={null} gcloud pubsub subscriptions create gmail-notifications-push \ --topic=gmail-notifications \ --push-endpoint=https://YOUR_DOMAIN/api/webhooks/gmail/notifications \ --project=YOUR_PROJECT_ID ``` ## Setup **1. Configure the environment** Set the following `GOOGLE_INTEGRATION_*` variables in your environment: * `GOOGLE_INTEGRATION_CLIENT_ID`: Your Client ID * `GOOGLE_INTEGRATION_CLIENT_SECRET`: Your Client Secret * `GMAIL_PUBSUB_PROJECT_ID`: Your GCP project ID * `GMAIL_PUBSUB_TOPIC`: `gmail-notifications` **2. Connect services** From the interface, navigate to **Integrations** and select **Google**. Connect your account using the configured credentials. **3. Subscribe to notifications** ```bash theme={null} curl -X POST https://YOUR_DOMAIN/api/webhooks/subscriptions \ -H "Authorization: Bearer TOKEN" \ -H "Content-Type: application/json" \ -d '{ "provider": "google_gmail", "resource": "INBOX", "agent_id": "AGENT_ID", "change_type": "created" }' ``` # Microsoft Integration Source: https://docs.apowerb.com/guides/integrations/microsoft Connecting Outlook, OneDrive, and other Microsoft services. ## Prerequisites * A Microsoft Azure AD application * Microsoft Graph permissions * A publicly reachable HTTPS URL ## Register an Application To establish the connection, you first need to register an application in the [Microsoft Entra admin center](https://entra.microsoft.com/): **1. Create App Registration** Go to **App registrations** > **New registration**. * Name: `apowerb-integration` * Supported account types: **Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts** * Redirect URI: `https://your-domain.com/api/v1/auth/callback` (or your local setup) **2. Generate Client Secret** Navigate to **Certificates & secrets** > **Client secrets** > **New client secret**. Save the value securely. **3. API Permissions** Go to **API permissions** > **Add a permission** > **Microsoft Graph**. * For Outlook: Select `Mail.Read`, `Mail.Send`, `Calendars.Read` * For OneDrive: Select `Files.Read.All`, `Files.ReadWrite` * Click **Grant admin consent** if required. ## Setup **1. Configure the environment** Set the following `MICROSOFT_INTEGRATION_*` variables in your environment: * `MICROSOFT_CLIENT_ID`: Your Application (client) ID * `MICROSOFT_CLIENT_SECRET`: Your generated client secret * `MICROSOFT_TENANT_ID`: Your Directory (tenant) ID (use `common` for multitenant) See [Configuration](/configuration). **2. Connect services** From the interface, navigate to **Integrations** and select **Microsoft**. Connect your account using the configured app details. The handler uses Microsoft Graph change notifications. Subscriptions expire after three days and are renewed automatically — see [Webhooks](/guides/webhooks). # Integrations Source: https://docs.apowerb.com/guides/integrations/overview Connect the services your agents act on. An integration connects an external service so agent tools can act on it — read a Drive folder, send an Outlook mail, list Teams chats. > [!NOTE] > > This is not how users sign in. Signing in **with** an identity provider belongs to a > commercial edition and is absent from the open-source build, which authenticates with > email and password. See [Editions](/concepts/editions). ![Integrations screen showing GitHub, Outlook, Teams, OneDrive, SharePoint, Google Drive, Gmail and Google Calendar](https://mintcdn.com/thaink2-445e19b2/01sXtdZdZRmlIMtW/images/integrations.jpg?fit=max\&auto=format\&n=01sXtdZdZRmlIMtW\&q=85\&s=bdc6cb021eabb78660eeb7eda1c3b890) ## Connecting a workspace integration **1. Get the authorisation URL** `GET /api/integrations/{provider}/{service}/connect` **2. User consents** On the provider's consent screen. **3. Provider redirects back** `POST /api/integrations/{provider}/callback` **4. Tokens are stored encrypted** In the `integrations` table, encrypted with `ENCRYPT_KEY`. Agent tools then use those tokens transparently. ## Supported services Eleven services can be connected. | Service | Family | What agents get | | - | - | - | | Google Drive | Storage | Read and search documents and files | | Gmail | Email | Read, search and send email | | Google Calendar | Calendar | View and create events | | Google Sheets | Spreadsheets | Read and write spreadsheet data | | Google Docs | Documents | Read and create documents | | Outlook | Microsoft 365 | Read and send email through Microsoft Graph | | Teams | Microsoft 365 | Read channel and chat messages | | OneDrive | Microsoft 365 | Read and write files | | SharePoint | Microsoft 365 | Reach sites and documents | | GitHub | Version control | Read repositories, open pull requests, manage issues | | Odoo | CRM / ERP | Search, create and update records on an Odoo SaaS instance | Scopes are requested per service — `gmail.readonly`, `drive.readonly`, `Mail.Read`, `Files.ReadWrite`, `repo`, and so on — so an agent only ever receives what its service needs. ## Endpoints | Method | Endpoint | Description | | - | - | - | | GET | `/api/integrations` | List connected integrations | | GET | `/api/integrations/google/{service}/connect` | Google authorisation URL | | POST | `/api/integrations/google/callback` | Google callback | | GET | `/api/integrations/microsoft/{service}/connect` | Microsoft authorisation URL | | POST | `/api/integrations/microsoft/callback` | Microsoft callback | | GET | `/api/integrations/github/connect` | GitHub authorisation URL | | POST | `/api/integrations/github/callback` | GitHub callback | | DELETE | `/api/integrations/{provider}` | Disconnect | # MCP Source: https://docs.apowerb.com/guides/mcp Reaching Model Context Protocol servers, and registering your own. Beyond its own Python tools, an agent can call tools served by a **Model Context Protocol** server. The core supports two routes, and they solve different problems. ## Toolsets built into the portfolio Two portfolio modules are MCP clients rather than plain functions: | Module | Server | Configuration | | - | - | - | | `web_search_mcp` | Tavily, over streamable HTTP | `TAVILY_API_KEY` | | `database_mcp` | MCP Toolbox for Databases | `MCP_TOOLBOX_URL` (default `http://localhost:5000`), `MCP_TOOLBOX_TOOLSET` | Leave `MCP_TOOLBOX_TOOLSET` empty to load every tool the Toolbox exposes, or name one toolset to load just that. They are discovered by their name: `tool_manager` treats any `mcp_tool_set_*` attribute as a **factory** and calls it when the agent is built. > [!NOTE] > > The factory matters. A toolset instantiated once at import would capture the API key of > that moment and keep using it after a rotation. Calling the factory per build means the > connection is created with the key that is current. ### MCP Toolbox for Databases The Toolbox is a separate process, with its own binary and a `tools.yaml` describing the databases it may reach. The core only needs to know where it listens. | Variable | Default | Description | | - | - | - | | `TOOLBOX_DIR` | — | Directory holding `tools.yaml` and the binary. Empty falls back to `RUNTIME_ROOT`, i.e. the working directory | | `TOOLBOX_PORT` | — | Port the Toolbox listens on | | `MCP_TOOLBOX_URL` | `http://localhost:5000` | URL the agent connects to | ## Servers registered at runtime Servers do not have to be baked into the portfolio. They can be stored and edited through the API, which is what the interface uses: | Method | Endpoint | Description | | - | - | - | | GET | `/api/mcp_configs` | List registered servers | | POST | `/api/mcp_configs` | Register one | | PUT | `/api/mcp_configs/{mcp_config_id}` | Update one | | POST | `/api/mcp_configs/reload` | Re-read the configurations and rebuild the toolsets | `reload` exists because a new server is useless until the toolsets are rebuilt — it saves restarting the server to pick up a configuration change. > [!WARNING] > > An MCP server is code you do not control, invoked by a model. Its tool descriptions > reach the agent's prompt, so a server you did not vet can influence what the agent > decides to do. Register servers you trust, and prefer scoping a Toolbox to named > toolsets over exposing every database it can see. # Orchestrator Source: https://docs.apowerb.com/guides/orchestrator Run agents on a cron schedule, through the orchestrator of your choice. Recurring runs are delegated to an **orchestrator**. Two are supported, and they are interchangeable: the client for each implements the same method surface, so nothing in the calling code changes when you switch. | `ORCHESTRATOR` | Backend | Notes | | - | - | - | | `mage` | [Mage AI](https://www.mage.ai/) | **the default** — used when the variable is unset | | `th2etl` | [th2etl](/ecosystem/th2etl) | the in-house replacement | > [!NOTE] > > Only these two values change behavior. Anything else is read as an unrecognized > setting and falls back to `mage` — there is no third backend. > [!WARNING] > > The setting is read by the listing endpoints too, not only when a schedule is created. > A deployment that flips the flag without restarting keeps reading the previous > orchestrator, and the runs created on the new one never appear. ![Orchestrator screen listing agents with their model, schedule and run actions](https://mintcdn.com/thaink2-445e19b2/01sXtdZdZRmlIMtW/images/orchestrator.jpg?fit=max\&auto=format\&n=01sXtdZdZRmlIMtW\&q=85\&s=136a07505ba2f28777a632e73af1f243) ## Scheduling a run ```json theme={null} POST /api/adk/schedule_run { "agent_id": "agent42", "user_id": "user@example.com", "session_id": "session_scheduled", "new_message": { "role": "user", "parts": [{ "text": "Generate the daily report" }] }, "schedule_interval": "@daily", "start_time": "2026-03-10T08:00:00" } ``` ### Interval shortcuts | Preset | Cron | | - | - | | `@hourly` | `0 * * * *` | | `@daily` — also `@midnight` | `0 0 * * *` | | `@weekly` | `0 0 * * 0` | | `@monthly` | `0 0 1 * *` | | Custom | e.g. `*/15 * * * *` | Mage accepts the `@interval` shortcuts directly. The th2etl client translates them into five-field cron expressions before creating the trigger, so the same request body works against either backend. ## Managing schedules and runs | Method | Endpoint | Description | | - | - | - | | GET | `/api/pipelines` | List pipelines | | POST | `/api/pipelines/agents/triggers` | Create a trigger for an agent | | GET | `/api/pipelines/{pipeline_uuid}/schedules` | List an agent's schedules | | PUT | `/api/pipelines/{pipeline_uuid}/schedules/{schedule_id}` | Update a schedule | | GET | `/api/pipelines/{pipeline_uuid}/schedules/{schedule_id}/runs` | List a schedule's runs | | GET | `/api/pipelines/runs/{run_id}` | Get one run | | GET | `/api/pipelines/runs/{run_id}/logs` | Get a run's logs | | PUT | `/api/pipelines/runs/{run_id}/cancel` | Cancel a run | The endpoints keep the `pipelines` naming from the Mage era. They are orchestrator agnostic: the same calls reach th2etl when the flag is set. ## What changes between the two The mapping matters if you inspect the orchestrator directly rather than through this API. | | Mage | th2etl | | - | - | - | | Unit per agent | a pipeline trigger | one scheduler, **named after the `agent_id`** | | Schedule identifier | an integer id | the scheduler **name** | | Per-trigger variables | trigger variables | the scheduler's `variables`, injected into the run context on every fire | | Ad-hoc trigger | trigger a run | `POST /schedulers/{name}/run` | > [!NOTE] > > Identifiers are opaque to callers — read one from a listing and pass it back. Do not > compare them numerically: Mage ids are integers while th2etl uses names, and a > numeric comparison against a th2etl id silently fails to match. ## Configuration See [Configuration](/configuration) for the variables each orchestrator needs. When `ORCHESTRATOR` is unset, the server talks to Mage — so a deployment that means to use th2etl must set it explicitly. # Business knowledge (RAG) Source: https://docs.apowerb.com/guides/rag Index documents, URLs, SQL results and S3 buckets into per-agent knowledge bases. Business knowledge (RAG) lets an agent answer from documents you provide. Indexing is delegated to the RAG service ([th2rag](/ecosystem/th2rag)), reachable at `RAG_BASE_URL`. ## Use Case: FAQ Automation Automatically answering common customer or internal questions based on your support knowledge base. ``` Upload documents → indexed by th2rag → the agent searches them when answering ``` ## Sources | Source | Endpoint | Notes | | - | - | - | | Files | `POST /api/rag/index-files` | PDF, CSV, TXT, DOCX… max 50 MB per file | | URL | `POST /api/rag/index-url` | Crawls and indexes a web page | | Database, SQL | `POST /api/rag/index-db` | Indexes the result of a SQL query | | Database, natural language | `POST /api/rag/index-db-nl` | Same, from a question | | S3 | `POST /api/rag/index-s3` | Indexes files from a bucket | ## Following progress * Poll `GET /api/rag/status/{knowledge_id}` * Or stream `GET /api/rag/stream/{agent_id}?session_id=xxx` — events `connected`, `status`, `complete` `GET /api/rag/knowledge/{agent_id}` lists what an agent currently has indexed. ## Security * Path traversal is blocked on session and agent identifiers * URL indexing refuses localhost and private address ranges (SSRF protection) * Session ownership is validated on every call * Completion callbacks from th2rag are verified with an HMAC-SHA256 signature (`RAG_WEBHOOK_SECRET`) # Skills Source: https://docs.apowerb.com/guides/skills Reusable procedures an agent can follow, shipped or written by you. A skill is a written procedure an agent can load: how to build a dashboard, how to recover from a failed tool call, how to phrase a report. Where a [tool](/guides/tools) gives an agent a new *capability*, a skill gives it a *method* for using the capabilities it already has. Skills are loaded through Google ADK: a skill is a directory containing a `SKILL.md`, and the core hands the resulting toolset to the agent. ## The portfolio Eight skills ship with the core: | Skill | What it covers | | - | - | | `dashboard-builder` | Building a BI dashboard: charts, KPIs and tables on one page | | `data-visualization` | Choosing and producing the chart that answers the question | | `text-to-sql` | Turning a data question into SQL, including exploring tables and joins | | `rag-search` | Searching knowledge bases and uploaded documents, and citing what it found | | `report-generation` | Producing a structured report, summary or executive briefing | | `email-campaign` | Campaigns end to end: leads from HubSpot, segmentation, drafting, then sending — but **only after the user approves explicitly** | | `onedrive-navigation` | Browsing, searching and managing files across OneDrive and SharePoint | | `error-recovery` | Reacting to a failed call — retry strategies instead of stopping | ## Your own skills Custom skills live in the database and are managed through the API: | Method | Endpoint | Description | | - | - | - | | GET | `/api/skills` | List your skills | | POST | `/api/skills` | Create one | | GET | `/api/skills/{skill_id}` | Read one | | PUT | `/api/skills/{skill_id}` | Update one | | DELETE | `/api/skills/{skill_id}` | Delete one | | GET | `/api/skills/portfolio` | List the built-in skills | ## Moving skills between instances | Method | Endpoint | Description | | - | - | - | | GET | `/api/skills/{skill_id}/export` | Export one of your skills | | GET | `/api/skills/portfolio/{skill_name}/export` | Export a built-in skill | | POST | `/api/skills/import` | Import a skill | Exporting a built-in skill is the practical way to write your own: start from one that already works, adjust it, import it back as yours. > [!NOTE] > > A portfolio skill that fails to load is logged and skipped, not fatal — the agent starts > without it. If a skill seems to have no effect, check the startup logs for > `[SKILLS] Failed to load portfolio skill` before looking at the agent's instruction. # Text-to-SQL Source: https://docs.apowerb.com/guides/text-to-sql Let an agent answer questions against a relational database. **1. Create a database tool config** Provide connection parameters through `POST /api/tools_config`. **2. Enable the tool on an agent** Add the `text_to_sql` tool config id to the agent's `agent_tools`. **3. Ask** The agent introspects the schema, generates SQL, executes it, and answers from the result set. Schema introspection is cached. After a migration, clear it: ``` POST /api/rag/schema-cache/invalidate ``` > [!NOTE] > > A query that returns no rows surfaces as `422`, not as an empty success — see > [Errors](/api-reference/errors). # Tools Source: https://docs.apowerb.com/guides/tools What an agent can do, and how a tool is configured per agent. A tool is a Python function an agent may call. The core ships a portfolio of **31 tool modules**; an agent is given the subset it needs, and each tool that talks to an external service reads its settings from a **tool configuration** attached to that agent. ## The portfolio | Family | Modules | | - | - | | Google Workspace | `google_auth`, `google_drive`, `google_gmail`, `google_calendar`, `google_docs`, `google_sheets` | | Microsoft 365 | `microsoft_auth`, `outlook_mail`, `teams`, `onedrive_core`, `onedrive_read`, `onedrive_write` | | Data and databases | `database`, `database_mcp`, `data_handler`, `text_to_sql`, `s3_tools`, `db_to_rag` | | BI and visuals | `business_intelligence`, `visualization`, `image_generation` | | Knowledge | `rag`, `memory` | | External services | `api_call`, `web_search_mcp`, `odoo`, `marketing`, `thaink2` | | Media | `audio` | | Utilities | `basic`, `integration_status` | Ask a running instance rather than trusting this table to stay exhaustive: | Method | Endpoint | Description | | - | - | - | | GET | `/api/tools` | Every tool available to the caller | | GET | `/api/tools/docs` | Their documentation, as the agent sees it | | GET | `/api/tools/{tool_name}/params` | The parameters one tool expects | ## Tool configurations A tool module is generic; a tool *configuration* binds it to something concrete — this database, that Drive folder, this API key. Configurations belong to an agent, so two agents can use `database` against two different servers. | Method | Endpoint | Description | | - | - | - | | GET | `/api/tools_config` | List configurations | | POST | `/api/tools_config` | Create one | | GET | `/api/tools_config/{tool_config_id}` | Read one | | PUT | `/api/tools_config/{tool_config_id}` | Update one | | DELETE | `/api/tools_config/{tool_config_id}` | Delete one | Credentials inside a configuration are encrypted at rest with `ENCRYPT_KEY`. > [!NOTE] > > Tools that act on Google or Microsoft data do **not** hold their own credentials: they > use the OAuth integration the user connected, so revoking the integration revokes the > agent's access with it. See [Integrations](/guides/integrations/overview). ## Tools backed by MCP Two modules are not plain functions but MCP toolsets: `database_mcp` and `web_search_mcp`. They are discovered by naming convention — a factory called `mcp_tool_set_*` is invoked at build time so the toolset is created fresh, with the current key, rather than captured once at import. See [MCP](/guides/mcp). ## Adding a tool A module in the portfolio exposes plain functions with type hints and a docstring — that docstring is what the model reads to decide whether to call it, so it is interface, not commentary. Reload the agent (`POST /api/agents/{agent_id}/reload`) to pick up a change without restarting the server. # Webhooks Source: https://docs.apowerb.com/guides/webhooks Trigger agents from events in connected services. apowerb can run an agent automatically when something happens in a connected service — today, when mail arrives. Two providers are supported: **Gmail** through Google Pub/Sub, and **Outlook** through Microsoft Graph subscriptions. ``` Email arrives → provider pushes a notification → apowerb receives it → fetches the message → runs the associated agent → logs the result ``` ![Webhooks screen showing subscription counters and the subscriptions and activity tabs](https://mintcdn.com/thaink2-445e19b2/aq5QuWIeWGBRQi25/images/webhooks.jpg?fit=max\&auto=format\&n=aq5QuWIeWGBRQi25\&q=85\&s=972d55a249a628d0262ef88962853243) ## Subscription API | Method | Endpoint | Description | | - | - | - | | POST | `/api/webhooks/subscriptions` | Create | | GET | `/api/webhooks/subscriptions` | List | | PATCH | `/api/webhooks/subscriptions/{id}` | Update agent, template or change type | | DELETE | `/api/webhooks/subscriptions/{id}` | Delete and unsubscribe | | POST | `/api/webhooks/subscriptions/{id}/renew` | Renew manually | | GET | `/api/webhooks/logs` | Execution logs | | GET | `/api/webhooks/logs/{log_id}` | One log entry | ```json theme={null} POST /api/webhooks/subscriptions { "provider": "google_gmail", "resource": "INBOX", "agent_id": "AGENT_ID", "change_type": "created", "agent_message_template": "New email from {{ sender }}: {{ subject }}\n\n{{ body }}" } ``` ## Automatic renewal | Provider | Expires after | | - | - | | Gmail watch | 7 days | | Outlook subscription | 3 days | A background task runs every six hours and renews anything expiring within twelve hours. If it fails, the subscription dies silently at expiry — watch the scheduler logs. ## Troubleshooting | Error | Cause | Fix | | - | - | - | | `403 — User not authorized` | Gmail cannot publish to the topic | Grant `gmail-api-push@system.gserviceaccount.com` the Publisher role | | `404 — Topic not found` | Wrong topic or project | Check `GMAIL_PUBSUB_PROJECT_ID` and `GMAIL_PUBSUB_TOPIC` | | Nothing arrives | Push subscription misconfigured | Verify the endpoint URL is public and correct | | `401 — Invalid credentials` | OAuth token expired | Reconnect the integration | | Watch expired | Renewal failed | Check scheduler logs, renew via the API | # Workflows Source: https://docs.apowerb.com/guides/workflows Chain agents, tools and logic in a visual graph, run it on demand or from a trigger. A workflow is a graph of typed **nodes** joined by **edges**. The Workflow Studio (`/workflows` in the app) draws it; the backend validates it, compiles it to a Google ADK `Workflow` and runs it, streaming one event per node. No user code runs inside a workflow: routing rules and `{{...}}` references are evaluated by the engine itself. ## In the Studio 1. **New workflow** — start from scratch (a manual trigger) or from the *Tool → Router → Agents* template, and give it a name. 2. Drag nodes from the palette, or click one to add it. Link them; on a routing node, pick the route of each edge — an edge without a route is drawn red. 3. Select a node to configure it. Every text field offers the upstream nodes as chips: one click inserts the right `{{...}}` reference. 4. **Test** opens the run panel: enter a payload (JSON, text or form), **Run**, and follow each node live — status, duration, route taken, output. **Replay** steps through the last run on the canvas. 5. **Publish** once the validation badge reads *Graph valid*. This arms the trigger. Changes are saved automatically. **Versions** lists every revision and restores any of them. ### Next-step suggestions Select a node and the canvas lists, under **Next step**, up to three node types that usually come after it, the most likely first. Click one: the node is added, linked, and its main field already reads the node it hangs off — `{{trigger1}}` in an Agent's `input`, an Output's `value` or a Notification's `body`. Nothing is published. * While the workflow has no Output, Output comes first whenever it is one of the options. * On a routing node (router, classifier, condition, try), the suggestion fills the first declared branch that has no edge yet, one branch at a time. * Nothing is suggested after an Output, or after a node that is already linked. These suggestions follow fixed rules: they are instant and cost nothing. #### Suggest with AI When the deployment turns it on, **Suggest with AI** under the list asks the shared model for up to two complete nodes, configured from the workflow's name, description and nodes. The model is only called when you click. Its proposals, marked ✨, come first, and each one replaces the rule suggestion of the same type. Hover one to read why it is proposed. The label and the reason are written in the language of the workflow's name. Every proposal is checked before you see it, and dropped rather than repaired: * it must pass the checks a node of a saved graph passes; * it may only use one of your agents, and only reference nodes upstream of it; * the branch it is wired to is computed by the server, never chosen by the model. The model can propose `agent`, `classifier`, `extract`, `rag`, `router`, `condition`, `convert`, `set`, `notification` (channel `app` only) and `output`. Without any agent on your account, the four types that need one are not offered at all. It never proposes a trigger, a tool, an HTTP request, an approval or a loop, try, merge or subworkflow node. What reaches the model is the **structure** of the graph: node types, ids and labels, branch names, field names (the trigger's sample payload, Extract and Set nodes), a Tool node's tool and an HTTP node's method, plus your agents' ids, names and descriptions. Sample values, templates, URLs, headers and recipients are never sent. | On screen | Meaning | | - | - | | *AI unavailable — the usual suggestions stay.* | The model did not answer in time or answered something unusable. **Retry with AI** asks again. | | *AI quota reached for now — the usual suggestions stay.* | The [shared model's cap](/configuration/default-llm) is reached; suggestions count against it like runs. | | *No other idea from the AI.* | The model had nothing valid to add. | **Self-hosting.** The button only shows when both the shared model is configured (`DEFAULT_LLM_MODEL` and `DEFAULT_LLM_API_KEY`) and the feature is on: | Variable | Default | | | - | - | - | | `WORKFLOW_SUGGEST_ENABLED` | `false` | Turns AI suggestions on | | `WORKFLOW_SUGGEST_MODEL` | empty | A faster or cheaper model, served by the same key and endpoint as `DEFAULT_LLM_MODEL`; empty uses `DEFAULT_LLM_MODEL` | | `WORKFLOW_SUGGEST_TIMEOUT_S` | `4` | Seconds the editor waits before keeping its rule suggestions | ### Import and export a JSON file **Export** in the Studio downloads the workflow as a JSON file named after it: ```json theme={null} { "name": "Order review", "description": "Reviews large orders before approval", "graph": { "version": 1, "nodes": [...], "edges": [...] } } ``` To import one, choose **New workflow → Import a JSON file**. The file's name and description fill the empty fields, and **Create** stays disabled until the file is read. Two shapes are accepted: the file above, or a bare graph `{version, nodes, edges}` — the body the [Definitions API](#definitions-api) stores. A file without `nodes` and `edges` is refused. An imported workflow always starts as a `draft`. The file carries no trigger URL or HMAC secret: publishing the copy issues new ones. Agent, tool and workflow ids are kept as they are: in a graph from another account, point them at your own — an agent that is not yours stops the run with `agent_not_found`. ## Lifecycle of a workflow | Status | Can be saved with errors | Runs manually | Trigger armed | | - | - | - | - | | `draft` | Yes — the editor lists the errors | Only once valid | No | | `published` | No — publishing requires a valid graph | Yes | Yes | Every save creates a revision (`edit`, `publish`, `unpublish`, `restore`). Restoring a revision always puts the workflow back to `draft`. Automatic triggers only ever run the **published** version, on behalf of the workflow owner. ## Nodes | Palette label | `type` | Required `config` | Output | | - | - | - | - | | Trigger | `trigger` | `kind` (see [Triggers](#triggers)) | The run payload | | Agent | `agent` | `agent_id`; optional `input` | The agent answer — text, or JSON when the answer parses as JSON | | AI Classifier | `classifier` | `agent_id`, `routes` (≥ 2 `{route, description}`) | Its input, passed through on the chosen route | | Extract | `extract` | `agent_id`, `fields` (1–30 `{name, type}`); optional `input` | An object with exactly the declared fields | | RAG | `rag` | `agent_id`, `query`; `top_k` 1–20 (default 5) | `{query, passages}` from the agent's knowledge bases | | Tool | `tool` | `tool`; optional `args` | The tool result | | HTTP request | `http` | `method` (GET, POST, PUT, PATCH, DELETE), `url`; optional `headers`, `body`, `timeout_s` 1–30 (default 15) | `{status, headers, body}` | | Notification | `notification` | `channel` (`email`, `app`, `teams`); `subject` for email and Teams; `to` (1–10 addresses) for email only; `body` | `{channel, sent}` | | Convert | `convert` | `to`: `text`, `json`, `number`, `boolean`, `list`, `csv`, `date`; optional `input` | The converted value | | Set | `set` | `fields`: list of `{key, value}` | An object with those keys | | Router | `router` | `rules` (`{field, op, value, route}`); optional `default_route` | Its input, on the first matching route | | Condition | `condition` | `rules`; `match`: `all` (default) or `any` | Its input, on route `true` or `false` | | Merge | `merge` | — | `{: }` for every incoming edge | | Loop | `loop` | `mode` (`foreach` + `items`, or `until` + `until`), `max_iterations` 1–100, `body` | `foreach`: list of body outputs; `until`: last body output | | Try | `try` | `body`; `retries` 0–3, `retry_delay_ms` 0–5000 | Route `ok` with the body output, or route `error` with `{code, detail, params, node}` | | Subworkflow | `subworkflow` | `workflow_id`; optional `input` | The other workflow's output | | Output | `output` | optional `value` | `value`, or its input when `value` is empty | | Human approval | `approval` | — | Not runnable yet: shown as *Soon*, refused at validation | Rule operators for `router`, `condition` and a loop's `until`: `eq`, `ne`, `gt`, `gte`, `lt`, `lte` (numeric), `contains` (case-insensitive text), `in` (value in a list), `exists`. A rule whose `field` is empty tests the node's input. ### Structure rules * Node `id`: a letter, then up to 63 letters, digits, `_` or `-`. Ids are unique. * At most **one** trigger per workflow. Without one, the workflow is manual. * No cycles: repeat work with a `loop`, not a back edge. * Only `router`, `classifier`, `condition` and `try` put a `route` on their outgoing edges, and only a route they declare. `condition` and `try` allow one edge per route. * An `output` node ends the flow: it cannot have outgoing edges. * A `loop` or `try` body is its own graph with exactly one trigger. A `try` body cannot contain another `try` or a `loop`. * A subworkflow cannot call its own workflow; chains stop at depth 3. ### Final output of a run The run output is the value of the `output` node reached, or, without one, the output of the last node reached. A run may end on several nodes — parallel branches from a fan-out, or two `output` nodes — and the output is then an object keyed by node id, like a `merge`. Only the nodes actually reached appear: the branch a `router`, `classifier`, `condition` or `try` did not take contributes nothing. An `output` node that is reached decides alone: the other branches' last nodes are then left out of the result. A route that is chosen but has no outgoing edge ends the run normally; the output is then empty. ## References between nodes A string in a node's `config` can read the output of an **upstream** node with `{{node_id}}` or `{{node_id.path.to.value}}`. Path segments are object keys or list indexes (`{{items.0.name}}`). * **Alone in the field**, the reference keeps the value's type: `"{{trigger.amount}}"` gives the number `1500`, an object stays an object. * **Inside text**, it is converted to text: objects and lists become JSON, a missing value becomes an empty string. * The referenced node must be an ancestor of the node that reads it, otherwise the graph is refused ("is not upstream, its output does not exist yet"). `{{node_id}}` always works. A path is checked against what the engine guarantees: | Upstream node | Allowed paths | | - | - | | `merge` | The ids of its source nodes | | `set`, `extract` | The declared keys / field names | | `rag` | `query`, `passages` | | `http` | `status`, `headers`, `body` | | `notification` | `channel`, `sent` | | `convert` to text, number, boolean or date | None — use `{{node_id}}` | | `router`, `classifier` | Anything except `.route`: the chosen route is never stored | | `trigger`, `agent`, `tool`, `loop` | Accepted at validation, checked at run time | A path that crosses a plain value at run time (for example `{{agent1.amount}}` when the agent answered with text) stops the run with `template_ref_invalid` instead of silently producing nothing. Inside a loop body, the body's trigger receives `{item, index, previous}` — `previous` is the previous iteration's output, or the loop input on the first turn. An `until` condition reads `{{iteration.output...}}` and `{{iteration.index}}` only. ## Example A webhook receives an order; orders above 1,000 are reviewed by an agent. ```json theme={null} { "version": 1, "nodes": [ { "id": "trigger", "type": "trigger", "config": { "kind": "webhook" } }, { "id": "order", "type": "set", "config": { "fields": [ { "key": "customer", "value": "{{trigger.customer}}" }, { "key": "amount", "value": "{{trigger.amount}}" } ] } }, { "id": "big", "type": "condition", "config": { "rules": [{ "field": "{{order.amount}}", "op": "gt", "value": 1000 }] } }, { "id": "review", "type": "agent", "config": { "agent_id": "AGENT_ID", "input": "Review the order from {{order.customer}} for {{order.amount}} EUR" } }, { "id": "done", "type": "output", "config": { "value": "{{review}}" } }, { "id": "skip", "type": "output", "config": { "value": "auto-approved" } } ], "edges": [ { "source": "trigger", "target": "order" }, { "source": "order", "target": "big" }, { "source": "big", "target": "review", "route": "true" }, { "source": "big", "target": "skip", "route": "false" }, { "source": "review", "target": "done" } ] } ``` `AGENT_ID` is the id of one of your [agents](/concepts/agents). With the payload `{"customer": "ACME", "amount": 1500}`, `order.amount` stays the number `1500`, the condition takes the `true` route and the agent receives `Review the order from ACME for 1500 EUR`. ## Triggers The trigger node's `config.kind` decides how a published workflow starts. The payload is what `{{trigger...}}` reads. | `kind` | Configuration | Payload | | - | - | - | | `manual` | — | The body sent to `/run` (Studio: the payload editor) | | `webhook` | `hmac` (bool) | The JSON body; a non-object body arrives as `{"body": ...}` | | `schedule` | `cron` (5 fields, at most every 5 min) **or** `at` (ISO date, future); `timezone` (default `Europe/Paris`) | `{"scheduled_at": ""}` | | `email` | `provider` (`outlook`, `gmail`); optional `from_filter` (address or domain), `subject_filter` | `{from, to, subject, body, received_at, attachments}` — attachment metadata only | | `file` | `provider` (`onedrive`, `google_drive`), `folder_id`, `folder_label`, `interval_min` 5–1440 (default 15) | `{id, name, path, url, size, modified_at}` for each new file | | `form` | `title`, `fields` (`{name, label, type}`: text, textarea, number, boolean, select, date), `access` (`authenticated`, `public`); optional `description` | The validated form values | | `agent_tool` | `tool_name` (`^[a-z][a-z0-9_]{2,40}$`, unique per owner), `description`, `input_schema` (`{name, type}`) | The arguments the calling agent passed | | `workflow_done` | `workflow_id` (another of your workflows), `on`: `success`, `error` or `any` | `{workflow_id, run_id, status, output, error}` | Email and file triggers use the account connected under [Integrations](/guides/integrations/overview); without it the trigger stays inactive (`integration_missing`). The first scan of a watched folder only records the files already there; later scans start one run per new or modified file. A schedule tick is skipped while the previous scheduled run is still running. An `agent_tool` workflow becomes a tool named `workflow:` that agents can call. The call waits for the run (120 s at most) and returns `{run_id, output}`, or an `error`. Workflows that call each other through `agent_tool` or `workflow_done` stop at a chain of 5, and never loop back to a workflow already in the chain. ### Webhook and form URLs Publishing a webhook or form workflow issues a secret URL, shown in the Studio and by `GET /api/workflows/{workflow_id}/triggers`: * webhook: `POST /api/hooks/workflows/{token}` — answers `202 {"run_id": "..."}`; * form: `/forms/{token}` in the app, submitted to `POST /api/hooks/forms/{token}`. `POST /api/workflows/{workflow_id}/triggers/rotate` issues a new token (the old URL stops working). With `hmac: true`, the HMAC secret is shown **only** when it is generated or rotated; each call must then carry `X-Apowerb-Signature: sha256=`, the HMAC-SHA256 of the raw body with that secret. ```bash theme={null} BODY='{"customer":"ACME","amount":1500}' SIG=$(printf '%s' "$BODY" | openssl dgst -sha256 -hmac "$HMAC_SECRET" | cut -d' ' -f2) curl -X POST "$WEBHOOK_URL" -H "Content-Type: application/json" \ -H "X-Apowerb-Signature: sha256=$SIG" -d "$BODY" ``` An unknown token or an unpublished workflow answers `404`, a bad signature `401`, a body over 256 KiB `413`, and more than 60 calls a minute per workflow `429`. A public form accepts 10 submissions a minute per visitor; fields that the form does not declare are dropped. ## Running and following a run `POST /api/workflows/defs/{workflow_id}/run` with `{"payload": ...}` runs the saved version and streams Server-Sent Events: | Event | Fields | | - | - | | `run_started` | `wid` — the run id | | `node_start` | `node_id`, `type` | | `node_complete` | `node_id`, `output`, `duration_ms` | | `route` | `node_id`, `route` | | `node_error` | `node_id`, `code`, `detail`, `params` | | `loop_capped` | `node_id`, `max_iterations`, `remaining` — the items a `foreach` left out, `null` for an `until` loop | | `done` / `error` / `cancelled` | Exactly one, last. `done` carries `output`; `error` carries `code` and `detail` | Nodes run one at a time, in dependency order: branches after a fan-out are correct but serialized. Each node output is capped at 1 MiB (`node_output_too_large`); HTTP responses too. Stop a run with `POST /api/workflows/{wid}/cancel`, `wid` being the run id carried by `run_started`: the current node finishes, no further node starts. Runs are kept with a status — `running`, `success`, `error`, `cancelled` — and listed newest first by `GET /api/workflows/runs`; each entry carries its trigger, the cause of its failure and `input_available`, which tells whether its input is still on disk and the run can therefore be replayed. `GET /api/workflows/runs/{run_id}` returns one run. Per-node outputs are only in the event stream, not stored. `POST /api/workflows/runs/{run_id}/replay` starts a **new** run from the stored input; a successful run needs `?force=true`, since its side effects already happened. ### Error codes Errors carry a stable `code` and `params` (never the raw exception). The most common: | Code | Meaning | | - | - | | `invalid_graph` | The graph failed validation; nothing ran. `/run` refuses it with a `422` — `{code, params, message}` — before the stream opens | | `template_ref_invalid` | A `{{...}}` path does not exist on that node's output | | `no_route` | No router rule matched and there is no `default_route` | | `classifier_no_route` | The classifier's answer matched none of its routes | | `extract_failed` | The answer was not JSON, or a field is missing or of the wrong type | | `convert_failed` | The value cannot be read as the target type | | `loop_items_not_list` | A `foreach` loop's `items` is not a list | | `http_url_refused` | The URL points to a private or internal address | | `http_timeout`, `http_failed`, `http_response_too_large` | The HTTP request did not complete | | `subworkflow_not_found`, `subworkflow_cycle`, `subworkflow_too_deep` | The called workflow is missing, calls back up the chain, or nests deeper than 3 | | `node_output_too_large` | A node produced more than 1 MiB | | `workflow_error` | Any other explained failure; read `detail` | | `internal` | Unexpected failure; `ref` links to the server log | ## Security notes * The `http` node refuses private and internal addresses and sets `Host` itself. A `4xx` or `5xx` answer does not fail the node: test `{{node.status}}` downstream. `Authorization`, `Proxy-Authorization`, `Cookie` and `X-API-Key` headers cannot be written in a graph, since anyone who reads or exports it would see them; authenticated HTTP calls are not available yet. * Notifications are limited to 30 sends an hour per owner, all channels together. `app` goes to the workflow owner, `teams` to the owner's Teams webhook. * A subworkflow or `workflow_done` source must belong to the same owner; other owners' workflows answer as not found. ## Definitions API | Method | Endpoint | Description | | - | - | - | | GET | `/api/workflows/defs` | List your workflows | | POST | `/api/workflows/defs` | Create — `{name, description?, graph?}` | | POST | `/api/workflows/defs/validate` | Check a graph without saving — `{valid, errors}`, plus `codes` (`{code, params}`) when the refusal carries one, such as `single_trigger` | | POST | `/api/workflows/defs/suggest-next` | AI suggestions after a node of an unsaved graph — `{graph, node_id, name?, description?}` → `{route, suggestions: [{type, label, config, reason}]}`; `404` when off, `422` for an unknown node, `402` over the cap, `503` when the model does not answer usefully | | GET | `/api/workflows/defs/{id}` | One workflow, with its `validation` report | | PUT | `/api/workflows/defs/{id}` | Update — `{expected_version, name?, description?, graph?, status?}`; `409` if someone saved first | | DELETE | `/api/workflows/defs/{id}` | Delete, with its revisions and trigger | | POST | `/api/workflows/defs/{id}/duplicate` | Copy as a new draft | | GET | `/api/workflows/defs/{id}/revisions` | Revision history | | POST | `/api/workflows/defs/{id}/revisions/{revision_id}/restore` | Restore as draft | | POST | `/api/workflows/defs/{id}/run` | Run and stream events | | GET | `/api/workflows/tools/schema?tool=` | Argument schema of a tool, for the `tool` node | ### Runs and triggers | Method | Endpoint | Description | | - | - | - | | GET | `/api/workflows/runs` | Your runs, newest first — `limit` (default 50) | | GET | `/api/workflows/runs/{run_id}` | One run | | POST | `/api/workflows/runs/{run_id}/replay` | Replay as a new run — `?force=true` for a successful one | | POST | `/api/workflows/{wid}/cancel` | Stop a live run — `204`, or `404` once it has ended | | GET | `/api/workflows/{workflow_id}/triggers` | Trigger state and secret URL | | POST | `/api/workflows/{workflow_id}/triggers/rotate` | New token, and a new HMAC secret | All endpoints require authentication and only see the caller's workflows. # Introduction Source: https://docs.apowerb.com/index apowerb is an open-source agentic framework for building, running and operating AI agents. apowerb is an agentic framework for building and deploying AI agents. It ships as a Python package exposing a FastAPI server, a Typer CLI, and a REST API that any client can drive — including the companion Next.js interface, [apowerb-ui](/ecosystem/apowerb-ui). Agents are defined in the database, materialised as Python modules at startup, and executed through [Google ADK](https://google.github.io/adk-docs/). Model access goes through [LiteLLM](https://docs.litellm.ai/), so any major provider works without touching agent code. > **[Quickstart](/quickstart)** > > Bring the full stack up with Docker in a few minutes. > **[Install from PyPI](/installation)** > > Run the server on its own, against your own Postgres. > **[API reference](/api-reference/introduction)** > > Every endpoint, generated from the OpenAPI schema. > **[Contributing](/contributing/contributing)** > > How to propose a change and get it released. ## What it does | Capability | Summary | | - | - | | **Agent orchestration** | Four execution patterns — `base`, `parallel`, `sequential`, `loop` — plus hierarchical sub-agents. | | **Tool system** | 24+ tool modules: Google Workspace, Microsoft 365, databases, RAG, S3, visualisation, web search. | | **RAG as a service** | Index files, URLs, SQL query results and S3 buckets into per-agent knowledge bases. | | **Text-to-SQL** | Schema introspection plus natural-language to SQL, executed against your database. | | **Webhooks** | Gmail (Pub/Sub) and Outlook (Graph) push notifications trigger agents on new mail. | | **OAuth integrations** | Google Workspace, Microsoft 365 and GitHub connected as agent tools. | | **SSE streaming** | Token-by-token agent output, RAG indexing progress, and user notifications. | | **Scheduling** | Cron-style recurring agent runs. | | **Agent Hub** | Publish an agent, let another workspace clone it. | ## Requirements * Python 3.12 or later (3.13 recommended) * PostgreSQL * [uv](https://docs.astral.sh/uv/) for local development > [!NOTE] > > Some capabilities described across this documentation belong to commercial editions > and are **absent** from the open-source build — not disabled behind a flag. See > [Editions](/concepts/editions) for how to tell which is which. # Installation Source: https://docs.apowerb.com/installation Install the apowerb package from PyPI or from source and run the server. ## From PyPI ```bash theme={null} pip install apowerb ``` The package installs the `apowerb` CLI (a Typer application) alongside the library. > [!NOTE] > > `apowerb` requires **Python 3.12 or later**. 3.11 is rejected: the code nests > identical quotes inside f-strings (PEP 701), which 3.11 cannot parse. ### Optional extras | Extra | Adds | | - | - | | `s3` | `s3fs`, `fsspec`, `aiobotocore` — S3 storage and S3 indexing | ```bash theme={null} pip install "apowerb[s3]" ``` ## From source ```bash theme={null} git clone https://github.com/apowerb/apowerb.git cd apowerb pip install uv uv venv source .venv/bin/activate # Windows: .venv\Scripts\activate uv sync uv pip install . cp .env.example .env ``` ## Run the server **CLI** ```bash theme={null} apowerb serve --host 0.0.0.0 --port 8000 ``` **Uvicorn** ```bash theme={null} uv run uvicorn apowerb.main:app --reload ``` The server listens on `http://127.0.0.1:8000/` by default, with interactive documentation at `/docs`. ## CLI commands ```bash theme={null} apowerb serve --host 0.0.0.0 --port 8000 apowerb agents list apowerb agents create apowerb agents delete apowerb tools list apowerb runs list ``` ## Next > **[Configuration](/configuration)** > > Every environment variable, required and optional. > **[Architecture](/concepts/architecture)** > > What happens on startup, and where the code lives. # Guardrails Source: https://docs.apowerb.com/monitoring/guardrails Implementing and configuring safety guardrails. Information on configuring guardrails to ensure agent safety and reliability. # Logs Source: https://docs.apowerb.com/monitoring/logs Monitoring and accessing system logs. Information on accessing and analyzing logs. ## Observability The platform supports external observability integration: * **OpenTelemetry**: Compatible with OTLP-compliant collectors via [th2pulse](/ecosystem/th2pulse). * **Datadog**: Direct integration for log streaming and metric collection. # Supervision Source: https://docs.apowerb.com/monitoring/supervision Reading sessions across accounts, and who is entitled to. `GET /api/supervision/sessions` lists sessions with their owner, so an operator can audit what ran on the platform rather than guessing from logs. The same entitlement governs the session trace route. Each row carries `session_id`, `app_name`, `agent_name`, `user_id`, `create_time`, `update_time`, a `preview` of the opening question, and counts: `steps`, `tool_calls`, `has_error`. The preview is what makes the list scannable — without it, hundreds of runs of the same agent read identically. Paginate with `limit` (200 by default) and `offset`; `total` is the unpaginated count. ## Who sees what In this edition, **each person sees their own sessions**. That is not a limitation to work around — it is the only default the core can honestly hold. Reading someone else's sessions is a privilege, and the core cannot decide who holds it: the notion of a platform owner lives in a table owned by a commercial brick, and the core must never name one. So it asks, through a registry hook. **With no brick registered, the answer is no.** > [!WARNING] > > Being an administrator is not, on its own, entitlement to read another account's > sessions. Earlier builds gated supervision on `is_admin`, which meant every > administrator saw every agent on the platform — including colleagues who are > administrators for operational reasons rather than platform owners. The boundary is the > platform owner, and only a brick can hold it. ## Grouping sessions Group and filter by `app_name`, never by `agent_name`. `app_name` is derived from the agent's id (`agent`), so it identifies one agent and one owner. `agent_name` is a label and is **not** unique across the platform — the same name can belong to several accounts — so grouping on it merges unrelated people's sessions into one row. ## Verifying the scope A supervision call that returns only your own sessions proves nothing on its own: it is the correct answer both when no brick is registered and when one is registered and refuses you. To tell the two apart, check whether the brick is **loaded**, not merely installed — they are separate steps, and an extension present on disk but absent from the loaded set answers exactly like an extension that was never installed. See [Editions & Extensions](/concepts/editions). # Quickstart Source: https://docs.apowerb.com/quickstart Bring the API, the interface and a database up with Docker Compose. The fastest way to see apowerb running is the [`apowerb-hosting`](https://github.com/apowerb/apowerb-hosting) stack: Postgres, the API and the interface, wired together by a single `docker compose up`. ## 1. Clone the hosting repository One repository, not three: the compose file pulls **published images** from Docker Hub, pinned to a pair that was tested together. Nothing is built locally. ```bash theme={null} git clone https://github.com/apowerb/apowerb-hosting.git cd apowerb-hosting ``` ## 2. Generate secrets and start ```bash theme={null} cp .env.example .env ./scripts/generate-secrets.sh docker compose -f docker-compose/docker-compose.yml --env-file .env up -d ``` > [!WARNING] > > Name the file. There **is** a `docker-compose.yml` at the root of that > repository, and it is not this one: it targets the Hostman App Platform, ships > no Postgres, and refuses to start without a managed database. A bare > `docker compose up` in that folder picks the wrong one. > [!NOTE] > > **Ports 3000 and 8000 must be free.** If something else already listens on > 3000, Postgres and the API come up and the interface alone fails, on > `Bind for 0.0.0.0:3000 failed: port is already allocated` — a partial stack > that looks like a broken install. Pick other ports on the command itself, > without touching `.env`; Compose lets a shell variable win over the > `--env-file`: > > ```bash theme={null} > FRONT_PORT=3010 TH2AGENT_PORT=8010 \ > docker compose -f docker-compose/docker-compose.yml --env-file .env up -d > ``` > > The addresses below shift accordingly. Postgres publishes no host port at > all, so it never collides. `generate-secrets.sh` fills `DB_PASSWORD`, `ENCRYPT_KEY` and the service tokens with random values. It never overwrites a value that is already set — see [Secrets](/deployment/introduction#secrets) for why that matters. **There is nothing else to fill in.** The database runs inside the stack, and every credential the template ships is empty on purpose — a value committed to a public repository is not a secret. What you do not get for free is a model: add your own key from the interface, or declare a shared one in `.env` (`DEFAULT_LLM_MODEL` and `DEFAULT_LLM_API_KEY`). Until then the stack runs and the model simply does not appear in the list. ![apowerb dashboard showing agent, integration and schedule counters](https://mintcdn.com/thaink2-445e19b2/01sXtdZdZRmlIMtW/images/home.jpg?fit=max\&auto=format\&n=01sXtdZdZRmlIMtW\&q=85\&s=50a3a5f0735595ccae9d527d10c86c0b) ## 3. Check it is up | Service | URL | Role | | - | - | - | | Interface | `http://localhost:3000` | Next.js UI | | API | `http://localhost:8000` | FastAPI server | | API docs | `http://localhost:8000/docs` | Interactive Swagger UI | | Health | `http://localhost:8000/health` | Liveness probe | ```bash theme={null} curl -s http://localhost:8000/health ``` Ports are configurable in `.env`. Postgres stays on the internal Docker network and is not published. ## 4. Create your first agent Authenticate, then create an agent through the API: ```bash theme={null} curl -X POST http://localhost:8000/api/agents \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "agent_name": "My Assistant", "agent_model": "anthropic/claude-sonnet-4-5-20250929", "agent_description": "Specialized agent for data analysis", "agent_instruction": "You are an expert data analyst.", "agent_type": "llm", "agent_tools": [], "sub_agents": [], "memory_enabled": false, "artifacts_enabled": false, "tags": ["analytics"] }' ``` Then run it — see [Sessions and runs](/concepts/sessions-and-runs). ## Other ways to deploy The Compose path above is the one tested end to end, and the shortest. Three others live in the same repository: * **[Helm chart](/deployment/helmchart)**, published on Docker Hub as an OCI artifact. * **[Kubernetes](/deployment/kubernetes)**, preparing the cluster the chart installs into. * **[Traefik overlay](/deployment/virtual-machine)**, for a single VM behind HTTPS. Container images are published too — the Compose file pulls them rather than building anything locally.