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,
    },
    service_name="Mera",
)
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. Set service_name when the host product uses a different user-facing brand; package and protocol names remain unchanged.

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.1.tar.gz (14.0 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.1-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: floagent_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 14.0 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.1.tar.gz
Algorithm Hash digest
SHA256 e0decfe2fcef388d51e68fd023780254ef6ec5f2ccb9d3edb173d7845ec5794f
MD5 9c00681a548d23927de4bf9d6a3788e5
BLAKE2b-256 2274671d29715ec1357a46df1ef67c880adb24f808ba20f9d7937c942540fe9c

See more details on using hashes here.

Provenance

The following attestation bundles were made for floagent_sdk-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: floagent_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.7 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ebe6eb18d0a66f9a7c91017a41cb074242ea110c9c5d9783f96ab1862dc13531
MD5 2d1cc9ce383741f829418c2f3eaef537
BLAKE2b-256 9f75c2a51ec4a1e89f2732269b0df52dc9c76f87a95c50d9c8fb89ada6b789a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for floagent_sdk-0.1.1-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

This release

0.1.1 This release

2 files

0.1.0

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