Metadata-Version: 2.4
Name: altk-boost
Version: 0.10.2
Summary: The Agent Lifecycle Toolkit (ALTK) is a library of components to help agent builders improve their agent with minimal integration effort and setup.
Project-URL: homepage, https://altk.ai/
Project-URL: documentation, https://agenttoolkit.github.io/agent-lifecycle-toolkit/
Project-URL: source, https://github.com/AgentToolkit/agent-lifecycle-toolkit
Project-URL: download, https://pypi.org/project/altk-boost/#files
Project-URL: tracker, https://github.com/AgentToolkit/altk-boost/issues
License-File: LICENSE
Keywords: LLM,NLP,RAG,agent,data,devtools,generation,index,retrieval
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: aiofiles==24.1.0
Requires-Dist: black>=25.1.0
Requires-Dist: docstring-parser>=0.16
Requires-Dist: genson>=1.3.0
Requires-Dist: ibm-watsonx-ai>=1.0.0
Requires-Dist: jinja2>=3.1.6
Requires-Dist: jsonschema>=4.0.0
Requires-Dist: langchain-chroma>=0.1.4
Requires-Dist: langchain-community>=0.3.21
Requires-Dist: langchain-core>=0.3.72
Requires-Dist: langchain-huggingface>=0.3.0
Requires-Dist: langchain-text-splitters>=1.0.0
Requires-Dist: litellm<2.0.0
Requires-Dist: llm-sandbox[docker,podman]>=0.2.5
Requires-Dist: nltk>=3.9.1
Requires-Dist: numpy>=2.2.6
Requires-Dist: onnxruntime==1.23.2; python_version == '3.10'
Requires-Dist: openai>=1.0.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: scipy>=1.15.3
Requires-Dist: smolagents>=1.21.3
Requires-Dist: tomli==2.2.1
Requires-Dist: typing-extensions>=4.0.0
Provides-Extra: build
Requires-Dist: uv~=0.8.22; extra == 'build'
Provides-Extra: docs
Requires-Dist: griffe-inherited-docstrings; extra == 'docs'
Requires-Dist: griffe-pydantic; extra == 'docs'
Requires-Dist: mkdocs-awesome-nav; extra == 'docs'
Requires-Dist: mkdocs-click; extra == 'docs'
Requires-Dist: mkdocs-enumerate-headings-plugin; extra == 'docs'
Requires-Dist: mkdocs-include-markdown-plugin>=7.1.8; extra == 'docs'
Requires-Dist: mkdocs-jupyter; extra == 'docs'
Requires-Dist: mkdocs-material; extra == 'docs'
Requires-Dist: mkdocstrings[python]; extra == 'docs'
Provides-Extra: refraction
Requires-Dist: nestful-wrapper>=0.1.4; extra == 'refraction'
Requires-Dist: nl2flow>=0.1.2; (sys_platform != 'win32') and extra == 'refraction'
Requires-Dist: sentence-transformers>=5.0.0; extra == 'refraction'
Provides-Extra: routing
Requires-Dist: bertopic>=0.17.3; extra == 'routing'
Requires-Dist: docling>=2.38.1; extra == 'routing'
Requires-Dist: milvus-lite>=2.5.2rc1; extra == 'routing'
Requires-Dist: pydash>=8.0.5; extra == 'routing'
Requires-Dist: pymilvus[milvus-lite,model]>=2.6.2; extra == 'routing'
Requires-Dist: scikit-learn>=1.7.1; extra == 'routing'
Requires-Dist: sentence-transformers>=5.0.0; extra == 'routing'
Provides-Extra: spotlight
Requires-Dist: torch==2.2.2; (sys_platform == 'darwin' and platform_machine == 'x86_64') and extra == 'spotlight'
Requires-Dist: torch>=2.5.1; (sys_platform != 'darwin' or platform_machine != 'x86_64') and extra == 'spotlight'
Requires-Dist: transformers>=4.53.3; extra == 'spotlight'
Provides-Extra: toolguard
Requires-Dist: toolguard>=0.2.9; extra == 'toolguard'
Description-Content-Type: text/markdown

<!-- NOTE: All links must be absolute in this README in order to not break pypi -->
<h1 align="center" >
    <img alt="Agent Lifecycle Toolkit (ALTK) logo" src="https://github.com/AgentToolkit/agent-lifecycle-toolkit/raw/main/docs/assets/logo.png" height="120">
</h1>

<h4 align="center">Delivering plug-and-play, framework-agnostic technology to boost agents' performance</h4>

