项目文件夹

文件
Gelei Deng e238d701f2 feat: 🎸 version 1.0 agentic workflow (#325)
* feat: 🎸 version 1.0 agentic workflow

Major rewrite of PentestGPT to use an agentic pipeline architecture:
Core Changes: - New event-driven architecture with EventBus for
TUI-agent decoupling - Implemented AgentController with 5-state
lifecycle (IDLE->RUNNING->PAUSED->COMPLETED->ERROR) - Added AgentBackend
interface with ClaudeCodeBackend implementation - Session management
with file-based persistence for resumable pentests - Langfuse
integration for observability and tracing Interface: - New Textual-based
TUI with real-time activity feed - Keyboard shortcuts: F1 help, Ctrl+P
pause, Ctrl+Q quit - Enhanced CLI with --target, --instruction,
--non-interactive, --debug flags Project Structure: - Moved legacy
multi-LLM version (v0.15) to legacy/ directory - New pentestgpt/core/
for agent, controller, events, session modules - New
pentestgpt/interface/ for TUI and CLI components - New
pentestgpt/benchmark/ for xbow benchmark integration - Comprehensive
test suite in tests/ with unit and integration tests DevOps: - Docker
support with Ubuntu 24.04 container - GitHub Actions CI/CD pipeline -
Makefile with dev commands (test, lint, format, typecheck) - Added
xbow-validation-benchmarks as submodule

* style: format code with Black

This commit fixes the style issues introduced in abe3be0 according to the output
from Black.

Details: https://github.com/GreyDGL/PentestGPT/pull/325

* fix: 🐛 fix test pipeline

* feat: 🎸 update format

* feat: 🎸 update

---------

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
2025-12-13 01:57:24 +08:00

42 行
1.4 KiB
Python

import os
from datetime import datetime
# get keys for your project
os.environ[
"LANGFUSE_PUBLIC_KEY"
] = "pk-lf-5655b061-3724-43ee-87bb-28fab0b5f676" # do not modify
os.environ[
"LANGFUSE_SECRET_KEY"
] = "sk-lf-c24b40ef-8157-44af-a840-6bae2c9358b0" # do not modify
from langfuse import Langfuse
langfuse = Langfuse()
from langfuse.model import CreateTrace, CreateSpan, CreateGeneration, CreateEvent
trace = langfuse.trace(CreateTrace(name="llm-feature"))
retrieval = trace.span(CreateSpan(name="retrieval"))
retrieval.generation(CreateGeneration(name="query-creation"))
retrieval.span(CreateSpan(name="vector-db-search"))
retrieval.event(CreateEvent(name="db-summary"))
trace.generation(CreateGeneration(name="user-output"))
generationStartTime = datetime.now()
generation = trace.generation(
CreateGeneration(
name="summary-generation",
startTime=generationStartTime,
endTime=datetime.now(),
model="gpt-3.5-turbo",
modelParameters={"maxTokens": "1000", "temperature": "0.9"},
prompt=[
{"role": "system", "content": "You are a helpful assistant."},
{
"role": "user",
"content": "Please generate a summary of the following documents \nThe engineering department defined the following OKR goals...\nThe marketing department defined the following OKR goals...",
},
],
metadata={"interface": "whatsapp"},
)
)