python-agent-engine

A reusable Python engine for building AI agents with LangChain, a framework for connecting language models to tools and application code. It manages repeated model conversations, tool calls, and displayed reasoning steps.

In plain words
What is it for?
Use it to build Python agents with tool calling, the ReAct pattern—a cycle of reasoning and actions—and support for OpenAI-compatible model services.
Why use it?
It removes the need to write the loop that sends requests, runs tools, collects results, and continues until an answer is ready.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/kennyzir/7deer_skills/python-agent-engine
Any agent
npx skills add kennyzir/7deer_skills --skill python-agent-engine
Clone the repo
git clone --depth 1 https://github.com/kennyzir/7deer_skills

Made for: Claude Code, Codex.

Per session 28 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 407 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00028 $0.00407
Opus 5 $0.00014 $0.00204
Sonnet 5 $0.00006 $0.00081
Haiku 4.5 $0.00003 $0.00041

Measured 2d ago against content hash f196fcca75e0, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

python-agent-engine scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (resources/agent_engine.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

python-agent-engine/SKILL.md · 61 lines

What it actually says

Python Agent Engine

A plug-and-play AI Agent core for Python applications. It handles the complexity of LLM interaction, tool calling loops, and context management.

Features

  • ReAct Loop: Automatically handles "Reasoning -> Tool Call -> Result -> Answer" process.
  • Thinking Process: Returns structured "Thinking Steps" for UI visualization.
  • Model Agnostic: Works with OpenAI, DeepSeek, or any OpenAI-compatible API.

Installation

  1. Copy resources/agent_engine.py to your project (e.g., src/core/agent_engine.py).
  2. Install dependencies:
    pip install langchain-core langchain-openai python-dotenv
    
  3. Set Environment Variables in your .env file:
    OPENAI_API_KEY=sk-...
    # Optional:
    OPENAI_BASE_URL=https://api.openai.com/v1
    

Usage Example

import asyncio
from langchain_core.tools import tool
from core.agent_engine import AgentEngine

# 1. Define Tools
@tool
def calculator(expression: str) -> str:
    """Calculates a math expression."""
    return str(eval(expression))

# 2. Initialize Agent
agent = AgentEngine(
    tools=[calculator],
    system_prompt="You are a helpful math assistant.",
    model_name="gpt-4o"
)

# 3. Chat
async def main():
    response = await agent.chat("What is 123 * 456?")
    
    print(f"Answer: {response.content}")
    print("\nThinking Steps:")
    for step in response.thinking_steps:
        print(f"[{step.type}] {step.content}")

if __name__ == "__main__":
    asyncio.run(main())
Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 61 lines · 28 tokens per session scan A f196fcca75e0

Subscribe to this mod's changes

python-agent-engine is a skill published in the GitHub repository kennyzir/7deer_skills (295 stars, last pushed 4d ago), licensed MIT. It adds 28 tokens to every session and 407 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

agent-framework-azure-ai-py

Build persistent agents on Azure AI Foundry using the Microsoft Agent Framework Python SDK.

sickn33/agentic-awesome-skills · 24 tokens

adk-sample-creator

Creates a new sample agent in the ADK Python repository — the sample directory, its agent.py, and its README.md — following the conventions the existing samples already use. Use when the user wants to add a sample or example demonstrating a feature or agent pattern (dynamic nodes, fan-out/fan-in, a standalone…

google/adk-python · 150 tokens

add-new-model

Add support for a newly-released LLM model in pydantic-ai (e.g. openai:gpt-5.6, anthropic:claude-sonnet-5). Use when a provider ships a new model id and you need to wire literals, profile flags, and tests to recognize it. Handles SDK-lag, gateway list conventions, and capability probing.

pydantic/pydantic-ai · 80 tokens

building-pydantic-ai-agents

Build AI agents with Pydantic AI — tools, capabilities (including on-demand loading), structured output, streaming, testing, and multi-agent patterns. Use when the user mentions Pydantic AI, imports pydanticai, or asks to build an AI agent, add tools/capabilities, defer capability loading, stream output, define agents…

pydantic/pydantic-ai · 85 tokens

google-agents-cli-adk-code

This skill should be used when the user wants to "write agent code", "build an agent with ADK", "add a tool", "create a callback", "define an agent", "use state management", or needs ADK (Agent Development Kit) Python API patterns and code examples. Part of the Google ADK skills suite. It provides a quick reference…

google/agents-cli · 129 tokens

agent-squad-python

Use when building or modifying a Python app that uses the agent-squad Python package — async multi-agent orchestration for Python 3.11+: orchestrator, agents (BedrockLLMAgent, AnthropicAgent, OpenAIAgent, SupervisorAgent, GroundedAgent, ChainAgent, and more), classifier routing (Bedrock, Anthropic, OpenAI), storage…

2FastLabs/agent-squad · 113 tokens