## What is ALTK?
The Agent Lifecycle Toolkit helps agent builders create better performing agents by easily integrating our components into agent pipelines. The components help improve the performance of agents by addressing key gaps in various stages of the agent lifecycle, such as in reasoning, or tool calling errors, or output guardrails.

👉 Read the launch [blog](https://research.ibm.com/blog/altk-agent-toolkit?previewToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTEsImlhdCI6MTc2MTc1MTg3MiwiZXhwIjoxNzYyMDExMDcyLCJzdWIiOiI0NTYwIn0.jfBYD6cOFSJXw0ZFPziCtGExsIvlc9uFp433KdO1CDE) to learn more about the vision and capabilities.



## Installation
To use ALTK, simply install agent-lifecycle-toolkit from your package manager, e.g. pip:

```bash
pip install agent-lifecycle-toolkit
```

More [detailed installation instructions](https://agenttoolkit.github.io/agent-lifecycle-toolkit/) are available in the docs.
<!-- [TODO: add link] -->

## Getting Started
Below is an end-to-end example that you can quickly get your hands dirty with. The example has a langgraph agent, a weather tool, and a component that checks for silent errors. Refer to the [examples](https://github.com/AgentToolkit/agent-lifecycle-toolkit/tree/main/examples) folder for this example and others. The below example will additionally require the `langgraph` and `langchain-anthropic` packages along with setting two environment variables.

```python
import random

from langgraph.prebuilt import create_react_agent
from langchain_core.tools import tool
from typing_extensions import Annotated
from langgraph.prebuilt import InjectedState

from altk.post_tool.silent_review.silent_review import SilentReviewForJSONDataComponent
from altk.post_tool.core.toolkit import SilentReviewRunInput, Outcome
from altk.core.toolkit import AgentPhase

# Ensure that the following environment variables are set:
# ANTHROPIC_API_KEY = *** anthropic api key ***
# ALTK_MODEL_NAME = anthropic/claude-sonnet-4-20250514

@tool
def get_weather(city: str, state: Annotated[dict, InjectedState]) -> str:
    """Get weather for a given city."""
    if random.random() >= 0.500:
        # Simulates a silent error from an external service
        result = {"weather": "Weather service is under maintenance."}
    else:
        result = {"weather": f"It's sunny and 70F in {city}!"}

    # Use SilentReview component to check if it's a silent error
    review_input = SilentReviewRunInput(messages=state["messages"], tool_response=result)
    reviewer = SilentReviewForJSONDataComponent()
    review_result = reviewer.process(data=review_input, phase=AgentPhase.RUNTIME)

    if review_result.outcome == Outcome.NOT_ACCOMPLISHED:
        # Agent should retry tool call if silent error was detected
        return "Silent error detected, retry the get_weather tool!"
    else:
        return result

agent = create_react_agent(
    model="anthropic:claude-sonnet-4-20250514",
    tools=[get_weather],
    prompt="You are a helpful assistant"
)

# Runs the agent
result = agent.invoke(
    {"messages": [{"role": "user", "content": "what is the weather in sf"}]}
)
# Show the final result which should not be that the service is in maintenance.
print(result["messages"][-1].content)
```

<!-- More advanced usage options are available in the [docs](). -->
<!-- [TODO: add link] -->

## Features
![lifecycle.png](https://github.com/AgentToolkit/agent-lifecycle-toolkit/raw/main/docs/assets/lifecycle.png)


| Lifecycle Stage | Component                                                              | Purpose                                                                                                                                                                                                                                                                                                                   |
|-----------------|------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Pre-LLM         | [Spotlight](https://github.com/AgentToolkit/agent-lifecycle-toolkit/tree/main/altk/pre_llm/spotlight)                                    | *Does your agent not follow instructions?* Emphasize important spans in prompts to steer LLM attention.
| Pre-LLM         | [Retrieval Augmented Thinking](https://github.com/AgentToolkit/agent-lifecycle-toolkit/tree/main/altk/pre_llm/routing/retrieval_augmented_thinking) | *Does your agent struggle to route to the right tool?* Provide your agent with tool hints generated from content from the tool domain.                                                                                                                                                                                       |
| Pre-tool        | [Refraction](https://github.com/AgentToolkit/agent-lifecycle-toolkit/tree/main/altk/pre_tool/refraction)              | *Does your agent generate inconsistent tool sequences?* Validate and repair tool call syntax to prevent execution failures.                                                                                                                                                                                               |
| Pre-tool        | [SPARC](https://github.com/AgentToolkit/agent-lifecycle-toolkit/tree/main/altk/pre_tool/sparc)                        | *Is your agent calling tools with hallucinated arguments or struggling to choose the correct tools in the right order?* Make sure tool calls match the tool specifications and request semantics, and are generated correctly based on the conversation. |
| Pre-tool        | [ToolGuard](https://github.com/AgentToolkit/agent-lifecycle-toolkit/tree/main/altk/pre_tool/toolguard)                        | *Is your agent violating business policies when calling tools?* Enforce business policy adherence in tool calls by providing policy documents and generating code that enforces these policies for tools. |
| Post-tool       | [JSON Processor](https://github.com/AgentToolkit/agent-lifecycle-toolkit/tree/main/altk/post_tool/code_generation)                                                       | *Is your agent overwhelmed with large JSON payloads in its context?* Generate code on the fly to extract relevant data in JSON tool responses.                                                                                                                                                                            |
| Post-tool       | [Silent Error Review](https://github.com/AgentToolkit/agent-lifecycle-toolkit/tree/main/altk/post_tool/silent_review) | *Is your agent ignoring subtle semantic tool errors?* Detect silent errors in tool responses and assess relevance, accuracy, and completeness.                                                                                                                                                                            |
| Post-tool       | [RAG Repair](https://github.com/AgentToolkit/agent-lifecycle-toolkit/tree/main/altk/post_tool/rag_repair)             | *Is your agent not able to recover from tool call failures?* Repair failed tool calls using domain-specific documents via Retrieval-Augmented Generation.                                                                                                                                                                 |
| Pre-response    | [Policy Guard](https://github.com/AgentToolkit/agent-lifecycle-toolkit/tree/main/altk/pre_response/policy_guard)                              | *Does your agent return responses that violate policies or instructions?* Ensure agent outputs comply with defined policies and repair them if needed.                                                                                                                                                                    |
| Build-Time   | [Tool Enrichment](https://github.com/AgentToolkit/agent-lifecycle-toolkit/tree/main/altk/build_time/tool_enrichment_toolkit)                              | *Does your tool have clear metadata or docstrings for the agent?* Generate tool and parameter descriptions to enhance tool calling. |
| Build-Time   | [Test Case Generation](https://github.com/AgentToolkit/agent-lifecycle-toolkit/tree/main/altk/build_time/test_case_generation_toolkit)                    | *Has your agent been tested to call the correct tool with the right arguments?* Generate user utterances to test its behavior across a variety of scenarios. |
| Build-Time   | [Tool Validation](https://github.com/AgentToolkit/agent-lifecycle-toolkit/tree/main/altk/build_time/tool_validation_toolkit)                          | *Does your agent call the correct tool with the right arguments for these test cases?* Invoke the agent with test utterances and identify different types of tool-selection and argument-related errors. |

## Documentation

Check out ALTK's [documentation](https://agenttoolkit.github.io/agent-lifecycle-toolkit/), for details on
installation, usage, concepts, and more.

The ALTK supports multiple LLM providers and two methods of configuring the providers. For more information, see the [LLMClient documentation](https://github.com/AgentToolkit/agent-lifecycle-toolkit/blob/main/altk/core/llm/README.md).

## Examples
Go hands-on with our [examples](https://github.com/AgentToolkit/agent-lifecycle-toolkit/tree/main/examples).

## Integrations
To further accelerate your AI application development, check out ALTK's native
[integrations](https://github.com/AgentToolkit/agent-lifecycle-toolkit/blob/main/docs/integrations/index.md) with popular frameworks and tools.

## Get Help and Support
Please feel free to connect with us using the [discussion section](https://github.com/AgentToolkit/agent-lifecycle-toolkit).

## Contributing Guidelines
ALTK is open-source and we ❤️ contributions.<br>

To help build ALTK, take a look at our: [Contribution guidelines](https://github.com/AgentToolkit/agent-lifecycle-toolkit/blob/main/CONTRIBUTING.md)

## Bugs
We use GitHub Issues to manage bugs. Before filing a new issue, please check to make sure it hasn't already been logged.

## Code of Conduct
This project and everyone participating in it are governed by the [Code of Conduct](https://github.com/AgentToolkit/agent-lifecycle-toolkit/blob/main/CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please read the [full text](https://github.com/AgentToolkit/agent-lifecycle-toolkit/blob/main/CODE_OF_CONDUCT.md) so that you know which actions may or may not be tolerated.

## License
The ALTK codebase is under Apache 2.0 license.
For individual model usage, please refer to the model licenses in the original packages.

## Contributors
Thanks to all of our contributors who make this project possible. Special thanks to the Global Agentic Middleware team in IBM Research for all the contributions from the many different teams and people.
