Skip to content

Add flyte-native Agent construct#1121

Open
cosmicBboy wants to merge 17 commits into
mainfrom
nielsb/flyte-agent
Open

Add flyte-native Agent construct#1121
cosmicBboy wants to merge 17 commits into
mainfrom
nielsb/flyte-agent

Conversation

@cosmicBboy
Copy link
Copy Markdown
Contributor

@cosmicBboy cosmicBboy commented May 27, 2026

This pull request adds a comprehensive suite of examples demonstrating how to use the flyte.ai.agents.Agent system with Flyte, covering basic usage, durable memory, HITL approval, chat UI integration, and more. It also updates dependencies and removes an outdated SDK installation command. The examples are well-annotated and showcase key patterns for agent authoring, tool integration, memory persistence, human-in-the-loop workflows, and deployment.

New agent examples and documentation:

  • Added a detailed README.md to examples/agents/flyte_agent/ explaining the Agent abstraction, main use cases, and how to author and deploy agents with Flyte.
  • Added basic_agent.py showing a minimal agent with math and weather tools, demonstrating local execution and tool registration.
  • Added agent_with_memory.py illustrating how to persist agent memory across runs using MemoryStore, including robust handling of concurrent updates.
  • Added hitl_approval_agent.py showing how to require human approval for sensitive tools using the flyteplugins-hitl plugin and the @tool(requires_approval=True) decorator.
  • Added agent_chat_ui.py demonstrating how to serve an agent behind the built-in chat UI, including durable tool tasks and custom theming.

Dependency and configuration updates:

  • Removed an outdated uv pip install command for the Flyte SDK from codemode_durable_agent_ui.py (the examples now use more recent or built-in SDK versions).

cosmicBboy added 13 commits May 27, 2026 10:00
Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>
Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>
Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>
Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>
Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>
Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>
Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>
Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>
Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>
Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>
Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>
Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>
@cosmicBboy cosmicBboy changed the title [wip] add flyte-native Agent construct Add flyte-native Agent construct May 29, 2026


@dataclass
class MemoryStore:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will eventually replace this with volumes right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep! consider the MemoryStore stuff (and most of this module, in fact) as experimental.

# falls back to the default ``auth_type="Pkce"`` and a Passthrough-only
# caller (e.g. a FastAPI app using ``init_passthrough``) trips the PKCE
# browser flow as soon as the first cluster-routed dataproxy call runs.
auth_kwargs = dict(self._session_config.auth_kwargs or {})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this intended?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, recent changes in these module broke the passthrough auth logic in app serving. This is needed to be able to forward the session config to downstream remote calls

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>
Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>
Signed-off-by: Niels Bantilan <niels.bantilan@gmail.com>
different approach.
"""
try:
import flyteplugins.hitl as hitl
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should wait for flyte events?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants