Skip to content

Managed Agents: rewrite stale wrapper tests + add real agentic integration suite #1428

@MervinPraison

Description

@MervinPraison

Problem

  1. src/praisonai/tests/unit/integrations/test_managed_agents.py (197 LOC, 10 tests) is 100 % stale. Every test either:

    • patch('praisonai.integrations.managed_agents.aiohttp', None)aiohttp is not imported in the current module (it uses anthropic);
    • assert managed.cli_command == "managed-anthropic" — attribute removed;
    • calls ManagedAgentIntegration(provider="anthropic", api_key="...") with positional-ish kwargs that no longer match the current ctor.

    Under the default pytest tier the file is gated-skipped → CI is green while the tests would error if the gate were off.

  2. Zero real agentic tests for managed agents. No test constructs Agent(name=..., backend=ManagedAgent(...)).start("real prompt") and asserts an LLM reply. Every existing test mocks the SDK.

Evidence:

  • pytest src/praisonai/tests/unit/integrations/test_managed_agents.py -v → "10 skipped" on main.
  • grep -n "agent.start" src/praisonai-agents/tests/managed/ → no results for a real prompt.

Acceptance criteria

  • test_managed_agents.py rewritten against current surface:
    • drops aiohttp / cli_command references;
    • asserts ManagedConfig defaults, map_managed_tools, factory routing (env-based + explicit), structural subtyping of both backends to ManagedBackendProtocol.
  • New gated real agentic suite at src/praisonai/tests/integration/test_managed_real.py (marker @pytest.mark.integration, guarded by RUN_REAL_AGENTIC=1 + respective API-key env var):
    • test_anthropic_managed_real — uses claude-haiku-4-5, asserts non-empty result + total_input_tokens > 0 + non-empty session_id;
    • test_local_managed_real_openai — uses gpt-4o-mini, same assertions;
    • test_multi_turn_preserves_session — two calls keep same session id;
    • Each test prints the full LLM output for human verification.
  • All tests pass locally and in CI (gated).
  • A short README at src/praisonai/tests/integration/README.md explaining how to run the real agentic suite locally.

Implementation plan

  1. Delete/rewrite tests/unit/integrations/test_managed_agents.py in-place.
  2. Add tests/integration/test_managed_real.py with pytest.importorskip("anthropic") / pytest.importorskip("litellm") guards and os.environ.get("RUN_REAL_AGENTIC") gate.
  3. Update _pytest_plugins/test_gating.py matrix so the new integration marker is visible under tier extended or nightly.
  4. README for the integration dir.

Files

Modify:

  • src/praisonai/tests/unit/integrations/test_managed_agents.py (full rewrite).
  • src/praisonai/tests/_pytest_plugins/test_gating.py (only if a new marker is needed).

Create:

  • src/praisonai/tests/integration/__init__.py
  • src/praisonai/tests/integration/test_managed_real.py
  • src/praisonai/tests/integration/README.md

Invariants

  • No change to core SDK.
  • Backward-compatible (only adds + rewrites tests).

References

cc @claude — per .windsurf/workflows/e2e-analysis-issue-pr-merge.md.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingclaudeAuto-trigger Claude analysis

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions