@javier/agent-compact
flwr new @javier/agent-compactFlower AgentApp
This minimal AgentApp uses the OpenAI SDK to send the current prompt and its active context through Flower Runtime. The active context contains the latest saved summary and the recommended run-series events after it. It estimates the context size from the saved summary and model usage. At 50,000 tokens, it summarizes conversation events and saves the summary response's output token count. During a tool loop, it checks after each model response so the model receives each tool result before that result can be summarized. Before model calls, it keeps message text and readable reasoning summaries while dropping response metadata and encrypted content. It emits the active context token count, republishes streamed response events to the frontend, and prints the final response text. The model can use Flower's filesystem and web search connectors when the prompt calls for local files or current web information. Use it as a starting point for a custom Flower Agent.
Flower Runtime supplies the SDK base URL and task token, so the AgentApp does not need provider credentials.
Summary support requires a Flower build with the new AgentSession compacted context methods.
Filesystem tools appear when SuperLink has FLWR_FILESYSTEM_ALLOWED_DIRS set. Web search requires FLWR_WEB_SEARCH_ENDPOINT or a provider key such as BRAVE_API_KEY, TAVILY_API_KEY, or EXA_API_KEY on SuperLink.
View run-series token counts
Run python run_series_site.py and open http://127.0.0.1:8765/. Select a run series from the oldest-first list, or enter an ID and click Fetch. Use ↻ to refresh the list and selected series; the ID also survives a browser refresh. Click a run to inspect the input and output of its last model call, or click a compacted context to read its saved summary. The page reads the sibling ../flower/framework/superlink.db database without changing it.
Build
Install the project and build its Flower App Bundle (FAB):
uv sync uv run flwr build
Customize
Edit agent/agent_app.py to change the model or add your agent logic. The current prompt is available as agent.prompt, and the run-series history is available through agent.events.get_trace(). The app reads and writes summaries through agent.events.get_compacted_contexts() and agent.events.put_compacted_context().
Learn more
See the Flower Agent documentation for more tutorials and guides.