Catalog PyPI
Back to packageRELEASE DETAILS

0.1.5

PyPI

agent-revert

A simple decorator for tracking and reverting agent actions

agentdecoratorreverttracking
Published24 Nov 2025
Direct dependencies6
Transitive dependenciesNot calculated

README

Version 0.1.5 documentation

Agent Revert

A lightweight package to govern and track agent actions. It allows you to register agents, track their actions via decorators, and monitor affected applications.

Installation

pip install agent-revert

Usage

Basic Usage

  1. Register your agent with the gateway.
  2. Decorate your functions with @track_action to monitor execution and affected apps.
from agent_revert import register_agent, track_action

# Register the agent
register_agent("MyAwesomeAgent")

@track_action(agent_name="MyAwesomeAgent", affected_apps=["Database"])
def my_function():
    # Do something
    pass

LangChain Example

Here is an example of how to integrate agent-revert with a basic LangChain agent that fetches weather data and updates a Google Document.

Prerequisites:

import os
from langchain.agents import initialize_agent, Tool, AgentType
from langchain.llms import OpenAI
from agent_revert import register_agent, track_action

# Ensure you have OPENAI_API_KEY set
# os.environ["OPENAI_API_KEY"] = "..."

# 1. Register the Agent
AGENT_NAME = "DailyReporter"
register_agent(AGENT_NAME)

# 2. Define Tools with Tracking

@track_action(agent_name=AGENT_NAME, affected_apps=["Weather API"])
def get_weather(location: str) -> str:
    """Mock weather function."""
    # In a real app, call a weather API here
    return f"The weather in {location} is Sunny, 25°C."

@track_action(agent_name=AGENT_NAME, affected_apps=["Google Docs"])
def update_google_doc(text: str) -> str:
    """Mock Google Doc update."""
    # In a real app, use Google Docs API here
    # See: https://developers.google.com/docs/api/quickstart/python
    print(f"Updating Google Doc with: {text}")
    return "Document updated successfully."

tools = [
    Tool(
        name="GetWeather",
        func=get_weather,
        description="Useful for getting the weather for a specific location."
    ),
    Tool(
        name="UpdateGoogleDoc",
        func=update_google_doc,
        description="Useful for updating the daily report Google Document."
    )
]

# 3. Initialize LangChain Agent
llm = OpenAI(temperature=0)

agent = initialize_agent(
    tools, 
    llm, 
    agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION, 
    verbose=True
)

# 4. Run the Agent
query = "Check the weather in San Francisco and update the daily report document with the forecast."
agent.run(query)

Features

  • Agent Registration: Keep track of all active agents in your system.
  • Action Tracking: Monitor start/end times and success/failure of agent actions.
  • Affected Apps: Explicitly declare which external applications (e.g., Google Docs, Jira, Salesforce) are modified by an action.
  • Gateway Integration: Sends events to a local or remote gateway for visualization.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 6

Native requirements
6 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
requests
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
requests>=2.25.0runtime
pytest
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
pytest>=7.0.0; extra == "dev"runtime
pytest-asyncio
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
pytest-asyncio>=0.21.0; extra == "dev"runtime
black
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
black>=23.0.0; extra == "dev"runtime
ruff
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
ruff>=0.1.0; extra == "dev"runtime
mypy
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
mypy>=1.0.0; extra == "dev"runtime

Distribution files

2 collected
agent_revert-0.1.5-py3-none-any.whl

bdist_wheel · 4.36 KB · Python py3

Source file
agent_revert-0.1.5.tar.gz

sdist · 4.56 KB · Python source

Source file

Repository

PENDING
gateagent/govern

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 23:12 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:68b9094c9c494d5530f538dfbac1a56f12e286d6a8be42e7f73b88c232c2df9a

Other collected versions

View all collected versions →