Skip to content

Agent refactor#343

Open
renan-souza wants to merge 43 commits into
fc_uifrom
agent_refactor
Open

Agent refactor#343
renan-souza wants to merge 43 commits into
fc_uifrom
agent_refactor

Conversation

@renan-souza

Copy link
Copy Markdown
Collaborator

No description provided.

…s to new paths

    - Deleted flowcept_agent.py, flowcept_ctx_manager.py, entire tools/ directory,
      and old prompts (general_prompts.py, in_memory_query_prompts.py,
      workflow_query_prompts.py) — all replaced by the new mcp_server/context_manager/
      mcp_tools/prompts structure
    - Moved ROUTING_PROMPT and SMALL_TALK_PROMPT from deleted general_prompts.py into
      base_prompts.py; updated session_tools.py import accordingly
    - Updated all six stale test imports across agent_tests.py and
      test_webservice_integration.py to point at the new module paths
      (mcp_tools/, data_query_tools/, context_manager, mcp_prompts)
  Wire the PROV-AGENT model (arXiv:2508.02866) throughout the Flowcept agent stack so every LLM call,
  MCP tool execution, and LangGraph chat turn is captured as a typed provenance task.

  - Replace bare "llm_task" / "agent_task" strings with PROV_AGENT.AI_MODEL_INVOCATION /
  PROV_AGENT.AGENT_TOOL enum values in FlowceptLLM, agent_flowcept_task, and context_manager.py
  - Add @agent_flowcept_task(subtype=PROV_AGENT.AGENT_TOOL) to all MCP tool wrappers
  (db_query_mcp_tools, in_memory_task_query_mcp_tools, report_tools, session_tools)
  - Wrap each run_chat / LangGraph execution in Flowcept(workflow_name="langgraph_chat",
  start_persistence=False, save_workflow=True) so every chat turn has its own workflow_id; call_model
  uses FlowceptLLM, call_tools uses FlowceptTask — both inherit Flowcept.current_workflow_id
  automatically
  - Fix FlowceptLLM._format_messages to handle BaseMessage objects (needed for LangGraph state)
  - Add buffer-None guard to agent_flowcept_task so the decorator skips gracefully when MQ is not
  started
  - Expand PROV_AGENT enum docstrings with W3C PROV mapping and paper citation; improve
  task_object.py subtype docstring with PROV-AGENT examples
  - Update docs/schemas.rst (paper citation, vocabulary table, wasInformedBy explanation) and
  agents/README.md (new PROV-AGENT Instrumentation section)
  - 11 new TestProvAgentInstrumentation structural tests; all pass
  Move MCP context handling under the agent MCP package, retire stale prompt-handler paths, and clarify agent/webservice separation docs. Replace fake webservice API tests with real integration
  assertions, and update dashboard routes to use the real dashboard DAO interface.
  - Flowcept.services_alive() now returns ServicesAliveResult(dict) — a dict
    subclass with __bool__, so all existing callers are unaffected while
    the health endpoint can expose per-service status
  - DBAPI.db_liveness_tests() added to test Mongo and LMDB independently
    (fixes the bug where both-enabled would only test whichever DAO won
    get_instance()); flowcept_controller calls DBAPI — no DAO imports leak
    out of db_api.py (SoC fix)
  - LLM liveness folded into services_alive() when AGENT_CHAT_ENABLED and
    api_key is non-placeholder — settings-driven, no new method
  - /api/v1/health/ready returns {"status", "services": {…}} with per-service
    breakdown; HTTP 503 when any service is unavailable
  - T18: session-scoped gridsearch_run_data fixture (conftest.py), cosine-
    similarity scorer (tests/test_utils/test_llm_utils.py), 21-case
    chat_query_tests.yaml with deterministic expected values, and two new
    tests (test_chat_endpoint_real_llm_db_queries,
    test_chat_endpoint_real_llm_df_queries); 18/20 webservice tests pass,
    2 blocked on orchestrator recursion limit, still investigating.
  Changes:

  - Missing settings now use built-in DEFAULT_SETTINGS, not sample_settings.yaml, so offline buffer dumping is enabled by default.
  - Flowcept.generate_report() with no input now reads the configured default buffer file.
  - examples/start_here.py no longer requires flowcept --init-settings.
  - rich is now a base dependency so print_markdown=True works after pip install flowcept.
  - run-tests.yml now tests examples/start_here.py after deleting settings, with no init step.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant