Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Flows API reference (Python)
@ai.flow() async def summarize_article(url: str) -> str: """Summarizes an article from a URL.""" # Flow implementation content = await fetch_article(url) response = await ai.generate( prompt=f"Summarize: {content}", ) return response.text # Call the flow result = await summarize_article("https://example.com")
# Direct call result = await my_flow(input_data) # Access flow metadata my_flow.name # Flow name my_flow.action # Underlying Action object
@ai.flow() async def process_data(data: str) -> str: """Processes data.""" return data.upper() @ai.flow() async def main_workflow(input: str) -> str: """Main workflow calling sub-flow.""" # Call another flow processed = await process_data(input) response = await ai.generate( prompt=f"Analyze: {processed}", ) return response.text
from genkit import FlowWrapper flow: FlowWrapper = ai.flow()(my_function) # Execute result = await flow(input_data)