Skip to main content

FloAgent Python SDK

CI PyPI Python

Python support for FloAgent external apps. The core handoff client has no runtime dependencies, and the optional Streamlit adapter handles authentication state and safe navigation.

Installation

python -m pip install floagent-sdk

For Streamlit apps:

python -m pip install "floagent-sdk[streamlit]"

Streamlit handoff

Construct navigation first so every redirect target is registered, then gate page execution through StreamlitHandoff:

import streamlit as st

from floagent_sdk import HandoffClient
from floagent_sdk.streamlit import StreamlitHandoff

home = st.Page("pages/home.py", title="Home", default=True)
admin = st.Page("pages/admin.py", title="Admin", url_path="admin")
navigation = st.navigation([home, admin])

client = HandoffClient.from_config(st.secrets["floagent"])
auth = StreamlitHandoff(
    client,
    redirect_pages={
        "/": home,
        "/admin": admin,
    },
)
session = auth.require_session()
auth.render_sidebar(session)
navigation.run()

Configure the app with a known API base URL:

[floagent]
api_base_url = "https://api.example.com"
allowed_api_base_urls = ["https://api-alt.example.com"]
request_timeout_seconds = 10

Incoming api_base_url values and session-discovered endpoints must match the configured URL or an explicit allowlist entry. This protects server-side apps from making authentication requests to attacker-controlled destinations.

Register the external app with FloAgent using the Streamlit app root as its handoff_url. Redirect paths must be listed in redirect_pages. Redirect query parameters such as task_id are restored after page switching.

Access and refresh tokens are kept in Streamlit Session State and are never written to browser storage. When the browser session is lost, the user must reopen or refresh the app through the FloAgent launcher to obtain a new one-time handoff.

Core client

Framework integrations can use HandoffClient directly:

from floagent_sdk import HandoffClient

client = HandoffClient("https://api.example.com")
session = client.exchange(token, api_base_url=discovered_api_base_url)

if session.needs_refresh():
    session = client.refresh(session)

The client exchanges POST /auth/login/handoff/exchange tokens and refreshes sessions through POST /auth/token/refresh. Tokens are never included in SDK error messages.

Development

python -m pip install -e ".[test,streamlit]"
python -m pytest
python -m pip wheel --no-deps --wheel-dir dist .

See CONTRIBUTING.md for the contribution workflow and SECURITY.md for private vulnerability reporting.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

floagent_sdk-0.1.0.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

floagent_sdk-0.1.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file floagent_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: floagent_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for floagent_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f88f09bc3371d71c60120f1ce443142fa8308adf49f4bfdf47d7cf264cadb1c6
MD5 ef227e85e6c4ac9aa534c848a53338d8
BLAKE2b-256 d79df123894d8e9d9de4bbc4ab09bf76a0614ec61ef99dee47a69806214dd730

See more details on using hashes here.

Provenance

The following attestation bundles were made for floagent_sdk-0.1.0.tar.gz:

Publisher: release.yml on flordaweave/floagent-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file floagent_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: floagent_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for floagent_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c3d2f2c17c82d4025d52ae392ba0ffa652fe4a9a7a8613e53735d7972904c2a6
MD5 a0b04ae9ee4634aea44671f4d2bbc343
BLAKE2b-256 2a55a06793349e0e86de02bacc9e6977ab8c2da4911d389cfd2db9acff22a308

See more details on using hashes here.

Provenance

The following attestation bundles were made for floagent_sdk-0.1.0-py3-none-any.whl:

Publisher: release.yml on flordaweave/floagent-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.1.1

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page