Skip to main content

Lineage Suggestion Agent

An AI-powered assistant that provides friendly, context-aware guidance to users navigating a data lineage workflow.

Description

This agent acts as a virtual assistant within a data lineage application. It takes the current status of the user's workflow as input and uses a large language model (LLM) to generate a concise, encouraging, and actionable suggestion for the next logical step.

The primary goal is to enhance the user experience by providing clear, timely guidance, reducing confusion, and helping users move smoothly through complex data lineage tasks.

Key Features

  • Context-Aware Guidance: Analyzes the current workflow status to provide relevant suggestions.
  • Friendly & Actionable: Generates suggestions that are easy to understand and act upon.
  • Encouraging Tone: Uses positive language to motivate users as they make progress.
  • Simple Integration: Designed to be easily integrated into any application requiring guided user interaction.

Installation

Prerequisites

  • uv – A fast Python package and environment manager.
  • Git

Steps

  1. Clone the lineage_suggestion_agent repository:

    git clone https://github.com/stepfnAI/lineage_suggestion_agent.git
    cd lineage_suggestion_agent
    
  2. Create a virtual environment and install dependencies:

    git switch dev
    uv sync --extra dev
    source .venv/bin/activate
    
  3. Clone and install the sfn_blueprint dependency: The agent requires the sfn_blueprint library.

    cd ../
    git clone https://github.com/stepfnAI/sfn_blueprint.git
    cd sfn_blueprint
    git switch dev
    uv pip install -e .
    cd ../lineage_suggestion_agent
    

Configuration

Configure the agent by creating a .env file in the project root or by exporting environment variables.

Available Settings

Environment Variable Description Default
OPENAI_API_KEY or ANTHROPIC_API_KEY (Required) Your AI provider API key. None
LINEAGE_AI_PROVIDER AI provider for suggestions. openai
LINEAGE_MODEL AI model for suggestions. gpt-4o
LINEAGE_TEMPERATURE AI model temperature (0.0 to 2.0). 0.3
LINEAGE_MAX_TOKENS Maximum tokens for the AI response. 4000

Example .env file:

# .env
OPENAI_API_KEY="sk-your-openai-api-key-here"

# Optional: Use a different model
# LINEAGE_MODEL="gpt-4o-mini"

Testing

To run the test suite, use the following command from the project root:

pytest

Usage

Running the Example Script

A basic usage example is provided in the examples/ directory.

python examples/basic_usage.py

Using as a Library

Integrate the LineageSuggestionAgent directly into your application.

from lineage_suggestion_agent import LineageSuggestionAgent

# 1. Initialize the agent
agent = LineageSuggestionAgent()

# 2. Define the current workflow status as a context string
context = "Join and transformations on 'Entity_X' are complete, creating 'Table_A'. Next action: MarkAsFinal."

# 3. Call the agent to get a suggestion
suggestion, cost = agent({"context": context})

# 4. Print the results
print(f"Suggestion: {suggestion.answer}")
print(f"Cost Details: {cost}")

Example Output

The agent returns a LineageSuggestion object and a cost dictionary.

Suggestion: Great job on completing the join and transformations for 'Entity_X'! Now, let's finalize this table. Please use the 'MarkAsFinal' action to complete the process.
Cost Details: {'prompt_tokens': 457, 'completion_tokens': 41, 'total_tokens': 498, 'total_cost_usd': 0.0016}

Release files for lineage-suggestion-agent 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lineage-suggestion-agent 0.1.2
File Size Uploaded
lineage_suggestion_agent-0.1.2.tar.gz 7.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lineage-suggestion-agent 0.1.2
File Interpreter ABI Platform
lineage_suggestion_agent-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 14.1 kB

Release files / lineage_suggestion_agent-0.1.2.tar.gz

Download URL lineage_suggestion_agent-0.1.2.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
bce042688aa3ea97b04698531064164c63ee221fb3f1ae513659b67ce9b65f2f
BLAKE2b-256 checksum
How to use checksums
9e8ce3a23aa3b6ab010b589d99611c77e429498ec2578eefd111452b675b3666
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.22

Release files / lineage_suggestion_agent-0.1.2-py3-none-any.whl

Download URL lineage_suggestion_agent-0.1.2-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7cf97f5af7db89aeab6049c1367f2c04e54025f0479b55ed3214a4d8e0bb5fd6
BLAKE2b-256 checksum
How to use checksums
db49087b6747c5df1e174edfe41743d2f587982c588257d68776341f38033a92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.22

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release 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