> ## Documentation Index
> Fetch the complete documentation index at: https://docs.noxus.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Python SDK

> Full-featured library for AI applications

Comprehensive, type-safe Python library for building AI-powered applications. Embed Noxus capabilities directly into your Python projects.

## Key Features

<CardGroup cols={2}>
  <Card title="Complete Platform Access" icon="terminal">
    Programmatically manage flows, agents, conversations, knowledge bases, and all platform features through a unified Python interface.
  </Card>

  <Card title="Type Safety" icon="shield-check">
    Full type hints and Pydantic models provide excellent IDE support, autocomplete, and compile-time error checking.
  </Card>

  <Card title="Async Support" icon="bolt">
    Built-in async/await patterns for high-performance, concurrent operations and non-blocking I/O.
  </Card>

  <Card title="Event Streaming" icon="signal">
    Real-time streaming of flow executions, conversation responses, and agent actions.
  </Card>
</CardGroup>

## Common Use Cases

<AccordionGroup>
  <Accordion title="Embedded AI Features" icon="sparkles">
    Integrate conversational AI, flows, or knowledge base search directly into your Python applications:

    ```python theme={null}
    from noxus_sdk.client import Client

    client = Client(api_key="your_api_key")

    # Get a flow and run it
    flow = client.workflows.get("wf_123")
    run = flow.run(
        body={"user_query": "Analyze this data"}
    )

    # Query knowledge base
    results = client.knowledge_bases.search(
        kb_id="kb_456",
        query="What's our refund policy?"
    )
    ```
  </Accordion>

  <Accordion title="Custom Applications" icon="window-maximize">
    Build custom interfaces, dashboards, or tools on top of Noxus:

    ```python theme={null}
    # Create a custom chatbot interface
    conversation = client.conversations.create(
        agent_id="agent_789",
        name="Customer Support Session"
    )

    # Stream responses
    for chunk in conversation.chat_stream("How do I reset my password?"):
        print(chunk.content, end="", flush=True)
    ```
  </Accordion>

  <Accordion title="Flow Orchestration" icon="diagram-project">
    Programmatically create, manage, and execute complex AI flows:

    ```python theme={null}
    # Build flow programmatically
    flow = client.flows.create_builder()
    flow.add_node("generate_text", {
        "prompt": "Write a summary",
        "model": "gpt-4"
    })
    flow.add_node("save_to_file", {
        "filename": "summary.txt"
    })
    flow.connect("generate_text", "save_to_file")

    # Deploy and run
    deployed = flow.deploy("Document Summarizer")
    result = deployed.run({"document": "..."})
    ```
  </Accordion>

  <Accordion title="Data Pipeline Integration" icon="route">
    Integrate AI processing into data pipelines and ETL flows:

    ```python theme={null}
    import pandas as pd

    # Process data through Noxus flows
    df = pd.read_csv("customer_feedback.csv")

    # Pre-fetch the workflow object
    flow = client.workflows.get("sentiment_analysis")

    for idx, row in df.iterrows():
        run = flow.run(
            body={"text": row['feedback']}
        )
        result = run.wait(output_only=True)
        df.at[idx, 'sentiment'] = result['sentiment']
        df.at[idx, 'category'] = result['category']

    df.to_csv("analyzed_feedback.csv")
    ```
  </Accordion>

  <Accordion title="Automation Scripts" icon="terminal">
    Create automation scripts for recurring AI tasks:

    ```python theme={null}
    import schedule
    import time
    from datetime import datetime

    # Pre-fetch the workflow object
    flow = client.workflows.get("daily_analytics")

    def daily_report():
        # Generate daily AI-powered report
        run = flow.run(
            body={"date": str(datetime.today())}
        )
        result = run.wait(output_only=True)
        
        # Email results
        send_email(result['report'])

    schedule.every().day.at("09:00").do(daily_report)

    while True:
        schedule.run_pending()
        time.sleep(60)
    ```
  </Accordion>
</AccordionGroup>

## Getting Started

<Steps>
  <Step title="Install the SDK">
    ```bash theme={null}
    pip install noxus-sdk
    ```
  </Step>

  <Step title="Get API Key">
    Generate an API key from your Noxus workspace settings
  </Step>

  <Step title="Initialize Client">
    ```python theme={null}
    from noxus_sdk.client import Client

    client = Client(api_key="your_api_key_here")
    ```
  </Step>

  <Step title="Start Building">
    Explore flows, conversations, and knowledge bases
  </Step>
</Steps>

<Card title="SDK Documentation" icon="book" href="/sdk/introduction">
  Complete SDK documentation with examples and API reference
</Card>
